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 9 fails with legacy config .eslintrc #156

Closed
MikeMcC399 opened this issue Apr 9, 2024 · 6 comments
Closed

Eslint 9 fails with legacy config .eslintrc #156

MikeMcC399 opened this issue Apr 9, 2024 · 6 comments
Assignees
Labels

Comments

@MikeMcC399
Copy link
Collaborator

Issue

Linting with an Eslint deprecated Configuration File fails when using the environment variable setting ESLINT_USE_FLAT_CONFIG = false and the repository being tested uses the configuration file

.eslintrc.

Versions

[email protected]
[email protected]
Ubuntu 22.04.4 LTS
Node.js 20.12.1 LTS

Steps to reproduce

Ubuntu 22.04.4 LTS, Node.js 20.12.1 LTS

git clone --branch test/eslint-9-cypress https://github.com/MikeMcC399/cypress-example-kitchensink
cd cypress-example-kitchensink
npm ci
export ESLINT_USE_FLAT_CONFIG=false
npm run lint

Logs

$ npm run lint

> [email protected] lint
> eslint --fix cypress app/assets/js/scripts.js


Oops! Something went wrong! :(

ESLint: 9.0.0

TypeError: context.getAncestors is not a function
Occurred while linting /home/mike/github/tmp/cypress-example-kitchensink/cypress/e2e/1-getting-started/todo.cy.js:20
Rule: "cypress/no-async-tests"
    at Identifier (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js:32:37)
    at ruleErrorHandler (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/linter.js:1145:48)
    at /home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at runRules (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/linter.js:1184:40)
    at Linter._verifyWithoutProcessors (/home/mike/github/tmp/cypress-example-kitchensink/node_modules/eslint/lib/linter/linter.js:1453:31)
(node:5779) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details.
(Use `node --trace-warnings ...` to show where the warning was created)

Related

References

@brettz9
Copy link
Contributor

brettz9 commented Apr 9, 2024

Besides the flat files, ESLint 9 also changed some APIs. In this case, as can be seen in the error message, it is that context.getAncestors has been dropped. See https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/#context.getancestors()

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Apr 9, 2024

Thanks @brettz9 !

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Apr 10, 2024

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Apr 17, 2024

The plugin should prevent installation with ESLint 9.x until it is compatible with this version.

@MikeMcC399
Copy link
Collaborator Author

@MikeMcC399 MikeMcC399 self-assigned this Apr 18, 2024
@MikeMcC399
Copy link
Collaborator Author

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

No branches or pull requests

2 participants