tests: migrate to FlatRuleTester v8 #204
Closed
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.
Issue
Tests in the tests/lib/rules directory which run internally under ESLint
8.x
are not compatible with ESLint9.x
.The guide Migrate to 9.0 > FlatRuleTester is now RuleTester explain:
This is a breaking change for the tests.
Migration steps
The migration is done in two steps:
FlatRuleTester
class in ESLint8.x
9.x
and at the same time migrate to using ESLint9.x
internally.Changes
This PR deals with the first step of migrating to the temporary
FlatRuleTester
class in ESLint8.x
.A follow-on PR will take care of the second step of migrating to ESLint
9.x
For all tests/lib/rules
*.js
test filesconst { FlatRuleTester } = require('eslint/use-at-your-own-risk')
according to the blog post Testing rules with flat config and the RuleTester class.parserOptions
tolanguageOptions
.References
Verification
Ubuntu
22.04.4
LTS, Node.jsv20.12.2
LTSnpm ci npm run test