ESLint v9.14.0 发布

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

亮点

🌐 Highlights

对导入属性的支持

🌐 Support for Import Attributes

我们已经更新了 ESLint,以完全支持 ECMAScript 2025 导入属性 语法。此语法允许模块导入语句和动态导入在模块说明符之外传递更多信息。主机环境可以使用这些信息来修改导入行为并支持额外类型的模块。例如,当指定 type: "json" 时,模块将被视为 JSON 模块

🌐 We have updated ESLint to fully support the ECMAScript 2025 Import Attributes syntax. This syntax allows module import statements and dynamic imports to pass on more information alongside the module specifier. Host environments can use this information to modify import behavior and support additional types of modules. For example, when type: "json" is specified, modules are treated as JSON Modules.

import json from "./foo.json" with { type: "json" };

import("foo.json", { with: { type: "json" } });

ESLint 的更新包括解析并确保命名约定规则不适用于 import 属性键,因为这些键是由 ECMAScript 规范或主机环境定义的,因此用户无法控制它们的命名。

🌐 The updates in ESLint include parsing and ensuring that naming convention rules do not apply to import attribute keys as they are defined by the ECMAScript Specification or by the host environment and thus users have no control over their naming.

请注意,已弃用的格式规则 将不会更新以支持此语法。如果你仍在使用核心格式规则,我们建议切换到源代码格式化工具。或者,你可以将核心格式规则替换为来自 @stylistic/eslint-plugin-js 的相应规则。

🌐 Please note that deprecated formatting rules will not be updated to support this syntax. If you are still using core formatting rules, we recommend switching to a source code formatter. Alternatively, you can replace core formatting rules with corresponding rules from @stylistic/eslint-plugin-js.

对正则表达式修饰符的支持

🌐 Support for RegExp Modifiers

我们已将 ESLint 更新,以完全支持 ECMAScript 2025 正则表达式模式修饰符。此功能允许你在子表达式中更改当前激活的 RegExp 标志。

🌐 We have updated ESLint to fully support the ECMAScript 2025 Regular Expression Pattern Modifiers. This feature allows you to change the currently active RegExp flags within a subexpression.

const regex1 = /^(?i:[a-z])[a-z]$/;

const regex2 = /^[a-z](?-i:[a-z])$/i;

ESLint 的更新包括解析以及确保与正则表达式相关的规则按预期运行。

🌐 The updates in ESLint include parsing and ensuring that rules related to regular expressions are behaving as expected.

改进的配置文件查找性能

🌐 Improved configuration file lookup performance

在 v9.13.0 中,我们引入了对配置文件查找方式的更改。其中一些更改由于配置文件数据缓存不正确,对 ESLint 的运行时性能产生了负面影响。这主要在使用默认配置查找算法时可见,据报告 性能下降约 20-30%(新算法可通过 --flag unstable_config_lookup_from_file 访问,其性能特性不同,在我们的测试中未显示出相同的负面性能影响)。

🌐 In v9.13.0, we introduced changes to how configuration files were looked up. Some of these changes negatively impact ESLint’s runtime performance due to incorrect caching of configuration file data. This was visible primarily using the default configuration lookup algorithm, where a 20-30% performance degradation was reported (the new algorithm, accessed via --flag unstable_config_lookup_from_file, has different performance characteristics and didn’t show the same negative performance impact in our tests).

我们现在已经修复了默认算法和实验算法中的配置文件查找缓存行为,因此当你从 v9.13.0 升级时,性能应该会得到改善。

🌐 We’ve now fixed the configuration file lookup caching behavior both in the default algorithm and the experimental algorithm so you should improved performance when you upgrade from v9.13.0.

特性

🌐 Features

  • 3fa009f 功能:添加对导入属性和正则表达式修饰符的支持 (#19076) (Milos Djermanovic)
  • b0faee3 功能:为 @eslint/js 包添加类型 (#19010) (Nitin Kumar)

错误修复

🌐 Bug Fixes

  • 24d0172 修复:为 readFile() 启用重试并发限制 (#19077) (Nicholas C. Zakas)
  • b442067 修复:在遍历过程中目录被删除时不再崩溃。(#19067) (Nicholas C. Zakas)
  • d474443 修复:在处理通配符时避免调用栈溢出 (#19035) (Livia Medeiros)

文档

🌐 Documentation

  • 151c965 文档:更新 context.languageOptions.parser 描述 (#19084) (Nitin Kumar)
  • dc34f94 文档:更新自述文件(GitHub Actions 机器人)
  • f16e846 文档:更新自述文件(GitHub Actions 机器人)
  • ee0a77e 文档:将链接从 @types/eslint 改为 lib/types (#19049) (Karl Horky)
  • 50f03a1 文档:在配置迁移指南中澄清全局忽略 (#19032) (Milos Djermanovic)

构建相关

🌐 Build Related

  • 37c9177 构建:更新 @wdio/* 依赖 (#19068) (Francesco Trotta)
  • 35a8858 构建:排除有缺陷的依赖版本 (#19065) (Francesco Trotta)

杂项

🌐 Chores

  • f36cb16 杂务:升级 @eslint/js@9.14.0 (#19086) (Milos Djermanovic)
  • 28be447 事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)
  • f48a2a0 测试:添加 no-invalid-regexp 测试与正则表达式修饰符 (#19075) (Milos Djermanovic)
  • 425202e perf: 修复配置加载器中的缓存 (#19042) (Milos Djermanovic)
  • 3d44b3c ci:在 Node.js 23 中运行测试 (#19055) (Francesco Trotta)
  • 7259627 测试:确保在 check-emfile-handling.js 中清理临时目录 (#19036) (Livia Medeiros)

最新的 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 的一次小版本升级。此版本添加了一些新功能,并修复了上一版本中发现的几个错误。