@rise-digital/eslint-config-rise
v2.2.1
Published
ESLint configurations by Rise
Downloads
11
Readme
eslint-config-rise
ESLint configurations used by us in Rise, we thought you might love them too.
Setup
Quick one-liner (install & configuration)
Installs eslint
, prettier
& @rise-digital/eslint-config-rise
,
and sets up the default .eslintrc.js
(Warning: this will overwrite an existing .eslintrc.js
)
yarn add --dev \
eslint \
prettier \
@rise-digital/eslint-config-rise \
&& \
printf '%s\n%s\n' \
"const config = require('@rise-digital/eslint-config-rise')" \
"module.exports = config()" \
> .eslintrc.js
Install
Install the necessary packages: eslint
, prettier
& @rise-digital/eslint-config-rise
yarn add --dev \
eslint \
prettier \
@rise-digital/eslint-config-rise
Configuration
A default configuration look like this.
Please note that the rc-file is a js
file and not json
, as we look up which packages to support.
// .eslintrc.js
const config = require('@rise-digital/eslint-config-rise')
module.exports = config()
The config creator take an optional options object, to extend or disable specific rules.
// .eslintrc.js
const config = require('@rise-digital/eslint-config-rise')
module.exports = config({
rules: {
'rule/to-disable': 0,
},
env: {
node: true,
},
globals: {
logger: true,
}
})
Current supported packages
By default standard
& prettier
is included in the config.
- Config is extended with Flowtype support, if
package.json
includesflow-bin
- Config is extended with React support, if
package.json
includesreact
- Config is extended with React Native support,if
package.json
includesreact-native
- Config is extended with Jest support,if
package.json
includesjest
Editor integration setup
Generally we want the editor to lint (run eslint
) while typing, and only fix errors (run eslint --fix
) on save.
Here are some extensions/packages for various editors:
Visual Studio Code
Use/add the following configuration in your User Settings
:
{
"editor.formatOnSave": false,
"eslint.autoFixOnSave": true
}
Atom
Use/add the following configuration in Your Config
(config.cson
):
"linter-eslint":
fixOnSave: true
Sublime Text
SublimeLinter package + SublimeLinter-contrib-eslint package ESLint-Formatter package
Enable automatic formatting on save, in the package-settings:
{
"format_on_save": true
}