ESLint v9.0.0-alpha.2 发布

我们刚刚发布了 ESLint v9.0.0-alpha.2,这是 ESLint 的一次重大版本升级。此次发布增加了一些新功能,并修复了前一个版本中发现的几个错误。此次发布还有一些破坏性更改,因此请仔细阅读以下内容。

亮点

🌐 Highlights

这是本版本 ESLint 中你需要了解的主要更改的总结。

🌐 This is a summary of the major changes you need to know about for this version of ESLint.

正在安装

🌐 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@9.0.0-alpha.2 --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.

no-restricted-imports 配置改进

🌐 no-restricted-imports configuration improvements

在 v8.x 中,如果你为 no-restricted-imports 规则的配置中的 paths 数组有多个条目具有相同的 name 属性,只有最后一个会生效。在 v9.0.0 中,所有条目都会生效,允许为不同的导入名称指定不同的错误消息。

🌐 In v8.x, if multiple entries in the paths array of your configuration for the no-restricted-imports rule had the same name property, only the last one would apply. In v9.0.0, all entries apply, allowing for specifying different error messages for different imported names.

RuleTester 检查重复的测试

🌐 RuleTester checks for duplicate tests

从 v9.0.0 起,RuleTester 可以检测并报告重复的测试用例。

🌐 As of v9.0.0, RuleTester detects and reports duplicate test cases.

重大更改

🌐 Breaking Changes

  • [57089cb](https://github.com/eslint/eslint/commit/57089cb5166acf8b8bdba8a8dbeb0a129f841478) 功能更新!: no-restricted-imports 允许同一路径的多个配置条目 (#18021) (Milos Djermanovic)
  • 2e1d549 功能更新!: 检测重复测试用例 (#17955) (Bryan Mishkin)

特性

🌐 Features

错误修复

🌐 Bug Fixes

  • 39076fb 修复:在 RuleTester 中处理绝对文件路径 (#17989) (Nitin Kumar)

文档

🌐 Documentation

  • 33d1ab0 文档:在 flat 配置忽略文档中添加更多示例 (#18020) (Milos Djermanovic)
  • e6eebca 文档:更新 sort-keys 选项属性计数 (#18025) (LB (Ben Johnston))
  • 1fedfd2 文档:改进平面配置忽略文档 (#17997) (Nicholas C. Zakas)
  • 38b9b06 文档:更新 valid-typeof 规则 (#18001) (Tanuj Kanti)
  • b4abfea 文档:更新有关 ECMAScript 支持的说明 (#17991) (Francesco Trotta)
  • 6788873 文档:更新发布博客文章模板 (#17994) (Nicholas C. Zakas)
  • 1f37442 文档:添加关于非 npm 插件配置的章节 (#17984) (Nicholas C. Zakas)

杂项

🌐 Chores

  • 6ffdcbb 事务: 升级 @eslint/js@9.0.0-alpha.2 (#18038) (Milos Djermanovic)
  • 2c12715 事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)
  • cc74c4d 杂项:升级 espree@10.0.0 (#18037) (Milos Djermanovic)
  • dfb68b6 任务:为文档网站使用 Node.js 20 (#18026) (Milos Djermanovic)
  • 8c1b8dd 测试:为忽略文件和目录添加更多测试 (#18018) (Milos Djermanovic)
  • 60b966b 事务: 将依赖 @eslint/js 更新到 v9.0.0-alpha.1 (#18014) (renovate[bot])
  • c893bc0 事务:将 markdownlint 更新为 v0.33.0 (#17995) (Nitin Kumar)

最新的 ESLint 新闻、案例研究、教程和资源。

ESLint v10.3.0 发布
1 min read

ESLint v10.3.0 发布

我们刚刚发布了 ESLint v10.3.0,这是 ESLint 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。

ESLint v10.2.1 发布
1 min read

ESLint v10.2.1 发布

我们刚刚发布了 ESLint v10.2.1,这是 ESLint 的一个补丁版本升级。本次发布修复了上一版本中发现的几个错误。

ESLint v10.2.0 发布
2 min read

ESLint v10.2.0 发布

我们刚刚发布了 ESLint v10.2.0,这是 ESLint 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。