graphql-eslint

ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.

MIT License

Stars
762
Committers
47

Bot releases are visible (Hide)

graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Minor Changes

  • 37c1579: feat: convert fix to suggestions in no-unreachable-types and no-unused-fields rules

Patch Changes

  • 988e445: fix: ignore operations and fragments in no-hashtag-description rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Patch Changes

  • 32ec2cb: fix: ignore arguments in require-field-of-type-query-in-mutation-result rule
  • 5a259ce: chore: remove unique-enum-value-names rule from recommended config
  • 36d5334: fix: ignore arguments in no-scalar-result-type-on-mutation rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Major Changes

  • a69f0be: ❗ BREAKING CHANGE ❗

    Split recommended config to 2 modes: "schema" and "operations".

    This was done in order to use recommended and all configs in schema-only projects where it is not possible to provide operations.

    recommended and all configs were divided to 4 configs:

    • schema-recommended - enables recommended rules for schema (SDL) development
    • schema-all - enables all rules for schema (SDL) development
    • operations-recommended - enables recommended rules for consuming GraphQL (operations) development
    • operations-all - enables all rules for consuming GraphQL (operations) development

    If you are migrating from v2 where recommended was 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 schema rules.

    If you are in a project that develops GraphQL operations (query/mutation/subscription), you'll need operations rules.

    If you are in a monorepo project, you probably need both sets of rules.

  • a69f0be: ❗ BREAKING CHANGE ❗

    feat: description-style now have default description style block.

  • a69f0be: ❗ BREAKING CHANGE ❗

    feat: remove query option in no-root-type as it's impossible to have write-only schema.

  • a69f0be: ❗ BREAKING CHANGE ❗

    • rename avoid prefix in rules to no.
    • remove avoid-operation-name-prefix and no-operation-name-suffix

    All rules that had a avoid prefix now have a no prefix.

    Rules avoid-operation-name-prefix and no-operation-name-suffix were removed because the same things can be validated by naming-convention rule.

    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"]
          }
        }
      ]
    }
    
  • a69f0be: ❗ BREAKING CHANGE ❗

    feat: add new options for naming-convention rule

    Options for naming-convention are changed. New option types includes the following kinds:

    • ObjectTypeDefinition
    • InterfaceTypeDefinition
    • EnumTypeDefinition
    • ScalarTypeDefinition
    • InputObjectTypeDefinition
    • UnionTypeDefinition

    Added new options:

    • Argument
    • DirectiveDefinition
    • VariableDefinition

    Option QueryDefinition was removed in favor of AST specific selector FieldDefinition[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-description rule

    Options for require-description are changed. New option types includes the following kinds:

    • ObjectTypeDefinition
    • InterfaceTypeDefinition
    • EnumTypeDefinition
    • ScalarTypeDefinition (new in v3)
    • InputObjectTypeDefinition
    • UnionTypeDefinition

    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
        }
      ]
    }
    
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Minor Changes

  • 64c302c: feat: add new rule no-root-type
  • c837c99: fix false positive case in no-unreachable-types rule when directive on root schema is used
  • 1914d6a: fix false positive case in known-fragment-names when import nested fragment

Patch Changes

  • 4c29de7: fix: make works graphql-eslint in yarn berry
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Patch Changes

  • dc29c27: update graphql-js peer dependency range
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Minor Changes

  • 81fae5a: GraphQL v16 support
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Patch Changes

  • 86b3709: fix error report for no-unused-fields and no-unreachable-types rule
  • cf3cc4f: fix error report for require-deprecation-reason and require-field-of-type-query-in-mutation-result rule
  • 578b890: fix error report for require-deprecation-date rule
  • ebab010: fix error report for alphabetize rule
  • 7dacfe5: fix error report for avoid-scalar-result-type-on-mutation rule
  • f712780: fix error report for unique-fragment-name and unique-operation-name rule
  • d081fcc: fix error report for selection-set-depth rule and for graphql-js rules
  • 46f03f7: fix error report for description-style rule
  • b36a32c: fix error report for strict-id-in-types and naming-convention rule
  • 7aa8157: fix error report for input-name rule
  • a285de3: fix error report for require-deprecation-reason and require-field-of-type-query-in-mutation-result rule
  • ced6789: fix error report for no-deprecated rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Patch Changes

  • 98b6bcb: fix: adjust report location for no-operation-name-suffix rule
  • 1bacedd: fix: adjust report location for no-anonymous-operations rule
  • c42cee5: fix: adjust report location for avoid-typename-prefix rule
  • eb4a851: fix: adjust report location for require-description rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] almost 3 years ago

Minor Changes

  • f2a6635: add new rule require-field-of-type-query-in-mutation-result
  • 44a6c73: fix false negative case for no-undefined-variables rule
  • ed6644b: feat: support ESLint 8
  • f713823: fix false positive case for no-unused-variables rule
  • c7a8b33: add new rule alphabetize
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] about 3 years ago

Minor Changes

  • 1dd2f43: feat: add recommended and all configs
  • 1dd2f43: add new rule require-deprecation-date
  • 1dd2f43: add new rule avoid-scalar-result-type-on-mutation
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] about 3 years ago

Minor Changes

  • c6886ba: [New rule] Compare operation/fragment name to the file name
  • 2032a66: fix no-unreachable-types rule when interface implementing other interface

Patch Changes

  • c6886ba: NEW PLUGIN: Compare operation/fragment name to the file name
  • 7b12bbf: fix(no-hashtag-description): allow hashtag comments between fields and arguments
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] about 3 years ago

Patch Changes

  • 403b946: enhance(eslint-plugin): refactor the parts using tools
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] about 3 years ago

Patch Changes

  • 0fb8d51: Update range of graphql-config and graphql-tools to fix documents loading issues
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] about 3 years ago

Major Changes

  • 17014ee: Drop support for Node 10, update to latest graphql-tools

Patch Changes

  • c0b12a5: fix(siblings): return virtual path for code files instead of real path
  • 3701b2a: use graphql-config even there is no graphql-config consmiconfig file
  • 44f0d73: fix false negative cases for no-unreachable-types rule
  • 5065482: fix caching for no-unreachable-types and no-unused-fields rules
  • 5e8ebd8: add tests for schema loaders
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Patch Changes

  • 34b4300: fix(graphql-config): pass real filepath to gqlConfig.getProjectForFile
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Patch Changes

  • ca8b521: fix: code filepath in unique-fragment-name and unique-operation-name rules
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Patch Changes

  • e7d8496: fix: documents in graphql-config can be null
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Patch Changes

  • f428d46: feat: improve generate-docs and types
  • 5a7e9a7: fix comments in files that contains import comments
  • 4348dcc: update eslint, various improvements
  • 01ade2e: fix unique-fragment-name and no-unused-fragments rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Minor Changes

  • a44d426: support #import in known-fragment-names rule
graphql-eslint - @graphql-eslint/[email protected]

Published by github-actions[bot] over 3 years ago

Patch Changes

  • 85d842e: add no-unused-fields rule
  • 6b5b90b: graphql-js migrate to .ts, fix links
  • f0560b0: Fix for missing exports for testkit
Badges
Extracted from project README
GraphQLConf 2024 Banner: September 10-12, San Francisco. Hosted by the GraphQL Foundation npm version
Related Projects