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

@ -21,30 +21,35 @@ module.exports = {
},
extends:["eslint:recommended",],
rules:{
indent: ["warn", 4,],
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
indent: [ "warn", 4, ],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"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", "never",],
"comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"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, },],
"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",
@ -73,53 +78,58 @@ module.exports = {
"plugin:@typescript-eslint/recommended",
],
rules: {
indent: ["warn", 4,],
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
indent: [ "warn", 4, ],
// 圆括号中的空格,为空不加空格,紧跟花括号、方括号、圆括号时也不加入空格
"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", "never",],
"comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"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, },],
"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",
},
},
@ -137,31 +147,36 @@ module.exports = {
"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", "never",],
"comma-style": [ "error", "last", ], // 逗号在行位
"array-bracket-spacing": [ "error", "always", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"no-undef-init": "error",
"no-invalid-this": "error",
"no-use-before-define": "error",

View File

@ -26,7 +26,7 @@ import( "element-plus/dist/index.css" );
const app = createApp( App );
// 注册element-plus的图标
for ( const [key, component,] of Object.entries( ElementPlusIconsVue ))
for ( const [ key, component, ] of Object.entries( ElementPlusIconsVue ))
{
app.component( key, component );
}

View File

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