chore: enable @typescript-eslint/ban-ts-comment#11326
Conversation
| path.get('body').forEach((p) => { | ||
| if (t.isImportDeclaration(p)) { | ||
| // @ts-expect-error | ||
| if (t.isImportDeclaration(p.node)) { |
There was a problem hiding this comment.
What is the reason for this change?
There was a problem hiding this comment.
t.isImportDeclaration only expects Node to be passed to the argument. p is NodePath and p.node is Node.
The previous code also works because NodePath and Node both has type property.
https://github.com/babel/babel/blob/df733b18ae88f370caddecc30c6d96844007c411/packages/babel-types/src/validators/generated/index.ts#L1062-L1078
But given that t.isImportDeclaration narrows the argument to ImportDeclaration instead of NodePath<ImportDeclaration>, passing p.node is more correct.
We could use p.isImportDeclaration() instead of t.isImportDeclaration(p.node), too.
There was a problem hiding this comment.
Thanks for the explanation, it looks good as is!
the default option already contains what I requested
Description
superseds close #8413
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).