graphql-linter

module
v0.1.0-rc.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2025 License: MIT

README

GraphQL Linter

As this issue has been open since 2020, the decision was made to add federation support to a new linter. In other words, the graphql-schema-linter spec is honoured and federation support is added.

Features

  • All rules from graphql-schema-linter supported.
  • Federation directives and composition are recognized and validated.
  • Validates GraphQL SDL files for syntax and best practices.
  • Checks for Apollo Federation directive usage and typos.
  • Ensures all types, enums, and fields have descriptions.
  • Detects undefined types and invalid enum values.
  • Reports errors with line numbers and context.
  • Supports error suppression via comments.

Installation

Binary
ARCH=$(uname -m | awk '{if ($1=="x86_64") print "amd64"; else if ($1=="arm64" || $1=="aarch64") print "arm64"; else { print "Unsupported architecture: " $1 > "/dev/stderr"; exit 1 }}')
OS=$(uname | tr '[:upper:]' '[:lower:]')
VERSION=v0.1.0-rc.11
curl --fail -L https://github.com/schubergphilis/graphql-linter/releases/download/${VERSION}/graphql-linter-${VERSION}-${OS}-${ARCH} \
-o graphql-linter && \
chmod +x graphql-linter && \
./graphql-linter --version | grep ${VERSION}
Golang
go install github.com/schubergphilis/graphql-linter/cmd/graphql-linter@v0.1.0-rc.11 && \
graphql-linter --version

Usage

Help
go run cmd/graphql-linter/main.go --help
Lint specific directory
go run cmd/graphql-linter/main.go -targetPath test/testdata/graphql/invalid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL