ESLint v9.12.0 发布

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

亮点

🌐 Highlights

实验配置文件解析

🌐 Experimental configuration file resolution

ESLint v9.0.0 的一个重大变化是新的配置系统,它将查找配置文件的方式从相对于被检查的文件改为从当前工作目录开始搜索。虽然这大大降低了配置文件查找的复杂性,但也产生了一个意想不到的副作用:单体仓库(monorepo)无法再在每个项目目录中包含单独的 eslint.config.js 文件,然后从根目录用一个命令运行 ESLint。为了解决这个问题,我们正在开发一种新的配置文件解析算法,更接近 eslintrc 配置系统的工作方式。

🌐 One of the big changes in ESLint v9.0.0 was the new config system which switched from looking for config files relative to the file being linted to starting the search from the current working directory. While this dramatically decreased the complexity of config file lookup, it also had an unintended side effect: monorepos could no longer include a separate eslint.config.js file in each project directory and then run ESLint with one command from the root. To address this, we’re working on a new configuration file resolution algorithm that more closely mirrors how the eslintrc config system worked.

这个新的算法也从正在进行 lint 的文件开始搜索,恢复了 monorepo 的使用场景,同时也使得可以从任何地方对任何文件运行 ESLint,并且每次都得到相同的结果。由于这个功能是实验性的,你需要使用 unstable_config_lookup_from_file 功能标志,如下所示:

🌐 This new algorithm also starts the search from the file being linted, restoring the monorepo use case and also making it possible to run ESLint from anywhere on any file and get the same results each time. Because this feature is experimental, you’ll need to use the unstable_config_lookup_from_file feature flag, like this:

npx eslint --flag unstable_config_lookup_from_file

有关此功能的更多信息,请参阅 实验性配置文件解析。有关使用功能标志的更多信息,请参阅 功能标志

🌐 For more information on this feature, see Experimental Configuration File Resolution. For more information on using feature flags, see Feature Flags.

其他显著变化

🌐 Other notable changes

  • RuleTester 现在支持测试用例的自定义 beforeafter 钩子。
  • complexity 规则有了一个新选项 variant 来支持修改后的圈复杂度。

特性

🌐 Features

错误修复

🌐 Bug Fixes

  • ea380ca 修复:升级重试以避免 EMFILE 错误 (#18986) (Nicholas C. Zakas)
  • fdd6319 修复:类型定义问题 (#18940) (Arya Emami)

文档

🌐 Documentation

  • ecbd522 文档:提及代码浏览器 (#18978) (Nicholas C. Zakas)
  • 7ea4ecc 文档:澄清元对象的使用 (#18697) (Amaresh S M)
  • d3e4b2e 文档:澄清如何排除 .js 文件 (#18976) (Milos Djermanovic)
  • 57232ff 文档:在语言文档中提及 plugin-kit (#18973) (Nicholas C. Zakas)
  • b80ed00 文档:更新自述文件(GitHub Actions 机器人)
  • cb69ab3 文档:更新自述文件(GitHub Actions 机器人)
  • 7fb0d95 文档:更新自述文件(GitHub Actions 机器人)
  • 493348a 文档:更新自述文件(GitHub Actions 机器人)
  • 87a582c 文档:修复 id-match 规则中的拼写错误 (#18944) (Jay)

杂项

🌐 Chores

  • 555aafd 任务: 升级到 @eslint/js@9.12.0 (#18987) (Francesco Trotta)
  • 873ae60 事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)
  • d0a5414 重构:用原生模块替换 strip-ansi (#18982) (Cristopher)
  • b827029 杂项:启用 JSON5 语法检查 (#18979) (Milos Djermanovic)
  • 8f55ca2 事务: 升级 espree、eslint-visitor-keys、eslint-scope (#18962) (Nicholas C. Zakas)
  • c1a2725 杂务:将依赖 mocha 更新至 ^10.7.3 (#18945) (Milos Djermanovic)

最新的 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 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。