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
Rules fail with ESLint 9.0.0 - context.getScope is not a function
#352
Comments
This issue relates to the blog Preparing your custom rules for ESLint v9.0.0 published on Sep 26, 2023 Good to see that there is already a merged PR for this as Eslint v9 was announced released on Apr 5, 2024. |
Thanks for reporting. I will take a look into it and try to make a patch release ASAP. |
I tested with Many thanks! |
@MikeMcC399 thanks for confirming... in this case I will close this issue. |
Yup, also verified. Thanks! |
Hello, I believe the 10.4.2 patch broke compatibility with eslint versions prior to 8 (We get the error on 7.32.0): |
Ouch! It sounds like this needs to be a new issue leading to a new fix release. The example in https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/#context.getscope() shows supporting both the deprecated API and the new API. If only the new API has been implemented, then it would break compatibility with anything below ESLint module.exports = {
create(context) {
const { sourceCode } = context;
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
// do something with scope
}
}
}
}; |
|
It appears there have been quite a few breaking changes with ESLint 9.0.0, and with that it looks like
context.getScope()
is no longer an available shortcut.It looks like a PR got merged that has the fix for this back on Feb 16, but it appears that hasn't been released yet - it's not in v10.4.1, which is the current latest.
Is there a plan to release that in the near future?
The text was updated successfully, but these errors were encountered: