1.0.3 • Published 7 months ago

@mvlchain/eslint-config v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@mvlchain/eslint-config

Common ESLint config used in MVL FE projects.

Install

$ yarn add -D @mvlchain/eslint-config

Usage

.eslintrc.js

  1. Add the following to .eslintrc.js
module.exports = {
  extends: ['@mvlchain/eslint-config'], // or @mvlchain/eslint-config/react
};

If you use @mvlchain/eslint-config/react, you don't need to use @mvlchain/eslint-config.

package.json

  1. Add the following to package.json
{
  "eslintConfig": {
    "extends": "@mvlchain/eslint-config" // or @mvlchain/eslint-config/react
  }
}

With Husky & Lint Staged

  1. Install husky, lint-staged:
$ yarn add -D husky lint-staged
  1. Add the following to package.json:
{
  "scripts": {
    // ...
    "prepare": "husky install",
    "lint-staged": "lint-staged",
    "lint:fix": "./node_modules/.bin/eslint --fix",
    // ...
  },
  "lint-staged": {
    "**/*.{ts,tsx}": [
      "yarn run lint:fix"
    ]
  }
}
  1. Set up pre-commit
$ yarn run prepare
$ npx husky add .husky/pre-commit "yarn run lint-staged"
$ git add .husky/pre-commit