one-eslint v0.0.4
one-eslint
A collection of opinionated eslint configs and plugins that can be installed as one dependency
It's similar to xo, but instead of wrapping eslint and prettier, it is installed along-side them. This enables
use of the regular eslint/prettier IDE plugins, CLIs and more.
Features
:battery: Batteries included
Bundles all plugins and configs under one dependency. You only need to install one-eslint (and eslint itself) and you're ready to go.
:robot: Maximum uniformity
The base config disallows:
null(Useundefined)classes(Usefunctions)interface(Usetype)functionkeyword (Usearrow functions)commonjs(Useesm)forEach(Usefor..of)reduce(Usefor..of,maporfilter)- Abbreviations
- Spelling mistakes
- Certain dependencies (Suggests alternatives)
:nerd_face: Functional programming style
Includes eslint-plugin-fp.
:jigsaw: Works well with other popular tools
Assumes the use of TypeScript and prettier (It does not enable any style or formatting rules)
:zap: Fast
Only enables rules that are actually useful.
Ignores the following (and more):
Rules that are covered by
TypeScriptanywayRules that contradict each other
Rules regarding
classes, they are disabled anywayRules that are extremely unlikely to catch errors in real life scenarios
For a full list of ignored rules and the reasoning behind them, see each configs ignored.js file.
:package: Install
npm
npm install --save-dev one-eslint eslintyarn
yarn add --dev one-eslint eslintConfigs
All configs contain unique rules and can be combined however you want.
Although it is recommended to always include the base config.
{
"extends": ["one-base", "one-react", "one-ava", "one-cypress", "one-node"]
}VS Code config
Some rules should be turned off in your IDE:
base
{
"eslint.rules.customizations": [
{
"rule": "no-console",
"severity": "off"
},
{
"rule": "no-debugger",
"severity": "off"
},
{
"rule": "@typescript-eslint/no-explicit-any",
"severity": "off"
}
]
}ava
{
"eslint.rules.customizations": [
{
"rule": "ava/no-only-test",
"severity": "off"
},
{
"rule": "ava/no-skip-test",
"severity": "off"
}
]
}Note
The configs are exported as one single dependency (one-eslint).
This is so that the plugins can be included with the configs and don't
pollute the package.json of the consumer. Also, if you use more than
one config, you still only have one dependency in your package.json.
Measure performance
Run eslint with TIMING=1
TIMING=1 npx eslint test-project/index.tsFormatter
https://github.com/sindresorhus/eslint-formatter-pretty
Features from xo
- Default paths to lint or ignore
- Enable clicking a line to open in your editor