This package provides Mutant's .eslintrc as an extensible shared config.
- Install the package
eslint-config-mutant
using:
# using npm
npm i eslint-config-mutant --save-dev
# using yarn
yarn add eslint-config-mutant -D
- Create a
.eslintrc.json
file with the following content:
{
"extends": ["eslint-config-mutant"]
}
- Create a
.prettierrc
file with following content:
{ "printWidth": 80, "singleQuote": true }
- Create a
.editorconfig
file with the following content:
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
# editorconfig-tools is unable to ignore longs strings or urls
max_line_length = null
And the configuration is ready to use, the custom rules that the config contains are:
{
"import/prefer-default-export": "off",
"no-use-before-define": ["error", { functions: false }],
"prettier/prettier": ["error"],
"arrow-body-style": "off",
"function-paren-newline": "off",
complexity: ["warn", 5],
"max-statements": ["warn", { max: 10 }],
"max-statements-per-line": ["warn", { max: 1 }],
"max-nested-callbacks": ["warn", { max: 2 }],
"max-depth": ["warn", { max: 2 }],
"max-params": ["warn", 3],
"max-len": [
"warn",
80,
{
ignoreUrls: true,
ignoreComments: true,
ignoreStrings: true,
ignorePattern: "^\\s*const\\s.+=\\s*require\\s*\\(",
},
],
"no-param-reassign": [
"warn",
{
props: true,
ignorePropertyModificationsFor: [
"acc",
"accumulator",
"item",
"e",
"module",
"req",
"request",
"res",
"response",
"session",
],
},
],
"no-useless-constructor": "off",
"class-methods-use-this": "off",
}
the other rules we extends from Airbnb's JavaScript styleguide