
亮点
🌐 Highlights
- 在 ES3 中,保留字作为标识符的使用现在已被禁止。此更改仅影响在解析器选项中配置了默认解析器
{ "ecmaVersion": 3 }的用户。 - 所有核心规则已更新,以支持 ES2022 类字段和私有类成员。ESLint 现在完全支持以下 ES2022 语法:
- 类的公共实例字段和私有实例字段
- 类的公共静态字段和私有静态字段
- 类的私有实例方法和访问器
- 类的私有静态方法和访问器
- 正则表达式匹配索引
- 顶层
await
[class-methods-use-this](/docs/8.0.0/rules/class-methods-use-this)规则有一个新的enforceForClassFields选项。[max-classes-per-file](/docs/8.0.0/rules/max-classes-per-file)规则有一个新的ignoreExpressions选项。
由于这是测试版发布,因此不应期望它可以用于生产环境,但请尝试使用并报告任何意外问题。
🌐 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 扩展已添加对 ESLint v8.0.0 的支持,你只需安装最新的 v2.1.25 版本扩展即可。
- 我们已经收到插件作者关于 使用 Jest 测试插件规则时出现的问题 的报告,因为 Jest 的解析器目前不支持 子路径导出。有关解决方法,请参阅 此评论。
正在安装
🌐 Installing
由于这是预发布版本,npm 不会自动升级。安装时必须指定 next 标签:
🌐 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更新:在complexity规则中支持类字段(参考 #14857)(#14957) (Milos Djermanovic)6d1ccb6更新:class-methods-use-this 中的 enforceForClassFields(参考 #14857)(#15018) (YeonJuan)dd10937更新:向 max-classes-per-file 添加了 ignoreExpressions 选项 (#15000) (Josh Goldberg)
错误修复
🌐 Bug Fixes
9bd3d87修复:lines-between-class-members 中的无分号风格(参考 #14857)(#15045)(Milos Djermanovic)f966fe6修复:更新 semi 用于 class-fields(参考 #14857)(#14945)(Nicholas C. Zakas)e9764f3修复: no-undef-init 不应适用于类字段 (参考 #14857) (#14994) (Milos Djermanovic)
文档
🌐 Documentation
91e82f5文档:LintMessage.line 和 column 可能未定义 (#15032) (Brandon Mills)dd56631文档:移除重复的代码路径分析文档 (#15033) (Milos Djermanovic)8c61f5a文档:在 prefer-named-capture-group 中添加关于非捕获分组的信息 (#15009) (Andrzej Wódkiewicz)4338b74文档:添加带有类字段的 no-dupe-class-members 示例(参考 #14857)(#15005)(Milos Djermanovic)88b4e3d文档:清楚说明规则选项如何被覆盖 (修复 #14962) (#14976) (Jake Ob)4165c7f文档:在 Node.js API 文档中澄清 Linter 与 ESLint 的区别(修复 #14953)(#14995) (Brian Bartels)80cfb8f文档:修复迁移指南中的拼写错误 (#14985) (Nitin Kumar)
依赖升级
🌐 Dependency Upgrades
杂项
🌐 Chores
