
亮点
🌐 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现在支持测试用例的自定义before和after钩子。complexity规则有了一个新选项variant来支持修改后的圈复杂度。
特性
🌐 Features
5a6a053功能:更新到jitiv2 (#18954) (Arya Emami)17a07fb功能:测试用例的 Hooks(RuleTester)(#18771) (Anna Bocharova)2ff0e51功能:实现备用配置查找 (#18742) (Nicholas C. Zakas)2d17453功能:实现修改后的圈复杂度 complexity (#18896) (Dmitry Pashkevich)
错误修复
🌐 Bug Fixes
文档
🌐 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)
