Cannot disable relay-page-info-spec
Please consider the schema below. The comment at the top follows the docs for disabling a rule. When running the linter against that schema, the error A ``PageInfo`` object type is required as per the Relay spec. is thrown even though the linter is being instructed to ignore it.
# lint-disable relay-page-info-spec
##
# GraphQL Service
# Name: batman-service
# Intent: This service summons batman to fight villans
#
##
""" A hero character. These are the good guys """
type Hero {
enemies: [Villain]
friends: [Hero]
id: ID!
name: String!
}
""" A villain character. These are the bad guys """
type Villain {
enemies: [Hero]
friends: [Villain]
id: ID!
name: String!
}
""" Query Root """
type Query {
""" Summons batman """
summon: Hero
}
Hey @shellscape! Thanks for opening this issue.
That's odd. 🤔
It might have to do with how the PageInfo rule reports its error and that error's location possibly being less than 1. 🤔
Definitely something weird going on.
In the meantime, you could use --except or --rules if this is a blocker for you.
Thanks for replying so quickly. I'm going the route of explicitly defining all rules (sans that one) in package.json. Added bonus of being declarative for folks wondering what it's validating, but I wanted to make the project aware of the issue.
Awesome! ☺️
but I wanted to make the project aware of the issue.
Thanks I really appreciate the help. ☺️🎉
graphql-schema-linter --except relay-page-info-spec worked for me, thanks!
Found that # lint-disable-line relay-page-info-spec can disable the rule.
% npx graphql-schema-linter --version
3.0.1
-> % npx graphql-schema-linter issue-269.graphql --rules relay-page-info-spec
/Users/uasi/tmp/graphql-schema-linter/issue-269.graphql
1:1 A `PageInfo` object type is required as per the Relay spec. relay-page-info-spec
✖ 1 error detected
-> % sed -i.bak '1s/lint-disable/lint-disable-line/' issue-269.graphql
-> % npx graphql-schema-linter issue-269.graphql --rules relay-page-info-spec
✔ 0 errors detected
I believe the problem is because lint-disable does not affect the line it is written on, so the error at 1:1 is not silenced by it.
https://github.com/cjoudrey/graphql-schema-linter/blob/fb0dd421138a5385de9be783393fd5f684219400/src/validator.js#L141
Small bump on the above issue since the given workaround will not work much longer: ‼ The --only and --except command line options have been deprecated. They will be removed in v1.0.0.