From c04c6e8365d3e3ffed2703c38dd17b60a9ed3460 Mon Sep 17 00:00:00 2001 From: Kane Date: Fri, 31 Mar 2023 23:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=BF=9B=E5=BA=A6=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/web/task_schedule/.eslintrc.cjs | 82 +++++++++++++------------ code/web/task_schedule/src/test/test.ts | 2 +- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/code/web/task_schedule/.eslintrc.cjs b/code/web/task_schedule/.eslintrc.cjs index 0cb39b1..fbcd67c 100644 --- a/code/web/task_schedule/.eslintrc.cjs +++ b/code/web/task_schedule/.eslintrc.cjs @@ -21,35 +21,35 @@ module.exports = { }, extends:["eslint:recommended",], rules:{ - indent: [ "warn", 4, ], + indent: ["warn", 4,], // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 - "space-in-parens": [ "error", "always", { exceptions: [ "{}", "[]", "()", "empty", ], },], + "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-unused-vars": "warn", - semi: [ "error", "always", ], // 控制行尾部分号 - quotes: [ "error", "double", ], - "comma-dangle": [ "error", { + semi: ["error", "always",], // 控制行尾部分号 + quotes: ["error", "double",], + "comma-dangle": ["error", { arrays: "always", objects: "always", imports: "never", exports: "never", functions: "never", },], // 数组和对象键值对最后一个逗号 - "comma-style": [ "error", "last", ], // 逗号在行位 - "array-bracket-spacing": [ "error", "always", { - singleValue: false, - objectsInArrays: false, - arraysInArrays: false, - },], + "comma-style": ["error", "last",], // 逗号在行位 "no-undef-init": "error", "no-invalid-this": "error", "no-use-before-define": "error", "no-shadow-restricted-names": "error", // 禁止对一些关键字或者保留字进行赋值操作,比如NaN、Infinity、undefined、eval、arguments等 - "comma-spacing": [ "error", { before: false, after: true, },], - "brace-style": [ "error", "allman", { allowSingleLine: true, },], + "comma-spacing": ["error", { before: false, after: true, },], + "array-bracket-spacing": ["error", "never", { + singleValue: false, + objectsInArrays: false, + arraysInArrays: false, + },], + "brace-style": ["error", "allman", { allowSingleLine: true, },], "prefer-const": "warn", - "space-before-function-paren": [ "error", { + "space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always", @@ -78,23 +78,23 @@ module.exports = { "plugin:@typescript-eslint/recommended", ], rules: { - indent: [ "warn", 4, ], + indent: ["warn", 4,], // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 - "space-in-parens": [ "error", "always", { exceptions: [ "{}", "[]", "()", "empty", ], },], + "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-unused-vars": "warn", - semi: [ "error", "always", ], // 控制行尾部分号 - quotes: [ "error", "double", ], - "comma-dangle": [ "error", { + semi: ["error", "always",], // 控制行尾部分号 + quotes: ["error", "double",], + "comma-dangle": ["error", { arrays: "always", objects: "always", imports: "never", exports: "never", functions: "never", },], // 数组和对象键值对最后一个逗号 - "comma-style": [ "error", "last", ], // 逗号在行位 - "array-bracket-spacing": [ "error", "always", { + "comma-style": ["error", "last",], // 逗号在行位 + "array-bracket-spacing": ["error", "always", { singleValue: false, objectsInArrays: false, arraysInArrays: false, @@ -103,33 +103,33 @@ module.exports = { "no-invalid-this": "error", "no-use-before-define": "error", "no-shadow-restricted-names": "error", // 禁止对一些关键字或者保留字进行赋值操作,比如NaN、Infinity、undefined、eval、arguments等 - "comma-spacing": [ "error", { before: false, after: true, },], - "brace-style": [ "error", "allman", { allowSingleLine: true, },], + "comma-spacing": ["error", { before: false, after: true, },], + "brace-style": ["error", "allman", { allowSingleLine: true, },], "prefer-const": "warn", - "space-before-function-paren": [ "error", { + "space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always", },], // vue - "vue/html-indent": [ "error", 4, ], + "vue/html-indent": ["error", 4,], // typescript - "@typescript-eslint/indent": [ "warn", 4, ], + "@typescript-eslint/indent": ["warn", 4,], "@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/ban-ts-comment": "warn", "@typescript-eslint/member-delimiter-style": "off", - "@typescript-eslint/semi": [ "error", "always", ], // 控制行尾部分号 - "@typescript-eslint/brace-style": [ "error", "allman", { allowSingleLine: true, },], - "@typescript-eslint/comma-dangle": [ "error", { + "@typescript-eslint/semi": ["error", "always",], // 控制行尾部分号 + "@typescript-eslint/brace-style": ["error", "allman", { allowSingleLine: true, },], + "@typescript-eslint/comma-dangle": ["error", { arrays: "always", objects: "always", imports: "never", exports: "never", functions: "never", },], // 数组和对象键值对最后一个逗号 - "@typescript-eslint/quotes": [ "error", "double", ], + "@typescript-eslint/quotes": ["error", "double",], "@typescript-eslint/space-before-function-paren": "off", }, }, @@ -141,38 +141,40 @@ module.exports = { }, plugins: ["@typescript-eslint",], extends: [ - "standard-with-typescript", "eslint:recommended", + "standard-with-typescript", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", ], rules: { // 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格 - "space-in-parens": [ "error", "always", { exceptions: [ "{}", "[]", "()", "empty", ], },], + "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", - "@typescript-eslint/indent": [ "error", 4, ], + "@typescript-eslint/indent": ["error", 4,], "@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/ban-ts-comment": "warn", "@typescript-eslint/member-delimiter-style": "off", - "@typescript-eslint/semi": [ "error", "always", ], // 控制行尾部分号 - "@typescript-eslint/brace-style": [ "error", "allman", { allowSingleLine: true, },], - "@typescript-eslint/comma-dangle": [ "error", { + "@typescript-eslint/semi": ["error", "always",], // 控制行尾部分号 + "@typescript-eslint/brace-style": ["error", "allman", { allowSingleLine: true, },], + "@typescript-eslint/comma-dangle": ["error", { arrays: "always", objects: "always", imports: "never", exports: "never", functions: "never", },], // 数组和对象键值对最后一个逗号 - "@typescript-eslint/quotes": [ "error", "double", ], + "@typescript-eslint/quotes": ["error", "double",], "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/strict-boolean-expressions": [ "error", { + "@typescript-eslint/strict-boolean-expressions": ["error", { allowString: false, },], - "comma-style": [ "error", "last", ], // 逗号在行位 - "array-bracket-spacing": [ "error", "always", { + "comma-style": ["error", "last",], // 逗号在行位 + "comma-spacing": ["off", { before: false, after: true, },], + "@typescript-eslint/comma-spacing": ["error", { before: false, after: true, },], // 使用eslint的,不用ts的 + "array-bracket-spacing": ["error", "always", { singleValue: false, objectsInArrays: false, arraysInArrays: false, diff --git a/code/web/task_schedule/src/test/test.ts b/code/web/task_schedule/src/test/test.ts index 7049082..ff3134d 100644 --- a/code/web/task_schedule/src/test/test.ts +++ b/code/web/task_schedule/src/test/test.ts @@ -14,7 +14,7 @@ interface Cat { name: string; purrs: boolean; -}; +} interface Dog {