Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable relay-page-info-spec #269

Open
shellscape opened this issue Dec 18, 2020 · 7 comments
Open

Cannot disable relay-page-info-spec #269

shellscape opened this issue Dec 18, 2020 · 7 comments

Comments

@shellscape
Copy link

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
}
@cjoudrey
Copy link
Owner

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.

@shellscape
Copy link
Author

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.

@cjoudrey
Copy link
Owner

Awesome! ☺️

but I wanted to make the project aware of the issue.

Thanks I really appreciate the help. ☺️🎉

@jacquayj
Copy link

jacquayj commented Jun 8, 2022

graphql-schema-linter --except relay-page-info-spec worked for me, thanks!

@uasi
Copy link

uasi commented Aug 30, 2022

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

@uasi
Copy link

uasi commented Aug 30, 2022

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.

if (config.line < errorLine) {

@sjoerdk-ahold
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants