-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
94 lines (93 loc) · 3.06 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const { defineConfig } = require("eslint-define-config")
module.exports = defineConfig({
root: true,
env: {
browser: true,
node: true,
jest: true,
es6: true
},
plugins: ["vue"],
parser: "vue-eslint-parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
allowImportExportEverywhere: true,
ecmaFeatures: {
jsx: true
}
},
extends: [
"eslint-config-airbnb-base",
"eslint:recommended",
"plugin:vue/vue3-essential",
"plugin:vue/vue3-recommended",
"plugin:prettier/recommended"
],
rules: {
// 禁止使用多余的包
"import/no-extraneous-dependencies": 0,
// 确保在导入路径内一致使用文件扩展名
"import/extensions": 0,
// 确保导入指向可以解析的文件/模块
"import/no-unresolved": 0,
// 首选默认导出导入/首选默认导出
"import/prefer-default-export": 0,
// 要求使用 let 或 const 而不是 var
"no-var": "error",
// 禁止使用 new 以避免产生副作用
"no-new": 1,
// 禁止变量声明与外层作用域的变量同名
"no-shadow": 0,
// 禁用 console
"no-console": 0,
// 禁止标识符中有悬空下划线
"no-underscore-dangle": 0,
// 禁止在可能与比较操作符相混淆的地方使用箭头函数
"no-confusing-arrow": 0,
// 禁用一元操作符 ++ 和 --
"no-plusplus": 0,
// 禁止对 function 的参数进行重新赋值
"no-param-reassign": 0,
// 禁用特定的语法
"no-restricted-syntax": 0,
// 禁止在变量定义之前使用它们
"no-use-before-define": 0,
// 禁止直接调用 Object.prototypes 的内置属性
"no-prototype-builtins": 0,
// 禁止可以在有更简单的可替代的表达式时使用三元操作符
"no-unneeded-ternary": "error",
// 禁止重复模块导入
"no-duplicate-imports": "error",
// 禁止在对象中使用不必要的计算属性
"no-useless-computed-key": "error",
// 禁止不必要的转义字符
"no-useless-escape": 0,
// 禁用 continue 语句
"no-continue": 0,
// 强制使用一致的缩进
indent: ["error", 2, { SwitchCase: 1 }],
// 强制使用骆驼拼写法命名约定
camelcase: 0,
// 强制类方法使用 this
"class-methods-use-this": 0,
// 要求构造函数首字母大写
"new-cap": 0,
// 强制一致地使用 function 声明或表达式
"func-style": 0,
// 强制一行的最大长度
"max-len": 0,
// 要求 return 语句要么总是指定返回的值,要么不指定
"consistent-return": 0,
// 强制switch要有default分支
"default-case": 2,
// 强制剩余和扩展运算符及其表达式之间有空格
"rest-spread-spacing": "error",
// 要求使用 const 声明那些声明后不再被修改的变量
"prefer-const": "error",
// 强制箭头函数的箭头前后使用一致的空格
"arrow-spacing": "error",
// 只强制对象解构,不强制数组解构
"prefer-destructuring": ["error", { object: true, array: false }]
}
})