Community Plugin
View plugin on GitHubUsed to be called gatsby-plugin-lint-queries
, now called gatsby-plugin-extract-schema
gatsby-plugin-lint-queries
A Gatsby plugin that lets you check your graphql
queries against the schema gatsby
generated.
Install
npm install --save gatsby-plugin-lint-queries
npm install --save-dev eslint babel-eslint eslint-plugin-graphql
How to use
Edit gatsby-config.js
module.exports = {
plugins: [`gatsby-plugin-lint-queries`]
};
Add .eslintrc.js
to the project root
const path = require("path");
module.exports = {
parser: "babel-eslint",
rules: {
"graphql/template-strings": [
"error",
{
env: "relay",
schemaJsonFilepath: path.resolve(__dirname, "./schema.json"),
tagName: "graphql"
}
]
},
plugins: ["graphql"]
};
Big thanks to Kurtis Kemple for all his help!