| 123456789101112131415161718192021222324252627 |
- module.exports = {
- root: true,
- env: {
- node: true,
- browser: true
- },
- parser: 'vue-eslint-parser', // 解析 .vue 文件
- parserOptions: {
- parser: '@babel/eslint-parser', // 解析 JS
- ecmaVersion: 2020,
- sourceType: 'module'
- },
- extends: [
- 'plugin:vue/recommended', // Vue2 官方推荐规则
- 'eslint:recommended', // ESLint 推荐规则
- 'plugin:prettier/recommended' // 整合 Prettier
- ],
- rules: {
- 'prettier/prettier': 'off',
- // 自定义规则 (示例)
- 'vue/multi-word-component-names': 'off', // 关闭组件名多单词要求
- 'vue/no-v-html': 'off', // 允许使用 v-html
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'no-prototype-builtins': 'off' // 将 Prettier 警告视为 ESLint 警告
- }
- }
|