@blueking/bkui-lint 0.0.5 → 0.1.0-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bkui-lint",
3
- "version": "0.0.5",
3
+ "version": "0.1.0-beta.0",
4
4
  "description": "蓝鲸监控平台公共lint工具",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -15,26 +15,31 @@
15
15
  "registry": "https://registry.npmjs.org/"
16
16
  },
17
17
  "dependencies": {
18
- "@typescript-eslint/eslint-plugin": "^7.12.0",
19
- "@typescript-eslint/parser": "^7.12.0",
20
- "eslint": "^9.4.0",
21
- "eslint-config-prettier": "^9.1.0",
22
- "eslint-config-tencent": "^1.0.4",
18
+ "@biomejs/biome": "^2.1.2",
19
+ "@eslint/js": "^9.31.0",
20
+ "eslint": "^9.31.0",
21
+ "eslint-config-prettier": "^10.1.8",
22
+ "eslint-config-tencent": "^1.1.3",
23
23
  "eslint-plugin-codecc": "1.0.0-beta.1",
24
- "eslint-plugin-perfectionist": "^2.10.0",
25
- "eslint-plugin-prettier": "^5.1.3",
26
- "eslint-plugin-vue": "^9.26.0",
27
- "postcss-html": "^1.7.0",
24
+ "eslint-plugin-perfectionist": "^4.15.0",
25
+ "eslint-plugin-prettier": "^5.5.3",
26
+ "eslint-plugin-vue": "^10.3.0",
27
+ "lint-staged": "16.1.2",
28
+ "picocolors": "^1.0.0",
29
+ "postcss-html": "^1.8.0",
28
30
  "postcss-less": "^6.0.0",
29
31
  "postcss-scss": "^4.0.9",
30
- "prettier": "^3.3.1",
31
- "stylelint": "^16.6.1",
32
- "stylelint-config-recess-order": "^5.0.1",
33
- "stylelint-config-recommended-vue": "^1.5.0",
34
- "stylelint-config-standard": "^36.0.0",
35
- "stylelint-order": "^6.0.4",
36
- "stylelint-scss": "^6.3.1",
37
- "vue-eslint-parser": "^9.4.3"
32
+ "prettier": "^3.6.2",
33
+ "simple-git-hooks": "^2.13.0",
34
+ "stylelint": "^16.22.0",
35
+ "stylelint-config-recess-order": "^7.1.0",
36
+ "stylelint-config-recommended-vue": "1.5.0",
37
+ "stylelint-config-standard": "^38.0.0",
38
+ "stylelint-config-standard-scss": "^15.0.1",
39
+ "stylelint-order": "^7.0.0",
40
+ "stylelint-scss": "^6.12.1",
41
+ "typescript": "^5.8.3",
42
+ "typescript-eslint": "^8.38.0"
38
43
  },
39
44
  "scripts": {}
40
45
  }
