Skip to content

Add GraphQL ESLint plugin to the codebase

Natalia Tepluhina requested to merge ntepluhina-eslint-plugin-graphql into master

What does this MR do and why?

This MR introduces the use of https://github.com/dotansimha/graphql-eslint/ in our codebase. Also, this MR ensures we have unique operation names as a side-effect: to generate a schema locally from remote and client schemas with [Apollo Tools], I've needed to remove all duplicates on operation names.

EDIT: Originally, this MR did not add any linting rules to CI, but now it adds some and leaves the schema-dependent ones commented out.

Original:

Currently, this linter is not added to the CI jobs but already can be used with fetched GraphQL schema locally.

Screenshots or screen recordings

No visual changes

How to set up and validate locally

EDIT: Simply run yarn run lint:eslint:all. You can also try running bundle exec gitlab:graphql:schema:dump and then uncommenting some of the rules in the .eslintrc.yml.

Origiinal:
  1. Fetch the GraphQL schema and store it locally under schema.graphql
  2. Run yarn eslint . --ext .graphql to see a bunch of errors

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Close #344087 (closed)

Edited by Paul Slaughter

Merge request reports