@blueking/eslint-config-bk 2.1.0 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,28 +1,31 @@
1
1
  /*
2
- * Tencent is pleased to support the open source community by making
3
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
- *
5
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
- *
7
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
- *
9
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
- *
11
- * ---------------------------------------------------
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
- *
17
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
- * the Software.
19
- *
20
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- * IN THE SOFTWARE.
25
- */
26
- module.exports = {
27
- extends: ['./tencent/index.js'],
28
- };
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const { defineConfig } = require('eslint/config');
27
+ const baseConfig = require('./tencent/base');
28
+ const prettierConfig = require('./tencent/prettier');
29
+
30
+ // base
31
+ module.exports = defineConfig([baseConfig, prettierConfig]);
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "name": "@blueking/eslint-config-bk",
3
- "version": "2.1.0",
3
+ "version": "3.0.0-beta.1",
4
+ "description": "ESLint configuration for BlueKing projects",
4
5
  "main": "index.js",
5
- "dependencies": {
6
- "@babel/eslint-parser": "^7.23.10",
7
- "@typescript-eslint/eslint-plugin": "^7.2.0",
8
- "@typescript-eslint/parser": "^7.2.0",
9
- "@vue/eslint-config-standard": "^8.0.1",
10
- "@vue/eslint-config-typescript": "^13.0.0",
11
- "eslint": "^8.57.0",
12
- "eslint-plugin-import": "^2.29.1",
13
- "eslint-plugin-node": "~11.1.0",
14
- "eslint-plugin-promise": "^6.1.1",
15
- "eslint-plugin-standard": "~5.0.0",
16
- "eslint-plugin-vue": "^9.23.0",
17
- "typescript": "^5.4.2",
18
- "vue-eslint-parser": "^9.4.2"
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./ts": "./ts.js",
9
+ "./vue": "./vue.js",
10
+ "./vuets": "./vuets.js"
19
11
  },
20
12
  "keywords": [
21
- "eslint-config-bk",
22
- "blueking"
13
+ "eslint"
23
14
  ],
15
+ "dependencies": {
16
+ "@eslint/js": "^9.22.0",
17
+ "@typescript-eslint/eslint-plugin": "^8.26.1",
18
+ "@typescript-eslint/parser": "^8.26.1",
19
+ "eslint": "^9.22.0",
20
+ "eslint-config-prettier": "^10.1.1",
21
+ "eslint-plugin-prettier": "^5.2.3",
22
+ "eslint-plugin-vue": "^10.0.0",
23
+ "typescript-eslint": "^8.26.1",
24
+ "vue-eslint-parser": "^10.1.1",
25
+ "eslint-plugin-import": "^2.31.0"
26
+ },
24
27
  "author": "bkfe",
25
28
  "license": "MIT"
