ESLint Config
Use this if you like, but I'll probably make changes and might not accept any.
Install
Install the packages:
pnpm add --save-dev \
@roydukkey/eslint-config \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-plugin-tsdoc
Vue
Install the optional peer dependency for linting Vue files.
pnpm add --save-dev eslint-plugin-vue
Configuration
Here is an example for configuring ESLint from the package.json
.
{
"script": {
"lint": "eslint './**/*.@(?(m|c)@(j|t)s|@(j|t)sx|vue)'",
"lint:fix": "npm run lint -- --fix"
},
"eslintConfig": {
"extends": "@roydukkey/eslint-config"
}
}
TypeScript
This package will not use the tsconfig.json
and instead only searches for tsconfig.eslint.json
files. This provides better support for different monorepos. You can read more about this on typescript-eslint.io.
Also, @typescript-eslint/recommended-requiring-type-checking
is applied so don't forget to target the proper environments. For example, the following configuration targets Node:
"eslintConfig": {
"env": {
"node": true
}
}