Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.59 KB

README.md

File metadata and controls

63 lines (45 loc) · 1.59 KB

@imhoff/eslint-config

My personal ESLint config.

This is meant to be used alongside Prettier (with @imhoff/prettier-config).

Usage

  1. Remove existing .eslintrc.* file, if present.

  2. Install eslint and the config.

    npm install -D eslint @imhoff/eslint-config
    
  3. Add the following to package.json:

    "eslintConfig": {
      "extends": "@imhoff/eslint-config/recommended"
    },

📝 You can also use the base rule set: @imhoff/eslint-config

With Prettier and @imhoff/prettier-config

  1. Set up Prettier and @imhoff/prettier-config.

  2. When using with Prettier and @imhoff/prettier-config, ESLint should run first. Set up your scripts in package.json like this:

      "scripts": {
        "lint": "npm run eslint && npm run prettier -- --check",
        "fmt": "npm run eslint -- --fix && npm run prettier -- --write",
        "prettier": "prettier \"**/*.ts\"",
        "eslint": "eslint . --ext .ts",
      }
    • npm run lint: for checking if ESLint and Prettier complain
    • npm run fmt: attempt to autofix lint issues and autoformat code

    📝 Not every rule in this configuration is autofixable, so npm run fmt may continue failing until lint issues are addressed manually.

With Captain Hook

  1. Install captainhook:

    npm install -D captainhook
    
  2. Add the following to package.json:

    "hooks": {
      "pre-commit": "npm run lint"
    },