My personal ESLint config.
pnpm add -D eslint @will-stone/eslint-config
If you are using any of the following packages, you will also need to install the corresponding plugin.
Package | Plugin |
---|---|
astro |
astro-eslint-parser eslint-plugin-astro |
react |
eslint-plugin-react eslint-plugin-react-hooks |
tailwindcss |
eslint-plugin-tailwindcss |
vitest |
@vitest/eslint-plugin |
// eslint.config.js
import config from '@will-stone/eslint-config'
export default config()
For example:
{
"scripts": {
"lint": "eslint ."
}
}
If you would like to apply lint and auto-fix before every commit, you can add
the following to your package.json
:
{
"lint-staged": {
"*.{js,jsx,ts,tsx,json}": ["eslint --fix"]
}
}
and then
pnpm add -D husky lint-staged
pnpm husky init
echo "lint-staged" > .husky/pre-commit
Inspired by the excellent Flat eslint-config by Anthony Fu.