eslint-plugin-graphql
eslint-plugin-graphql copied to clipboard
Cannot read property 'getSchema' of undefined
trafficstars
If you run eslint on a graphql project with the graphql plugin but with a file set that does not include any graphql lintable files this error occurs. The issue is that eslint is just feeding all of its files to the graphql rule and the rule assumes that all files received should be linted, so when a file is received that is not included in the graphql schema map it is assumed that there will be a valid project config when there is not. The error occurs when it calls getSchema on the undefined project config.
Repro Steps
echo "module.exports={foo:'bar'};" > test.jsecho '{"schemaPath":"schema.graphql","include":"**/*Query.graphql"}' > .graphqlconfigeslint --plugin graphql --rule "{'graphql/template-strings': 'error'}" .
Issue Labels
- [x] has-reproduction
- [ ] feature
- [ ] docs
- [ ] blocking
- [ ] good first issue