ESLint config for JavaScript, TypeScript, Vue 3 / Nuxt 3.
Based on Anthony Fu and Kevin Deng configs.
pnpm add -D eslint @cany748/eslint-config # JavaScript only
# Or yarn add -D / npm install -D
pnpm add -D eslint @cany748/eslint-config-ts # JavaScript and TypeScript
pnpm add -D eslint @cany748/eslint-config-vue # JavaScript, TypeScript, Vue 3 / Nuxt 3
// `.eslintrc` or `eslintConfig` on `package.json`
{
"extends": "@cany748"
// "extends": "@cany748/eslint-config-ts"
// "extends": "@cany748/eslint-config-vue"
}
// `.prettierrc` or `prettier` on `package.json`
{
"printWidth": 140
}
You don't need
.eslintignore
normally as it has been provided by the preset.
For example:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
If you want to apply lint and auto-fix before every commit, you can add the following to your package.json
:
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
and then
pnpm add -D lint-staged simple-git-hooks
MIT License © 2021-PRESENT