
亮点
🌐 Highlights
--pass-on-unpruned-suppressions CLI 选项
🌐 --pass-on-unpruned-suppressions CLI Option
ESLint v9.24.0 引入了批量抑制功能,这是备受期待的功能。当启用批量抑制时,ESLint 会在名为 eslint-suppressions.json 的文件中跟踪先前被抑制的违规情况,确保它们在后续运行中仍被忽略。随着代码库的编辑,其中一些违规可能会被解决,但仍会列在抑制文件中,直到被明确移除。最初的批量抑制草案提议在发现未使用抑制的情况下以退出码 2 退出,但用户请求能够忽略未清理的抑制以获得更大的灵活性。
🌐 ESLint v9.24.0 introduced bulk suppressions, a highly anticipated feature. When bulk suppressions are enabled, ESLint tracks previously suppressed violations in a file called eslint-suppressions.json, ensuring they remain ignored in subsequent runs. As the codebase is edited, some of these violations may be resolved but will still be listed in the suppressions file until explicitly removed. The original bulk suppressions draft proposed exiting with exit code 2 in cases where unused suppressions were found, but users requested the ability to ignore unpruned suppressions for greater flexibility.
在 ESLint v9.28.0 中,这现在成为可能,这要归功于一个新的 CLI 选项。--pass-on-unpruned-suppressions 标志允许 ESLint 跳过不再出现的抑制。当启用此标志时,未使用的抑制不会被报告为错误,也不会影响退出代码。
🌐 With ESLint v9.28.0, this is now possible thanks to a new CLI option. The --pass-on-unpruned-suppressions flag allows ESLint to skip suppressions that no longer occur. When this flag is enabled, unused suppressions are not reported as errors and do not affect the exit code.
核心规则中的 TypeScript 语法支持
🌐 TypeScript Syntax Support in Core Rules
正如在 ESLint v9.23.0 发布博客文章 中宣布的那样,我们正在积极努力将 TypeScript 语法支持添加到核心规则中。
🌐 As announced in the ESLint v9.23.0 release blog post, we are actively working to add TypeScript syntax support to core rules.
ESLint v9.28.0 为另外五个核心规则引入了完整的 TypeScript 语法支持。这些规则是:
🌐 ESLint v9.28.0 introduces full TypeScript syntax support for five more core rules. These rules are:
func-style。此规则具有新的 TypeScript 特定选项"allowTypeAnnotation",并已更新以在 TypeScript 代码中忽略重载的函数声明。no-magic-numbers。此规则有新的 TypeScript 特定选项:"ignoreEnums"、"ignoreNumericLiteralTypes"、"ignoreReadonlyClassProperties"和"ignoreTypeIndexes"。no-shadow。此规则有新的 TypeScript 特定选项"ignoreTypeValueShadow"和"ignoreFunctionTypeParameterNameValueShadow",并且"hoist"选项接受新的、TypeScript 特定的值。no-use-before-define。此规则具有新的 TypeScript 特定选项:"enums"、"typedefs"和"ignoreTypeReferences"。prefer-arrow-callback.
这些规则现在可以用于检查 TypeScript 文件以及常规 JavaScript 文件。
要检查 TypeScript 代码,请确保使用 @typescript-eslint/parser 或其他兼容的解析器。
🌐 These rules can now be used to lint TypeScript files as well as regular JavaScript.
To lint TypeScript code, be sure to use @typescript-eslint/parser, or another compatible parser.
特性
🌐 Features
b0674be功能:为 languageOptions 自定义序列化 (#19760) (Nicholas C. Zakas)a95721f功能:添加--pass-on-unpruned-suppressionsCLI 选项 (#19773) (Milos Djermanovic)bfd0e7a功能:在no-use-before-define中支持 TypeScript 语法 (#19566) (Tanuj Kanti)68c61c0功能:在no-shadow中支持 TS 语法 (#19565) (Nitin Kumar)0f773ef功能:在no-magic-numbers中支持 TS 语法 (#19561) (Nitin Kumar)c4a6b60功能:向 func-style 添加 allowTypeAnnotation (#19754) (sethamus)b03ad17功能:为prefer-arrow-callback添加 TypeScript 支持 (#19678) (Tanuj Kanti)bc3c331功能:在 func-style 规则中忽略重载的函数声明 (#19755) (sethamus)
错误修复
🌐 Bug Fixes
eea3e7e修复:从GlobalScope#implicit中移除配置的全局变量 (#19779) (Milos Djermanovic)a467de3修复:更新 context.report 类型 (#19751) (Nitin Kumar)fd467bb修复:移除 interopDefault 以使用 jiti 的默认值 (#19697) (sethamus)72d16e3修复:避免no-unassigned-vars在 declare module 中的误报 (#19746) (Azat S.)81c3c93修复: curly 类型 (#19750) (Eli)
文档
🌐 Documentation
3ec2082文档:文件配置项中的嵌套数组 (#19799) (Nicholas C. Zakas)89a65b0文档:明确配置数组如何应用于文件的子集 (#19788) (Shais Ch)2ba8a0d文档:在插件文档中添加 meta.namespace 的描述 (#19798) (Nicholas C. Zakas)59dd7e6文档:使用示例更新func-style(#19793) (Tanuj Kanti)e9129e0文档:在范围管理器文档中添加全局作用域的implicit字段 (#19770) (Milos Djermanovic)52f5b7a文档:修复小错误并添加链接 (#19743) (루밀LuMir)00716a3文档:事先建议不要使用 no-return-await 规则 (#19727) (Mike DiDomizio)
杂项
🌐 Chores
175b7b8任务: 升级到@eslint/js@9.28.0(#19802) (Francesco Trotta)844f5a6事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)62b1c1b杂务:将 globals 更新到 v16 (#19791) (Nitin Kumar)e8a1cb8杂务:在 Renovate 中忽略 jiti-v2.0 和 jiti-v2.1 (#19786) (Nitin Kumar)43d3975事务: 添加 Copilot 指南文件 (#19753) (Nicholas C. Zakas)2dfb5eb测试:更新SourceCodeTraverser测试 (#19763) (Milos Djermanovic)5bc21f9杂项:将*.code-workspace添加到.gitignore(#19771) (루밀LuMir)f4fa40e重构:NodeEventGenerator -> SourceCodeTraverser (#19679) (Nicholas C. Zakas)0f49329重构:使用服务发出警告 (#19725) (Francesco Trotta)20a9e59杂务: 更新依赖 shelljs 至 ^0.10.0 (#19740) (renovate[bot])
