{"id":47505,"library":"eslint-plugin-graphql-schema","title":"eslint-plugin-graphql-schema","description":"ESLint plugin for validating GraphQL schema definitions with rules for descriptions, naming conventions, ordering, and required patterns. Version 2.0.3 is the latest stable release, updated as needed via GitHub. Key differentiators: focused solely on schema validation (not operations), supports .graphql and .gql file extensions, and provides a custom parser for direct linting. Includes 15 rules covering arguments, enums, input objects, and object types.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/joshuaNathaniel/eslint-plugin-graphql-schema","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-graphql-schema","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-graphql-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-graphql-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; required for plugin to function","package":"eslint","optional":false}],"imports":[{"note":"Install as a dev dependency; the plugin is referenced by name 'graphql-schema' in .eslintrc.","wrong":"npm install eslint-plugin graphql-schema","symbol":"eslint-plugin-graphql-schema","correct":"npm install eslint-plugin-graphql-schema --save-dev"},{"note":"All rules must be prefixed with 'graphql-schema/' when configured in rules.","wrong":"{\n  \"rules\": {\n    \"arguments-have-descriptions\": \"warn\"\n  }\n}","symbol":"rules","correct":"{\n  \"plugins\": [\"graphql-schema\"],\n  \"rules\": {\n    \"graphql-schema/arguments-have-descriptions\": \"warn\"\n  }\n}"},{"fix":"Use the full path 'eslint-plugin-graphql-schema/parser'","note":"The custom parser is required for linting .graphql files directly; it's exported from the plugin package.","wrong":"\"parser\": \"graphql-schema\"","symbol":"parser","correct":"\"parser\": \"eslint-plugin-graphql-schema/parser\""}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"overrides\": [\n    {\n      \"files\": [\"*.graphql\"],\n      \"parser\": \"eslint-plugin-graphql-schema/parser\",\n      \"plugins\": [\"graphql-schema\"],\n      \"rules\": {\n        \"graphql-schema/arguments-have-descriptions\": \"error\",\n        \"graphql-schema/defined-types-are-used\": \"error\",\n        \"graphql-schema/enum-values-have-descriptions\": \"error\",\n        \"graphql-schema/type-fields-have-descriptions\": \"error\"\n      }\n    }\n  ]\n}\n\n// schema.graphql\ntype Query {\n  \"Get a user by ID\"\n  user(id: ID!): User\n}\n\n\"Represents a user\"\ntype User {\n  \"Unique identifier\"\n  id: ID!\n  \"User's name\"\n  name: String!\n}\n\nenum Role {\n  \"Administrator role\"\n  ADMIN\n  \"Regular user\"\n  USER\n}","lang":"json","description":"Configures ESLint with the graphql-schema plugin and custom parser for .graphql files, with example schema that complies with rules."},"warnings":[{"fix":"Ensure ESLint version is 6 or higher and Node version is 12 or higher.","message":"Requires ESLint 6+ and Node >=12","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Add 'parser': 'eslint-plugin-graphql-schema/parser' in ESLint config overrides for .graphql files.","message":"Custom parser must be explicitly set for .graphql files","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Reference rules as 'graphql-schema/rule-name' in ESLint config.","message":"Rules must be prefixed with graphql-schema/","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use eslint-plugin-graphql for operation validation.","message":"Plugin only validates schemas, not operations (queries/mutations)","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check documentation; use 'type-fields-have-descriptions' or 'input-object-values-have-descriptions' as appropriate.","message":"Rule 'types-have-descriptions' may be deprecated in favor of more specific rules","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'15':59 '2.0.3':24 'argument':62 'convent':18 'cover':61 'custom':53 'definit':12 'descript':16 'differenti':36 'direct':56 'enum':63 'eslint':2,6,70,73 'eslint-plugin':72 'eslint-plugin-graphql-schema':1 'eslintplugin':71 'extens':49 'file':48 'focus':37 'github':34 'gql':47 'graphql':4,10,45 'includ':58 'input':64 'javascript':69 'key':35 'latest':27 'lint':57 'name':17 'need':32 'object':65,67 'oper':43 'order':19 'parser':54 'pattern':22 'plugin':3,7,74 'provid':51 'releas':29 'requir':21 'rule':14,60 'schema':5,11,40 'sole':38 'stabl':28 'support':44 'type':68 'updat':30 'valid':9,41 'version':23 'via':33","created_at":"2026-06-07T16:51:51.723049+00:00","updated_at":"2026-06-07T16:51:51.723049+00:00","problems":[{"fix":"Run 'npm install eslint-plugin-graphql-schema --save-dev' and ensure the parser is written exactly as 'eslint-plugin-graphql-schema/parser'.","cause":"The plugin is not installed or the parser path is incorrect.","error":"Error: Failed to load parser 'eslint-plugin-graphql-schema/parser' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-graphql-schema/parser'"},{"fix":"Use strings: \"graphql-schema/arguments-have-descriptions\": \"off\".","cause":"Rule severity must be 'off', 'warn', 'error' (strings) or 0/1/2.","error":"Error: Configuration for rule \"graphql-schema/arguments-have-descriptions\" is invalid: Value \"off\" is not accepted. Expected boolean or object."},{"fix":"Ensure the 'parser' is set correctly and the file has a schema definition (e.g., type Query { ... }).","cause":"The parser is not applied to .graphql files, or the file doesn't contain a valid GraphQL schema.","error":"TypeError: Cannot read properties of undefined (reading 'type')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/joshuaNathaniel/eslint-plugin-graphql-schema#readme","github":"https://github.com/joshuaNathaniel/eslint-plugin-graphql-schema","docs":null,"changelog":null,"pypi":null,"npm":"eslint-plugin-graphql-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}