Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Situation
Tests in the tests/lib/rules which run internally under ESLint
7.x
and8.x
are not compatible with ESLint9.x
.The guide Migrate to 9.0 > FlatRuleTester is now RuleTester explains:
This is a breaking change for the tests.
Goal
The enhancement goal is to be able to test the repo rules using each of the supported versions of ESLint:
7.x
,8.x
and9.x
.Migration steps
Achieving the goal requires separating the tests into a legacy copy, for use with the
RuleTester
class of ESLint7.x
and8.x
, and another copy which will be migrated to use theRuleTester
of ESLint9.x
.The migration is done in two steps:
RuleTester
class in ESLint9.x
.Changes
This PR deals with creating the legacy copy.
A follow-on PR will take care of the second step of migrating tests to run under to ESLint
9.x
.tests
totests-legacy
jest.config-legacy.js
test:legacy
scriptcircle.yml
to test ESLint7
and8
withtest-legacy
Note that the original tests/lib/rules directory is temporarily unused in this PR.
References
Verification
Ubuntu
22.04.4
LTS, Node.jsv20.12.2
LTS and onWindows 11, Node.js
v20.12.2
At this point, ESLint 9 cannot be tested and would result in multiple errors. The resolution is left for a follow-on PR.