eslint-plugin-graphql
eslint-plugin-graphql copied to clipboard
"required-fields" rule crash for InlineFragment
trafficstars
Eslint crashes when there's a required field along with an inline fragment.
Eslint config:
"graphql/required-fields": ["error", {
"requiredFields": ["id"],
"schemaJsonFilepath": "./data/schema.json"
}]
Schema:
interface Viewer {
id: ID!
}
type UserViewer implements Viewer {
id: ID!
firstName: String
lastName: String
}
Query:
{
viewer {
... on UserViewer {
firstName
}
}
}
Intended:
error 'id' field required on 'viewer'
Actual:
Cannot read property 'value' of undefined
TypeError: Cannot read property 'value' of undefined
at /[...]/node_modules/eslint-plugin-graphql/lib/rules.js:44:26
at Array.find (native)
at /[...]/node_modules/eslint-plugin-graphql/lib/rules.js:42:66
[...]
Any update on this issue? I'm seeing this as well.