
亮点
🌐 Highlights
no-constant-binary-expression 中的新选项 checkRelationalComparisons
🌐 New option checkRelationalComparisons in no-constant-binary-expression
ESLint v10.6.0 为 no-constant-binary-expression 规则引入了一个新的选项 checkRelationalComparisons。启用后,该规则会报告使用 <、<=、> 或 >= 的关系比较,其结果基于它们的字面操作数始终是常量。
🌐 ESLint v10.6.0 introduces a new option checkRelationalComparisons for the no-constant-binary-expression rule.
When enabled, the rule reports relational comparisons using <, <=, >, or >= whose result is always constant based on their literal operands.
例如:
🌐 For example:
const value = "a" > "b"; // always `false`
while (0 <= 0) { // always `true`
/* ... */
}
规则改进
🌐 Rule refinements
以下规则已被调整,以提高正确性并确保在边缘情况下行为更一致或更直观:
🌐 The following rules have been tweaked to improve correctness and ensure more consistent or intuitive behavior in edge cases:
max-classes-per-filemax-nested-callbacksno-constant-binary-expressionno-extra-boolean-castno-promise-executor-returnno-throw-literalprefer-exponentiation-operatorprefer-promise-reject-errorsradix
特性
🌐 Features
b1f9106功能:在 no-constant-binary-expression 中检测 Symbol() 和 BigInt() (#20981) (Taejin Kim)f291007功能:向 no-constant-binary-expression 添加 checkRelationalComparisons (#20948) (sethamus)
错误修复
🌐 Bug Fixes
[6b05784](https://github.com/eslint/eslint/commit/6b05784eb271ac98ca3e1e2a48c4b14bb588c786)修复:prefer-exponentiation-operator 在语句开头的无效自动修复 (#20997) (Milos Djermanovic)bb9eb2a修复:在no-extra-boolean-cast中考虑被遮蔽的Boolean(#21013) (den$)8fd8741修复:不要在radix规则中报告被遮蔽的未定义 (#21011) (Pixel)5784980修复:在 no-throw-literal 中不要报告被覆盖的未定义 (#21010) (Pixel)9cd1e6d修复:在 no-promise-executor-return 中抑制无效的类建议 (#21008) (Pixel)d4eb2dc修复:在 prefer-promise-reject-errors 中不报告被遮蔽的未定义 (#21006) (Pixel)2360464修复: prefer-promise-reject-errors 对被遮蔽的 Promise 的误报 (#21003) (den$)63d52d2修复:恢复 max-classes-per-file 报告范围 (#21002) (Pixel)7feaff0修复:在 max-nested-callbacks 中检测 IIFE 回调的逻辑 (#20979) (fnx)399a2ec修复:不要在max-nested-callbacks中报告内部非回调 (#20995) (Milos Djermanovic)
文档
🌐 Documentation
a83683d文档:更新自述文件(GitHub Actions 机器人)f5449f9文档:记录 RuleT 中 global assertionOptions 的用户空间模式… (#20986) (playgirl)bea49f7文档:更新自述文件(GitHub Actions 机器人)e5f70f9文档:更新代码路径图 (#20984) (Tanuj Kanti)8890c2d文档:为 MCP 服务器添加 TypeScript 配置指南 (#20796) (Pierluigi Lenoci)3eb3d9b文档:更新自述文件(GitHub Actions 机器人)c5bb59c文档:更新自述文件(GitHub Actions 机器人)eb3c97c文档:修复 prefer-const 规则描述中的语法错误 (#20983) (lumir)
杂项
🌐 Chores
6a42034ci:在主分支上运行生态系统测试 (#20891) (sethamus)3dbacdbci:将 actions/checkout 从 6 升级到 7 (#21014) (dependabot[bot])c3abfca任务:在 HTML 格式化程序中修复 JSDoc 参数类型 (#21018) (Minseon Kim)a832320ci:将生态系统测试拆分为单独的作业 (#21001) (xbinaryx)27166e7例行任务:更新生态系统插件 (#21005) (ESLint 机器人)865d76eci: 将 pnpm/action-setup 从 6.0.8 更新到 6.0.9 (#20989) (dependabot[bot])27a88c9杂务:在根目录中将依赖 markdown-it 更新到 v14 (#20994) (Milos Djermanovic)970cea6事务: 将依赖 markdown-it 更新到 v14 (#20993) (Milos Djermanovic)b482120杂务:将依赖 prettier 更新到 v3.8.4 (#20990) (renovate[bot])6993fb3杂项:更新生态系统插件 (#20985) (ESLint 机器人)

