Skip to content

Commit 03ccb9d

Browse files
authored
fix error from no-deprecated rule 4.0.0-alpha.13: node.typeInfo(...).inputType.getFields is not a function (#2743)
* aa * aa * aa
1 parent c1ee26a commit 03ccb9d

File tree

7 files changed

+16
-49
lines changed

7 files changed

+16
-49
lines changed

.changeset/cool-spoons-explain.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
fix error from `no-deprecated` rule
6+
`4.0.0-alpha.13: node.typeInfo(...).inputType.getFields is not a function`

.husky/_/husky.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

.husky/pre-commit

Whitespace-only changes.

.husky/pre-push

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"eslint": "9.14.0",
4040
"eslint-plugin-eslint-plugin": "6.3.2",
4141
"eslint-plugin-tailwindcss": "3.17.5",
42-
"husky": "9.1.7",
4342
"jest-snapshot-serializer-raw": "2.0.0",
4443
"json-schema-to-markdown": "1.1.1",
4544
"prettier": "3.3.3",

packages/plugin/src/rules/no-deprecated/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,16 @@ export const rule: GraphQLESLintRule<[], true> = {
132132
}
133133
},
134134
ObjectValue(node) {
135-
const typeInfo = node.typeInfo();
136-
// @ts-expect-error -- fixme
137-
const fields = typeInfo.inputType!.getFields();
138-
for (const field of node.fields) {
139-
const fieldName = field.name.value;
140-
const reason = fields[fieldName].deprecationReason;
141-
if (reason) {
142-
report(field, reason);
135+
const { inputType } = node.typeInfo();
136+
if (!inputType) return;
137+
if ('getFields' in inputType) {
138+
const fields = inputType.getFields();
139+
for (const field of node.fields) {
140+
const fieldName = field.name.value;
141+
const reason = fields[fieldName].deprecationReason;
142+
if (reason) {
143+
report(field, reason);
144+
}
143145
}
144146
}
145147
},

pnpm-lock.yaml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)