
亮点
🌐 Highlights
no-unused-vars 建议
🌐 no-unused-vars Suggestions
[no-unused-vars](https://eslint.nodejs.cn/docs/latest/rules/no-unused-vars) 规则现在提供了 建议!当规则检测到像这样的未使用变量时:
🌐 The no-unused-vars rule provides suggestions now! When the rule sees code with an unused variable like this:
const a = "Hello";
const b = "World!";
console.log(a);
现在它会建议删除未使用的变量声明:
🌐 It will now suggest removing the unused variable declaration:
const a = "Hello";
console.log(a);
建议也适用于更复杂的情况,如未使用的函数参数、解构语法等。
🌐 Suggestions also work for more complex cases like unused function arguments, destructuring syntax, etc.
function avg(a, b, c) {
return (a + b) / 2;
}
console.log(avg(12, 13, 25));
在应用建议之后变为:
🌐 after the suggestion is applied becomes:
function avg(a, b) {
return (a + b) / 2;
}
console.log(avg(12, 13, 25));
and
const [{ status, value, reason }] = await Promise.allSettled([promise1, promise2]);
if (status === "rejected") {
throw reason;
}
在建议变为之后:
🌐 after the suggestion becomes:
const [{ status, reason }] = await Promise.allSettled([promise1, promise2]);
if (status === "rejected") {
throw reason;
}
no-unused-vars 建议标志着数月工作的完成。我们很可能会在未来的更新中进一步改进和微调此功能。
允许空值 message.fix
🌐 Nullish message.fix Allowed
以前,如果一个 处理器 返回了一个 LintMessage 并且 fix 属性被设置为 undefined 或 null,在尝试应用自动修复时,ESLint 会因一个无用的错误信息而崩溃。这个问题在当前版本中已经修复。
🌐 Previously, if a processor returned a LintMessage with a fix property set to undefined or null, ESLint would crash with an unhelpful error message when trying to apply the autofix.
This problem has been fixed in the current release.
特性
🌐 Features
eed91d1功能:向no-unused-vars添加建议 (#18352) (Tanuj Kanti)
错误修复
🌐 Bug Fixes
67d683d修复:当message.fix为 null 或 undefined 时修复崩溃 (#19168) (ntnyq)c618707修复:在 no-useless-assignment 中忽略具有非标识符引用的变量 (#19200) (YeonJuan)
文档
🌐 Documentation
3c22d2a文档:在 [yoda](/docs/rules/yoda).md] 中将yoda更新为Yoda以保持一致性 (#19230) (루밀LuMir)e0a2203文档:给no-sequences添加缺失的反引号 (#19233) (루밀LuMir)4cc4881文档:更新自述文件(GitHub Actions 机器人)[3db6fdf](https://github.com/eslint/eslint/commit/3db6fdf885b17d25103e3cddc31fea56542e064d)文档:[no-await-in-loop] 展开了其优点和不适用性 (#19211)(Kirk Waiblinger)bf2a4f6文档:给func-style添加缺失的反引号 (#19227) (루밀LuMir)ba098bd文档:向prefer-spread添加缺失的头文件 (#19224) (루밀LuMir)b607ae6文档:更新no-param-reassign的描述 (#19220) (루밀LuMir)1eb424d文档:给prefer-destructuring添加缺失的反引号 (#19223) (루밀LuMir)85998d1文档:给no-unneeded-ternary添加缺失的反引号 (#19222) (루밀LuMir)b75b32c文档:给no-new-func添加缺失的反引号 (#19219) (루밀LuMir)a7700bc文档:给id-length添加缺失的反引号 (#19217) (루밀LuMir)e2bb429文档:为 [complexity](/docs/rules/complexity).md(#19214) (루밀LuMir) ] 添加缺失的反引号045d716文档:向id-denylist添加缺失的)(#19213) (루밀LuMir)7fe4114文档:更新自述文件(GitHub Actions 机器人)c743ba6文档:向no-restricted-syntax添加 CSS 语言 (#19208) (Milos Djermanovic)1416d70文档:给eqeqeq添加缺失的反引号 (#19207) (루밀LuMir)b950c1b文档:给prefer-object-spread添加缺失的反引号 (#19206) (루밀LuMir)8a941cb文档:更新require-unicode-regexp的文档和description(#19205) (루밀LuMir)cbab228文档:更新自述文件(GitHub Actions 机器人)f2257ce文档:更新no-script-url的注释和description(#19203) (루밀LuMir)365f0f4文档:给default-case-last添加缺失的反引号 (#19202) (루밀LuMir)e6b84f5文档:在文档中添加缺失的标点符号 (#19161) (루밀LuMir)[c88708e](https://github.com/eslint/eslint/commit/c88708e0571b62ee5d6c6168373e4204ec75b931)文档:在for-direction的description中用反引号替换引号 (#19199) (루밀LuMir)a76f233文档:在代码注释中使用更高对比度的颜色标记 (#19187) (Josh Goldberg ✨)db19502文档:更新自述文件(GitHub Actions 机器人)
杂项
🌐 Chores
cc243c9任务: 升级到@eslint/js@9.17.0(#19242) (Francesco Trotta)84c5787事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)4c4f53b事务:为flags.js添加缺失的反引号 (#19226) (루밀LuMir)4b3132c杂务: 更新依赖 eslint-plugin-expect-type 到 ^0.6.0 (#19221) (renovate[bot])9bf2204杂项:为eslint-config-eslint包添加类型定义 (#19050) (Arya Emami)ee8c220事务: 修复integration-tutorial-code中错误的name属性 (#19218) (루밀LuMir)cca801d杂项:将 cross-spawn 升级到 7.0.6 (#19185) (folortin)
