ESLint v10.2.0 发布

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

亮点

🌐 Highlights

语言感知规则

🌐 Language-aware rules

ESLint v10.2.0 通过新的 meta.languages 属性增加了对语言感知规则的支持。规则作者现在可以明确声明规则支持哪些语言,如果在不支持的语言上启用该规则,ESLint 将根据 language 配置选项抛出运行时错误。

🌐 ESLint v10.2.0 adds support for language-aware rules through the new meta.languages property. Rule authors can now explicitly declare which languages a rule supports, and ESLint will throw a runtime error if that rule is enabled for an unsupported language, as specified by the language configuration option.

这是一个仅支持 JavaScript 语言的规则示例:

🌐 Here is an example of a rule that only supports the JavaScript language:

const rule = {
    meta: {
        type: "problem",
        docs: {
            description: "Example JavaScript rule",
        },
        languages: ["js/js"],
    },
    create(context) {
        return {};
    },
};

目前,没有任何 ESLint 内置规则限制它们设计用于的语言,但将来可能会有所改变。

🌐 Currently, none of the ESLint built-in rules restrict the languages they are designed to work with, but this may change in the future.

有关 meta.languages 属性的更多信息,请参见 自定义规则文档

🌐 More information about the meta.languages property can be found in the custom rules documentation.

Temporal 支持

🌐 Temporal support

随着 Temporal 提案 现在处于 TC39 第 4 阶段,ESLint v10.2.0 将 Temporal 识别为内置全局。因此,在默认配置下,no-undef 规则不再标记 Temporal

🌐 With the Temporal proposal now at TC39 stage 4, ESLint v10.2.0 recognizes Temporal as a built-in global. As a result, the no-undef rule no longer flags Temporal under the default configuration:

/* eslint no-undef: "error" */

const now = Temporal.Now.instant(); // OK

此外,no-obj-calls 规则现在会报告对全局 Temporal 对象的直接调用:

🌐 In addition, the no-obj-calls rule now reports direct calls to the global Temporal object:

/* eslint no-obj-calls: "error" */

Temporal(); // Error: 'Temporal' is not a function.

特性

🌐 Features

错误修复

🌐 Bug Fixes

  • 542cb3e 修复:更新第一方依赖 (#20714) (Francesco Trotta)

文档

🌐 Documentation

  • a2af743 文档:将 language 添加到配置对象 (#20712) (Francesco Trotta)
  • 845f23f 文档:更新自述文件(GitHub Actions 机器人)
  • 5fbcf59 文档:从 ts playground 链接中移除 sourceType (#20477) (Tanuj Kanti)
  • 8702a47 文档:更新自述文件(GitHub Actions 机器人)
  • ddeaded 文档:更新自述文件(GitHub Actions 机器人)
  • 2b44966 文档:在管理发布中添加主要版本部分 (#20269) (Milos Djermanovic)
  • eab65c7 文档:更新示例中的 eslint 版本 (#20664) (루밀LuMir)
  • 3e4a299 文档:更新 ESM 依赖政策,并附上自用包的备注 (#20660) (Milos Djermanovic)

杂项

🌐 Chores

  • 8120e30 重构:提取未修改的循环条件 (#20679) (kuldeep kumar)
  • 46e8469 任务:将依赖 markdownlint-cli2 更新到 ^0.22.0 (#20697) (renovate[bot])
  • 01ed3aa 测试:为 Unicode 工具添加单元测试 (#20622) (Manish chaudhary)
  • 811f493 ci:从类型集成测试中移除 --legacy-peer-deps (#20667) (Milos Djermanovic)
  • 6b86fcf 杂务:将依赖 npm-run-all2 更新到 v8 (#20663) (renovate[bot])
  • 632c4f8 杂项: 将 prettier 更新提交添加到 .git-blame-ignore-revs (#20662) (루밀LuMir)
  • b0b0f21 事务:将依赖 eslint-plugin-regexp 更新到 ^3.1.0 (#20659) (Milos Djermanovic)
  • 228a2dd 事务:将依赖 eslint-plugin-eslint-plugin 更新到 ^7.3.2 (#20661) (Milos Djermanovic)
  • 3ab4d7e 测试:为 eslintrc 风格的键添加测试 (#20645) (kuldeep kumar)

最新的 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.1.0 发布
2 min read

ESLint v10.1.0 发布

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