Unable to configure a subset of rules
qrsor opened this issue · comments
Node version: 12.16.3
Command executed: npx graphql-schema-linter aws_appsync.graphql schema.graphql
Configuration file: graphql-schema-linter.config.js
module.exports = {
rules: ["defined_types_are_used"],
};
Expected: schema is validated using a single rule
Actual: A message is being displayed:
Warning on rules: The following rule(s) are invalid: Defined_types_are_used
I was able to get it working by replacing the rule name with "DefinedTypesAreUsed".
Hello @qrsor, I'm glad you managed to get it to work.
The rules are named with hyphens (-
) as per: https://github.com/cjoudrey/graphql-schema-linter#built-in-rules
Here's an example: https://github.com/cjoudrey/graphql-schema-linter#in-packagejson
In your case, this should work:
module.exports = {
rules: ["defined-types-are-used"],
};
In case you're curious, the reason "DefinedTypesAreUsed"
also works is because internally they are named with camel-cases. The hyphen names get converted to camel case here:
graphql-schema-linter/src/configuration.js
Lines 170 to 175 in e21bcef
Feel free to re-open this if you have other issues.