@5rabbits/eslint-config

1.0.2 • Public • Published

5rabbits ESLint config

Shared ESLint configuration for Lemontech products.

Installation

  • Install @5rabbits/eslint-config and its dependencies:
$ export PKG=@5rabbits/eslint-config && npm info $PKG peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add --dev $PKG
  • If you have an .eslintrc file, add "extends": ["@5rabbits"].

  • If you don't have an .eslintrc file, create it on the root of your project:

$ echo '{\n  "extends": ["@5rabbits"]\n}' > .eslintrc

Usage

  • Add a lint script to your package.json:

    {
      "scripts": {
        "lint": "eslint . --ext .js,.jsx"
      }
    }
  • Run with yarn lint to check the entire project.

Prettier

If the projects uses prettier (recommended), install eslint-config-prettier and append "prettier" to the .eslintrc extends array.

Integrations

Git

You can use husky and lint-staged to lint the changed files before commiting. Example:

// package.json
{
  "lint-staged": {
    "*.{js,jsx}": ["eslint"]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}

If the changes causes lint errors the commit will fail until you fix them.

Webpack

Use eslint-loader to automatically lint files on webpack builds.

Rollup

Use rollup-plugin-eslint to automatically lint files on rollup builds.

Package Sidebar

Install

npm i @5rabbits/eslint-config

Weekly Downloads

45

Version

1.0.2

License

MIT

Unpacked Size

4.01 kB

Total Files

4

Last publish

Collaborators

  • lemonlet
  • glara
  • rdiaz