Command-line tool and library for validating GraphQL schema definitions against a configurable set of rules. Current stable version is 3.0.1, with monthly releases. It supports custom rules, multiple output formats (compact, JSON, text), and integration with pre-commit hooks via lint-staged. Unlike graphql-eslint or other query-focused tools, this linter targets schema definition files (.graphql) and enforces best practices like field descriptions, type naming conventions, and alphabetical sorting. Requires graphql as a peer dependency (v15 or v16).
npm install graphql-schema-linterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Lints a GraphQL schema file with specific rules and outputs the result as text.
Use ES module imports or upgrade to Node.js 14+ and set 'type': 'module' in package.json.
Change 'import { lint } from 'graphql-schema-linter'' to 'import lint from 'graphql-schema-linter''.Update to GraphQL spec compliant syntax; these flags are only for legacy schemas.
Explicitly list schema files or use separate patterns in lint-staged config.
Run 'npm install graphql' or 'yarn add graphql'.
Use 'import lint from 'graphql-schema-linter'' instead of 'import { lint } ...'.Ensure the 'rules' option is an array, e.g., ['fields-have-descriptions'].