package/eslint.js DELETED
@@ -1,340 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- /* eslint-disable @typescript-eslint/no-require-imports */
3
- const typescriptEslint = require('@typescript-eslint/eslint-plugin');
4
- const eslintConfigPrettier = require('eslint-config-prettier');
5
- const prettier = require('eslint-plugin-prettier');
6
- const typescriptEslintParser = require('@typescript-eslint/parser');
7
- const codecc = require('eslint-plugin-codecc');
8
- const eslintVueParser = require('vue-eslint-parser');
9
- const perfectionist = require('eslint-plugin-perfectionist');
10
- const eslintVuePlugin = require('eslint-plugin-vue');
11
- const { rules: tencentEslintLegacyRules } = require('eslint-config-tencent/ts');
12
- const prettierConfig = require('./prettier');
13
- const OFF = 0;
14
- // const WARNING = 1;
15
- const ERROR = 2;
16
- // deprecating formatting rules https://typescript-eslint.io/blog/deprecating-formatting-rules
17
- const deprecateRules = Object.fromEntries(
18
- [
19
- 'ban-ts-comment',
20
- 'block-spacing',
21
- 'brace-style',
22
- 'comma-dangle',
23
- 'comma-spacing',
24
- 'func-call-spacing',
25
- 'indent',
26
- 'key-spacing',
27
- 'keyword-spacing',
28
- 'lines-around-comment',
29
- 'lines-between-class-members',
30
- 'member-delimiter-style',
31
- 'no-extra-parens',
32
- 'no-extra-semi',
33
- 'padding-line-between-statements',
34
- 'quotes',
35
- 'semi',
36
- 'space-before-blocks',
37
- 'space-before-function-paren',
38
- 'space-infix-ops',
39
- 'type-annotation-spacing',
40
- ].map(rule => [`@typescript-eslint/${rule}`, OFF]),
41
- );
42
- const jsxOrVueSortGroups = {
43
- 'custom-groups': {
44
- DEFINITION: '*(is|vIs|v-is)',
45
- LIST_RENDERING: '*(v-for|vFor)',
46
- CONDITIONALS: '*(v-if|v-else-if|v-else|vIf|vElseIf|vElse)',
47
- RENDER_MODIFIERS: '*(v-pre|v-once|vPre|vOnce)',
48
- GLOBAL: 'id',
49
- UNIQUE: '*(ref|key)',
50
- WIDTH: 'width',
51
- HEIGHT: 'height',
52
- STYLE: '*style',
53
- CLASS: '*(class|ext-cls|extCls)',
54
- TWO_WAY_BINDING: '*(v-model|vModel)',
55
- SLOT: '*(v-slot|slot|vSlot)',
56
- OTHER_DIRECTIVES: 'v-*',
57
- EVENTS: '*(on*|v-on|vOn|@*)',
58
- CONTENT: '*(v-html|v-text|vHtml|vText)',
59
- },
60
- groups: [
61
- 'DEFINITION',
62
- 'LIST_RENDERING',
63
- 'CONDITIONALS',
64
- 'RENDER_MODIFIERS',
65
- 'GLOBAL',
66
- 'UNIQUE',
67
- 'STYLE',
68
- 'WIDTH',
69
- 'HEIGHT',
70
- 'CLASS',
71
- 'TWO_WAY_BINDING',
72
- 'SLOT',
73
- 'OTHER_DIRECTIVES',
74
- 'multiline',
75
- 'unknown',
76
- 'shorthand',
77
- 'EVENTS',
78
- ],
79
- };
80
- module.exports = [
81
- {
82
- files: ['*.js', '**/*.js', '*.ts', '**/*.ts'],
83
- ignores: ['*.tsx', '**/*.tsx', '*.vue', '**/*.vue'],
84
- plugins: { perfectionist },
85
- rules: {
86
- 'perfectionist/sort-classes': [
87
- ERROR,
88
- {
89
- groups: [
90
- 'decorated-accessor-property',
91
- 'static-private-method',
92
- 'private-property',
93
- 'static-property',
94
- 'index-signature',
95
- 'private-method',
96
- 'static-method',
97
- 'property',
98
- 'private-decorated-accessor-property',
99
- 'private-decorated-property',
100
- 'decorated-property',
101
- 'constructor',
102
- ['get-method', 'set-method'],
103
- 'decorated-set-method',
104
- 'decorated-get-method',
105
- 'decorated-method',
106
- 'unknown',
107
- 'method',
108
- ],
109
- order: 'asc',
110
- type: 'natural',
111
- },
112
- ],
113
- // 'perfectionist/sort-objects': [
114
- // ERROR,
115
- // {
116
- // 'custom-groups': {
117
- // ID: '*(id|ID|Id)',
118
- // NAME: '*(name|Name|NAME)',
119
- // path: 'path',
120
- // // components: 'components',
121
- // // directives: 'directives',
122
- // // emits: 'emits',
123
- // // props: 'props',
124
- // // setup: 'setup',
125
- // // render: 'render',
126
- // },
127
- // groups: ['ID', 'NAME', 'path', 'unknown'],
128
- // order: 'asc',
129
- // 'partition-by-comment': 'Part:**',
130
- // type: 'natural',
131
- // },
132
- // ],
133
- },
134
- },
135
- {
136
- plugins: { perfectionist },
137
- rules: {
138
- 'perfectionist/sort-enums': [
139
- ERROR,
140
- {
141
- order: 'asc',
142
- type: 'natural',
143
- },
144
- ],
145
- 'perfectionist/sort-exports': [
146
- ERROR,
147
- {
148
- order: 'asc',
149
- type: 'natural',
150
- },
151
- ],
152
- 'perfectionist/sort-imports': [
153
- ERROR,
154
- {
155
- 'custom-groups': {
156
- type: {
157
- magicBox: 'magicBox',
158
- top: 'top',
159
- tsxSupport: 'tsxSupport',
160
- vueI18n: 'vueI18n',
161
- },
162
- value: {
163
- magicBox: ['./common/import-magicbox-ui', 'monitor-ui/directive/index', 'monitor-static/svg-icons'],
164
- top: ['./public-path', './public-path.ts', 'monitor-common/polyfill'],
165
- tsxSupport: ['vue-property-decorator', 'vue-tsx-support'],
166
- vueI18n: ['./i18n/i18n', 'vue', 'vue-*'],
167
- },
168
- },
169
- groups: [
170
- 'top',
171
- 'vueI18n',
172
- 'magicBox',
173
- 'tsxSupport',
174
- ['builtin', 'external'],
175
- ['internal', 'sibling', 'parent', 'side-effect', 'index', 'object'],
176
- 'unknown',
177
- ['type', 'builtin-type', 'external-type', 'internal-type', 'parent-type', 'sibling-type', 'index-type'],
178
- ['style', 'side-effect-style'],
179
- ],
180
- 'internal-pattern': ['@/*', '@router/*', '@store/*', '@page/*', '@static/*'],
181
- 'newlines-between': 'always',
182
- order: 'asc',
183
- type: 'natural',
184
- },
185
- ],
186
- 'perfectionist/sort-jsx-props': [
187
- ERROR,
188
- {
189
- ...jsxOrVueSortGroups,
190
- order: 'asc',
191
- type: 'natural',
192
- },
193
- ],
194
- 'perfectionist/sort-maps': [
195
- ERROR,
196
- {
197
- order: 'asc',
198
- type: 'natural',
199
- },
200
- ],
201
- // 'perfectionist/sort-intersection-types': [
202
- // ERROR,
203
- // {
204
- // type: 'natural',
205
- // order: 'asc',
206
- // },
207
- // ],
208
- 'perfectionist/sort-union-types': [
209
- ERROR,
210
- {
211
- order: 'asc',
212
- type: 'natural',
213
- },
214
- ],
215
- 'perfectionist/sort-vue-attributes': [
216
- ERROR,
217
- {
218
- ...jsxOrVueSortGroups,
219
- type: 'natural',
220
- order: 'asc',
221
- },
222
- ],
223
- },
224
- },
225
- {
226
- plugins: { prettier },
227
- rules: {
228
- ...prettier.configs.recommended.rules,
229
- 'prettier/prettier': [
230
- ERROR,
231
- {
232
- ...prettierConfig,
233
- },
234
- ],
235
- },
236
- },
237
- {
238
- files: ['*.js', '**/*.js', '*.ts', '**/*.ts', '*.tsx', '**/*.tsx'],
239
- ignores: [],
240
- languageOptions: {
241
- parser: typescriptEslintParser,
242
- parserOptions: {
243
- ecmaVersion: 'latest',
244
- project: true,
245
- },
246
- },
247
- plugins: {
248
- '@typescript-eslint': typescriptEslint,
249
- codecc,
250
- },
251
- rules: {
252
- 'codecc/license': [
253
- ERROR,
254
- {
255
- license: `/*
256
- * Tencent is pleased to support the open source community by making
257
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
258
- *
259
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
260
- *
261
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
262
- *
263
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
264
- *
265
- * ---------------------------------------------------
266
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
267
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
268
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
269
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
270
- *
271
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
272
- * the Software.
273
- *
274
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
275
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
276
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
277
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
278
- * IN THE SOFTWARE.
279
- */\n`,
280
- pattern: '.*Tencent is pleased to support the open source community.+',
281
- },
282
- ],
283
- ...typescriptEslint.configs.recommended.rules,
284
- ...tencentEslintLegacyRules,
285
- ...deprecateRules,
286
- '@typescript-eslint/consistent-type-imports': [
287
- ERROR,
288
- {
289
- prefer: 'type-imports',
290
- disallowTypeAnnotations: true,
291
- fixStyle: 'inline-type-imports',
292
- },
293
- ],
294
- },
295
- },
296
- ...eslintVuePlugin.configs['flat/recommended'].map(config =>
297
- config.files
298
- ? {
299
- ...config,
300
- files: ['*.vue', '**/*.vue'],
301
- languageOptions: {
302
- ...config.languageOptions,
303
- parser: eslintVueParser,
304
- parserOptions: {
305
- ...config.languageOptions.parserOptions,
306
- allowAutomaticSingleRunInference: false,
307
- ecmaFeatures: { jsx: true, legacyDecorators: true },
308
- ecmaVersion: 'latest',
309
- extraFileExtensions: ['.vue'],
310
- parser: typescriptEslintParser,
311
- project: true,
312
- tsconfigRootDir: process.cwd(),
313
- },
314
- },
315
- plugins: {
316
- '@typescript-eslint': typescriptEslint,
317
- vue: eslintVuePlugin,
318
- },
319
- rules: {
320
- ...config.rules,
321
- ...tencentEslintLegacyRules,
322
- '@typescript-eslint/explicit-member-accessibility': OFF,
323
- 'comma-dangle': [ERROR, 'always-multiline'],
324
- ...deprecateRules,
325
- },
326
- }
327
- : config,
328
- ),
329
- {
330
- rules: {
331
- 'vue/html-self-closing': OFF,
332
- 'vue/require-default-prop': OFF,
333
- 'vue/attributes-order': OFF,
334
- },
335
- },
336
- eslintConfigPrettier,
337
- {
338
- ignores: ['**/node_modules/'],
339
- },
340
- ];
package/prettier.js DELETED
@@ -1,40 +0,0 @@
1
- /*
2
- * Tencent is pleased to support the open source community by making
3
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
4
- *
5
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
- *
7
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
8
- *
9
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
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
- arrowParens: 'avoid',
28
- bracketSameLine: false,
29
- jsxSingleQuote: true,
30
- printWidth: 120,
31
- quoteProps: 'as-needed',
32
- semi: true,
33
- singleAttributePerLine: true,
34
- singleQuote: true,
35
- tabWidth: 2,
36
- trailingComma: 'all',
37
- useTabs: false,
38
- vueIndentScriptAndStyle: true,
39
- jsxBracketSameLine: false,
40
- };
package/stylelint.js DELETED
@@ -1,74 +0,0 @@
1
- /*
2
- * Tencent is pleased to support the open source community by making
3
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
4
- *
5
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
- *
7
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
8
- *
9
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
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: ['stylelint-config-recommended-vue', 'stylelint-config-recess-order'],
28
- overrides: [
29
- {
30
- customSyntax: 'postcss-scss',
31
- files: ['*.scss', '*.css', '**/*.scss', '**/*.css'],
32
- },
33
- {
34
- customSyntax: 'postcss-html',
35
- files: ['*.vue', './**/*.vue'],
36
- },
37
- {
38
- customSyntax: 'postcss-less',
39
- files: ['*.less', './**/*.less'],
40
- },
41
- ],
42
- plugins: ['stylelint-scss', 'stylelint-order'],
43
- rules: {
44
- 'at-rule-no-unknown': [
45
- true,
46
- {
47
- ignoreAtRules: ['/.*/'],
48
- },
49
- ],
50
- 'at-rule-no-vendor-prefix': true,
51
- 'comment-empty-line-before': ['always', { except: ['first-nested'] }],
52
- // 不能用important
53
- 'declaration-no-important': true,
54
- // Sass rules
55
- 'max-nesting-depth': 10,
56
- // 不要使用已被 autoprefixer 支持的浏览器前缀
57
- 'media-feature-name-no-vendor-prefix': true,
58
- 'order/order': ['declarations', { type: 'at-rule' }, { hasBlock: true, type: 'at-rule' }, 'rules'],
59
- 'property-no-vendor-prefix': true,
60
- // 去掉多个import、extends、父子声明之间的空行 --开始
61
- 'rule-empty-line-before': [
62
- 'always',
63
- {
64
- except: ['first-nested'],
65
- ignore: ['after-comment'],
66
- },
67
- ],
68
- 'scss/at-extend-no-missing-placeholder': true,
69
- 'scss/dollar-variable-pattern': '^_?[a-z]+[\\w-]*$',
70
- 'selector-max-id': 3,
71
- 'selector-no-vendor-prefix': true,
72
- 'value-no-vendor-prefix': true,
73
- },
74
- };