Closed steverice closed 3 years ago
Hey @steverice, thanks for opening this issue.
I think this might indeed have been an oversight. Good catch!
Checking for ruleName
being defined seems better for the use case you mentioned.
Would you mind opening a PR for this?
Sure thing. #267 should fix this.
240 added a block of code that filters out errors if they are in the ignore list, but only if they are an
instanceof ValidationError
:Presumably, this is so that plain
GraphQLError
s cannot be accidentally ignored. However, this seems to make it impossible to ignore any custom rules.The
ValidationError
object that's referenced here is the object exported bysrc/validation_error.js
ingraphql-schema-linter
. Asgraphql-schema-linter
is expected to be installed globally, other code (where custom rules may live) will be unable to import this reference, at least not without some ugly workarounds.Theoretically, if the package also containing the custom rules is installed globally, or if
graphql-schema-linter
is being run from the samenode_modules
directory as the custom rule, it would work — but I don't believe this was an intentional restriction.Am I missing something here? Would it be better to replace the
instanceof
check with something like checking ifruleName
is defined?cc @id-ilych