|
@@ -3,6 +3,8 @@ module.exports = {
|
|
|
env: {
|
|
|
node: true
|
|
|
},
|
|
|
+ parser: '@typescript-eslint/parser', // 关键
|
|
|
+ plugins: ['@typescript-eslint'],
|
|
|
'extends': [
|
|
|
'plugin:vue/essential',
|
|
|
'eslint:recommended'
|
|
@@ -10,9 +12,40 @@ module.exports = {
|
|
|
rules: {
|
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
|
- "no-unused-vars":"off" //关闭声明后未被使用的变量或参数
|
|
|
+ "no-unused-vars":"off", //关闭声明后未被使用的变量或参数
|
|
|
+ "no-prototype-builtins": "off", // 允许直接调用Object.prototype方法
|
|
|
+ "vue/no-unused-components": "off", // 允许未使用的组件
|
|
|
+ "vue/no-unused-vars": "off", // 允许模板中未使用的变量
|
|
|
+ "vue/no-parsing-error": "off", // 允许Vue模板解析错误
|
|
|
+ "no-redeclare": "off", // 允许重复声明
|
|
|
+ "no-self-assign": "off", // 允许自我赋值
|
|
|
+ "vue/no-mutating-props": "off", // 允许修改props
|
|
|
+ "vue/no-use-v-if-with-v-for": "off", // 允许v-if与v-for一起使用
|
|
|
+ "vue/require-valid-default-prop": "off", // 允许props默认值不是函数
|
|
|
+ "no-irregular-whitespace": "off" // 允许不规则空白
|
|
|
},
|
|
|
parserOptions: {
|
|
|
- parser: 'babel-eslint'
|
|
|
- }
|
|
|
+ ecmaVersion: 2020,
|
|
|
+ sourceType: 'module',
|
|
|
+ project: './tsconfig.json', // 如有类型检查规则
|
|
|
+ extraFileExtensions: ['.vue']
|
|
|
+ },
|
|
|
+ overrides: [
|
|
|
+ {
|
|
|
+ files: ['*.ts', '*.tsx', '*.d.ts'],
|
|
|
+ rules: {
|
|
|
+ // 如有需要关掉历史规则
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ files: ['*.vue'],
|
|
|
+ parser: 'vue-eslint-parser',
|
|
|
+ parserOptions: {
|
|
|
+ parser: '@typescript-eslint/parser',
|
|
|
+ extraFileExtensions: ['.vue'],
|
|
|
+ ecmaVersion: 2020,
|
|
|
+ sourceType: 'module'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|