@graphql-eslint/eslint-plugin@3.0.0
Major Changes
-
a69f0be: ❗ BREAKING CHANGE ❗
Split
recommendedconfig to 2 modes: "schema" and "operations".This was done in order to use
recommendedandallconfigs inschema-onlyprojects where it is not possible to provide operations.recommendedandallconfigs were divided to 4 configs:schema-recommended- enables recommended rules for schema (SDL) developmentschema-all- enables all rules for schema (SDL) developmentoperations-recommended- enables recommended rules for consuming GraphQL (operations) developmentoperations-all- enables all rules for consuming GraphQL (operations) development
If you are migrating from v2 where
recommendedwas introduced, please change the following:{ "overrides": [ { "files": ["*.js"], "processor": "@graphql-eslint/graphql" }, { "files": ["*.graphql"], - "extends": "plugin:@graphql-eslint/recommended" + "extends": "plugin:@graphql-eslint/schema-recommended" } ] }If you are in a project that develops the GraphQL schema, you'll need
schemarules.If you are in a project that develops GraphQL operations (query/mutation/subscription), you'll need
operationsrules.If you are in a monorepo project, you probably need both sets of rules.
-
a69f0be: ❗ BREAKING CHANGE ❗
feat:
description-stylenow have default description styleblock. -
a69f0be: ❗ BREAKING CHANGE ❗
feat: remove
queryoption inno-root-typeas it's impossible to have write-only schema. -
a69f0be: ❗ BREAKING CHANGE ❗
- rename
avoidprefix in rules tono. - remove
avoid-operation-name-prefixandno-operation-name-suffix
All rules that had a
avoidprefix now have anoprefix.Rules
avoid-operation-name-prefixandno-operation-name-suffixwere removed because the same things can be validated bynaming-conventionrule.Before
{ "@graphql-eslint/avoid-operation-name-prefix": [ "error", { "keywords": ["Query", "Mutation", "Subscription", "Get"] } ], "@graphql-eslint/no-operation-name-suffix": "error" }After
{ "@graphql-eslint/naming-convention": [ "error", { "OperationDefinition": { "style": "PascalCase", "forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"], "forbiddenSuffixes": ["Query", "Mutation", "Subscription"] } } ] } - rename
-
a69f0be: ❗ BREAKING CHANGE ❗
feat: add new options for
naming-conventionruleOptions for
naming-conventionare changed. New optiontypesincludes the following kinds:ObjectTypeDefinitionInterfaceTypeDefinitionEnumTypeDefinitionScalarTypeDefinitionInputObjectTypeDefinitionUnionTypeDefinition
Added new options:
ArgumentDirectiveDefinitionVariableDefinition
Option
QueryDefinitionwas removed in favor ofASTspecific selectorFieldDefinition[parent.name.value=Query].Before
{ "@graphql-eslint/naming-convention": [ "error", { "ObjectTypeDefinition": "PascalCase", "InterfaceTypeDefinition": "PascalCase", "EnumTypeDefinition": "PascalCase", "ScalarTypeDefinition": "PascalCase", "InputObjectTypeDefinition": "PascalCase", "UnionTypeDefinition": "PascalCase", "FieldDefinition": "camelCase", "InputValueDefinition": "camelCase", "QueryDefinition": { "forbiddenPrefixes": ["get"] }, "leadingUnderscore": "allow", "trailingUnderscore": "allow" } ] }After
{ "@graphql-eslint/naming-convention": [ "error", { "types": "PascalCase", "FieldDefinition": "camelCase", "InputValueDefinition": "camelCase", "FieldDefinition[parent.name.value=Query]": { "forbiddenPrefixes": ["get"] }, "allowLeadingUnderscore": true, "allowTrailingUnderscore": true } ] } -
a69f0be: ❗ BREAKING CHANGE ❗
feat: add new options for
require-descriptionruleOptions for
require-descriptionare changed. New optiontypesincludes the following kinds:ObjectTypeDefinitionInterfaceTypeDefinitionEnumTypeDefinitionScalarTypeDefinition(new in v3)InputObjectTypeDefinitionUnionTypeDefinition
Before
{ "@graphql-eslint/require-description": [ "error", { "on": [ "ObjectTypeDefinition", "InterfaceTypeDefinition", "EnumTypeDefinition", "InputObjectTypeDefinition", "UnionTypeDefinition", "FieldDefinition", "InputValueDefinition", "EnumValueDefinition", "DirectiveDefinition" ] } ] }After
{ "@graphql-eslint/require-description": [ "error", { "types": true, "FieldDefinition": true, "InputValueDefinition": true, "EnumValueDefinition": true, "DirectiveDefinition": true } ] }