eslint-config-usecases
v3.1.0
Published
ESLint configs by usecase
Downloads
571
Readme
eslint-config-usecases
ESLint configs by usecase with a strong bias towards quality, strictness and the
decision to ban useless semicolons (;
) for legibility and efficiency
(cf. the "semi" never rule).
Those ESLint configs are devised around some specific use cases of JavaScript:
(
usecases/usecase/nodejs
): JavaScript for Node.js applications (and thus including Electron applications)(
usecases/usecase/browser-vue
): JavaScript for browsers for Vue.js applications(
usecases/usecase/browser-commonjs
): JavaScript for browsers using CommonJS through the build of a bundle (with Browserify/WebPack)(
usecases/usecase/browser-modern
): JavaScript for modern browsers with support for ES2015 and up(
usecases/usecase/browser
): JavaScript for all browsers even old(
usecases/usecase/test-jest
): Tests with Jest(
usecases/usecase/test-mocha
): Tests with Mocha
All those usecases have their special env
and rules
set, while inheriting
some common properties.
Usage
If not already present, install the eslint
package locally in your project:
$ npm install eslint --save-dev
Then, still in your project, locally install the eslint-config-usecases
package:
$ npm install eslint-config-usecases --save-dev
And finally, you have to add an .eslintrc.js
file at the root of your project
with the following content:
module.exports = {
extends: 'usecases/usecase/nodejs'
}
And you can change usecases/usecase/nodejs
to the value of the corresponding
usecase.
Note that you can add many different .eslintrc.js
files in the tree structure
of your project depending on what is inside each directory.
For more information read ESLint Shareable Configs
Note
Because JavaScript is more powerful, flexible and expressive, I prefer to use
JavaScript ESLint configuration files over JSON or YML. That's why there isn't
any .eslintrc
, .eslintrc.json
or .eslintrc.yml
files.
Contributions
Those use cases are focusing only on some needs on purpose. Exhaustiveness is not intended. Feel free to contribute if you have similar needs.