🔧 一个 Vue 的 ESLint 配置,使用 Prettier 格式化代码。
如果只需要对 TypeScript 的代码进行格式化,可以使用 @loongwoo/eslint-config-typescript-prettier。
1.安装依赖
pnpm add -D @loongwoo/eslint-config-vue
# or
bun add -D @loongwoo/eslint-config-vue
# or
yarn add -D @loongwoo/eslint-config-vue
# or
npm install --save-dev @loongwoo/eslint-config-vue2.配置 ESLint
{
  "extends": "@loongwoo/vue"
}3.打开 package.json 文件,在 scripts 配置中添加 eslint 命令,运行 ESLint 校验代码。
{
  "scripts": {
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  }
}