0.0.6 • Published 7 years ago
@ubiwhere/eslint-config v0.0.6
eslint-config
eslint configuration to be used across ubiwhere projects.
Installation
$ yarn add -D eslint @ubiwhere/eslint-config
Usage
Create a .eslintrc.json
file in the project root using a base configuration and addons.
First you need to choose the base configuration to use:
es5
- The configuration to be used in ECMAScript 5 based projectses6
- The configuration to be used in ECMAScript 6 based projectses7
- The configuration to be used in ECMAScript 7 based projectses8
- The configuration to be used in ECMAScript 8 based projectses9
- The configuration to be used in ECMAScript 9 based projects
Then enhance it with one or more addons:
browser
- If you are going to develop code for the browser (assumes you use CommonJS or AMD)node
- If you are going to develop code for NodeJSes-modules
: If you are going to use ES6 import & export instead of CommonJS or AMDbabel-parser
: Use babel-eslint parser so that you may use language features that are not yet implemented in eslint (e.g.: dynamic imports)react
- If you are going to use React (requireses6
base configuration or higher)jest
- If you are going to use Jest to develop tests
Examples
Cutting edge React in the browser:
{
"root": true,
"extends": [
"@ubiwhere/eslint-configy/es9",
"@ubiwhere/eslint-configy/addons/browser",
"@ubiwhere/eslint-configy/addons/es-modules",
"@ubiwhere/eslint-configy/addons/react"
]
}
Cutting edge NodeJS:
{
"root": true,
"extends": [
"@ubiwhere/eslint-configy/es9",
"@ubiwhere/eslint-configy/addons/node"
]
}
Cutting edge NodeJS with ES modules (requires a transpiler such as Babel or similar):
{
"root": true,
"extends": [
"@ubiwhere/eslint-configy/es9",
"@ubiwhere/eslint-configy/addons/node",
"@ubiwhere/eslint-configy/addons/es-modules"
]
}
Old ES5 in the browser:
{
"root": true,
"extends": [
"@ubiwhere/eslint-configy/es5",
"@ubiwhere/eslint-configy/addons/browser"
]
}
Note that by setting root
to true, we ensure that no ancestor configuration is used which also improves ESLint
performance because no more file lookups need to be done.
Tests
$ yarn test
$ yarn test -- --watch
during development