@qiaer/eslint-config-vue2

Vue 2 Standard Style - ESLint 可共享配置
Install
npm install @qiaer/eslint-config-vue2
Latest Version:0.1.3
License:ISC
Last Updated:Sep 21, 2026
Links: npm
Maintainer: qiaer

@qiaer/eslint-config-vue2

面向 Vue 2 的 ESLint 可共享配置,继承 @qiaer/eslint-config,并启用 Vue 2 推荐规则。

特性

  • 继承 @qiaer/eslint-config(Standard Style + ESLint 8)
  • 使用 vue-eslint-parser 解析 .vue 单文件组件
  • 启用 plugin:vue/recommended 推荐规则
  • 针对 *.ts / *.vue 关闭 no-undef,测试目录放宽 no-console
  • 自定义 vue/html-self-closing 配置

安装

npm

npm install @qiaer/eslint-config-vue2 --save-dev

yarn

yarn add @qiaer/eslint-config-vue2 --dev

pnpm

pnpm add @qiaer/eslint-config-vue2 --save-dev

使用

在项目根目录的 .eslintrc.js、.eslintrc.json 或 .eslintrc 中扩展本配置。

.eslintrc.js

module.exports = {
  extends: ['@qiaer/eslint-config-vue2'],
}

.eslintrc.json

{
  "extends": "@qiaer/eslint-config-vue2"
}

覆盖规则

module.exports = {
  extends: ['@qiaer/eslint-config-vue2'],
  rules: {
    'vue/multi-word-component-names': 'off',
  },
}

主要规则

  • vue/html-self-closing:void / 组件标签自闭合,普通 HTML 不自闭合;svg/math 任意。
  • no-undef:在 *.ts、*.vue 中关闭(由 TypeScript/编译器处理)。
  • no-console:在 **/__tests__/**、**/gulpfile.ts 中关闭。

命令行

npx eslint . --ext .js,.vue
npx eslint . --ext .js,.vue --fix

更新日志

v1.0.0-beta.0

  • 依赖 @qiaer/eslint-config 升级为 ^1.0.0-beta.0
  • 升级 eslint-plugin-vue 至 ^9.22.0,新增 vue-eslint-parser ^9.4.3
  • 移除 eslint-define-config,配置改为直接 module.exports
  • 增加 exports、files、engines,统一脚本为 --config=index.js
  • 完善 README(npm/yarn/pnpm、使用方式、规则说明)

说明:当前使用 file:../eslint-config 链接本地包,便于 Lerna 开发。发布前需将依赖改回版本号(如 ^1.0.0-beta.0)再执行 lerna publish,否则发布后的包无法正确安装。

许可证

MIT

Related Packages

@leukeleu/eslint-config

Reusable Eslint config for Leukeleu projects

10,175 0
@vue/create-eslint-config

Utility to setup ESLint in Vue.js projects.

27,225 52
eslint-config-ktsn-vue

ESLint config for Vue.js project

12,758 1
@detools/eslint-config-vue

Eslint Shared Config for Vue based on AirBnB Styleguide

8,977 1
@snabcentr/eslint-config

Библиотека стилей оформления JS/TS/Vue/HTML кода.

5,237

Version History

Version Released License
0.1.3 ISC