-
Notifications
You must be signed in to change notification settings - Fork 91
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
fix: convert deprecated context calls #182
fix: convert deprecated context calls #182
Conversation
|
@MikeMcC399 Can we have the circle.yml print the version that was installed for ESLint? I was trying to see which version is installed on this step, and you can't actually tell. The warnings are a bit confusing printing a 7.x version. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
e22982a
to
9702da2
Compare
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.
Looks good!
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
c445177
to
d3d333a
Compare
Updated according to new recommendations from Preparing your custom rules for ESLint v9.0.0.
|
VerificationUse https://github.com/cypress-io/cypress-example-kitchensink as test platform Preparation npm ci
npm install eslint-plugin-mocha@latest https://github.com/MikeMcC399/eslint-plugin-cypress#convert-to-sourcecode Test the following combinations with
(1) Failure: (expected) ESLint 9.xOn Node.js npm install eslint@9 --force # to override peer dependencies
export ESLINT_USE_FLAT_CONFIG=false # to use deprecated configuration files with ESLint 9.x
npm run lint
(3) Warning from npm
(4) Warning from ESLint
|
I successfully re-tested for ESLint With forced npm installation and use of the environment variable setting |
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.
Nice, getting so much closer!
@MikeMcC399 Let me know if this doesn't release. I might need to configure some keys on our side if it's still not working. |
🎉 This PR is included in version 3.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The release seems to have gone through with no problems. I'm beginning to think that the issue last time was just a GitHub glitch (it wouldn't be the first time)! I'll go back to the kitchensink repo and make sure it still works there. It should be fine as far as I know. |
context
: planned failure Eslint 9 #154Issue
context.getScope()
context.getAncestors()
context.getAncestors()
These methods are deprecated in ESLint
8.x
(eslint@8.50.0 and later8.x
releases), causing warnings, and removed in ESLint9.x
(eslint@9.0.0), causing failures.Change
See ESLint Blog Preparing your custom rules for ESLint v9.0.0 Sep 26, 2023.
The above mentioned rules are converted according to:
sourceCode.getScope
sourceCode.getAncestors
except that instead of the suggested code lineconst { sourceCode } = context;
the following is usedconst { sourceCode = {} } = context;
to avoid failure on earlier versions, such as ESLint8.23.0
.Edit: the recommendations have been revised and the above line of code is now
const sourceCode = context.sourceCode ?? context.getSourceCode();
Verification
On Ubuntu
22.04.4
LTS with Node.js20.12.2
LTS. For ESLintv7
andv8
executenpx jest
.