Product
Introducing Java Support in Socket
We're excited to announce that Socket now supports the Java programming language.
@graphql-eslint/eslint-plugin
Advanced tools
@graphql-eslint/eslint-plugin is an ESLint plugin that provides linting rules for GraphQL schema and operations. It helps developers enforce best practices, catch errors early, and maintain consistency in their GraphQL code.
Linting GraphQL Schema
This feature allows you to lint your GraphQL schema files. The example configuration enforces rules to ensure that all type names are known and warns about deprecated fields.
module.exports = {
'plugins': ['@graphql-eslint'],
'overrides': [
{
'files': ['*.graphql'],
'parser': '@graphql-eslint/eslint-plugin',
'rules': {
'@graphql-eslint/known-type-names': 'error',
'@graphql-eslint/no-deprecated': 'warn'
}
}
]
};
Linting GraphQL Operations
This feature allows you to lint GraphQL operations within your JavaScript files. The example configuration enforces rules to ensure that there are no unused fields and that the 'id' field is used when available.
module.exports = {
'plugins': ['@graphql-eslint'],
'overrides': [
{
'files': ['*.js'],
'processor': '@graphql-eslint/graphql',
'rules': {
'@graphql-eslint/no-unused-fields': 'error',
'@graphql-eslint/require-id-when-available': 'warn'
}
}
]
};
Custom Rules
This feature allows you to define custom linting rules for your GraphQL code. The example configuration shows how to set up a custom rule with specific options.
module.exports = {
'plugins': ['@graphql-eslint'],
'rules': {
'@graphql-eslint/custom-rule': [
'error',
{
'ruleOption': 'value'
}
]
}
};
eslint-plugin-graphql is another ESLint plugin that provides GraphQL linting capabilities. It focuses on validating GraphQL queries and schema definitions within JavaScript files. Compared to @graphql-eslint/eslint-plugin, it has fewer built-in rules and less flexibility for custom rules.
graphql-schema-linter is a standalone tool for linting GraphQL schemas. It provides a set of rules to enforce best practices and catch common errors in schema definitions. Unlike @graphql-eslint/eslint-plugin, it does not integrate directly with ESLint and is used as a separate command-line tool.
graphql-eslint is a package that provides a set of ESLint rules for GraphQL. It is similar to @graphql-eslint/eslint-plugin but focuses more on providing a comprehensive set of rules for both schema and operations. It also offers better integration with various GraphQL tools and libraries.
https://the-guild.dev/graphql/eslint
Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!
And if this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.
Help us keep GraphQL ESLint open and inclusive. Please read and follow our Code of Conduct as adopted from Contributor Covenant.
Released under the MIT license.
FAQs
GraphQL plugin for ESLint
We found that @graphql-eslint/eslint-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.
Security News
Deno 2.0 is now available with enhanced package management, full Node.js and npm compatibility, improved performance, and support for major JavaScript frameworks.