ESLint v10.12.0 已发布

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

亮点

🌐 Highlights

SourceCode 中对令牌和注释的支持

🌐 Support for tokens and comments in SourceCode

规则作者经常会使用 ESLint 的 SourceCode 对象,它表示正在被 lint 的 JavaScript 源代码。它的 getText()、getLoc() 和 getRange() 方法一直都接受节点、标记或注释,但文档没有描述所有的参数类型,而且类型定义会拒绝一些有效的调用,例如传入一个注释。

🌐 Rule authors often work with ESLint’s SourceCode object, which represents the JavaScript source code being linted. Its getText(), getLoc(), and getRange() methods have always accepted a node, token, or comment, but the documentation didn’t describe every argument type, and the type definitions rejected some valid calls, such as passing a comment.

这个版本更新了文档和类型定义,以匹配实际行为。这也让这些方法与语言插件中使用的核心 SourceCodeBase 接口的实现保持一致。调用这些方法的代码不会受影响,但实现或模拟 SourceCode 的 TypeScript 代码可能需要更新 getText()、getLoc() 和 getRange() 的签名,以接受 tokens 和 comments。

🌐 This release updates the documentation and type definitions to match the actual behavior. This also aligns these methods with implementations of the core SourceCodeBase interface used in language plugins. Code that calls these methods is unaffected, but TypeScript code that implements or mocks SourceCode may need its getText(), getLoc(), and getRange() signatures updated to accept tokens and comments.

规则修复

🌐 Rule fixes

以下规则已更新,以便在某些边缘情况下正确工作,包括自动修复行为和代码中补充Unicode字符的处理:

🌐 The following rules have been updated to work correctly in certain edge cases, including autofix behavior and the handling of supplementary Unicode characters in code:

特性

🌐 Features

错误修复

🌐 Bug Fixes

文档

🌐 Documentation

杂项

🌐 Chores

  • 152067f 杂务:更新生态系统插件 (#21362) (ESLint 机器人)
  • b56d58e 事务: 将 github/codeql-action 操作更新至 v4.38.2 (#21376) (renovate[bot])
  • bfaea12 性能:针对每个 languageOptions 缓存规范化的配置全局变量 (#21364) (James Ross)
  • 322209e ci:在生态系统测试中避免 Nx 缓存并禁用失败的测试(#21369)(Francesco Trotta)
  • d166567 事务: 将依赖 prettier 更新到 v3.9.9 (#21371) (renovate[bot])
  • 29585ce 任务:将依赖 eslint-plugin-expect-type 更新到 ^0.7.0 (#21359) (renovate[bot])
  • 39d79ba 事务: 将 github/codeql-action 操作更新至 v4.38.1 (#21354) (renovate[bot])
  • 182a6e9 事务: 将依赖 prettier 更新到 v3.9.8 (#21352) (renovate[bot])
  • f995127 任务: 删除 CLAUDE.md,改用 AGENTS.md (#21339) (Jarren)
  • b95fb6c 事务: 将依赖 prettier 更新到 v3.9.7 (#21347) (renovate[bot])
  • 3782dd4 杂务:更新生态系统插件 (#21342) (ESLint 机器人)

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

ESLint v10.11.0 已发布
1 min read

ESLint v10.11.0 已发布

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

ESLint v10.10.0 已发布
1 min read

ESLint v10.10.0 已发布

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

ESLint v10.9.1 已发布
1 min read

ESLint v10.9.1 已发布

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