Open shellscape opened 3 years ago
Hey @shellscape, thanks for opening this issue.
This is definitely an oversight if that's the case. It might also just be missing from the README.md
.
I agree that people should be able to do something like this in their package.json
:
{
"graphql-schema-linter": {
"ignore": {
"fields-have-descriptions": ["Obvious", "Query.obvious", "Query.something.obvious"]
}
}
}
If this is actually broken, I would start by looking here: https://github.com/cjoudrey/graphql-schema-linter/blob/c2876f3b93bd2a262c2af838f17cca5e21c23848/src/options.js
I took a closer look and we have a test for this use case: https://github.com/cjoudrey/graphql-schema-linter/blob/c2876f3b93bd2a262c2af838f17cca5e21c23848/test/config/package_json/test.js#L52-L76
So either the test is broken or perhaps we're just missing some documentation in the README.md
about the above use case.
Yeah my first stop was the README. The text here: https://github.com/cjoudrey/graphql-schema-linter#configuration-file, states that ignore
is not an option that it accepts. So I gave it a shot anyways, and it didn't work. Triple checked the syntax and no joy. (I was ignoring an unused type). Once added on the command line option, worked as expected. So if it is supported, something is definitely off.
FWIW I tried the ignore syntax in package.json and it worked fine for me.
"graphql-schema-linter": { "ignore": { "types-have-descriptions": [ ... ] } }
Seems to work fine in package.json, but I couldn't get it to work with .graphql-schema-linterrc
I have this in my package.json, working quite alright with a TypeGraphQL generated schema.
{
"graphql-schema-linter": {
"ignore": {
"arguments-have-descriptions": ["Query._entities"],
"fields-are-camel-cased": ["Query._entities", "Query._service"],
"fields-have-descriptions": ["Query", "Mutation"],
"types-are-capitalized": ["_Service"],
"types-have-descriptions": ["Query", "Mutation", "_Any", "_Entity", "_Service"]
}
}
}
I must admit I'm a bit baffled as to why
--ignore
accepts JSON but not from package.json, where the format is also JSON. If at all possible, please consider supporting theignore
option within package.json. It would save a whole lot of headache. 🍻