Sharable eslint config for JavaScript
npm install --save-dev @miirinjej/eslint-config eslint
Or (if Babel isn't set up):
npm install --save-dev @babel/core @babel/preset-env @miirinjej/eslint-config eslint
In addition, when options "useBuiltIns": "entry"|"usage"
are used in Babel config:
npm install core-js@latest
Add this config to package.json
:
"eslintConfig": {
"extends": [
"@miirinjej/eslint-config"
]
}
See also: https://eslint.org/docs/user-guide/configuring
You can extend the current configuration by extending (or overriding) rules or an array of existing configurations:
{
"extends": ["@miirinjej/eslint-config", "./eslint.config.js"],
"rules": {
"no-console": "off"
}
}
See also: https://eslint.org/docs/user-guide/configuring#extending-configuration-files
@babel/eslint-parser
allows you to lint all valid Babel code with eslint.
Note: @babel/eslint-parser
requires @babel/core
and a valid Babel configuration file to run. If you do not have
this already set up, please see the Babel usage guide.
@babel/preset-env
allows you to use the latest JavaScript based on your target environment(s).
- @babel/eslint-parser — Use Babel's parser for linting all Babel features.
- @babel/eslint-plugin — Adds replacements for built-in rules to include Babel features.
- eslint-plugin-import — Linting of ES2015+ import/export syntax, and prevent issues with misspelling of file paths and import names.
- eslint-plugin-promise — Best practices when working with promises.
- eslint-plugin-unicorn — Various awesome ESLint rules.
See config itself.
Rules are grouped and sorted by default as in the original lists: