Skip to content
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

Eslint 8 deprecated rules context: planned failure Eslint 9 #154

Closed
MikeMcC399 opened this issue Apr 9, 2024 · 5 comments · Fixed by #182
Closed

Eslint 8 deprecated rules context: planned failure Eslint 9 #154

MikeMcC399 opened this issue Apr 9, 2024 · 5 comments · Fixed by #182

Comments

@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Apr 9, 2024

Issue

Eslint 8 shows deprecation warnings for planned removal in Eslint 9:

  • "no-unnecessary-waiting" rule is using context.getScope()
  • "no-async-tests" rule is using context.getAncestors()
  • "no-async-before" rule is using context.getAncestors()

(node:3998) DeprecationWarning: "no-unnecessary-waiting" rule is using context.getScope(), which is deprecated and will be removed in ESLint v9. Please use sourceCode.getScope() instead.
(node:3998) DeprecationWarning: "no-async-tests" rule is using context.getAncestors(), which is deprecated and will be removed in ESLint v9. Please use sourceCode.getAncestors() instead.
(node:3970) DeprecationWarning: "no-async-before" rule is using context.getAncestors(), which is deprecated and will be removed in ESLint v9. Please use sourceCode.getAncestors() instead.

Versions

eslint@8.57.0
eslint-plugin-cypress@2.15.2
Ubuntu 22.04.4 LTS
Node.js 20.12.2 LTS

Steps to reproduce

Ubuntu 22.04.4 LTS, Node.js 20.12.2 LTS

git clone https://github.com/cypress-io/eslint-plugin-cypress
cd eslint-plugin-cypress
npm install eslint@8 --legacy-peer-deps
npm test

Logs

$ npm test

> eslint-plugin-cypress@0.0.0-development test
> jest

(node:4074) DeprecationWarning: "no-unnecessary-waiting" rule is using `context.getScope()`, which is deprecated and will be removed in ESLint v9. Please use `sourceCode.getScope()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 PASS  tests/lib/rules/no-unnecessary-waiting.js
 PASS  tests/lib/rules/no-force.js
 PASS  tests/lib/rules/assertion-before-screenshot.js
 PASS  tests/lib/rules/no-assigning-return-values.js
 PASS  tests/lib/rules/unsafe-to-chain-command.js
 PASS  tests/lib/rules/require-data-selectors.js
 PASS  tests/lib/rules/no-pause.js
(node:4074) DeprecationWarning: "no-async-tests" rule is using `context.getAncestors()`, which is deprecated and will be removed in ESLint v9. Please use `sourceCode.getAncestors()` instead.
 PASS  tests/lib/rules/no-async-tests.js
(node:4074) DeprecationWarning: "no-async-before" rule is using `context.getAncestors()`, which is deprecated and will be removed in ESLint v9. Please use `sourceCode.getAncestors()` instead.
 PASS  tests/lib/rules/no-async-before.js
 PASS  tests/config.js

Test Suites: 10 passed, 10 total
Tests:       133 passed, 133 total
Snapshots:   0 total
Time:        1.431s, estimated 2s
Ran all test suites.

Related

Edit: updated after merge of PR #151

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Apr 9, 2024

This issue relates to the blog Preparing your custom rules for ESLint v9.0.0 published on Sep 26, 2023.

@MikeMcC399
Copy link
Collaborator Author

The incompatible methods need special handling, see

since their replacements were only added in later ESLint 8.x versions about one year ago.

@MikeMcC399
Copy link
Collaborator Author

(node:3970) DeprecationWarning: "no-async-before" rule is using context.getAncestors(), which is deprecated and will be removed in ESLint v9. Please use sourceCode.getAncestors() instead.

@MikeMcC399
Copy link
Collaborator Author

@cypress-app-bot
Copy link

🎉 This issue has been resolved in version 3.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants