Skip to content

Conversation

@ddebrunner
Copy link
Contributor

Add GraphQL Linting with Custom Rules and Configuration

Summary

Implements a comprehensive GraphQL linting system for the StepZen VS Code extension with configurable rules and real-time feedback.

Features

  • 5 custom linting rules: no anonymous operations, no duplicate fields, require descriptions, require deprecation reasons, field naming conventions, and root field nullability
  • Configurable rule system: Enable/disable individual rules via VS Code settings
  • Dynamic updates: Rule changes take effect immediately without extension restart
  • VS Code integration: Linting errors/warnings appear in Problems panel with precise line/column locations
  • Auto-linting: Optional automatic linting on file save
  • Command integration: "StepZen: Lint GraphQL Schema" command for manual linting

Technical Details

  • Uses GraphQL parser for accurate AST-based linting
  • Modular rule system for easy extension
  • Configuration-driven rule activation
  • Proper VS Code diagnostic collection integration
  • File watching with debounced auto-linting

Files Changed

  • src/services/graphqlLinter.ts - Core linting service with custom rules
  • src/commands/lintGraphQL.ts - Manual linting command
  • src/commands/configureLintRules.ts - Settings configuration command
  • package.json - Command registration and settings schema
  • src/extension.ts - Configuration change listeners and command registration
  • src/utils/constants.ts - New command and config constants

Testing

Includes test files demonstrating each rule with intentional violations and correct usage patterns.

Copy link
Contributor

@carloseberhardt carloseberhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@ddebrunner ddebrunner merged commit 89846e1 into main Jul 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants