apollographql / eslint-plugin-graphql

:vertical_traffic_light: Check your GraphQL query strings against a schema.
https://www.npmjs.com/package/eslint-plugin-graphql
1.21k stars 103 forks source link

Straightforward tutorial instructions wanted on how configure eslint-plugin-graphql #187

Open nemethmik opened 6 years ago

nemethmik commented 6 years ago

Hello Friends, I have seen Jon Wong's video (Supercharge your GraphQL Development - Jon Wong @ GraphQL Europe 2018) on https://youtu.be/Zj6F-TfN2R8?t=225 talking about a number of tools. I was able to use both graphql CLI and Apollo Codegen, but I simply wasn't able to configure the GraphQL ESLint plugin. I use VS Code with the ESLint extension, I have ESLint installed globally, it works fine on my system. I installed the GraphQL plugin as global package, too. I have an .eslintrc.json and .graphqlconfig. My schema is defined in a .graphql SDL file, and my queries in another .graphql file. The "graphql lint" command works fine, just like Credit Karmas GraphQL schema loader and query validator, all work fine to detect errors, if and when I had any. The problem is that when I edit and save my query graphql file, the GraphQL ESLing plugin doesn't give any warning/errors, nothing.

Here is my .eslintrc.json: { "env": { "browser": true, "es6": true, "node": true }, "extends": "eslint:recommended", "parserOptions": { "ecmaFeatures": { "jsx": true }, "ecmaVersion": 2018, "sourceType": "module" }, "plugins": [ "react", "graphql" ], "rules": { "indent": [ "error", "tab" ], "quotes": [ "error", "double" ], "semi": [ "error", "never" ], "graphql/template-strings": ["error", { "env": "literal" }] } } Here is my .graphqlconfig: { "schemaPath": "./imports/schema/b1schema.graphql" } Thank you so much, Miklos

Issue Labels

timbuckley commented 4 years ago

Any progress on this? My setup is similar and provides no warnings/errors to my .graphql files.