Use this if you like, but I'll probably make changes and might not accept any.
Install the packages:
pnpm add --save-dev \
@roydukkey/eslint-config \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint
Install the optional peer dependency for linting Vue files.
pnpm add --save-dev eslint-plugin-vue
Here is an example for configuring ESLint from the package.json
and eslint.config.js
.
{
"script": {
"lint": "eslint './**/*.@(?(m|c)@(j|t)s|@(j|t)sx|vue)'",
"lint:fix": "npm run lint -- --fix"
}
}
import { config } from 'typescript-eslint';
import roydukkeyConfig from '@roydukkey/eslint-config';
export default config(
...roydukkeyConfig({
tsconfigRootDir: import.meta.dirname,
}),
);
By default, this package will not use the tsconfig.json
and instead only searches for tsconfig.eslint.json
files. This provides better support for different monorepos.
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:
import { config } from 'typescript-eslint';
import globals from 'globals';
export default config(
{
languageOptions: {
globals: {
...globals.node,
},
},
},
);