From 230852b8f2c2a00a648a1f73208563d93bdd3baa Mon Sep 17 00:00:00 2001 From: zyn Date: Fri, 15 Dec 2023 09:59:25 +0800 Subject: [PATCH] =?UTF-8?q?feature(eslint):=20=E6=B7=BB=E5=8A=A0=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 } }