Support ESLint 9
MikeMcC399 opened this issue · comments
Issue
This plugin should support usage with ESLint v9.0.0 announcement dated Apr 5, 2024.
See also the Migration Guide to v9.x.
The repo test running jest
fails with ESlint 9.
Versions
eslint@9.0.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.1
LTS
git clone https://github.com/cypress-io/eslint-plugin-cypress
cd eslint-plugin-cypress
npm install eslint@9 -D
npm test
Logs
Test log
The full log is not shown here. It starts with:
$ npm test
> eslint-plugin-cypress@0.0.0-development test
> jest
FAIL tests/lib/rules/no-unnecessary-waiting.js
● no-unnecessary-waiting › valid › foo.wait(10)
ConfigError: ESLint configuration in rule-tester is invalid: Config (unnamed): Key "parserOptions": This appears to be in eslintrc format rather than flat config format.
at rethrowConfigError (node_modules/@humanwhocodes/config-array/api.js:225:8)
at node_modules/@humanwhocodes/config-array/api.js:1018:5
at Array.reduce (<anonymous>)
at FlatConfigArray.getConfig (node_modules/@humanwhocodes/config-array/api.js:1014:39)
at runRuleForItem (node_modules/eslint/lib/rule-tester/rule-tester.js:793:25)
at testValidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:908:28)
at Object.<anonymous> (node_modules/eslint/lib/rule-tester/rule-tester.js:1258:33)
and ends with:
PASS tests/config.js
Test Suites: 9 failed, 1 passed, 10 total
Tests: 130 failed, 3 passed, 133 total
Snapshots: 0 total
Time: 1.651 s, estimated 3 s
Ran all test suites.
Related
Edit: Updated for latest changes to repo Apr 18, 2024
Unfortunately the title of this issue and the errors it describes are not in sync.
-
PR #201 provides documentation about using the plugin in
FlatCompat
mode. Using this as a basis it should be possible to open up the plugin also for usage with ESLint9.x
very soon. -
The test errors described are due to breaking changes in the v9 > RuleTester. The rules themselves have already been worked on to make them compatible with ESLint
9.x
. That was done in PR #182. -
The set of tests need to be reworked to deal with the changes described in Testing rules with flat config and the RuleTester class and FlatRuleTester is now RuleTester. Once this is done, I expect to close this issue.
-
The single outstanding item will be #146. Due to the
FlatCompat
mode, this is not a gating factor to use the plugin under ESLint9.x
, although it is definitely a desirable enhancement.
The repo https://github.com/cypress-io/cypress-example-kitchensink demonstrates eslint-plugin-cypress@3.2.0
running under eslint@9.2.0
.