eslint-plugin-graphql
eslint-plugin-graphql copied to clipboard
Include/Exclude files? [Multiple schemas]
I am trying to use this plugin to lint multiple schemas (that is, two different graphql services, not two schemas merged into one).
Currently, I do something like this
'graphql/template-strings': [
'error',
{
tagName: 'serviceOneGql',
schemaJson: require('./src/service-one-schema.json'),
},
{
tagName: 'serviceTwoGql',
schemaJson: require('./src/service-two-schema.json'),
},
],
but this has one major drawback: because the tagName has changed, we do not get any syntax highlighting, as most tools (vscode and prettier) are hard-coded to only look for gql
and graphql
tags, and this is not configurable.
A simple solution would be to tell eslint-plugin-graphql
to include
and/or exclude
certain files, something like this (not real, just my dream):
'graphql/template-strings': [
'error',
{
schemaJson: require('./src/service-one-schema.json'),
include: './src/service-one-queries/**/*.ts'
},
{
schemaJson: require('./src/service-two-schema.json'),
include: './src/service-two-queries/**/*.ts'
},
],
Is something like this possible?
+1 on this - I'm facing the exact same scenario in a monorepo with multiple projects and include
exclude
tags would allow me to lint two separate schemas without using custom tag names