42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
parserOptions: {
|
|
parser: '@babel/eslint-parser',
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module'
|
|
},
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
es6: true
|
|
},
|
|
extends: [
|
|
'plugin:vue/essential',
|
|
'eslint:recommended',
|
|
'plugin:prettier/recommended' // 必须放在最后,这样 Prettier 规则会覆盖 ESLint 的格式规则
|
|
],
|
|
rules: {
|
|
// 将所有 Vue ESLint 规则降级为警告
|
|
'vue/no-use-v-if-with-v-for': 'warn',
|
|
'vue/return-in-computed-property': 'warn',
|
|
'vue/html-closing-bracket-newline': 'off', // 交给 Prettier 处理
|
|
'vue/attributes-order': 'warn',
|
|
'vue/html-indent': 'off', // 交给 Prettier 处理
|
|
'vue/no-spaces-around-equal-signs-in-attribute': 'off', // 交给 Prettier 处理
|
|
'vue/no-lone-template': 'warn',
|
|
'vue/component-tags-order': 'warn',
|
|
'vue/no-template-shadow': 'warn',
|
|
'vue/component-definition-name-casing': 'warn',
|
|
'vue/mustache-interpolation-spacing': 'off', // 交给 Prettier 处理
|
|
'vue/multi-word-component-names': 'warn',
|
|
|
|
// 其他常见规则也设为警告
|
|
'no-console': 'off', // 开发调试需要,不限制 console
|
|
'no-debugger': 'warn',
|
|
'no-unused-vars': 'warn',
|
|
|
|
// Prettier 规则
|
|
'prettier/prettier': ['warn', {}, { usePrettierrc: true }]
|
|
}
|
|
}
|