
亮点
🌐 Highlights
max-nested-callbacks 中的新选项 checkConstructorCallCallbacks
🌐 New option checkConstructorCallCallbacks in max-nested-callbacks
max-nested-callbacks 规则现在支持 checkConstructorCallCallbacks 选项。
启用后,该规则在计算嵌套深度时,也会统计通过 new 传递给构造函数调用的回调函数,例如 new Promise((resolve) => {})。
🌐 The max-nested-callbacks rule now supports a checkConstructorCallCallbacks option.
When enabled, the rule also counts callback functions passed to constructor calls with new, such as new Promise((resolve) => {}), when calculating nesting depth.
例如,对于 { "max": 1, "checkConstructorCallCallbacks": true },该规则会报告以下代码超出了允许的回调嵌套深度:
🌐 For example, with { "max": 1, "checkConstructorCallCallbacks": true }, the rule reports the following code as exceeding the allowed callback nesting depth:
run(() => {
new Promise(resolve => resolve());
});
preserve-caught-error 中的新选项 errorClassNames
🌐 New option errorClassNames in preserve-caught-error
preserve-caught-error 规则现在支持 errorClassNames 选项。
此选项允许你通过将捕获的原始错误作为原因传递,来指定必须保留原始捕获错误的其他自定义错误类名。
🌐 The preserve-caught-error rule now supports an errorClassNames option.
This option lets you specify additional custom error class names that must preserve the original caught error by passing it as a cause.
例如,对于 { "errorClassNames": ["MyError"] },下面的代码会被报告,因为抛出的 MyError 没有将原始错误包含为原因,就像内置的错误类型必须做的一样:
🌐 For example, with { "errorClassNames": ["MyError"] }, the following code is reported because the thrown MyError does not include the original error as a cause, just like built-in error types must:
try {
doSomething();
} catch (error) {
throw new MyError("something went wrong");
}
no-compare-neg-zero 的建议
🌐 Suggestions for no-compare-neg-zero
[no-compare-neg-zero](/docs/latest/rules/no-compare-neg-zero) 规则现在支持建议。在适当的情况下,它会建议将 -0 替换为 0,或在像 === 或 !== 这样的运算符上使用 Object.is()。 例如,对于像 x === -0 这样的表达式,该规则建议使用 x === 0 以保留现有的比较行为,以及使用 Object.is(x, -0) 来区分 -0 与 +0。
🌐 The no-compare-neg-zero rule now supports suggestions. Where appropriate, it suggests replacing -0 with 0 or using Object.is() instead of operators such as === or !==.
For example, for an expression such as x === -0, the rule suggests x === 0 to preserve the existing comparison behavior, and Object.is(x, -0) to distinguish -0 from +0.
特性
🌐 Features
cf2a9bf功能:为 preserve-caught-error 规则添加 errorClassNames 选项 (#21032) (sethamus)f8b873a功能: 构造函数回调的 max-nested-callbacks 选项 (#21063) (fnx)557fde8功能:在radix规则中支持计算的Number.parseInt成员访问 (#21041) (Pixel)0b4a73b功能:向 no-compare-neg-zero 添加建议 (#21034) (den$)[96cdd42](https://github.com/eslint/eslint/commit/96cdd427db5f26c6403fba92b0f7ae4556c595ec)功能:在radix规则中报告无效的带符号数字 radix 值 (#21030) (Pixel)
错误修复
🌐 Bug Fixes
3e7bf15修复:将ignoreClassesWithImplements应用于类表达式 (#21069) (Pixel)[0d7d70c](https://github.com/eslint/eslint/commit/0d7d70cf013ec5bf1e4f5a0fcf7128bdf059b2d4)修复:在 preserve-caught-error 的封装括号外插入原因 (#21062) (Mahin Anowar)75ec753修复:处理eqeqeq规则中的静态模板字面量 (#21058) (Pixel)b717a22修复:防止eqeqeq空选项报告非等号运算符 (#21057) (Pixel)e35b05f修复:避免no-invalid-regexp对被遮蔽的正则表达式的误报 (#21051) (Pixel)a3172b6修复:避免no-control-regex对被遮蔽的正则表达式产生误报 (#21050) (Pixel)[d1f637e](https://github.com/eslint/eslint/commit/d1f637eca27e523d613991c6bea5b8726b810e4c)修复:在 no-implicit-coercion 中为序列表达式的操作数加上括号 (#21045) (spokodev)8859baf修复:避免 prefer-numeric-literals 对被遮蔽的全局变量的误报 (#21047) (韩国)a9e5961修复: use-isnan 对被遮蔽的 NaN/Number 的误报 (#20958) (sethamus)8a240a7修复:避免在radix规则中对展开参数出现误报 (#21044) (Pixel)
文档
🌐 Documentation
c30d808文档:更新自述文件(GitHub Actions 机器人)5139800文档:在 v9 和 v10 指南中记录 ESLint 迁移代码修改工具 (#20980) (Alex Bit)04174cb文档:更新自述文件(GitHub Actions 机器人)026e130文档:更新错误修复的语义化版本策略 (#21048) (Milos Djermanovic)9d42fef文档:更新自述文件(GitHub Actions 机器人)b230159文档:更新自述文件(GitHub Actions 机器人)0129972文档:在配置文件指南中将**/.js通配符更正为**/*.js(#21036) (EduardF1)
杂项
🌐 Chores
9489379事务: 更新依赖 @eslint/eslintrc 到 ^3.3.6 (#21076) (renovate[bot])81a4774事务: v9.39.5 版本更新 (Jenkins)9835414杂项:在所有 TypeScript 文件中启用$ExpectType注解 (#21071) (Francesco Trotta)72adf6b杂项:在 renovate 中限制markdownlint-cli2更新 (#21067) (lumir)833ec10杂务:将依赖 prettier 更新到 v3.9.4 (#21061) (renovate[bot])7ea106d杂项:更新生态系统插件 (#21059) (ESLint 机器人)8fb550e任务: 向.git-blame-ignore-revs添加 prettier 更新提交 (#21056) (lumir)e4e1166杂务:将依赖 prettier 更新到 v3.9.1 (#21055) (renovate[bot])0493f53杂项:将 prettier 更新到 v3.9.0 (#21054) (Pixel)1056a99杂务:将依赖 prettier 更新到 v3.8.5 (#21049) (renovate[bot])4d4155dci:在拉取请求上运行生态系统测试 (#21027) (sethamus)993539f事务: 更新依赖 @eslint/json 到 ^2.0.1 (#21042) (renovate[bot])53f8b69测试:向no-constant-binary-expression添加错误位置 (#21039) (lumir)5ab71d5重构:清理 radix 规则内部 (#21015) (Pixel)a80a9a4例行任务:更新生态系统插件 (#21035) (ESLint 机器人)7c9a029ci:在 CI 中添加 Node.js 26 (#20847) (lumir)

