ESLint v9.21.0 发布

我们刚刚发布了 ESLint v9.21.0,这是 ESLint 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。

亮点

🌐 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

  • 418717f 功能:为规则引入新的已弃用类型 (#19238) (fnx)
  • 5c5b802 功能:添加 --ext CLI 选项 (#19405) (Milos Djermanovic)

错误修复

🌐 Bug Fixes

  • db5340d 修复:更新缺失插件消息模板 (#19445) (Milos Djermanovic)
  • d8ffdd4 修复:规则崩溃时不退出进程 (#19436) (Francesco Trotta)

文档

🌐 Documentation

  • c5561ea 文档:更新自述文件(GitHub Actions 机器人)
  • 80b0485 文档:在规则示例中将 var 替换为 letconst (#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)

最新的 ESLint 新闻、案例研究、教程和资源。

ESLint v10.3.0 发布
1 min read

ESLint v10.3.0 发布

我们刚刚发布了 ESLint v10.3.0,这是 ESLint 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。

ESLint v10.2.1 发布
1 min read

ESLint v10.2.1 发布

我们刚刚发布了 ESLint v10.2.1,这是 ESLint 的一个补丁版本升级。本次发布修复了上一版本中发现的几个错误。

ESLint v10.2.0 发布
2 min read

ESLint v10.2.0 发布

我们刚刚发布了 ESLint v10.2.0,这是 ESLint 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。