
亮点
🌐 Highlights
--ext CLI 选项
🌐 --ext CLI Option
此版本的 ESLint 重新引入了命令行选项 --ext,以允许对具有特定扩展名的文件进行 lint 检查。
--ext 选项在传统的 “eslintc” 配置系统中一直可用,但在新的配置系统中被移除了,因为其功能可以通过 files 模式轻松实现。
例如,在配置对象中指定 files: ["**/*.ts"] 将会 lint 所有具有 .ts 扩展名的文件。
files 模式对于 lint 除 .js、.mjs 或 .cjs 之外的扩展名文件非常有用,但它们需要配置文件。为了在没有配置文件的情况下对任意扩展名的文件进行 lint,现在可以在命令行中使用 --ext 选项,如下所示:
🌐 This version of ESLint reintroduces the command line option --ext to allow linting files with a particular extension.
The --ext option has always been available in the legacy “eslintc” configuration system, but it was eliminated in the new configuration system because its functionality can be easily achieved through files patterns.
For example, specifying files: ["**/*.ts"] in a configuration object will lint all files that have the .ts extension.
files patterns are useful to lint files with extensions other than .js, .mjs or .cjs, but they require a configuration file. In order to lint files with arbitrary extensions without a configuration file, the --ext option can now be used in the command line like this:
npx eslint --no-config-lookup --rule '{"no-unused-vars": "error"}' --ext '.jsx'
有关更多信息,请参阅CLI 文档。
🌐 See the CLI documentation for further information.
已弃用规则的新元数据
🌐 New Metadata for Deprecated Rules
ESLint v9.21.0 扩展了规则元数据的格式,以更好地注释已弃用的规则,提供更详细的信息。这包括规则被弃用的插件的具体版本,以及替代规则和插件的链接。了解更多。
🌐 ESLint v9.21.0 extends the format of rule metadata to better annotate deprecated rules, providing more detailed information. This includes the specific version of a plugin in which a rule was deprecated, as well as links to alternative rules and plugins. Learn more.
特性
🌐 Features
错误修复
🌐 Bug Fixes
db5340d修复:更新缺失插件消息模板 (#19445) (Milos Djermanovic)d8ffdd4修复:规则崩溃时不退出进程 (#19436) (Francesco Trotta)
文档
🌐 Documentation
c5561ea文档:更新自述文件(GitHub Actions 机器人)80b0485文档:在规则示例中将var替换为let和const(#19434) (Tanuj Kanti)f67d5e8文档:更新自述文件(GitHub Actions 机器人)75afc61文档:更新自述文件(GitHub Actions 机器人)0636cab文档:将 Eleventy 从 v2 更新到 v3 (#19415) (Amaresh S M)dd7d930文档:更新自述文件(GitHub Actions 机器人)
杂项
🌐 Chores
a8c9a9f杂务:更新@eslint/eslintrc和@eslint/js(#19453) (Francesco Trotta)265e0cf事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)3401b85测试:为Rule.ReportDescriptor类型添加测试 (#19449) (Francesco Trotta)e497aa7杂项:更新重写依赖 (#19448) (Francesco Trotta)dab5478任务:配置中缺少插件的更好错误信息 (#19402) (Tanuj Kanti)ebfe2eb事务:为错误报告问题配置块设置 js 语言 (#19439) (Josh Goldberg ✨)5fd211d测试:处理器可以返回子路径 (#19425) (Milos Djermanovic)