26
- }
29
+ }
package/tencent/base.js CHANGED
@@ -1 +1,161 @@
1
- module.exports={rules:{"array-bracket-spacing":["error","never"],"array-callback-return":"warn","arrow-body-style":["warn","as-needed"],"arrow-parens":["warn","as-needed",{requireForBlockBody:true}],"arrow-spacing":"warn","block-spacing":"error","brace-style":"error",camelcase:["error",{ignoreDestructuring:true,properties:"never"}],"comma-dangle":["warn","always-multiline"],"comma-spacing":["error",{before:false,after:true}],"comma-style":["error","last"],"computed-property-spacing":["warn","never"],"dot-notation":"warn","eol-last":["error","always"],eqeqeq:["warn","always"],"func-call-spacing":["error","never"],"func-style":["off","expression"],"function-paren-newline":["warn","multiline"],"generator-star-spacing":["warn",{before:false,after:true}],"id-length":"off","implicit-arrow-linebreak":["warn","beside"],indent:["warn",2,{SwitchCase:1,VariableDeclarator:1,outerIIFEBody:1,FunctionDeclaration:{parameters:1,body:1},FunctionExpression:{parameters:1,body:1},CallExpression:{arguments:1},ArrayExpression:1,ObjectExpression:1,ImportDeclaration:1,flatTernaryExpressions:false,ignoredNodes:["JSXElement","JSXElement > *","JSXAttribute","JSXIdentifier","JSXNamespacedName","JSXMemberExpression","JSXSpreadAttribute","JSXExpressionContainer","JSXOpeningElement","JSXClosingElement","JSXFragment","JSXOpeningFragment","JSXClosingFragment","JSXText","JSXEmptyExpression","JSXSpreadChild"],ignoreComments:false}],"key-spacing":"error","keyword-spacing":["error",{overrides:{if:{after:true},for:{after:true},while:{after:true},else:{after:true}}}],"linebreak-style":["warn","unix"],"max-len":["error",{code:120,ignoreStrings:true,ignoreUrls:true,ignoreRegExpLiterals:true,ignoreTemplateLiterals:true}],"new-cap":["error",{newIsCap:true,newIsCapExceptions:[],capIsNew:false,capIsNewExceptions:["Immutable.Map","Immutable.Set","Immutable.List"],properties:false}],"newline-per-chained-call":["warn",{ignoreChainWithDepth:2}],"no-array-constructor":["error"],"no-case-declarations":"error","no-confusing-arrow":"warn","no-const-assign":"error","no-dupe-class-members":"error","no-else-return":["warn",{allowElseIf:false}],"no-eval":"error","no-iterator":"warn","no-loop-func":"error","no-mixed-operators":["error",{groups:[["%","**"],["%","+"],["%","-"],["%","*"],["%","/"],["&","|","<<",">>",">>>"],["==","!=","===","!=="],["&&","||"]],allowSamePrecedence:false}],"no-multi-assign":"error","no-multiple-empty-lines":"error","no-nested-ternary":"warn","no-new-func":"error","no-new-object":"error","no-new-wrappers":"warn","no-param-reassign":["warn",{props:true,ignorePropertyModificationsFor:["acc","accumulator","e","ctx","req","request","res","response","$scope","staticContext","state"]}],"no-plusplus":["error",{allowForLoopAfterthoughts:true}],"no-prototype-builtins":"error","no-restricted-properties":["warn",{object:"Math",property:"pow",message:"Please use ** instand"}],"no-restricted-syntax":["warn",{selector:"ForInStatement",message:"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."},{selector:"LabeledStatement",message:"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."},{selector:"WithStatement",message:"`with` is disallowed in strict mode because it makes code impossible to predict and optimize."}],"no-trailing-spaces":"error","no-undef":["error"],"no-underscore-dangle":"warn","no-unneeded-ternary":"warn","no-unused-vars":["error",{args:"after-used",ignoreRestSiblings:true,argsIgnorePattern:"^_.+",varsIgnorePattern:"^_.+"}],"no-useless-constructor":"warn","no-useless-escape":"error","no-var":"error","no-whitespace-before-property":"warn","nonblock-statement-body-position":["error","beside"],"object-curly-spacing":["warn","always"],"object-shorthand":"warn","one-var":["warn","never"],"operator-linebreak":["error","before",{overrides:{"=":"none"}}],"padded-blocks":["error","never"],"prefer-arrow-callback":"warn","prefer-const":["error",{destructuring:"any",ignoreReadBeforeAssign:false}],"prefer-destructuring":["warn",{VariableDeclarator:{array:false,object:true},AssignmentExpression:{array:true,object:false}},{enforceForRenamedProperties:false}],"prefer-rest-params":"warn","prefer-spread":"warn","prefer-template":"error","quote-props":["error","as-needed",{keywords:false}],quotes:["warn","single",{allowTemplateLiterals:false}],radix:"warn",semi:["error","always"],"space-before-blocks":"error","space-before-function-paren":["error",{anonymous:"always",named:"never",asyncArrow:"always"}],"space-in-parens":["error","never"],"space-infix-ops":"error","spaced-comment":["error","always"],"template-curly-spacing":["error","never"],"wrap-iife":["error","outside"]}};
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const js = require('@eslint/js');
27
+ const globals = require('globals');
28
+ const importPlugin = require('eslint-plugin-import');
29
+
30
+ // base
31
+ module.exports = [
32
+ {
33
+ ignores: [
34
+ 'dist',
35
+ 'public',
36
+ 'postcss.config.js',
37
+ 'bk.config.js',
38
+ 'paas-server',
39
+ 'mock-server',
40
+ 'node_modules',
41
+ ],
42
+ },
43
+ importPlugin.flatConfigs.recommended,
44
+ {
45
+ languageOptions: {
46
+ ecmaVersion: 'latest',
47
+ globals: {
48
+ document: 'readonly',
49
+ window: 'readonly',
50
+ ...globals.node,
51
+ ...globals.browser,
52
+ },
53
+ },
54
+ rules: {
55
+ ...js.configs.recommended.rules, // https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js
56
+ 'array-callback-return': 'warn', // 在数组方法的回调中强制执行 return 语句
57
+ camelcase: ['error', { ignoreDestructuring: true, properties: 'never' }], // 强制实施驼峰命名约定
58
+ 'dot-notation': 'warn', // 尽可能强制使用点表示法
59
+ eqeqeq: ['warn', 'always'], // 需要使用 === 和 !==
60
+ 'func-style': ['off', 'expression'], // 强制一致地使用分配给变量的函数声明或表达式
61
+ 'new-cap': [
62
+ 'error',
63
+ {
64
+ newIsCap: true,
65
+ newIsCapExceptions: [],
66
+ capIsNew: false,
67
+ capIsNewExceptions: [
68
+ 'Immutable.Map',
69
+ 'Immutable.Set',
70
+ 'Immutable.List',
71
+ ],
72
+ properties: false,
73
+ },
74
+ ], // 要求构造函数名称以大写字母开头
75
+ 'no-array-constructor': ['error'], // 禁止数组构造函数
76
+ 'no-else-return': ['warn', { allowElseIf: false }], // 不允许在 if 语句中的 return 语句后使用 else 块
77
+ 'no-eval': 'error', // 不允许使用 eval()
78
+ 'no-iterator': 'warn', // 禁止使用 __iterator__ 属性
79
+ 'no-loop-func': 'error', // 禁止在循环语句中包含不安全引用的函数声明
80
+ 'no-multi-assign': 'error', // 禁止使用链式赋值表达式
81
+ 'no-nested-ternary': 'warn', // 不允许嵌套的三元表达式
82
+ 'no-new-func': 'error', // 禁止使用 Function 对象使用新运算符
83
+ 'no-new-object': 'error', // 不允许 Object 构造函数 // 替换 no-object-constructor。
84
+ 'no-new-wrappers': 'warn', // 不允许使用 String、Number 和 Boolean 对象使用新运算符
85
+ 'no-param-reassign': [
86
+ 'warn',
87
+ {
88
+ props: true,
89
+ ignorePropertyModificationsFor: [
90
+ 'acc',
91
+ 'accumulator',
92
+ 'e',
93
+ 'ctx',
94
+ 'req',
95
+ 'request',
96
+ 'res',
97
+ 'response',
98
+ '$scope',
99
+ 'staticContext',
100
+ 'state',
101
+ ],
102
+ },
103
+ ], // 不允许重新分配函数参数
104
+ 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], // 不允许使用一元运算符 ++ 和 --
105
+ 'no-restricted-properties': [
106
+ 'warn',
107
+ { object: 'Math', property: 'pow', message: 'Please use ** instand' },
108
+ ], // 禁止对某些对象使用某些属性
109
+ 'no-restricted-syntax': [
110
+ 'warn',
111
+ {
112
+ selector: 'ForInStatement',
113
+ message:
114
+ 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
115
+ },
116
+ {
117
+ selector: 'LabeledStatement',
118
+ message:
119
+ 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
120
+ },
121
+ {
122
+ selector: 'WithStatement',
123
+ message:
124
+ '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
125
+ },
126
+ ], // 禁止指定语法
127
+ 'no-underscore-dangle': 'warn', // 不允许标识符中出现悬空下划线
128
+ 'no-unused-vars': [
129
+ 'error',
130
+ {
131
+ argsIgnorePattern: '^_.*', // 忽略以下划线开头的参数
132
+ varsIgnorePattern: '^_.*', // 忽略以下划线开头的变量
133
+ },
134
+ ], // 禁止未使用的变量
135
+ 'no-unneeded-ternary': 'warn', // 当存在更简单的替代项时,不允许使用三元运算符
136
+ 'no-useless-constructor': 'warn', // 不允许不必要的构造函数
137
+ 'no-var': 'error', // 需要 let 或 const 而不是 var
138
+ 'object-shorthand': 'warn', // 需要或禁止对象文本的方法和属性速记语法
139
+ 'one-var': ['warn', 'never'], // 强制在函数中一起或单独声明变量
140
+ 'prefer-arrow-callback': 'warn', // 要求使用箭头函数进行回调
141
+ 'prefer-const': [
142
+ 'error',
143
+ { destructuring: 'any', ignoreReadBeforeAssign: false },
144
+ ], // 要求对在声明后从不重新分配的变量进行 const 声明
145
+ 'prefer-destructuring': [
146
+ 'warn',
147
+ {
148
+ VariableDeclarator: { array: false, object: true },
149
+ AssignmentExpression: { array: true, object: false },
150
+ },
151
+ { enforceForRenamedProperties: false },
152
+ ], // 需要从数组和/或对象中解构
153
+ 'prefer-rest-params': 'warn', // 需要 rest 参数而不是参数
154
+ 'prefer-spread': 'warn', // 需要扩展运算符而不是 .apply()
155
+ 'prefer-template': 'error', // 需要模板文本而不是字符串连接
156
+ quotes: ['warn', 'single', { allowTemplateLiterals: false }], // 强制一致使用反引号、双引号或单引号
157
+ radix: 'warn', // 在使用 parseInt() 时强制一致地使用 radix 参数
158
+ semi: ['error', 'always'], // 需要或不允许使用分号代替 ASI
159
+ },
160
+ },
161
+ ];
@@ -1 +1,30 @@
1
- module.exports={plugins:["prettier","chalk"],rules:{"chalk/chalk":["warn",{icon:"💡",hexColor:"#f00",message:"Prettier 规则仍在开发中,不建议在公司项目中使用,可能会导致 CodeCC 检查出错。"}],"wrap-iife":"off","template-curly-spacing":"off","space-infix-ops":"off","space-in-parens":"off","space-before-blocks":"off","quote-props":"off","padded-blocks":"off","operator-linebreak":"off","object-curly-spacing":"off","nonblock-statement-body-position":"off","no-whitespace-before-property":"off","no-trailing-spaces":"off","no-multiple-empty-lines":"off","no-mixed-operators":"off","no-confusing-arrow":"off","newline-per-chained-call":"off","max-len":"off","linebreak-style":"off","key-spacing":"off","implicit-arrow-linebreak":"off","generator-star-spacing":"off","function-paren-newline":"off","eol-last":"off","computed-property-spacing":"off","comma-style":"off","comma-dangle":"off","block-spacing":"off","arrow-spacing":"off","arrow-parens":"off","array-bracket-spacing":"off","@typescript-eslint/type-annotation-spacing":"off","@typescript-eslint/space-before-function-paren":"off","@typescript-eslint/semi":"off","@typescript-eslint/quotes":"off","@typescript-eslint/keyword-spacing":"off","@typescript-eslint/indent":"off","@typescript-eslint/func-call-spacing":"off","@typescript-eslint/comma-spacing":"off","@typescript-eslint/brace-style":"off","prettier/prettier":["warn",{printWidth:120,tabWidth:2,useTabs:false,semi:true,singleQuote:true,quoteProps:"as-needed",jsxSingleQuote:false,trailingComma:"all",bracketSpacing:true,jsxBracketSameLine:false,arrowParens:"always",rangeStart:0,rangeEnd:null,requirePragma:false,insertPragma:false,proseWrap:"preserve",htmlWhitespaceSensitivity:"css",vueIndentScriptAndStyle:false,endOfLine:"lf",embeddedLanguageFormatting:"auto"},{usePrettierrc:false}]}};
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
27
+
28
+ module.exports = [
29
+ eslintPluginPrettierRecommended, // 启用eslint-plugin-prettier,使用eslint-config-prettier关闭eslint的冲突规则
30
+ ];
package/tencent/ts.js CHANGED
@@ -1 +1,76 @@
1
- module.exports={plugins:["@typescript-eslint"],rules:{"brace-style":"off","no-empty-function":"off","no-invalid-this":"off","no-magic-numbers":"off","react/sort-comp":"off","func-call-spacing":"off","comma-spacing":"off","dot-notation":"off",indent:"off","keyword-spacing":"off",camelcase:"off","no-underscore-dangle":"off","no-array-constructor":"off","no-dupe-class-members":"off","no-undef":"off","no-unused-vars":"off","no-useless-constructor":"off",quotes:"off",semi:"off","space-before-function-paren":"off","spaced-comment":["error","always",{markers:["/"]}],"@typescript-eslint/adjacent-overload-signatures":"error","@typescript-eslint/brace-style":"error","@typescript-eslint/comma-spacing":["error",{before:false,after:true}],"@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/explicit-member-accessibility":"off","@typescript-eslint/func-call-spacing":["error","never"],"@typescript-eslint/indent":["warn",2,{SwitchCase:1,VariableDeclarator:1,outerIIFEBody:1,FunctionDeclaration:{parameters:1,body:1},FunctionExpression:{parameters:1,body:1},CallExpression:{arguments:1},ArrayExpression:1,ObjectExpression:1,ImportDeclaration:1,flatTernaryExpressions:false,ignoredNodes:["JSXElement","JSXElement > *","JSXAttribute","JSXIdentifier","JSXNamespacedName","JSXMemberExpression","JSXSpreadAttribute","JSXExpressionContainer","JSXOpeningElement","JSXClosingElement","JSXFragment","JSXOpeningFragment","JSXClosingFragment","JSXText","JSXEmptyExpression","JSXSpreadChild"],ignoreComments:false}],"@typescript-eslint/keyword-spacing":["error",{overrides:{if:{after:true},for:{after:true},while:{after:true},else:{after:true}},before:true,after:true}],"@typescript-eslint/member-ordering":["error",{default:["public-static-field","protected-static-field","private-static-field","static-field","public-static-method","protected-static-method","private-static-method","static-method","public-instance-field","protected-instance-field","private-instance-field","public-field","protected-field","private-field","instance-field","field","constructor","public-instance-method","protected-instance-method","private-instance-method","public-method","protected-method","private-method","instance-method","method"]}],"@typescript-eslint/method-signature-style":"off","@typescript-eslint/no-array-constructor":"error","@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-empty-interface":"error","@typescript-eslint/no-inferrable-types":"warn","@typescript-eslint/no-namespace":["error",{allowDeclarations:true,allowDefinitionFiles:true}],"@typescript-eslint/no-non-null-asserted-optional-chain":"error","@typescript-eslint/no-parameter-properties":"off","@typescript-eslint/no-require-imports":"error","@typescript-eslint/no-this-alias":["error",{allowDestructuring:true}],"@typescript-eslint/no-unused-expressions":["error",{allowShortCircuit:true,allowTernary:true,allowTaggedTemplates:true}],"@typescript-eslint/no-unused-vars":["error",{args:"after-used",ignoreRestSiblings:true,argsIgnorePattern:"^_.+",varsIgnorePattern:"^_.+"}],"@typescript-eslint/no-useless-constructor":"warn","@typescript-eslint/prefer-for-of":"warn","@typescript-eslint/prefer-function-type":"off","@typescript-eslint/prefer-namespace-keyword":"error","@typescript-eslint/quotes":["warn","single",{allowTemplateLiterals:false}],"@typescript-eslint/semi":["error","always"],"@typescript-eslint/space-before-function-paren":["error",{anonymous:"always",named:"never",asyncArrow:"always"}],"@typescript-eslint/triple-slash-reference":["error",{path:"never",types:"always",lib:"always"}],"@typescript-eslint/type-annotation-spacing":"error","@typescript-eslint/typedef":["error",{arrayDestructuring:false,arrowParameter:false,memberVariableDeclaration:false,objectDestructuring:false,parameter:false,propertyDeclaration:true,variableDeclaration:false}],"@typescript-eslint/unified-signatures":"error"}};
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const parserTypeScript = require('@typescript-eslint/parser');
27
+ const pluginTypeScript = require('@typescript-eslint/eslint-plugin');
28
+
29
+ module.exports = [
30
+ {
31
+ files: ['**/*.?([cm])ts', '**/*.?([cm])tsx'],
32
+ languageOptions: {
33
+ parser: parserTypeScript,
34
+ parserOptions: {
35
+ sourceType: 'module',
36
+ },
37
+ },
38
+ plugins: {
39
+ '@typescript-eslint': pluginTypeScript,
40
+ },
41
+ rules: {
42
+ ...pluginTypeScript.configs.recommended.rules,
43
+ camelcase: 'off',
44
+ 'dot-notation': 'off',
45
+ 'no-array-constructor': 'off',
46
+ 'no-dupe-class-members': 'off',
47
+ 'no-empty-function': 'off',
48
+ 'no-invalid-this': 'off',
49
+ 'no-magic-numbers': 'off',
50
+ 'no-undef': 'off',
51
+ 'no-underscore-dangle': 'off',
52
+ 'no-unused-vars': 'off',
53
+ 'no-useless-constructor': 'off',
54
+ '@typescript-eslint/no-array-constructor': 'error',
55
+ '@typescript-eslint/no-dupe-class-members': 'error',
56
+ '@typescript-eslint/no-unused-vars': [
57
+ 'error',
58
+ {
59
+ args: 'after-used',
60
+ ignoreRestSiblings: true,
61
+ argsIgnorePattern: '^_.*',
62
+ varsIgnorePattern: '^_.*',
63
+ },
64
+ ],
65
+ '@typescript-eslint/no-useless-constructor': 'warn',
66
+ },
67
+ },
68
+ {
69
+ files: ['*.d.ts'],
70
+ rules: {
71
+ 'eslint-comments/no-unlimited-disable': 'off',
72
+ 'import/no-duplicates': 'off',
73
+ 'unused-imports/no-unused-vars': 'off',
74
+ },
75
+ },
76
+ ];