{"name":"@graphql-eslint/eslint-plugin","version":"3.11.0-alpha-20220822143702-ea4e67a","description":"GraphQL plugin for ESLint","sideEffects":false,"peerDependencies":{"graphql":"^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"dependencies":{"@babel/code-frame":"^7.16.7","@graphql-tools/code-file-loader":"^7.2.14","@graphql-tools/graphql-tag-pluck":"^7.2.6","@graphql-tools/utils":"^8.6.9","chalk":"^4.1.2","debug":"^4.3.4","fast-glob":"^3.2.11","graphql-config":"^4.3.0","graphql-depth-limit":"^1.1.0","lodash.lowercase":"^4.3.0"},"repository":{"type":"git","url":"git+https://github.com/B2o5T/graphql-eslint.git"},"keywords":["eslint","eslintplugin","eslint-plugin","graphql"],"author":{"name":"Dotan Simha","email":"dotansimha@gmail.com"},"license":"MIT","main":"index.js","module":"index.mjs","typings":"index.d.ts","typescript":{"definition":"index.d.ts"},"exports":{"./package.json":"./package.json",".":{"require":"./index.js","import":"./index.mjs"},"./*":{"require":"./*.js","import":"./*.mjs"}},"readme":"This project integrates GraphQL and ESLint, for a better developer experience.\n\n<img height=\"150\" src=\"./logo.png\">\n\n[![npm version](https://badge.fury.io/js/%40graphql-eslint%2Feslint-plugin.svg)](https://badge.fury.io/js/%40graphql-eslint%2Feslint-plugin)\n\n> Created and maintained by [The Guild](https://the-guild.dev)\n\n## Key Features\n\n- 🚀 Integrates with ESLint core (as a ESTree parser)\n- 🚀 Works on `.graphql` files, `gql` usages and `/* GraphQL */` magic comments\n- 🚀 Lints both GraphQL schema and GraphQL operations\n- 🚀 Extended type info for more advanced usages\n- 🚀 Supports ESLint directives (for example: `eslint-disable-next-line`)\n- 🚀 Easily extendable - supports custom rules based on GraphQL's AST and ESLint API\n- 🚀 Validates, lints, prettifies and checks for best practices across GraphQL schema and GraphQL operations\n- 🚀 Integrates with [`graphql-config`](https://graphql-config.com)\n- 🚀 Integrates and visualizes lint issues in popular IDEs (VSCode / WebStorm)\n\n> Special thanks to [ilyavolodin](https://github.com/ilyavolodin) for his work on a similar project!\n\n<img src=\"https://thumbs.gfycat.com/ActualTerrificDog-size_restricted.gif\" />\n\n## Getting Started\n\n- [Introducing GraphQL-ESLint!](https://the-guild.dev/blog/introducing-graphql-eslint) @ `the-guild.dev`\n\n### Installation\n\nStart by installing the plugin package, which includes everything you need:\n\n```sh\nyarn add -D @graphql-eslint/eslint-plugin\n```\n\nOr, with NPM:\n\n```sh\nnpm install --save-dev @graphql-eslint/eslint-plugin\n```\n\n> Make sure you have `graphql` dependency in your project.\n\n## Configuration\n\nTo get started, define an override in your ESLint config to apply this plugin to `.graphql` files. Add the [rules](docs/README.md) you want applied.\n\n> 🚨 Important! This step is necessary even if you are declaring operations and/or schema in code files.\n\n```json\n{\n  \"overrides\": [\n    {\n      \"files\": [\"*.graphql\"],\n      \"parser\": \"@graphql-eslint/eslint-plugin\",\n      \"plugins\": [\"@graphql-eslint\"],\n      \"rules\": {\n        \"@graphql-eslint/known-type-names\": \"error\"\n      }\n    }\n  ]\n}\n```\n\nIf your GraphQL definitions are defined only in `.graphql` files, and you're only using rules that apply to individual files, you should be good to go 👍. If you would like use a remote schema or use rules that apply across the entire collection of definitions at once, see [here](#extended-linting-rules-with-graphql-schema).\n\n### Apply this plugin to GraphQL definitions defined in code files\n\nIf you are defining GraphQL schema or GraphQL operations in code files, you'll want to define an additional override to extend the functionality of this plugin to the schema and operations in those files.\n\n```diff\n{\n  \"overrides\": [\n+   {\n+     \"files\": [\"*.js\"],\n+     \"processor\": \"@graphql-eslint/graphql\"\n+   },\n    {\n      \"files\": [\"*.graphql\"],\n      \"parser\": \"@graphql-eslint/eslint-plugin\",\n      \"plugins\": [\"@graphql-eslint\"],\n      \"rules\": {\n        \"@graphql-eslint/known-type-names\": \"error\"\n      }\n    }\n  ]\n}\n```\n\nUnder the hood, specifying the `@graphql-eslint/graphql` processor for code files will cause `graphql-eslint/graphql` to extract the schema and operation definitions from these files into virtual GraphQL documents with `.graphql` extensions. This will allow the overrides you've defined for `.graphql` files, via `\"files\": [\"*.graphql\"]`, to get applied to the definitions defined in your code files.\n\n### Extended linting rules with GraphQL Schema\n\nSome rules require an understanding of the entire schema at once. For example, [no-unreachable-types](https://github.com/B2o5T/graphql-eslint/blob/master/docs/rules/no-unreachable-types.md#no-unreachable-types) checks that all types are reachable by root-level fields.\n\nTo use these rules, you'll need to tell ESLint how to identify the entire set of schema definitions.\n\nIf you are using [`graphql-config`](https://graphql-config.com), you are good to go. `graphql-eslint` integrates with it automatically and will use it to load your schema!\n\nAlternatively, you can define `parserOptions.schema` in the `*.graphql` override in your ESLint config.\n\nThe parser allows you to specify a json file / graphql files(s) / url / raw string to locate your schema (We are using `graphql-tools` to do that). Just add `parserOptions.schema` to your configuration file:\n\n```diff\n{\n  \"files\": [\"*.graphql\"],\n  \"parser\": \"@graphql-eslint/eslint-plugin\",\n  \"plugins\": [\"@graphql-eslint\"],\n  \"rules\": {\n    \"@graphql-eslint/no-unreachable-types\": \"error\"\n  },\n+ \"parserOptions\": {\n+   \"schema\": \"./schema.graphql\"\n+ }\n}\n```\n\n> You can find a complete [documentation of the `parserOptions` here](docs/parser-options.md).\n\n> Some rules require type information to operate, it's marked in the docs for each rule!\n\n### Extended linting rules with siblings operations\n\nWhile implementing this tool, we had to find solutions for a better integration of the GraphQL ecosystem and ESLint core.\n\nGraphQL operations can be distributed across many files, while ESLint operates on one file at a time. If you are using GraphQL fragments in separate files, some rules might yield incorrect results, due the missing information.\n\nTo workaround that, we allow you to provide additional information on your GraphQL operations, making it available for rules while doing the actual linting.\n\nTo provide that, we are using `graphql-tools` loaders to load your sibling operations and fragments, just specify a glob expression(s) that points to your code/`.graphql` files:\n\n```diff\n{\n  \"files\": [\"*.graphql\"],\n  \"parser\": \"@graphql-eslint/eslint-plugin\",\n  \"plugins\": [\"@graphql-eslint\"],\n  \"rules\": {\n    \"@graphql-eslint/unique-operation-name\": \"error\"\n  },\n  \"parserOptions\": {\n+   \"operations\": \"./src/**/*.graphql\",\n    \"schema\": \"./schema.graphql\"\n  }\n}\n```\n\n### VSCode Integration\n\nUse [ESLint VSCode extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) to integrate ESLint into VSCode.\n\nFor syntax highlighting you need a GraphQL extension (which may potentially have its own linting), for example [GraphQL (by GraphQL Foundation)](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql).\n\n### Disabling Rules\n\nThe `graphql-eslint` parser looks for GraphQL comments syntax (marked with `#`) and will send it to ESLint as directives. That means, you can use ESLint directives syntax to hint ESLint, just like in any other type of files.\n\nTo disable ESLint for a specific line, you can do:\n\n```graphql\n# eslint-disable-next-line\ntype Query {\n  foo: String!\n}\n```\n\nYou can also specify specific rules to disable, apply it over the entire file, `eslint-disable-next-line` or current `eslint-disable-line`.\n\nYou can find a list of [ESLint directives here](https://eslint.org/docs/2.13.1/user-guide/configuring#disabling-rules-with-inline-comments).\n\n## Available Rules\n\nYou can find a complete list of [all available rules here](docs/README.md).\n\n### Deprecated Rules\n\nSee [docs/deprecated-rules.md](docs/deprecated-rules.md).\n\n## Available Configs\n\n<!-- prettier-ignore-start -->\n|Name|Description|\n|:-:|-|\n|[`schema-recommended`](packages/plugin/src/configs/schema-recommended.json)|enables recommended rules for schema (SDL) development|\n|[`schema-all`](packages/plugin/src/configs/schema-all.json)|enables all rules for schema (SDL) development, except for those that require `parserOptions.operations` option|\n|[`operations-recommended`](packages/plugin/src/configs/operations-recommended.json) |enables recommended rules for consuming GraphQL (operations) development|\n|[`operations-all`](packages/plugin/src/configs/operations-all.json)|enables all rules for consuming GraphQL (operations) development|\n|[`relay`](packages/plugin/src/configs/relay.json)|enables rules from Relay specification for schema (SDL) development|\n<!-- prettier-ignore-end -->\n\n> If you are in a project that develops the GraphQL schema, you'll need `schema` rules. \n\n> If you are in a project that develops GraphQL operations (query/mutation/subscription), you'll need `operations` rules.\n\n> If you are in a monorepo project, you probably need both sets of rules, see [example of configuration](examples/monorepo/.eslintrc.cjs).\n\n### Config usage\n\nFor example, to enable the `schema-recommended` config, enable it in your `.eslintrc` file with the `extends` option:\n\n> All configs under the hood set `parser` as `@graphql-eslint/eslint-plugin` and add `@graphql-eslint` to `plugins` array, so you don't need to specify them.\n\n```diff\n{\n  \"overrides\": [\n    {\n      \"files\": [\"*.js\"],\n      \"processor\": \"@graphql-eslint/graphql\"\n    },\n    {\n      \"files\": [\"*.graphql\"],\n-     \"parser\": \"@graphql-eslint/eslint-plugin\",\n-     \"plugins\": [\"@graphql-eslint\"],\n+     \"extends\": \"plugin:@graphql-eslint/schema-recommended\"\n    }\n  ]\n}\n```\n\n### `prettier` rule\n\n`eslint-plugin-prettier` supports `.graphql` files, and `v4.1.0` supports `graphql` blocks even better. You need to do the following:\n\n```js\nmodule.exports = {\n  overrides: [\n    {\n      files: ['*.js'],\n      processor: '@graphql-eslint/graphql',\n      extends: ['plugin:prettier/recommended']\n    },\n    {\n      files: ['*.graphql'],\n      parser: '@graphql-eslint/eslint-plugin',\n      plugins: ['@graphql-eslint'],\n      rules: {\n        'prettier/prettier': 'error'\n      }\n    }\n  ]\n}\n```\n\nYou can take [`examples/prettier`](examples/prettier/.eslintrc.cjs) as example.\n\n## Further Reading\n\nIf you wish to learn more about this project, how the parser works, how to add custom rules and more please refer to the below links:\n\n- [Writing Custom Rules](docs/custom-rules.md)\n- [How the parser works?](docs/parser.md)\n- [`parserOptions`](docs/parser-options.md)\n\n## Contributions\n\nContributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!\n\nAnd if this is your first time contributing to this project, please do read our [Contributor Workflow Guide](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md) before you get started off.\n\n### Code of Conduct\n\nHelp us keep GraphQL ESLint open and inclusive. Please read and follow our [Code of Conduct](https://github.com/the-guild-org/Stack/blob/master/CODE_OF_CONDUCT.md) as adopted from [Contributor Covenant](https://contributor-covenant.org).\n\n## License\n\nReleased under the [MIT license](LICENSE).\n","readmeFilename":"README.md","gitHead":"ea4e67a76afebf9c62cd53888790c365fad7ab54","bugs":{"url":"https://github.com/B2o5T/graphql-eslint/issues"},"homepage":"https://github.com/B2o5T/graphql-eslint#readme","_id":"@graphql-eslint/eslint-plugin@3.11.0-alpha-20220822143702-ea4e67a","_nodeVersion":"18.7.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-O9oB9VCydrplDpOnuvOk4U285Qmn8l2PhijsKSy0yczLhNPK8A2Z9JkPUehtTqyeImxN6msLoqZ5AHIR00zBEg==","shasum":"a89478b41eb68ed812d4dc865067ec2d495bdded","tarball":"http://registry-npm.ywwl.com/@graphql-eslint/eslint-plugin/download/@graphql-eslint/eslint-plugin-3.11.0-alpha-20220822143702-ea4e67a.tgz","fileCount":117,"unpackedSize":502165,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyfwjywBcdxRbnVq9t726YcVJoo4VXrx5mal89rSScLQIhAKCXAmbYeBnqX3aXjHvqci3xFK7aaZxsyU3ekXvD5oxc"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjA5SWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5cxAAnFNO8Ef8bkTgX+yIt6vs+ll2N22emEQspbhhTb4TU/wvIcSg\r\nhcacii9BftiFVjvW0/gPTlWaEBoTYOyJvv4efnDGEqE9QvDAJ2L6Y9wM1NnI\r\nZW8T1wW2OGsD345JDa4Vgtv+lKX3JvEyGzafU5OmRC0D4v/fSqtLu42Hu5RY\r\nsVJp8txNXAu/+iyBFnQMKkmvZ9hmx+RbmFzu+oVeS6yEkMl6KAY9SLp84QSZ\r\nivoiLaCHw8PeAwYTIYoLMHorLqM8/b84yTuPWJr754s2UCyEHDZ/ck+r5fzU\r\nvxbwOZTWDx7bg+oAhsM8mLW/nJp9Tl4TfTRoeeXNJ68SYPHSBMQxEedG6nUK\r\nYDQDi7mUWJ8e8WpoPCekGGMlbHrHOd5VMiROgHtP9iPJS0RqPiaBrJfxNfS5\r\nAz8vXQeLA+BSpOH5RuWvVHC9w1FpNyQFayXsj9PRrmceJXlcHUFKcRriuqQi\r\nFi0NvnbF/bh+Ljg75OmJ11Re1uX/kPXZ0ejw/kHIUUYokZRpoRwStXDtFI7i\r\nCeTa+r5kJpib7b4gc9eeKJc1I9qVlOARVPDvdyAljO7+KCHRoay3llbcSijd\r\n1RY2CzZBaMb+xl/2aw5YqmvviQZxkQ1XSvhA/PDvO3u+6/zqefnO+e01BJJu\r\nQP2tZGo1JMUeKOlne7a3UgNQAmoxPzYElfc=\r\n=f1ea\r\n-----END PGP SIGNATURE-----\r\n","size":93160,"noattachment":false,"key":"/@graphql-eslint/eslint-plugin/-/@graphql-eslint/eslint-plugin-3.11.0-alpha-20220822143702-ea4e67a.tgz"},"_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"directories":{},"maintainers":[{"name":"ivolodin","email":"ivolodin@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin_3.11.0-alpha-20220822143702-ea4e67a_1661179030595_0.572055563604561"},"_hasShrinkwrap":false,"publish_time":1661179030802,"_cnpm_publish_time":1661179030802,"dist-tags":{"alpha":"4.4.2-alpha-20260803170659-1779f77e37ef86fa9e32c7f7023d5008c023471e","latest":"4.4.2"}}