diff --git a/README.md b/README.md index 99924cfba7e5ba004217123510925bacaa3c63f4..3f6b5c83ad32ae376d42f28da972130b316b972f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,28 @@ module.exports = { - `autoFix`: (`boolean?`) Enable auto-fixing static queries with generated types. +## ESLint + +You can use the extracted schema file for [eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql)! + +```js +// In a file called .eslintrc.js +module.exports = { + rules: { + 'graphql/template-strings': ['error', { + env: 'relay', + schemaJsonFilepath: `${__dirname}/.cache/caches/gatsby-plugin-typegen/schema.json`, + tagName: 'graphql', + }], + }, + plugins: [ + 'graphql' + ] +}; +``` + +You may get error for first time because schema is not extracted in your `.cache` dir yet. + ## Acknowledgements - [gatsby-plugin-extract-code](https://github.com/NickyMeuleman/gatsby-plugin-extract-schema)