eslint-config-soda
ESLint configurations for my personal projects.
TODO
Since ESLint v2 removes the ecmaFeatures
that are specific to ES6,
we now need to develop a plugin to disable some unrecommended ES6 features.
These features are:
objectLiteralDuplicateProperties
(error prone)regexYFlag
(since it's not fully polyfillable)generators
(should be forbidden in browser, as the regenerator runtime is too big)
Usage
This package export 4 ESLint configurations for your usage.
Note: rules related to ES6+ syntax are turned on for every ruleset except the
"legacy" one.
eslint-config-soda
The default export contains all of our ESLint rules, including ES6+ features while compatible with ES3+ environments.
It is a general-purpose rule set, so many redundant rules are enabled, and conflict rules are disabled.
npm install --save-dev eslint eslint-config-soda
- add
"extends": "soda"
to your .eslintrc
eslint-config-soda/node
Lints Node.js projects, including rules for ES6+ features.
npm install --save-dev eslint eslint-config-soda
- add
"extends": "soda/node"
to your .eslintrc
eslint-config-soda/browser
Lints front-end projects, including rules for ES6+ features.
(generators/async/await are disabled since transpiling these features will introduce a lot of overhead).
npm install --save-dev eslint eslint-config-soda
- add
"extends": "soda/browser"
to your .eslintrc
eslint-config-soda/legacy
Lints ES5 and below, for browser use only.
npm install --save-dev eslint-config-soda eslint
- add
"extends": "soda/legacy"
to your .eslintrc
Module Loader
Users are not enforced to use one specific loader spec, so you need to specify
one by yourself after extending this package.
Here are the examples:
- ES6 modules:
{
"extends": "soda",
"parserOptions": {
"sourceType": "module"
}
}
- CommonJS modules
{
"extends": "soda",
"env": {
"commonjs": true
}
}
- AMD modules
{
"extends": "soda",
"env": {
"amd": true
}
}
React Projects
If you are developing a React.js project, you might need the ruleset eslint-config-soda-react
.