shinnn's ESLint sharable config
- Enforce tab indents to save file size
- Support ECMAScript 2019 features for example optional
catch
binding, and more experimental ones when babel-eslint is installed - Target
.cjs
and.mjs
file extension by default to support ECMAScript modules - Automatically fix errors without explicitly passing a
--fix
flag- On CI environments, this feature is disabled in order to encourage fixing code locally.
- Users still can manually disable it with
--no-fix
flag.
- Automatically ignore generated files, for example paths under
coverage/
,tmp/
anddist/
- Use a beautiful codeframe formatter by default
- Cache results by default to operate only on the changed files
- Allow CLI-friendly
process.exit()
to be used only inside executables - Optional Svelte support
Install eslint
and this package with npm.
npm install --save-dev eslint @shinnn/eslint-config
Then add the following configuration to your project's package.json
.
"eslintConfig": {
"extends": "@shinnn"
}
babel-eslint utilization
When babel-eslint
is installed, this config automatically uses it as a parser. There is no need to add "parser": "babel-eslint"
to the package.json
explicitly.
npm install --save-dev babel-eslint
babel-eslint
lets ESLint parse experimental ECMAScript syntax the default parser doesn't support, for example class fields and BigInt
.
Svelte support
When eslint-plugin-svelte3
is installed, this config also makes ESLint validate .svelte
files.
npm install --save-dev eslint-plugin-svelte3
# No need to explicitly add `--cache`, `--cache-location`, `--ext`, `--fix` and `--format` flags
$ eslint .
const {CLIEngine} = require('eslint');
const cli = new CLIEngine({
// For programmatic usage via API and build tool integrations like Webpack eslint-loader,
// options for example `fix: true` and `cache: true` are still needed to set them explicitly.
});
cli.executeOnText('var foo=true;'); //=> {results: [ ... ], errorCount: ... }
ISC License © 2017 - 2019 Watanabe Shinnosuke