
亮点
🌐 Highlights
非活动标志不会抛出错误
🌐 Inactive flags do not throw an error
当我们在今年早些时候发布 ESLint v9.18.0 时,一些用户报告说,当使用 unstable_ts_config 功能标志运行 ESLint 时会抛出错误,因为该标志已失效。虽然这个错误是预期内的,但我们意识到在某些使用失效标志的情况下,发出警告比抛出错误更合适,因此我们决定相应地更改行为。你可以在文档中阅读关于新功能标志政策的更多信息。
🌐 When we released ESLint v9.18.0 earlier this year, some users reported that running ESLint with the unstable_ts_config feature flag was throwing an error since that flag had become inactive.
While the error was expected, we realized that raising a warning would be more appropriate than throwing an error in certain situations when inactive flags are used, and we decided to change the behavior accordingly.
You can read more about the new feature flags policy in the documentation.
空配置会引发警告
🌐 Empty configurations raise a warning
在 ESLint v9.20.0 中,使用空配置或导出空数组的配置,如 export default [],会导致出现警告信息。
🌐 In ESLint v9.20.0, using an empty configuration or a configuration that exports an empty array as in export default [] results in a warning message.
要在测试或其他场景中显式使用一个什么都不做的配置,你可以导出一个包含空对象的数组:
🌐 To explicitly use a configuration that does nothing in tests or other scenarios, you can export an array with an empty object:
export default [{}];
已更新的 ESLint 类型
🌐 Updated ESLint types
去年,ESLint 通过使用 语言插件 引入了对 JavaScript 以外语言进行 lint 的功能。 ESLint v9.20.0 增强了许多类型定义,以确保与新功能的兼容性,尤其是在与语言插件结合使用时。 这一变化对插件开发者尤其重要,因为它使得使用 TypeScript 创建语言插件成为可能。
🌐 Last year, ESLint introduced the capability to lint languages other than JavaScript through the use of language plugins. ESLint v9.20.0 enhances many type definitions to ensure compatibility with the new features used especially in conjunction with language plugins. This change is especially significant for plugin developers because it makes it possible to create language plugins using TypeScript.
特性
🌐 Features
错误修复
🌐 Bug Fixes
91d4d9f修复:使类型与 @eslint/core 同步 (#19157) (Nicholas C. Zakas)fa25c7a修复:当使用空配置文件时发出警告 (#19399) (Nicholas C. Zakas)31a9fd0修复:错误插件格式的错误消息更清晰 (#19380) (Nicholas C. Zakas)61d99e3修复:为不可序列化解析器提供更好的错误信息 (#19384) (Nicholas C. Zakas)db1b9a6修复:确保在consistent-this中检查模块作用域的引用 (#19383) (Nicholas C. Zakas)8bcd820修复:arrow-body-style在单令牌主体时崩溃 (#19379) (Milos Djermanovic)
文档
🌐 Documentation
b7012c8文档:将示例中使用 var 改写为使用 let 和 const (#19407) (Mueez Javaid Hashmi)6406376文档:更新自述文件(GitHub Actions 机器人)350f2b9文档:将一些使用 var 的示例改写为使用 let 和 const (#19404) (Mueez Javaid Hashmi)93c325a文档:将示例中使用 var 改写为使用 let 和 const (#19398) (Mueez Javaid Hashmi)56ff404文档:在规则文档中将 var 替换为 let 或 const (#19396) (Daniel Harbrueger)4053226文档:在no-eval示例中更改sourceType(#19393) (Milos Djermanovic)1324af0文档:在规则文档中将 var 替换为 let 和 const (#19392) (Daniel Harbrueger)[8b87e00](https://github.com/eslint/eslint/commit/8b87e007bb2ba59b73061d22ef34baffb5656b79)文档:在规则中将var替换为const和let(#19389)(Tanuj Kanti)758c66b文档:解释冻结规则的意义 (#19382) (Nicholas C. Zakas)0ef8bb8文档:规则示例的额外检查 (#19358) (Milos Djermanovic)58ab2f6文档:修复入门指南中安装步骤的顺序 (#19326) (Tanuj Kanti)
杂项
🌐 Chores
979097a杂务:升级 @eslint/js@9.20.0 (#19412) (Francesco Trotta)031734e事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)d4c47c3测试:避免测试输出中的空配置警告 (#19408) (Milos Djermanovic)67dd82a杂项:将依赖 @eslint/json 更新到 ^0.10.0 (#19387) (renovate[bot])15ac0e1事务:在 stale.yml 工作流程中添加权限:read-all (#19374) (Josh Goldberg ✨)
