Highlights
This is a summary of the major changes you need to know about for this version of ESLint.
Installing
Since this is a pre-release version, you will not automatically be upgraded by npm. You must specify the next
tag when installing:
npm i eslint@next --save-dev
You can also specify the version directly:
npm i eslint@9.0.0-beta.0 --save-dev
Migration Guide
As there are a lot of changes, we’ve created a migration guide describing the breaking changes in great detail along with the steps you should take to address them. We expect that most users should be able to upgrade without any build changes, but the migration guide should be a useful resource if you encounter problems.
New default values for rule options
In v9.0.0, the following rules have new defaults:
no-unused-vars
: The default value of thecaughtErrors
option is changed from"none"
to"all"
.no-useless-computed-key
: The default value of theenforceForClassMembers
option is changed fromfalse
totrue
.
Stricter RuleTester
validations
This release adds more checks in RuleTester
:
- Messages cannot have unsubstituted placeholders.
- Suggestions must change the code.
- Test case
output
must be different fromcode
. - Test error objects must specify
message
ormessageId
. - Test error object must specify
suggestions
if the actual error provides suggestions. - Test suggestion objects must specify
desc
ormessageId
. - Test suggestion objects must specify
output
. filename
andonly
properties of test objects must be of the expected type (string
andboolean
, respectively).
New API loadESLint()
ESLint now exports a new function loadESLint()
from its main entry point. Integrations can use this function to get either the ESLint
class (former FlatESLint
class) or the LegacyESLint
class (former ESLint
class) and thus easily swap between flat config and eslintrc APIs.
Breaking Changes
9163646
feat!: Rule Tester checks for missing placeholder data in the message (#18073) (fnx)3c4d51d
feat!: default forenforceForClassMembers
inno-useless-computed-key
(#18054) (Francesco Trotta)47e60f8
feat!: Stricter rule test validations (#17654) (fnx)1a94589
feat!:no-unused-vars
default caughtErrors to ‘all’ (#18043) (Josh Goldberg ✨)
Features
53f0f47
feat: Add loadESLint() API method for v9 (#18097) (Nicholas C. Zakas)2d11d46
feat: add suggestions touse-isnan
in binary expressions (#17996) (StyleShit)
Bug Fixes
Documentation
f1c7e6f
docs: Switch to Ethical Ads (#18090) (Strek)15c143f
docs: JS Foundation -> OpenJS Foundation in PR template (#18092) (Nicholas C. Zakas)6ea339e
docs: add stricter rule test validations to v9 migration guide (#18085) (Milos Djermanovic)3c816f1
docs: use relative link from CLI to core concepts (#18083) (Milos Djermanovic)9458735
docs: fix malformedeslint
config comments in rule examples (#18078) (Francesco Trotta)07a1ada
docs: link from--fix
CLI doc to the relevant core concept (#18080) (Bryan Mishkin)b844324
docs: Update team responsibilities (#18048) (Nicholas C. Zakas)aadfb60
docs: document languageOptions and other v9 changes for context (#18074) (fnx)857e242
docs: tweak explanation for meta.docs rule properties (#18057) (Bryan Mishkin)10485e8
docs: recommend messageId over message for reporting rule violations (#18050) (Bryan Mishkin)98b5ab4
docs: Update README (GitHub Actions Bot)505fbf4
docs: updateno-restricted-imports
rule (#18015) (Tanuj Kanti)c25b4af
docs: Update README (GitHub Actions Bot)
Chores
e40d1d7
chore: upgrade @eslint/js@9.0.0-beta.0 (#18108) (Milos Djermanovic)9870f93
chore: package.json update for @eslint/js release (Jenkins)2c62e79
chore: upgrade @eslint/eslintrc@3.0.1 (#18107) (Milos Djermanovic)81f0294
chore: upgrade espree@10.0.1 (#18106) (Milos Djermanovic)5e2b292
chore: upgrade eslint-visitor-keys@4.0.0 (#18105) (Milos Djermanovic)ce838ad
chore: replace dependency npm-run-all with npm-run-all2 ^5.0.0 (#18045) (renovate[bot])54df731
chore: update dependency markdownlint-cli to ^0.39.0 (#18084) (renovate[bot])8f06a60
chore: update dependency shelljs to ^0.8.5 (#18079) (Francesco Trotta)93ffe30
chore: update dependency file-entry-cache to v8 (#17903) (renovate[bot])