feature(eslint): 添加规则

This commit is contained in:
zyn
2023-12-15 09:59:25 +08:00
parent 78e7d08029
commit 230852b8f2
+11 -2
View File
@@ -1,4 +1,4 @@
module.exports ={
module.exports = {
// 继承其他规则
'extends': ['eslint:recommended', 'plugin:vue/essential'],
// 解析选项
@@ -23,9 +23,18 @@ module.exports ={
'prefer-const': 'error', // 强制使用 const 定义常量
'indent': ['error', 2], // 缩进 2 个空格
// '@stylistic/js/indent': ['error', 2], // 缩进 2 个空格
'quotes': ['error', 'single'] // 强制使用单引号
'quotes': ['error', 'single'], // 强制使用单引号
"spaced-comment": ["error", "always"], // 注释后面需要有空格
'space-before-blocks': 'error', // 代码块前面(if function等的大括号之前)需要有空格
'space-before-function-paren': ['error', 'always'], // 函数括号前面需要有空格
"space-infix-ops": 'error', // 操作符前后需要有空格
"no-irregular-whitespace": 'error', // 不能有不规则的空格 https://eslint.nodejs.cn/docs/latest/rules/no-irregular-whitespace
"no-trailing-spaces": 'error', // 一行结束后面不要有空格
"array-bracket-spacing": ["error","always"], // 数组前后需要有空格
"object-curly-spacing": ["error","always"], // 对象前后需要有空格
},
env: {
browser: true,
node: true
}
}