ESLint v10.4.0 发布

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

亮点

🌐 Highlights

新的 includeIgnoreFile() 助手

🌐 New includeIgnoreFile() helper

此版本引入了用于配置文件的 includeIgnoreFile() 辅助工具,它允许从 .gitignore 文件或任何其他具有 gitignore 风格模式的文件中包含模式。

🌐 This release introduces the includeIgnoreFile() helper for configuration files that allows for including patterns from .gitignore files or any other files with gitignore-style patterns.

以前在外部包 @eslint/compat 中可用,现在新的 includeIgnoreFile 辅助函数从 eslint/config 入口点导出,并提供了一个扩展的 API,允许包含多个文件,并将模式相对于这些文件的位置进行解释,这在嵌套 .gitignore 文件的常见用例中十分常见。

🌐 Previously available in the external package @eslint/compat, the new includeIgnoreFile helper function is exported from the eslint/config entrypoint and provides an extended API that allows multiple files to be included and patterns to be interpreted relative to the location of those files, which is a common use case for nested .gitignore files.

// eslint.config.js

import { defineConfig, includeIgnoreFile } from "eslint/config";
import { fileURLToPath } from "node:url";

const rootGitignorePath = fileURLToPath(
    new URL(".gitignore", import.meta.url)
);
const nestedGitignorePath = fileURLToPath(
    new URL("some/other/folder/.gitignore", import.meta.url),
);

export default defineConfig([
    includeIgnoreFile([rootGitignorePath, nestedGitignorePath], {
        // option to interpret patterns relative to the locations of the specified files
        gitignoreResolution: true,
    }),
    {
        // your overrides
    },
]);

有关更多详细信息,请参阅包含 .gitignore 文件部分。

🌐 Please see the Include .gitignore Files section for more details.

特性

🌐 Features

错误修复

🌐 Bug Fixes

  • 544c0c3 修复:在调试输出中转义代码路径 DOT 标签 (#20866) (Pixel998)
  • 6799431 修复:将依赖 @eslint/config-helpers 更新至 ^0.6.0 (#20850) (renovate[bot])
  • f078fef 修复:处理非数组的已弃用规则替换 (#20825) (xbinaryx)

文档

🌐 Documentation

  • 7e52a71 文档:添加对 @eslint-react/eslint-plugin 的提及 (#20869) (Pavel)
  • db3468b 文档:调整关于模糊 CJS 与 ESM 配置的措辞 (#20865) (Kirk Waiblinger)
  • 9084664 文档:更新自述文件(GitHub Actions 机器人)
  • 9cc7387 文档:更新自述文件(GitHub Actions 机器人)
  • 3d7b548 文档:更新自述文件(GitHub Actions 机器人)
  • 191ec3c 文档:更新自述文件(GitHub Actions 机器人)

杂项

🌐 Chores

  • 6616856 杂务:将 knip 升级到 v6 (#20875) (Pixel998)
  • d13b084 ci:确保自动创建的 PR 运行 CI (#20860) (lumir)
  • e71c7af ci: 将 pnpm/action-setup 从 6.0.5 更新到 6.0.7 (#20862) (dependabot[bot])
  • d84393d 测试:为 SuppressionsService.applySuppressions() 添加单元测试 (#20863) (kuldeep kumar)
  • 24db8cb 测试:为 SuppressionsService.save() 添加测试 (#20802) (kuldeep kumar)
  • 2ef0549 杂务:更新生态系统插件 (#20857) (github-actions[bot])
  • a429791 ci: 移除 eslint-webpack-plugin 类型的集成测试 (#20668) (Milos Djermanovic)
  • 9e37386 杂项:在 code-sample-minimizer 中将 recast 替换为范围方法 (#20682) (Copilot)
  • 0dd1f9f 测试:禁用 vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER 的警告 (#20845) (Francesco Trotta)
  • 9da3c7b 重构:移除已弃用的 meta.language 并迁移 meta.dialects (#20716) (Pixel998)
  • 2099ed1 重构:将 meta.defaultOptions 添加到更多规则,启用代码检查 (#20800) (xbinaryx)
  • f1dfbc9 杂务:更新生态系统插件 (#20836) (github-actions[bot])
  • c759413 ci: 将 pnpm/action-setup 从 6.0.3 更新到 6.0.5 (#20843) (dependabot[bot])
  • 5b817d6 测试:为 lib/shared/ast-utils 添加单元测试 (#20838) (kuldeep kumar)
  • 1c13ae3 测试:为 lib/shared/severity 添加单元测试 (#20835) (kuldeep kumar)

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

ESLint v10.8.0 发布
2 min read

ESLint v10.8.0 发布

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

ESLint v9.39.5 发布
1 min read

ESLint v9.39.5 发布

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