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
Docs: context migration suggestions fail on earlier v8 versions #559
Comments
Thanks. I'm working on this. |
Many thanks for the update to the blog Preparing your custom rules for ESLint v9.0.0 > From I ran into a snag when implementing this, since the repo I'm updating had the following in its config: "parserOptions": {
"ecmaVersion": 2018
} I needed to update to |
Thanks once again for the assistance! cypress-io/[email protected] has successfully used your new recommendations! |
Docs page(s)
Preparing your custom rules for ESLint v9.0.0 > From
context
toSourceCode
which is linked to byMigrate to v9.x > Removed multiple
context
methodsAt least the following call transitions are problematic where the API call was not available on earlier ESLint
v8.x
releasesSourceCode#getScope(node)
added in ESLintv8.37.0
SourceCode#getAncestors(node)
added in ESLintv8.38.0
Other calls added around the same time are probably also affected.
What documentation issue do you want to solve?
Code examples using
const { sourceCode } = context;
cause an error running in Jest for ESLint <v8.37.0
.What do you think is the correct solution?
Please check if this should be changed to
const { sourceCode = {} } = context;
Participation
Additional comments
Steps to reproduce
Ubuntu
22.04.4
LTS, Node.js20.12.2
using ESLint8.57.0
as base vesion.Original state
git clone https://github.com/MikeMcC399/eslint-plugin-cypress cd eslint-plugin-cypress git switch show/api-deprecation npm ci npx jest tests/lib/rules/no-unnecessary-waiting.js --silent
Note deprecation warning
Recommended update
Using recommended code from blog Preparing your custom rules for ESLint v9.0.0 > From
context
toSourceCode
Note failure (log truncated):
Modified update
Use suggested change
const { sourceCode = {} } = context;
in branchshow/convert-to-sourcecode-Rev2
Continue to use
[email protected]
Note success with no deprecation message:
Revert to
[email protected]
git restore . npm ci npx jest tests/lib/rules/no-unnecessary-waiting.js --silent
Note also success with no deprecation message.
The text was updated successfully, but these errors were encountered: