-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: made BaseNode.parent non-optional #5252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: made BaseNode.parent non-optional #5252
Conversation
Thanks for the PR, @JoshuaKGoldberg! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
* while traversing. | ||
*/ | ||
// The parent node of the current node | ||
// (added in @typescript-eslint/types as ESLint adds it while traversing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to an inline //
comment so the /** */
jsdoc comment doesn't risk getting attached to type
.
export function getRange( | ||
node: Pick<ts.Node, 'getEnd' | 'getStart'>, | ||
ast: ts.SourceFile, | ||
): [number, number] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Program
-typed values were getting passed in here. Having the node
Pick
out the only methods it needs stopped some type errors.
@@ -390,7 +387,7 @@ export class Converter { | |||
params: typeParameters.map(typeParameter => | |||
this.convertType(typeParameter), | |||
), | |||
}; | |||
} as TSESTree.TSTypeParameterDeclaration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this and the other node don't use this.createNode
?
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v6 #5252 +/- ##
==========================================
+ Coverage 91.64% 91.67% +0.03%
==========================================
Files 358 358
Lines 12237 12232 -5
Branches 3591 3585 -6
==========================================
Hits 11214 11214
+ Misses 721 719 -2
+ Partials 302 299 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…pescript-eslint#5036) * refactor(utils)!: removed `TRuleListener` generic from the `createRule` * refactor!: removed `TRuleListener` generic from the `CLIEngine` and `RuleCreateFunction` * chore: document and refactor 'extra' to 'parserSettings' (typescript-eslint#5834) * chore(website): fix renamed Sponsorship docs link (typescript-eslint#5882) * docs: Mention wide globs performance implications in monorepos docs and parser README (typescript-eslint#5864) * docs: Mention wide globs performance implications in monorepos docs and parser readme * Update docs/linting/typed-linting/MONOREPOS.md Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com> Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com> Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
…ipt-eslint#3076) * feat: update TSImportType node * fix: update visitor keys * chore: document and refactor 'extra' to 'parserSettings' (typescript-eslint#5834) * chore(website): fix renamed Sponsorship docs link (typescript-eslint#5882) * docs: Mention wide globs performance implications in monorepos docs and parser README (typescript-eslint#5864) * docs: Mention wide globs performance implications in monorepos docs and parser readme * Update docs/linting/typed-linting/MONOREPOS.md Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com> Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com> Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
* feat(scope-manager): ignore ECMA version * chore: document and refactor 'extra' to 'parserSettings' (typescript-eslint#5834) * chore(website): fix renamed Sponsorship docs link (typescript-eslint#5882) * Remove much more * Fix WebLinter lint * docs: Mention wide globs performance implications in monorepos docs and parser README (typescript-eslint#5864) * docs: Mention wide globs performance implications in monorepos docs and parser readme * Update docs/linting/typed-linting/MONOREPOS.md Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com> * chore: add auto-canary release for v6 (typescript-eslint#5883) Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
…TSInterfaceDeclaration and TSModuleDeclaration (typescript-eslint#4863) * chore: remove invalid properties from ast nodes * chore: remove invalid code in scope-manager and typescript-estree * chore: re-write snapshots that were using invalid properties * feat: remove modifiers union from ast types Co-authored-by: Juan García <juank1809@gmail.com> Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
* chore(utils)\!: remove (ts-)eslint-scope types * Remove eslint-scope dep * More file deletions
# Conflicts: # packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts # packages/utils/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BREAKING CHANGE:
changes the AST types in a non-backwards compatible way.
PR Checklist
parent
property on AST Nodes #1417Overview
Doesn't quite make
BaseNode
'sparent
property generic (a good next step?), but does makeProgram
's propertyparent?: never
.I removed all checks like
/if \(\w+\.parent/
,/!\w+\.parent/
, and/\w+\.parent ((&&)|(\|\|))/
, then added back any that caused type checking complaints. Those were mostly from places that recursively went up the AST vianode.parent
.