Skip to content

will-stone/eslint-config

Repository files navigation

@will-stone/eslint-config

My personal ESLint config.

Usage

Install

npm i -D eslint @will-stone/eslint-config

Create config file

// eslint.config.js
import config from '@will-stone/eslint-config'

export default config()

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

VS Code support (auto fix)

Install VS Code ESLint extension.

Add the following settings to your .vscode/settings.json:

{
  // Enable the ESlint flat config support
  "eslint.experimental.useFlatConfig": true,
}

Lint Staged

If you would like to apply lint and auto-fix before every commit, you can add the following to your package.json:

{
  "scripts": {
    "prepare": "husky install"
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": ["eslint --fix"]
  }
}

and then

npm i -D husky lint-staged
npx husky install
npx husky add .husky/pre-commit "npx --no lint-staged"

Credits

Inspired by the excellent Flat eslint-config by Anthony Fu.