Highlights
- The use of reserved words as identifiers in ES3 is now disallowed. This change only affects users with default parser configured with
{ "ecmaVersion": 3 }
in parser options. - All core rules have been updated to support ES2022 class fields and private class members. ESLint now fully supports the following ES2022 syntax:
- Class public instance fields and private instance fields
- Class public static fields and private static fields
- Class private instance methods and accessors
- Class private static methods and accessors
- RegExp match indices
- Top-level
await
- The
class-methods-use-this
rule has a newenforceForClassFields
option. - The
max-classes-per-file
rule has a newignoreExpressions
option.
Since this is a beta release, it is not expected to be ready for production, but please try it and report any unexpected issues.
Notes
- VS Code ESLint extension has added support for ESLint v8.0.0, you’ll just need to install the latest v2.1.25 of the extension.
- We have received reports from plugin authors about problems with testing plugin rules with Jest, as Jest’s resolver currently doesn’t support subpath exports. For a workaround, please see this comment.
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@8.0.0-beta.2 --save-dev
Migration Guide
As there are a lot of changes, we’ve created a migration guide describing the 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.
Breaking Changes
Enhancements
88a3952
Update: support class fields in thecomplexity
rule (refs #14857) (#14957) (Milos Djermanovic)6d1ccb6
Update: enforceForClassFields in class-methods-use-this (refs #14857) (#15018) (YeonJuan)dd10937
Update: added ignoreExpressions option to max-classes-per-file (#15000) (Josh Goldberg)
Bug Fixes
9bd3d87
Fix: semicolon-less style in lines-between-class-members (refs #14857) (#15045) (Milos Djermanovic)f966fe6
Fix: Update semi for class-fields (refs #14857) (#14945) (Nicholas C. Zakas)e9764f3
Fix: no-undef-init should not apply to class fields (refs #14857) (#14994) (Milos Djermanovic)
Documentation
91e82f5
Docs: LintMessage.line and column are possibly undefined (#15032) (Brandon Mills)dd56631
Docs: remove duplicate code path analysis document (#15033) (Milos Djermanovic)8c61f5a
Docs: add info about non-capturing groups to prefer-named-capture-group (#15009) (Andrzej Wódkiewicz)4338b74
Docs: add no-dupe-class-members examples with class fields (refs #14857) (#15005) (Milos Djermanovic)88b4e3d
Docs: Make clear how rule options are overridden (fixes #14962) (#14976) (Jake Ob)4165c7f
Docs: Clarify Linter vs ESLint in node.js api docs (fixes #14953) (#14995) (Brian Bartels)80cfb8f
Docs: fix typo in migration guide (#14985) (Nitin Kumar)