diff --git a/.eslintrc.js b/.eslintrc.js index bfd51f200..3ce61251a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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 } }