ESLint v8.4.0 released

by Milos Djermanovic - 3 December 2021

We just pushed ESLint v8.4.0, which is a minor release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release.

Highlights

New Parser Option

The default parser has a new option allowReserved (boolean, default false). When set to true, reserved words can be used as identifiers.

This option can only be used with "ecmaVersion": 3.

{
    "parserOptions": {
        "ecmaVersion": 3,
        "allowReserved": true
    }
}

New Features for Custom Formatters

This release adds two new features for custom formatters.

Async Formatters

Formatters are now allowed to return Promise<string>. That is, a formatter can be an async function.

//------ my-formatter.js ------
module.exports = async function(results, context) {
    const something = await getSomethingAsync();
    // ...
    return formattedResults;
};

context.cwd

The context argument has a new property cwd (string, absolute path). It represents the working directory used for linting. This value comes from the cwd constructor option of the ESLint class, and formatters can use it to output relative paths more reliably than by using process.cwd().

//------ my-formatter.js ------
module.exports = function(results, context) {
    const cwd = context.cwd;
    // ...
};

Features

Bug Fixes

  • 4940cc5 fix: mark --rulesdir option as deprecated in CLI docs (#15310) (Kevin Partington)

Documentation

  • 54deec5 docs: update integrations.md (#15380) (Vlad Sholokhov)
  • fa0423a docs: fix typo in PR template (#15365) (Nitin Kumar)
  • e233920 docs: enable a few more markdownlint rules and fix violations (#15368) (Bryan Mishkin)
  • 632176d docs: Dedent needlessly indented example in getter-return docs (#15363) (Jordan Eldredge)
  • 4497e88 docs: Update release notes blog post template (#15285) (Nicholas C. Zakas)

Chores

  • efede90 chore: upgrade @eslint/eslintrc@1.0.5 (#15389) (Milos Djermanovic)
  • 0b8c846 chore: fix update-readme to avoid multiple consecutive blank lines (#15375) (Milos Djermanovic)
  • 94b2a8b chore: Use default Chromium binary in M1 Mac tests (#15371) (Brandon Mills)
  • ba58d94 ci: use node v16 for Verify Files (#15364) (Nitin Kumar)
  • 1e32ee5 chore: add jsdoc type annotation to rules (#15291) (Bryan Mishkin)