eslint-config-base
MOXY's ESLint base configuration.
Installation
$ npm install --save-dev eslint @moxy/eslint-config-base
Usage
Create a .eslintrc.json
file in the project root and extend from one of these base configurations:
@moxy/eslint-config-base
- Latest ECMAScript version without modules.@moxy/eslint-config-base/esm
- Latest ECMAScript version with ECMAScript modules.@moxy/eslint-config-base/cjs
- Latest ECMAScript version with CommonJS modules.
Instead of the latest ECMAScript version (2020), you may target specific versions of ECMAScript by using their configurations instead.
List of all base configurations
@moxy/eslint-config-base/es2015
- ECMAScript 2015 (aka es6) without modules.@moxy/eslint-config-base/es2016
- ECMAScript 2016 (aka es7) without modules.@moxy/eslint-config-base/es2017
- ECMAScript 2017 (aka es8) without modules.@moxy/eslint-config-base/es2018
- ECMAScript 2018 (aka es9) without modules.@moxy/eslint-config-base/es2019
- ECMAScript 2019 (aka es10) without modules.@moxy/eslint-config-base/es2020
- ECMAScript 2020 (aka es11) without modules.@moxy/eslint-config-base/esm/es2015
- ECMAScript 2015 (aka es6) with ECMAScript modules.@moxy/eslint-config-base/esm/es2016
- ECMAScript 2016 (aka es7) with ECMAScript modules.@moxy/eslint-config-base/esm/es2017
- ECMAScript 2017 (aka es8) with ECMAScript modules.@moxy/eslint-config-base/esm/es2018
- ECMAScript 2018 (aka es9) with ECMAScript modules.@moxy/eslint-config-base/esm/es2019
- ECMAScript 2019 (aka es10) with ECMAScript modules.@moxy/eslint-config-base/esm/es2020
- ECMAScript 2020 (aka es11) with ECMAScript modules.@moxy/eslint-config-base/cjs/es2015
- ECMAScript 2015 (aka es6) with CommonJS modules.@moxy/eslint-config-base/cjs/es2016
- ECMAScript 2016 (aka es7) with CommonJS modules.@moxy/eslint-config-base/cjs/es2017
- ECMAScript 2017 (aka es8) with CommonJS modules.@moxy/eslint-config-base/cjs/es2018
- ECMAScript 2018 (aka es9) with CommonJS modules.@moxy/eslint-config-base/cjs/es2019
- ECMAScript 2019 (aka es10) with CommonJS modules.@moxy/eslint-config-base/cjs/es2020
- ECMAScript 2020 (aka es11) with CommonJS modules.
All files that end in .config.js
within your project root folder will automatically be treated as Node.js files as they relate to tooling, such as babel.config.js
and commitlint.config.js
.
Examples
-
Example of .eslintrc.json
for Node.js projects:
{
"root": true,
"env": {
"node": true
},
"extends": [
"@moxy/eslint-config-base/cjs/es2019"
]
}
-
Example of .eslintrc.json
for browser only projects that use ECMAScript modules:
{
"root": true,
"env": {
"browser": true
},
"extends": [
"@moxy/eslint-config-base/esm",
]
}
-
Example of .eslintrc.json
for isomorphic / universal projects that use ECMAScript modules:
{
"root": true,
"env": {
"browser": true,
"node": true
},
"extends": [
"@moxy/eslint-config-base/esm"
]
}
ℹ️ Note that by setting root
to true, we ensure that no ancestor configuration is used which also improves ESLint
performance because no more file lookups need to be done.
Shared functionality
This package contains functionality that may be used directly if necessary: