Skip to content

Commit

Permalink
fix error from no-deprecated rule `4.0.0-alpha.13: node.typeInfo(..…
Browse files Browse the repository at this point in the history
….).inputType.getFields is not a function` (#2743)

* aa

* aa

* aa
  • Loading branch information
dimaMachina authored Nov 21, 2024
1 parent c1ee26a commit 03ccb9d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 49 deletions.
6 changes: 6 additions & 0 deletions .changeset/cool-spoons-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphql-eslint/eslint-plugin': patch
---

fix error from `no-deprecated` rule
`4.0.0-alpha.13: node.typeInfo(...).inputType.getFields is not a function`
29 changes: 0 additions & 29 deletions .husky/_/husky.sh

This file was deleted.

Empty file removed .husky/pre-commit
Empty file.
1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"eslint": "9.14.0",
"eslint-plugin-eslint-plugin": "6.3.2",
"eslint-plugin-tailwindcss": "3.17.5",
"husky": "9.1.7",
"jest-snapshot-serializer-raw": "2.0.0",
"json-schema-to-markdown": "1.1.1",
"prettier": "3.3.3",
Expand Down
18 changes: 10 additions & 8 deletions packages/plugin/src/rules/no-deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,16 @@ export const rule: GraphQLESLintRule<[], true> = {
}
},
ObjectValue(node) {
const typeInfo = node.typeInfo();
// @ts-expect-error -- fixme
const fields = typeInfo.inputType!.getFields();
for (const field of node.fields) {
const fieldName = field.name.value;
const reason = fields[fieldName].deprecationReason;
if (reason) {
report(field, reason);
const { inputType } = node.typeInfo();
if (!inputType) return;
if ('getFields' in inputType) {
const fields = inputType.getFields();
for (const field of node.fields) {
const fieldName = field.name.value;
const reason = fields[fieldName].deprecationReason;
if (reason) {
report(field, reason);
}
}
}
},
Expand Down
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03ccb9d

Please sign in to comment.