ESLint v8.4.0 released
by Milos Djermanovic - 3 December 2021We 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
5771663
feat: addallowReserved
parser option (#15387) (Milos Djermanovic)32ac37a
feat: Flat config support in Linter (refs #13481) (#15185) (Nicholas C. Zakas)d041f34
feat: Treat Class/New Expressions as truthy in no-constant-condition (#15326) (Jordan Eldredge)8f44cf5
feat: report only lines that exceed the limit in max-lines-per-function (#15140) (Sneh Khatri)808ad35
feat: pass cwd to formatters (refs eslint/rfcs#57) (#13392) (Toru Nagashima)f1b7499
feat: support async formatters (#15243) (MO)
Bug Fixes
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 nodev16
for Verify Files (#15364) (Nitin Kumar)1e32ee5
chore: add jsdoc type annotation to rules (#15291) (Bryan Mishkin)