This commit is contained in:
Kane 2023-03-31 23:41:03 +08:00
parent b53090e808
commit 88006b2db9
3 changed files with 55 additions and 36 deletions

View File

@ -22,6 +22,7 @@ module.exports = {
extends:["eslint:recommended",], extends:["eslint:recommended",],
rules:{ 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-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
@ -36,7 +37,11 @@ module.exports = {
functions: "never", functions: "never",
},], // 数组和对象键值对最后一个逗号 },], // 数组和对象键值对最后一个逗号
"comma-style": [ "error", "last", ], // 逗号在行位 "comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": ["error", "never",], "array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"no-undef-init": "error", "no-undef-init": "error",
"no-invalid-this": "error", "no-invalid-this": "error",
"no-use-before-define": "error", "no-use-before-define": "error",
@ -74,6 +79,7 @@ module.exports = {
], ],
rules: { 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-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
@ -88,7 +94,11 @@ module.exports = {
functions: "never", functions: "never",
},], // 数组和对象键值对最后一个逗号 },], // 数组和对象键值对最后一个逗号
"comma-style": [ "error", "last", ], // 逗号在行位 "comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": ["error", "never",], "array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"no-undef-init": "error", "no-undef-init": "error",
"no-invalid-this": "error", "no-invalid-this": "error",
"no-use-before-define": "error", "no-use-before-define": "error",
@ -137,6 +147,7 @@ module.exports = {
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
], ],
rules: { 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-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
@ -161,7 +172,11 @@ module.exports = {
allowString: false, allowString: false,
},], },],
"comma-style": [ "error", "last", ], // 逗号在行位 "comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": ["error", "never",], "array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"no-undef-init": "error", "no-undef-init": "error",
"no-invalid-this": "error", "no-invalid-this": "error",
"no-use-before-define": "error", "no-use-before-define": "error",

View File

@ -34,3 +34,7 @@ const animal: CatOrDog =
}; };
console.log( "test" ); console.log( "test" );
const gainers: Array<string | number> = [ "kane", 588, ];
const kane = { a: 100, b: 200, };