ESLint v10.0.0-rc.0 released

We just pushed ESLint v10.0.0-rc.0, which is a major release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely.

Highlights

This version of ESLint is not ready for production use and is provided to gather feedback from the community before releasing the final version. Please let us know if you have any problems or feedback by creating issues on our GitHub repo.

Note that this prerelease version of ESLint has a separate documentation section.

Enhancements to RuleTester

Since its earliest days, ESLint has provided the RuleTester API to help plugin authors test their rules against custom test cases and configurations. This release introduces several enhancements to RuleTester to enforce more robust test definitions and improve debugging.

requireData assertion option

A new assertion option, requireData, is now available. When set to true, RuleTester will require invalid test cases to include a data object whenever a messageId references a message with placeholders. This helps ensure that tests remain consistent with rule messages that rely on placeholder substitution.

For example, consider a hypothetical rule no-trivial-sum that reports on expressions such as 1 + 2 and defines a message with placeholders:

trivialSum: "Trivial sum found. Replace {{actualExpression}} with {{sum}}."

If an invalid test case includes messageId: "trivialSum" but omits data:

assertionOptions: { requireData: true },
invalid: [
  {
    code: "const a = 1 + 2;",
    errors: [{ messageId: "trivialSum" }],
  },
],

RuleTester will now throw an assertion error indicating that the data property is missing.

To resolve this, include the placeholder values in the error object:

  {
    code: "const a = 1 + 2;",
    errors: [
      {
        messageId: "trivialSum",
        data: { actualExpression: "1 + 2", sum: 3 },
      },
    ],
  },

Improved location reporting for failing tests

RuleTester now decorates stack traces with information that makes it easier to locate failing test cases in your source code. For example, if the no-trivial-sum rule fails to report an error for 1 + 2, the test case in the previous section will fail and the test output will include stack trace lines like:

roughly at RuleTester.run.invalid[0] (/my-project/test/no-trivial-sum.js:10)
roughly at RuleTester.run.invalid (/my-project/test/no-trivial-sum.js:7)

The first line indicates:

  • invalid[0]: the index of the failing test case in the invalid array
  • /my-project/test/no-trivial-sum.js:10: the file and line number where that test case is defined. Many IDE terminals, including Visual Studio Code’s, recognize this format and allow you to click directly to the relevant line.

The second line points to the start of the entire invalid array.

Note that these line numbers may not always be included, depending on how your tests are structured. When the lines cannot be determined precisely, the failing test index (e.g., 0) and the printed code snippet are still available to locate the test case.

countThis option in max-params rule

The max-params rule now supports the new countThis option, which supersedes the deprecated countVoidThis. With the setting countThis: "never", the rule will now ignore any this annotation in a function’s argument list when counting the number of parameters in a TypeScript function. For example:

function doSomething(this: SomeType, first: string, second: number) {
 // ...
}

will be considered a function taking only 2 parameters.

Installing

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@10.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.

Breaking Changes

  • f9e54f4 feat!: estimate rule-tester failure location (#20420) (ST-DDT)

Features

Bug Fixes

  • d186f8c fix: update eslint (#20427) (renovate[bot])
  • 2332262 fix: error location should not modify error message in RuleTester (#20421) (Milos Djermanovic)
  • ab99b21 fix: ensure filename is passed as third argument to verifyAndFix() (#20405) (루밀LuMir)
  • 8a60f3b fix: remove ecmaVersion and sourceType from ParserOptions type (#20415) (Pixel998)
  • eafd727 fix: remove TDZ scope type (#20231) (jaymarvelz)
  • 39d1f51 fix: correct Scope typings (#20404) (sethamus)
  • 2bd0f13 fix: update verify and verifyAndFix types (#20384) (Francesco Trotta)

Documentation

Chores

  • b4b3127 chore: package.json update for @eslint/js release (Jenkins)
  • f658419 refactor: remove raw parser option from JS language (#20416) (Pixel998)
  • 2c3efb7 chore: remove category from type test fixtures (#20417) (Pixel998)
  • 36193fd chore: remove category from formatter test fixtures (#20418) (Pixel998)
  • e8d203b chore: add JSX language tag validation to check-rule-examples (#20414) (Pixel998)
  • bc465a1 chore: pin dependencies (#20397) (renovate[bot])
  • 703f0f5 test: replace deprecated rules in linter tests (#20406) (루밀LuMir)
  • ba71baa test: enable strict mode in type tests (#20398) (루밀LuMir)
  • f9c4968 refactor: remove lib/linter/rules.js (#20399) (Francesco Trotta)
  • 6f1c48e chore: updates for v9.39.2 release (Jenkins)

The latest ESLint news, case studies, tutorials, and resources.

ESLint v9.39.2 released
1 min read

ESLint v9.39.2 released

We just pushed ESLint v9.39.2, which is a patch release upgrade of ESLint. This release fixes several bugs found in the previous release.

ESLint v10.0.0-beta.0 released
3 min read

ESLint v10.0.0-beta.0 released

We just pushed ESLint v10.0.0-beta.0, which is a major release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely.

ESLint v10.0.0-alpha.1 released
2 min read

ESLint v10.0.0-alpha.1 released

We just pushed ESLint v10.0.0-alpha.1, which is a major release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely.