🔧 ESLint configuration for TypeScript, using Prettier to format code.
If you need to format Vue code, you can use @loongwoo/eslint-config-vue.
- Install dependencies
pnpm add -D @loongwoo/eslint-config-typescript-prettier
#or
yarn add -D @loongwoo/eslint-config-typescript-prettier
# or
npm install --save-dev @loongwoo/eslint-config-typescript-prettier
- Configure ESLint
import tsPrettier from '@loongwoo/eslint-config-typescript-prettier';
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
...tsPrettier,
{
files: ['*.ts', '*.tsx'],
ignores: ['src/vite-env.d.ts'],
},
];
- Open the
package.json
file and add theeslint
command in thescripts
configuration.
{
"scripts": {
"lint": "eslint . --fix"
}
}