Skip to content

lint

The lint command runs configurable lint rules on your GraphQL documents.

Terminal window
graphql lint [OPTIONS]
OptionDescription
-f, --format <FORMAT>Output format: human (default), json, github, sarif
-w, --watchWatch for file changes and re-lint
--fixAutomatically fix issues that have safe fixes
--fix-dry-runShow what would be fixed without modifying files
--max-warnings <N>Maximum number of warnings allowed before returning a non-zero exit code (exit code 6)
Terminal window
# Basic linting
graphql lint
# JSON output for CI
graphql lint --format json
# Watch mode for development
graphql lint --watch
# Auto-fix lint issues
graphql lint --fix
# Preview fixes without applying them
graphql lint --fix-dry-run
# Specific project
graphql --project frontend lint
  • 0 — No lint errors (warnings don’t cause non-zero exit)
  • 1 — Lint errors found
  • 6 — Warning threshold exceeded (--max-warnings)

Lint rules are configured in .graphqlrc.yml:

extensions:
graphql-analyzer:
lint:
extends: recommended
rules:
noDeprecated: warn
uniqueNames: error

See Linting Configuration and the Rules Catalog for all available rules.