-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(utils): update types to reflect RuleContext
and SourceCode
changes and deprecations
#7812
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(utils): update types to reflect RuleContext
and SourceCode
changes and deprecations
#7812
Conversation
Thanks for the PR, @G-Rath! 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. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Are folks ok if I ignore the deprecation linting errors? I can help getting them addressed but would prefer to do so in dedicated PR since they'll require actual runtime changes and there's a few different ways they can be approached |
Well, we need typescript-eslint to work on both v8 and v9 for the time being. Dropping v8 would be a breaking change. I'd presume |
My point is you'll need to make changes to support v9 since some of these are being removed in that major - it's pretty straight forward (I've already done this in I'll add disable directives for now |
Agreed. https://github.com/jest-community/eslint-plugin-jest/blob/3c12c9842df7950dd214855fa69b1785c4d1574d/src/rules/utils/misc.ts is roughly the strategy I'm betting we'll want to take. 🙂 export const getDeclaredVariables = (
context: TSESLint.RuleContext<string, unknown[]>,
node: TSESTree.Node,
) => {
const sourceCode = getSourceCode(context);
if ('getDeclaredVariables' in sourceCode) {
return sourceCode.getDeclaredVariables(node);
}
return context.getDeclaredVariables(node);
}; |
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.
💯 thanks!
Adding |
Thanks again @G-Rath! |
Amusingly, there are now a bunch of lint failures on |
PR Checklist
Overview
Reference: https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9