eslint-config-esnext
raw JSON → 4.1.0 verified Sat Apr 25 auth: no javascript
Pluggable ESLint config for ECMAScript Next (ES2015+) that you can import, extend and override. Current stable version is 4.1.0. Released infrequently; last release was in 2019. Provides a biased, opinionated set of lint rules favoring code concision and brevity, built on top of eslint:recommended and plugin:import. Uses babel-eslint parser to support all Babel syntax including experimental features like object rest/spread. Supports ES6 modules, CommonJS, and ECMAScript 7. Designed as a superset that you can override. Requires eslint ^6.0.0 as a peer dependency.
Common errors
error Error: Cannot find module 'eslint-config-esnext' ↓
cause ESLint config not installed or not resolved because the package name is not in node_modules.
fix
Run 'npm install --save-dev eslint-config-esnext' in your project root.
error Configuration for rule 'import/no-unresolved' is invalid ↓
cause Plugin eslint-plugin-import may not be installed; it is a dependency of eslint-config-esnext but not automatically installed via npm.
fix
Run 'npm install --save-dev eslint-plugin-import' to install the required plugin.
error Cannot read property 'isEcmaVersion' of undefined ↓
cause Incompatible eslint version (e.g., eslint 7.x) with config that expects eslint ^6.
fix
Downgrade eslint to version ^6.0.0.
Warnings
deprecated babel-eslint is deprecated; use @babel/eslint-parser instead. ↓
fix Replace babel-eslint with @babel/eslint-parser and update parser option to '@babel/eslint-parser'.
breaking Requires eslint ^6.0.0. Not compatible with eslint 7+. ↓
fix Downgrade eslint to version 6.x or use a different config that supports eslint 7+.
gotcha Config uses parser: babel-eslint which may not support the latest ECMAScript proposals. Rules may not be enforced correctly. ↓
fix Consider updating parser manually to @babel/eslint-parser with @babel/eslint-plugin.
gotcha The config is highly opinionated with many rules enabled; may conflict with other configs or project preferences. ↓
fix Override rules in your own .eslintrc after extending.
deprecated ExperimentalObjectRestSpread parser option is deprecated in modern ESLint. ↓
fix Use ecmaVersion: 2021 or later and remove experimentalObjectRestSpread.
Install
npm install eslint-config-esnext yarn add eslint-config-esnext pnpm add eslint-config-esnext Imports
- esnext config wrong
extends: ['eslint-config-esnext']correctextends: ['esnext'] - .eslintrc file wrong
extends: eslint-config-esnextcorrectextends: - esnext - peer dependency wrong
npm install --save-dev eslint-config-esnext (without eslint)correctnpm install --save-dev eslint@^6.0.0 eslint-config-esnext
Quickstart
// Install dependencies:
// npm install --save-dev eslint@^6.0.0 eslint-config-esnext
// .eslintrc.json
{
"extends": ["esnext"]
}
// .eslintrc.js
module.exports = {
extends: ['esnext'],
rules: {
'no-console': 'off' // override a rule
}
};