ESLint configuration & ruleset for Javascript (ES6) + React.
In order to add eslint-config-fiverr to a repository, use npm to add it to the development dependencies.
npm i -D @fiverr/eslint-config-fiverr eslint-plugin-react
Add a .eslintrc
file in the main directory of your repository, in which you define the usage of eslint-config-fiverr as well as repository specific configuration & rules.
This is the basic structure:
{
"extends": "@fiverr/fiverr",
"globals": {},
"rules": {}
}
Include some:
{
"extends": [
"@fiverr/eslint-config-fiverr/rules/base",
"@fiverr/eslint-config-fiverr/rules/es6",
"@fiverr/eslint-config-fiverr/rules/jest",
]
}
Included in @fiverr/fiverr
:
base
: Just the set of ruleses6
: New ES support and rulesreact
: React specific rules andeslint-plugin-react
plugin
Need to be added explicitly:
jest
mocha
- globals - add any global variable that is used in your repository. Example:
"React": true
- rules - add any rule you need in addition to eslint-config-fiverr, or if you want to override some of it's rules.
Configuring your IDE to use ESLint is fairly easy:
- Open settings by clicking
cmd
+,
- Languages & Frameworks > Javascript > Code Quality Tools > ESLint
- Check the 'Enable' checkbox
- Under 'Node Interpeter' type the path to the NodeJS executable file (rubymine usually auto-detects it)
- Under 'Configuration File' check the option 'Search for .eslitrc'.
- Click OK
You can use either of these plugins: