ESLint v9.0.0-rc.0 发布

我们刚刚发布了 ESLint v9.0.0-rc.0,这是 ESLint 的一次重大版本升级。本次发布增加了一些新功能,并修复了前一版本中发现的若干错误。本次发布还包含一些重大变更,请仔细阅读以下内容。

亮点

🌐 Highlights

这是本版本 ESLint 中你需要了解的主要更改的总结。

🌐 This is a summary of the major changes you need to know about for this version of ESLint.

正在安装

🌐 Installing

由于这是预发布版本,npm 不会自动升级。安装时必须指定 next 标签:

🌐 Since this is a pre-release version, you will not automatically be upgraded by npm. You must specify the next tag when installing:

npm i eslint@next --save-dev

你也可以直接指定版本:

🌐 You can also specify the version directly:

npm i eslint@9.0.0-rc.0 --save-dev

迁移指南

🌐 Migration Guide

由于有很多变化,我们创建了一个 迁移指南,详细描述了重大更改以及你应该采取的应对步骤。我们预计大多数用户应该能够在不更改构建的情况下升级,但如果遇到问题,迁移指南应该是一个有用的资源。

🌐 As there are a lot of changes, we’ve created a migration guide describing the breaking changes in great detail along with the steps you should take to address them. We expect that most users should be able to upgrade without any build changes, but the migration guide should be a useful resource if you encounter problems.

预计算代码路径

🌐 Precalculated Code Paths

ESLint v9.0.0 现在在规则使用的遍历之前预先计算代码路径信息。因此,无论在规则的何处访问,代码路径信息现在都是完整的。

🌐 ESLint v9.0.0 now precalculates code path information before the traversal used by rules. As a result, the code path information is now complete regardless of where it is accessed inside of a rule.

禁止未使用的 // fallthrough 注释

🌐 Disallow Unused // fallthrough Comments

在 ESLint v9.0.0-rc.0 中,规则 no-fallthrough 有一个新选项 reportUnusedFallthroughComment。 当此选项设置为 true 时,如果某个 case 永远不会贯穿,该规则将禁止出现贯穿注释。 此举旨在帮助避免在重构过程中可能出现的误导性注释。

🌐 In ESLint v9.0.0-rc.0, the rule no-fallthrough has a new option reportUnusedFallthroughComment. When this option is set to true, the rule will prohibit a fallthrough comment if a case can never fallthrough. This is intended to help avoiding misleading comments that can occur as a result of refactoring.

重大更改

🌐 Breaking Changes

  • 09bd7fe 重大更新!: 将 AST 遍历移入 SourceCode (#18167) (Nicholas C. Zakas)

特性

🌐 Features

  • [b8fb572](https://github.com/eslint/eslint/commit/b8fb57256103b908712302ccd508f464eff1c9dc) 功能:为 no-fallthrough 规则添加 reportUnusedFallthroughComment 选项 (#18188)(Kirk Waiblinger)

错误修复

🌐 Bug Fixes

  • ae8103d 修复:在平面配置模式下在 CLI 中加载插件 (#18185) (Francesco Trotta)

文档

🌐 Documentation

构建相关

🌐 Build Related

  • b91f9dc 构建:修复 prism-eslint-hooks.js 中的 TypeError (#18209) (Francesco Trotta)

杂项

🌐 Chores

  • 297416d 杂项:为 eslint-9.0.0-rc.0 更新 package.json (#18223) (Francesco Trotta)
  • d363c51 事务:更新 package.json 以适配 @eslint/js 版本发布(Jenkins)
  • 1b841bb 杂务:修复一些评论 (#18213) (avoidaway)
  • 29c3595 任务:删除重复的词 (#18193) (cuithon)
  • acc2e06 任务:引入 Knip (#18005) (Lars Kappert)

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