eslint-config-mutant

1.5.0 • Public • Published

Eslint config mutant

This package provides Mutant's .eslintrc as an extensible shared config.

Usage

  1. Install the package eslint-config-mutant using:
# using npm
npm i eslint-config-mutant --save-dev
# using yarn
yarn add eslint-config-mutant -D
  1. Create a .eslintrc.json file with the following content:
{
  "extends": ["eslint-config-mutant"]
}
  1. Create a .prettierrc file with following content:
{ "printWidth": 80, "singleQuote": true }
  1. 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

Dependencies (6)

Dev Dependencies (6)

Package Sidebar

Install

npm i eslint-config-mutant

Weekly Downloads

0

Version

1.5.0

License

ISC

Unpacked Size

10.2 kB

Total Files

8

Last publish

Collaborators

  • brunohafonso