
亮点
🌐 Highlights
新的 CLI 选项 --no-warn-ignored
🌐 New CLI option --no-warn-ignored
此版本包含一个新的 CLI 选项 --no-warn-ignored,当启用时,会抑制关于在文件列表中明确传入但被忽略的文件的警告。该新选项仅在 flat config 模式下可用。
🌐 This release includes a new CLI option --no-warn-ignored that, when on, suppresses warnings about ignored files that were explicitly passed in the file list. The new option is available only in the flat config mode.
当 ESLint 使用来自传递单个文件列表的工具(例如 lint-staged)的 --max-warnings 0 运行时,此选项特别有用,因为它可以防止在传递被忽略的文件时出现退出代码 1。
🌐 This option is particularly useful when ESLint is run with --max-warnings 0 from tools that pass a list of individual files, such as lint-staged, as it prevents exit code 1 when an ignored file is passed.
{
"lint-staged": {
"*.js": "eslint --max-warnings 0 --no-warn-ignored"
}
}
应用编程接口
🌐 API
作为此更改的一部分,FlatESLint 构造函数有一个新选项 warnIgnored: boolean,默认值为 true。
🌐 As part of this change, FlatESLint constructor has a new option warnIgnored: boolean, default true.
FlatESLint#lintText() 的 warnIgnored 选项仍然可用,但现在默认为构造函数选项的值。实际上,其默认值已从 false 更改为 true。为了保留之前的行为,请将 warnIgnored: false 传递给 FlatESLint#lintText():
🌐 The warnIgnored option of FlatESLint#lintText() is still available, but it now defaults to the value of the constructor option. Effectively, its default value is changed from false to true. In order to retain previous behavior, pass warnIgnored: false to FlatESLint#lintText():
const eslint = new FlatESLint();
await eslint.lintFiles(patterns);
await eslint.lintText(code, { filePath, warnIgnored: false });
特性
🌐 Features
0a9c433功能:为扁平配置添加--no-warn-ignoredCLI 选项 (#17569) (Domantas Petrauskas)[977e67e](https://github.com/eslint/eslint/commit/977e67ec274a05cb7391665b5e3453e7f72f72b2)功能:logical-assignment-operators用于报告具有 3 个操作数的表达式 (#17600) (Yosuke Ota)
错误修复
🌐 Bug Fixes
f976b2f修复:在平面配置中使规则严重性区分大小写 (#17619) (Milos Djermanovic)0edfe36修复:确保崩溃错误消息不会重复 (#17584) (Nicholas C. Zakas)dd79abc修复:eslint-disable以能够解析带引号的规则名称 (#17612) (太田陽介)d2f6801修复:确保 && 后跟 ?? 时的正确代码路径 (#17618) (Nicholas C. Zakas)
文档
🌐 Documentation
ee5be81文档:在规则示例中默认使用sourceType: "module"(#17615) (Francesco Trotta)1aa26df文档:为 multiline-ternary 添加更多示例 (#17610) (George Ashiotis)47d0b44文档:更新自述文件(GitHub Actions 机器人)dbf831e文档:使用生成的 og 图片 (#17601) (Percy Ma)1866da5文档:更新自述文件(GitHub Actions 机器人)
杂项
🌐 Chores
1ef39ea杂务:升级 @eslint/js@8.51.0 (#17624) (Milos Djermanovic)f8c7403事务: package.json 更新 @eslint/js 版本发布 (ESLint Jenkins)2665552测试:修复平面配置 linter 测试以在平面配置模式下使用 Linter (#17616) (Milos Djermanovic)7b77bcc事务: 重构 CodePathState (#17510) (Nicholas C. Zakas)bc77c9a事务:记录和重构 ForkContext (#17566) (Nicholas C. Zakas)24e1f14事务: 重构并记录 CodePath (#17558) (Nicholas C. Zakas)
