@frabbit/eslint-config 1.5.14 → 7.4.5
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/LICENSE +1 -1
- package/README.md +39 -34
- package/dist/index.d.mts +14606 -0
- package/dist/index.mjs +1117 -0
- package/package.json +79 -57
- package/dist/index.cjs +0 -1409
- package/dist/index.d.cts +0 -107
- package/dist/index.d.ts +0 -107
- package/dist/index.js +0 -1303
package/dist/index.js
DELETED
|
@@ -1,1303 +0,0 @@
|
|
|
1
|
-
// src/plugins.ts
|
|
2
|
-
import * as _pluginAntfu from "eslint-plugin-antfu";
|
|
3
|
-
import * as _pluginComments from "eslint-plugin-eslint-comments";
|
|
4
|
-
import * as _pluginMarkdown from "eslint-plugin-markdown";
|
|
5
|
-
import * as _pluginTypeScript from "@typescript-eslint/eslint-plugin";
|
|
6
|
-
import * as _pluginUnicorn from "eslint-plugin-unicorn";
|
|
7
|
-
import * as _pluginVue from "eslint-plugin-vue";
|
|
8
|
-
import * as _pluginUnocss from "@unocss/eslint-plugin";
|
|
9
|
-
import * as _pluginPrettier from "eslint-plugin-prettier";
|
|
10
|
-
import * as _configPrettier from "eslint-config-prettier";
|
|
11
|
-
import * as pluginSonar from "eslint-plugin-sonarjs";
|
|
12
|
-
import * as _pluginSecurity from "eslint-plugin-security";
|
|
13
|
-
import * as pluginImport from "eslint-plugin-i";
|
|
14
|
-
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
15
|
-
import * as pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
16
|
-
import * as pluginYml from "eslint-plugin-yml";
|
|
17
|
-
import * as parserTypeScript from "@typescript-eslint/parser";
|
|
18
|
-
import * as parserVue from "vue-eslint-parser";
|
|
19
|
-
import * as parserYml from "yaml-eslint-parser";
|
|
20
|
-
import * as parserJsonc from "jsonc-eslint-parser";
|
|
21
|
-
// @__NO_SIDE_EFFECTS__
|
|
22
|
-
function interopDefault(m) {
|
|
23
|
-
return m.default || m;
|
|
24
|
-
}
|
|
25
|
-
var pluginAntfu = /* @__PURE__ */ interopDefault(_pluginAntfu);
|
|
26
|
-
var pluginComments = /* @__PURE__ */ interopDefault(_pluginComments);
|
|
27
|
-
var pluginMarkdown = /* @__PURE__ */ interopDefault(_pluginMarkdown);
|
|
28
|
-
var pluginTypeScript = /* @__PURE__ */ interopDefault(_pluginTypeScript);
|
|
29
|
-
var pluginUnicorn = /* @__PURE__ */ interopDefault(_pluginUnicorn);
|
|
30
|
-
var pluginVue = /* @__PURE__ */ interopDefault(_pluginVue);
|
|
31
|
-
var pluginUnocss = /* @__PURE__ */ interopDefault(_pluginUnocss);
|
|
32
|
-
var pluginPrettier = /* @__PURE__ */ interopDefault(_pluginPrettier);
|
|
33
|
-
var configPrettier = /* @__PURE__ */ interopDefault(_configPrettier);
|
|
34
|
-
var pluginSecurity = /* @__PURE__ */ interopDefault(_pluginSecurity);
|
|
35
|
-
|
|
36
|
-
// src/configs/comments.ts
|
|
37
|
-
var comments = [
|
|
38
|
-
{
|
|
39
|
-
plugins: {
|
|
40
|
-
"eslint-comments": pluginComments
|
|
41
|
-
},
|
|
42
|
-
rules: {
|
|
43
|
-
...pluginComments.configs.recommended.rules,
|
|
44
|
-
"eslint-comments/disable-enable-pair": [
|
|
45
|
-
"error",
|
|
46
|
-
{ allowWholeFile: true }
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
// src/globs.ts
|
|
53
|
-
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
54
|
-
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
55
|
-
var GLOB_JS = "**/*.?([cm])js";
|
|
56
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
57
|
-
var GLOB_TS = "**/*.?([cm])ts";
|
|
58
|
-
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
59
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
60
|
-
var GLOB_CSS = "**/*.css";
|
|
61
|
-
var GLOB_LESS = "**/*.less";
|
|
62
|
-
var GLOB_SCSS = "**/*.scss";
|
|
63
|
-
var GLOB_JSON = "**/*.json";
|
|
64
|
-
var GLOB_JSON5 = "**/*.json5";
|
|
65
|
-
var GLOB_JSONC = "**/*.jsonc";
|
|
66
|
-
var GLOB_MARKDOWN = "**/*.md";
|
|
67
|
-
var GLOB_VUE = "**/*.vue";
|
|
68
|
-
var GLOB_NUXT_PAGE = "pages/**/*.vue";
|
|
69
|
-
var GLOB_NUXT_LAYOUTS = "layouts/**/*.vue";
|
|
70
|
-
var GLOB_YAML = "**/*.y?(a)ml";
|
|
71
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
72
|
-
var GLOB_ALL_SRC = [
|
|
73
|
-
GLOB_SRC,
|
|
74
|
-
GLOB_STYLE,
|
|
75
|
-
GLOB_JSON,
|
|
76
|
-
GLOB_JSON5,
|
|
77
|
-
GLOB_MARKDOWN,
|
|
78
|
-
GLOB_VUE,
|
|
79
|
-
GLOB_NUXT_PAGE,
|
|
80
|
-
GLOB_NUXT_LAYOUTS,
|
|
81
|
-
GLOB_YAML,
|
|
82
|
-
GLOB_HTML
|
|
83
|
-
];
|
|
84
|
-
var GLOB_NODE_MODULES = "**/node_modules";
|
|
85
|
-
var GLOB_DIST = "**/dist";
|
|
86
|
-
var GLOB_LOCKFILE = [
|
|
87
|
-
"**/package-lock.json",
|
|
88
|
-
"**/yarn.lock",
|
|
89
|
-
"**/pnpm-lock.yaml"
|
|
90
|
-
];
|
|
91
|
-
var GLOB_EXCLUDE = [
|
|
92
|
-
GLOB_NODE_MODULES,
|
|
93
|
-
GLOB_DIST,
|
|
94
|
-
...GLOB_LOCKFILE,
|
|
95
|
-
"**/output",
|
|
96
|
-
"**/coverage",
|
|
97
|
-
"**/temp",
|
|
98
|
-
"**/fixtures",
|
|
99
|
-
"**/.vitepress/cache",
|
|
100
|
-
"**/.nuxt",
|
|
101
|
-
"**/.vercel",
|
|
102
|
-
"**/.changeset",
|
|
103
|
-
"**/.idea",
|
|
104
|
-
"**/.output",
|
|
105
|
-
"**/.vite-inspect",
|
|
106
|
-
"**/CHANGELOG*.md",
|
|
107
|
-
"**/*.min.*",
|
|
108
|
-
"**/LICENSE*",
|
|
109
|
-
"**/__snapshots__",
|
|
110
|
-
"**/auto-import?(s).d.ts",
|
|
111
|
-
"**/components.d.ts"
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
// src/configs/ignores.ts
|
|
115
|
-
var ignores = [{ ignores: GLOB_EXCLUDE }];
|
|
116
|
-
|
|
117
|
-
// src/configs/imports.ts
|
|
118
|
-
var imports = [
|
|
119
|
-
{
|
|
120
|
-
plugins: {
|
|
121
|
-
antfu: pluginAntfu,
|
|
122
|
-
import: pluginImport
|
|
123
|
-
},
|
|
124
|
-
rules: {
|
|
125
|
-
"antfu/import-dedupe": "error",
|
|
126
|
-
"import/first": "error",
|
|
127
|
-
"import/newline-after-import": ["error", { count: 1 }],
|
|
128
|
-
"import/no-default-export": "error",
|
|
129
|
-
"import/no-duplicates": "error",
|
|
130
|
-
"import/no-mutable-exports": "error",
|
|
131
|
-
"import/no-named-default": "error",
|
|
132
|
-
"import/no-self-import": "error",
|
|
133
|
-
"import/no-webpack-loader-syntax": "error",
|
|
134
|
-
"import/order": [
|
|
135
|
-
"error",
|
|
136
|
-
{
|
|
137
|
-
alphabetize: { caseInsensitive: true, order: "asc" },
|
|
138
|
-
groups: [
|
|
139
|
-
"builtin",
|
|
140
|
-
"external",
|
|
141
|
-
"internal",
|
|
142
|
-
"parent",
|
|
143
|
-
"sibling",
|
|
144
|
-
"index",
|
|
145
|
-
"object",
|
|
146
|
-
"type"
|
|
147
|
-
],
|
|
148
|
-
"newlines-between": "always",
|
|
149
|
-
pathGroups: [{ group: "internal", pattern: "{{@,~}/,#}**" }],
|
|
150
|
-
pathGroupsExcludedImportTypes: ["type"]
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
files: [
|
|
157
|
-
`**/*config*.${GLOB_SRC_EXT}`,
|
|
158
|
-
`**/views/${GLOB_SRC}`,
|
|
159
|
-
`**/pages/${GLOB_SRC}`,
|
|
160
|
-
`**/{index,vite,esbuild,rollup,webpack,rspack}.ts`,
|
|
161
|
-
"**/*.d.ts",
|
|
162
|
-
`${GLOB_MARKDOWN}/**`
|
|
163
|
-
],
|
|
164
|
-
plugins: {
|
|
165
|
-
import: pluginImport
|
|
166
|
-
},
|
|
167
|
-
rules: {
|
|
168
|
-
"import/no-default-export": "off"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
];
|
|
172
|
-
|
|
173
|
-
// src/configs/javascript.ts
|
|
174
|
-
import globals from "globals";
|
|
175
|
-
|
|
176
|
-
// src/env.ts
|
|
177
|
-
import process2 from "node:process";
|
|
178
|
-
import { isPackageExists } from "local-pkg";
|
|
179
|
-
var isInEditor = (process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI;
|
|
180
|
-
var hasTypeScript = isPackageExists("typescript");
|
|
181
|
-
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
182
|
-
|
|
183
|
-
// src/configs/javascript.ts
|
|
184
|
-
var javascript = [
|
|
185
|
-
{
|
|
186
|
-
languageOptions: {
|
|
187
|
-
globals: {
|
|
188
|
-
...globals.browser,
|
|
189
|
-
...globals.es2021,
|
|
190
|
-
...globals.node
|
|
191
|
-
},
|
|
192
|
-
parserOptions: {
|
|
193
|
-
ecmaFeatures: {
|
|
194
|
-
jsx: true
|
|
195
|
-
},
|
|
196
|
-
sourceType: "module"
|
|
197
|
-
},
|
|
198
|
-
sourceType: "module"
|
|
199
|
-
},
|
|
200
|
-
plugins: {
|
|
201
|
-
"unused-imports": pluginUnusedImports
|
|
202
|
-
},
|
|
203
|
-
rules: {
|
|
204
|
-
"array-callback-return": "error",
|
|
205
|
-
"block-scoped-var": "error",
|
|
206
|
-
camelcase: [
|
|
207
|
-
"error",
|
|
208
|
-
{
|
|
209
|
-
ignoreDestructuring: true,
|
|
210
|
-
ignoreImports: true,
|
|
211
|
-
properties: "always"
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
"class-methods-use-this": "error",
|
|
215
|
-
"constructor-super": "error",
|
|
216
|
-
"dot-notation": "warn",
|
|
217
|
-
eqeqeq: ["error", "smart"],
|
|
218
|
-
"for-direction": "error",
|
|
219
|
-
"getter-return": "error",
|
|
220
|
-
"no-alert": "warn",
|
|
221
|
-
"no-async-promise-executor": "error",
|
|
222
|
-
"no-await-in-loop": "error",
|
|
223
|
-
"no-case-declarations": "error",
|
|
224
|
-
"no-class-assign": "error",
|
|
225
|
-
"no-compare-neg-zero": "error",
|
|
226
|
-
"no-cond-assign": "error",
|
|
227
|
-
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
228
|
-
"no-const-assign": "error",
|
|
229
|
-
"no-constant-condition": "error",
|
|
230
|
-
"no-control-regex": "error",
|
|
231
|
-
"no-debugger": "warn",
|
|
232
|
-
"no-delete-var": "error",
|
|
233
|
-
"no-dupe-args": "error",
|
|
234
|
-
"no-dupe-class-members": "error",
|
|
235
|
-
"no-dupe-else-if": "error",
|
|
236
|
-
"no-dupe-keys": "error",
|
|
237
|
-
"no-duplicate-case": "error",
|
|
238
|
-
"no-duplicate-imports": "error",
|
|
239
|
-
"no-else-return": "error",
|
|
240
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
241
|
-
"no-empty-character-class": "error",
|
|
242
|
-
"no-empty-pattern": "error",
|
|
243
|
-
"no-ex-assign": "error",
|
|
244
|
-
"no-extend-native": "error",
|
|
245
|
-
"no-extra-bind": "error",
|
|
246
|
-
"no-extra-boolean-cast": "error",
|
|
247
|
-
"no-extra-label": "error",
|
|
248
|
-
"no-fallthrough": ["warn", { commentPattern: "break[\\s\\w]*omitted" }],
|
|
249
|
-
"no-func-assign": "error",
|
|
250
|
-
"no-global-assign": "error",
|
|
251
|
-
"no-import-assign": "error",
|
|
252
|
-
"no-inner-declarations": "error",
|
|
253
|
-
"no-invalid-regexp": "error",
|
|
254
|
-
"no-irregular-whitespace": "error",
|
|
255
|
-
"no-lonely-if": "error",
|
|
256
|
-
"no-loop-func": "error",
|
|
257
|
-
"no-loss-of-precision": "error",
|
|
258
|
-
"no-misleading-character-class": "error",
|
|
259
|
-
"no-mixed-spaces-and-tabs": "error",
|
|
260
|
-
"no-multi-str": "error",
|
|
261
|
-
"no-new-symbol": "error",
|
|
262
|
-
"no-nonoctal-decimal-escape": "error",
|
|
263
|
-
"no-obj-calls": "error",
|
|
264
|
-
"no-octal": "error",
|
|
265
|
-
"no-octal-escape": "error",
|
|
266
|
-
"no-param-reassign": "error",
|
|
267
|
-
"no-proto": "error",
|
|
268
|
-
"no-prototype-builtins": "error",
|
|
269
|
-
"no-redeclare": "error",
|
|
270
|
-
"no-regex-spaces": "error",
|
|
271
|
-
"no-restricted-syntax": [
|
|
272
|
-
"error",
|
|
273
|
-
"ForInStatement",
|
|
274
|
-
"LabeledStatement",
|
|
275
|
-
"WithStatement"
|
|
276
|
-
],
|
|
277
|
-
"no-return-await": "warn",
|
|
278
|
-
"no-self-assign": "error",
|
|
279
|
-
"no-setter-return": "error",
|
|
280
|
-
"no-shadow-restricted-names": "error",
|
|
281
|
-
"no-sparse-arrays": "error",
|
|
282
|
-
"no-this-before-super": "error",
|
|
283
|
-
"no-undef": "error",
|
|
284
|
-
"no-undef-init": "error",
|
|
285
|
-
"no-unexpected-multiline": "error",
|
|
286
|
-
"no-unneeded-ternary": "error",
|
|
287
|
-
"no-unreachable": "error",
|
|
288
|
-
"no-unsafe-finally": "error",
|
|
289
|
-
"no-unsafe-negation": "error",
|
|
290
|
-
"no-unsafe-optional-chaining": "error",
|
|
291
|
-
"no-unused-expressions": [
|
|
292
|
-
"error",
|
|
293
|
-
{
|
|
294
|
-
allowShortCircuit: true,
|
|
295
|
-
allowTaggedTemplates: true,
|
|
296
|
-
allowTernary: true
|
|
297
|
-
}
|
|
298
|
-
],
|
|
299
|
-
"no-unused-labels": "error",
|
|
300
|
-
"no-unused-vars": "off",
|
|
301
|
-
"no-useless-backreference": "error",
|
|
302
|
-
"no-useless-call": "error",
|
|
303
|
-
"no-useless-catch": "error",
|
|
304
|
-
"no-useless-escape": "error",
|
|
305
|
-
"no-useless-return": "error",
|
|
306
|
-
"no-void": "error",
|
|
307
|
-
"no-with": "error",
|
|
308
|
-
"object-shorthand": [
|
|
309
|
-
"error",
|
|
310
|
-
"always",
|
|
311
|
-
{ avoidQuotes: true, ignoreConstructors: false }
|
|
312
|
-
],
|
|
313
|
-
"prefer-arrow-callback": [
|
|
314
|
-
"error",
|
|
315
|
-
{ allowNamedFunctions: false, allowUnboundThis: true }
|
|
316
|
-
],
|
|
317
|
-
"prefer-const": [
|
|
318
|
-
"warn",
|
|
319
|
-
{ destructuring: "all", ignoreReadBeforeAssign: true }
|
|
320
|
-
],
|
|
321
|
-
"prefer-exponentiation-operator": "error",
|
|
322
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
323
|
-
"prefer-rest-params": "error",
|
|
324
|
-
"prefer-spread": "error",
|
|
325
|
-
"prefer-template": "error",
|
|
326
|
-
"require-atomic-updates": "error",
|
|
327
|
-
"require-await": "error",
|
|
328
|
-
"require-yield": "error",
|
|
329
|
-
"sort-imports": [
|
|
330
|
-
"error",
|
|
331
|
-
{
|
|
332
|
-
allowSeparatedGroups: false,
|
|
333
|
-
ignoreCase: false,
|
|
334
|
-
ignoreDeclarationSort: true,
|
|
335
|
-
ignoreMemberSort: false,
|
|
336
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
337
|
-
}
|
|
338
|
-
],
|
|
339
|
-
"unicode-bom": ["error", "never"],
|
|
340
|
-
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
341
|
-
"unused-imports/no-unused-vars": [
|
|
342
|
-
"error",
|
|
343
|
-
{ args: "after-used", ignoreRestSiblings: true }
|
|
344
|
-
],
|
|
345
|
-
"use-isnan": [
|
|
346
|
-
"error",
|
|
347
|
-
{ enforceForIndexOf: true, enforceForSwitchCase: true }
|
|
348
|
-
],
|
|
349
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
350
|
-
"vars-on-top": "error",
|
|
351
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }]
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
files: ["**/scripts/*", "**/cli.*"],
|
|
356
|
-
rules: {
|
|
357
|
-
"no-console": "off"
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
files: ["**/*.{test,spec}.js?(x)"],
|
|
362
|
-
rules: {
|
|
363
|
-
"no-unused-expressions": "off"
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
];
|
|
367
|
-
|
|
368
|
-
// src/configs/jsonc.ts
|
|
369
|
-
var jsonc = [
|
|
370
|
-
{
|
|
371
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
372
|
-
languageOptions: {
|
|
373
|
-
parser: parserJsonc
|
|
374
|
-
},
|
|
375
|
-
plugins: {
|
|
376
|
-
jsonc: pluginJsonc
|
|
377
|
-
},
|
|
378
|
-
rules: {
|
|
379
|
-
...pluginJsonc.configs["recommended-with-jsonc"].rules,
|
|
380
|
-
"jsonc/quote-props": "off",
|
|
381
|
-
"jsonc/quotes": "off"
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
];
|
|
385
|
-
|
|
386
|
-
// src/configs/markdown.ts
|
|
387
|
-
var markdown = [
|
|
388
|
-
{
|
|
389
|
-
files: [GLOB_MARKDOWN],
|
|
390
|
-
plugins: {
|
|
391
|
-
markdown: pluginMarkdown
|
|
392
|
-
},
|
|
393
|
-
processor: "markdown/markdown"
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
397
|
-
languageOptions: {
|
|
398
|
-
parserOptions: {
|
|
399
|
-
ecmaFeatures: {
|
|
400
|
-
impliedStrict: true
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
rules: {
|
|
405
|
-
...pluginMarkdown.configs.recommended.overrides[1].rules,
|
|
406
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
407
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
|
408
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
409
|
-
"@typescript-eslint/no-namespace": "off",
|
|
410
|
-
"@typescript-eslint/no-redeclare": "off",
|
|
411
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
412
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
413
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
414
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
415
|
-
"no-alert": "off",
|
|
416
|
-
"no-console": "off",
|
|
417
|
-
"no-restricted-imports": "off",
|
|
418
|
-
"no-undef": "off",
|
|
419
|
-
"no-unused-expressions": "off",
|
|
420
|
-
"no-unused-vars": "off",
|
|
421
|
-
"unused-imports/no-unused-imports": "off",
|
|
422
|
-
"unused-imports/no-unused-vars": "off"
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
];
|
|
426
|
-
|
|
427
|
-
// src/configs/prettier.ts
|
|
428
|
-
var prettierConflictRules = { ...configPrettier.rules };
|
|
429
|
-
delete prettierConflictRules["vue/html-self-closing"];
|
|
430
|
-
var prettier = [
|
|
431
|
-
{
|
|
432
|
-
plugins: {
|
|
433
|
-
prettier: pluginPrettier
|
|
434
|
-
},
|
|
435
|
-
rules: {
|
|
436
|
-
...prettierConflictRules,
|
|
437
|
-
...pluginPrettier.configs.recommended.rules,
|
|
438
|
-
"prettier/prettier": "warn"
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
];
|
|
442
|
-
|
|
443
|
-
// src/configs/security.ts
|
|
444
|
-
var security = [
|
|
445
|
-
{
|
|
446
|
-
plugins: {
|
|
447
|
-
security: pluginSecurity
|
|
448
|
-
},
|
|
449
|
-
rules: {
|
|
450
|
-
"security/detect-bidi-characters": "warn",
|
|
451
|
-
"security/detect-buffer-noassert": "warn",
|
|
452
|
-
"security/detect-child-process": "warn",
|
|
453
|
-
"security/detect-disable-mustache-escape": "warn",
|
|
454
|
-
"security/detect-eval-with-expression": "warn",
|
|
455
|
-
"security/detect-new-buffer": "warn",
|
|
456
|
-
"security/detect-no-csrf-before-method-override": "warn",
|
|
457
|
-
"security/detect-non-literal-fs-filename": "warn",
|
|
458
|
-
"security/detect-non-literal-regexp": "warn",
|
|
459
|
-
"security/detect-non-literal-require": "warn",
|
|
460
|
-
"security/detect-object-injection": "warn",
|
|
461
|
-
"security/detect-possible-timing-attacks": "warn",
|
|
462
|
-
"security/detect-pseudoRandomBytes": "warn",
|
|
463
|
-
"security/detect-unsafe-regex": "warn"
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
];
|
|
467
|
-
|
|
468
|
-
// src/configs/sonarjs.ts
|
|
469
|
-
var sonarjs = [
|
|
470
|
-
{
|
|
471
|
-
plugins: {
|
|
472
|
-
sonarjs: pluginSonar
|
|
473
|
-
},
|
|
474
|
-
rules: {
|
|
475
|
-
"sonarjs/cognitive-complexity": "error",
|
|
476
|
-
"sonarjs/elseif-without-else": "off",
|
|
477
|
-
"sonarjs/max-switch-cases": "error",
|
|
478
|
-
"sonarjs/no-all-duplicated-branches": "error",
|
|
479
|
-
"sonarjs/no-collapsible-if": "error",
|
|
480
|
-
"sonarjs/no-collection-size-mischeck": "error",
|
|
481
|
-
"sonarjs/no-duplicate-string": "error",
|
|
482
|
-
"sonarjs/no-duplicated-branches": "error",
|
|
483
|
-
"sonarjs/no-element-overwrite": "error",
|
|
484
|
-
"sonarjs/no-empty-collection": "error",
|
|
485
|
-
"sonarjs/no-extra-arguments": "error",
|
|
486
|
-
"sonarjs/no-gratuitous-expressions": "error",
|
|
487
|
-
"sonarjs/no-identical-conditions": "error",
|
|
488
|
-
"sonarjs/no-identical-expressions": "error",
|
|
489
|
-
"sonarjs/no-identical-functions": "error",
|
|
490
|
-
"sonarjs/no-ignored-return": "error",
|
|
491
|
-
"sonarjs/no-inverted-boolean-check": "off",
|
|
492
|
-
"sonarjs/no-nested-switch": "error",
|
|
493
|
-
"sonarjs/no-nested-template-literals": "error",
|
|
494
|
-
"sonarjs/no-one-iteration-loop": "error",
|
|
495
|
-
"sonarjs/no-redundant-boolean": "error",
|
|
496
|
-
"sonarjs/no-redundant-jump": "error",
|
|
497
|
-
"sonarjs/no-same-line-conditional": "error",
|
|
498
|
-
"sonarjs/no-small-switch": "error",
|
|
499
|
-
"sonarjs/no-unused-collection": "error",
|
|
500
|
-
"sonarjs/no-use-of-empty-return-value": "error",
|
|
501
|
-
"sonarjs/no-useless-catch": "error",
|
|
502
|
-
"sonarjs/non-existent-operator": "error",
|
|
503
|
-
"sonarjs/prefer-immediate-return": "error",
|
|
504
|
-
"sonarjs/prefer-object-literal": "error",
|
|
505
|
-
"sonarjs/prefer-single-boolean-return": "error",
|
|
506
|
-
"sonarjs/prefer-while": "error"
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
];
|
|
510
|
-
|
|
511
|
-
// src/configs/sort.ts
|
|
512
|
-
var sortPackageJson = [
|
|
513
|
-
{
|
|
514
|
-
files: ["**/package.json"],
|
|
515
|
-
rules: {
|
|
516
|
-
"jsonc/sort-array-values": [
|
|
517
|
-
"error",
|
|
518
|
-
{
|
|
519
|
-
order: { type: "asc" },
|
|
520
|
-
pathPattern: "^files$"
|
|
521
|
-
}
|
|
522
|
-
],
|
|
523
|
-
"jsonc/sort-keys": [
|
|
524
|
-
"error",
|
|
525
|
-
{
|
|
526
|
-
order: [
|
|
527
|
-
"name",
|
|
528
|
-
"version",
|
|
529
|
-
"private",
|
|
530
|
-
"packageManager",
|
|
531
|
-
"description",
|
|
532
|
-
"type",
|
|
533
|
-
"keywords",
|
|
534
|
-
"license",
|
|
535
|
-
"homepage",
|
|
536
|
-
"bugs",
|
|
537
|
-
"repository",
|
|
538
|
-
"author",
|
|
539
|
-
"contributors",
|
|
540
|
-
"funding",
|
|
541
|
-
"files",
|
|
542
|
-
"main",
|
|
543
|
-
"module",
|
|
544
|
-
"types",
|
|
545
|
-
"exports",
|
|
546
|
-
"typesVersions",
|
|
547
|
-
"sideEffects",
|
|
548
|
-
"unpkg",
|
|
549
|
-
"jsdelivr",
|
|
550
|
-
"browser",
|
|
551
|
-
"bin",
|
|
552
|
-
"man",
|
|
553
|
-
"directories",
|
|
554
|
-
"publishConfig",
|
|
555
|
-
"scripts",
|
|
556
|
-
"peerDependencies",
|
|
557
|
-
"peerDependenciesMeta",
|
|
558
|
-
"optionalDependencies",
|
|
559
|
-
"dependencies",
|
|
560
|
-
"devDependencies",
|
|
561
|
-
"engines",
|
|
562
|
-
"config",
|
|
563
|
-
"overrides",
|
|
564
|
-
"pnpm",
|
|
565
|
-
"husky",
|
|
566
|
-
"lint-staged",
|
|
567
|
-
"eslintConfig",
|
|
568
|
-
"prettier"
|
|
569
|
-
],
|
|
570
|
-
pathPattern: "^$"
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
order: { type: "asc" },
|
|
574
|
-
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
order: ["types", "require", "import", "default"],
|
|
578
|
-
pathPattern: "^exports.*$"
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
order: { type: "asc" },
|
|
582
|
-
pathPattern: "^resolutions$"
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
order: { type: "asc" },
|
|
586
|
-
pathPattern: "^pnpm.overrides$"
|
|
587
|
-
}
|
|
588
|
-
]
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
];
|
|
592
|
-
var sortTsconfig = [
|
|
593
|
-
{
|
|
594
|
-
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
595
|
-
rules: {
|
|
596
|
-
"jsonc/sort-keys": [
|
|
597
|
-
"error",
|
|
598
|
-
{
|
|
599
|
-
order: [
|
|
600
|
-
"extends",
|
|
601
|
-
"compilerOptions",
|
|
602
|
-
"references",
|
|
603
|
-
"files",
|
|
604
|
-
"include",
|
|
605
|
-
"exclude"
|
|
606
|
-
],
|
|
607
|
-
pathPattern: "^$"
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
order: [
|
|
611
|
-
/* Projects */
|
|
612
|
-
"incremental",
|
|
613
|
-
"composite",
|
|
614
|
-
"tsBuildInfoFile",
|
|
615
|
-
"disableSourceOfProjectReferenceRedirect",
|
|
616
|
-
"disableSolutionSearching",
|
|
617
|
-
"disableReferencedProjectLoad",
|
|
618
|
-
/* Language and Environment */
|
|
619
|
-
"target",
|
|
620
|
-
"lib",
|
|
621
|
-
"jsx",
|
|
622
|
-
"experimentalDecorators",
|
|
623
|
-
"emitDecoratorMetadata",
|
|
624
|
-
"jsxFactory",
|
|
625
|
-
"jsxFragmentFactory",
|
|
626
|
-
"jsxImportSource",
|
|
627
|
-
"reactNamespace",
|
|
628
|
-
"noLib",
|
|
629
|
-
"useDefineForClassFields",
|
|
630
|
-
"moduleDetection",
|
|
631
|
-
/* Modules */
|
|
632
|
-
"module",
|
|
633
|
-
"rootDir",
|
|
634
|
-
"moduleResolution",
|
|
635
|
-
"baseUrl",
|
|
636
|
-
"paths",
|
|
637
|
-
"rootDirs",
|
|
638
|
-
"typeRoots",
|
|
639
|
-
"types",
|
|
640
|
-
"allowUmdGlobalAccess",
|
|
641
|
-
"moduleSuffixes",
|
|
642
|
-
"allowImportingTsExtensions",
|
|
643
|
-
"resolvePackageJsonExports",
|
|
644
|
-
"resolvePackageJsonImports",
|
|
645
|
-
"customConditions",
|
|
646
|
-
"resolveJsonModule",
|
|
647
|
-
"allowArbitraryExtensions",
|
|
648
|
-
"noResolve",
|
|
649
|
-
/* JavaScript Support */
|
|
650
|
-
"allowJs",
|
|
651
|
-
"checkJs",
|
|
652
|
-
"maxNodeModuleJsDepth",
|
|
653
|
-
/* Emit */
|
|
654
|
-
"declaration",
|
|
655
|
-
"declarationMap",
|
|
656
|
-
"emitDeclarationOnly",
|
|
657
|
-
"sourceMap",
|
|
658
|
-
"inlineSourceMap",
|
|
659
|
-
"outFile",
|
|
660
|
-
"outDir",
|
|
661
|
-
"removeComments",
|
|
662
|
-
"noEmit",
|
|
663
|
-
"importHelpers",
|
|
664
|
-
"importsNotUsedAsValues",
|
|
665
|
-
"downlevelIteration",
|
|
666
|
-
"sourceRoot",
|
|
667
|
-
"mapRoot",
|
|
668
|
-
"inlineSources",
|
|
669
|
-
"emitBOM",
|
|
670
|
-
"newLine",
|
|
671
|
-
"stripInternal",
|
|
672
|
-
"noEmitHelpers",
|
|
673
|
-
"noEmitOnError",
|
|
674
|
-
"preserveConstEnums",
|
|
675
|
-
"declarationDir",
|
|
676
|
-
"preserveValueImports",
|
|
677
|
-
/* Interop Constraints */
|
|
678
|
-
"isolatedModules",
|
|
679
|
-
"verbatimModuleSyntax",
|
|
680
|
-
"allowSyntheticDefaultImports",
|
|
681
|
-
"esModuleInterop",
|
|
682
|
-
"preserveSymlinks",
|
|
683
|
-
"forceConsistentCasingInFileNames",
|
|
684
|
-
/* Type Checking */
|
|
685
|
-
"strict",
|
|
686
|
-
"strictBindCallApply",
|
|
687
|
-
"strictFunctionTypes",
|
|
688
|
-
"strictNullChecks",
|
|
689
|
-
"strictPropertyInitialization",
|
|
690
|
-
"allowUnreachableCode",
|
|
691
|
-
"allowUnusedLabels",
|
|
692
|
-
"alwaysStrict",
|
|
693
|
-
"exactOptionalPropertyTypes",
|
|
694
|
-
"noFallthroughCasesInSwitch",
|
|
695
|
-
"noImplicitAny",
|
|
696
|
-
"noImplicitOverride",
|
|
697
|
-
"noImplicitReturns",
|
|
698
|
-
"noImplicitThis",
|
|
699
|
-
"noPropertyAccessFromIndexSignature",
|
|
700
|
-
"noUncheckedIndexedAccess",
|
|
701
|
-
"noUnusedLocals",
|
|
702
|
-
"noUnusedParameters",
|
|
703
|
-
"useUnknownInCatchVariables",
|
|
704
|
-
/* Completeness */
|
|
705
|
-
"skipDefaultLibCheck",
|
|
706
|
-
"skipLibCheck"
|
|
707
|
-
],
|
|
708
|
-
pathPattern: "^compilerOptions$"
|
|
709
|
-
}
|
|
710
|
-
]
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
];
|
|
714
|
-
|
|
715
|
-
// src/configs/typescript.ts
|
|
716
|
-
var typescript = [
|
|
717
|
-
{
|
|
718
|
-
files: [GLOB_TS, GLOB_TSX],
|
|
719
|
-
languageOptions: {
|
|
720
|
-
parser: parserTypeScript,
|
|
721
|
-
parserOptions: {
|
|
722
|
-
sourceType: "module"
|
|
723
|
-
}
|
|
724
|
-
},
|
|
725
|
-
plugins: {
|
|
726
|
-
"@typescript-eslint": pluginTypeScript,
|
|
727
|
-
antfu: pluginAntfu
|
|
728
|
-
},
|
|
729
|
-
rules: {
|
|
730
|
-
...pluginTypeScript.configs["eslint-recommended"].overrides[0].rules,
|
|
731
|
-
...pluginTypeScript.configs.strict.rules,
|
|
732
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
733
|
-
"@typescript-eslint/ban-types": "off",
|
|
734
|
-
"@typescript-eslint/consistent-type-assertions": [
|
|
735
|
-
"error",
|
|
736
|
-
{
|
|
737
|
-
assertionStyle: "as",
|
|
738
|
-
objectLiteralTypeAssertions: "allow-as-parameter"
|
|
739
|
-
}
|
|
740
|
-
],
|
|
741
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
742
|
-
"error",
|
|
743
|
-
{ disallowTypeAnnotations: false, fixStyle: "inline-type-imports" }
|
|
744
|
-
],
|
|
745
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
746
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
747
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
748
|
-
// handled by unused-imports/no-unused-imports
|
|
749
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
750
|
-
"@typescript-eslint/prefer-as-const": "warn",
|
|
751
|
-
"no-restricted-syntax": ["error", "TSEnumDeclaration[const=true]"]
|
|
752
|
-
}
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
files: ["**/*.d.ts"],
|
|
756
|
-
rules: {
|
|
757
|
-
"eslint-comments/no-unlimited-disable": "off",
|
|
758
|
-
"import/no-duplicates": "off",
|
|
759
|
-
"unused-imports/no-unused-vars": "off"
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
{
|
|
763
|
-
files: ["**/*.{test,spec}.ts?(x)"],
|
|
764
|
-
rules: {
|
|
765
|
-
"no-unused-expressions": "off"
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
{
|
|
769
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
770
|
-
rules: {
|
|
771
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
772
|
-
"@typescript-eslint/no-var-requires": "off"
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
];
|
|
776
|
-
|
|
777
|
-
// src/configs/unicorn.ts
|
|
778
|
-
var unicorn = [
|
|
779
|
-
{
|
|
780
|
-
plugins: {
|
|
781
|
-
unicorn: pluginUnicorn
|
|
782
|
-
},
|
|
783
|
-
rules: {
|
|
784
|
-
"unicorn/better-regex": "error",
|
|
785
|
-
"unicorn/catch-error-name": "error",
|
|
786
|
-
"unicorn/consistent-function-scoping": "off",
|
|
787
|
-
"unicorn/custom-error-definition": "off",
|
|
788
|
-
// 'unicorn/custom-error-definition': 'error',
|
|
789
|
-
"unicorn/error-message": "error",
|
|
790
|
-
"unicorn/escape-case": "error",
|
|
791
|
-
"unicorn/expiring-todo-comments": "error",
|
|
792
|
-
"unicorn/explicit-length-check": "error",
|
|
793
|
-
"unicorn/filename-case": [
|
|
794
|
-
"error",
|
|
795
|
-
{
|
|
796
|
-
case: "kebabCase",
|
|
797
|
-
ignore: [/^[A-Z]+\..*$/]
|
|
798
|
-
}
|
|
799
|
-
],
|
|
800
|
-
"unicorn/import-index": "warn",
|
|
801
|
-
"unicorn/new-for-builtins": "off",
|
|
802
|
-
// 'unicorn/new-for-builtins': 'error',
|
|
803
|
-
"unicorn/no-abusive-eslint-disable": "error",
|
|
804
|
-
"unicorn/no-array-callback-reference": "error",
|
|
805
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
806
|
-
"unicorn/no-array-push-push": "error",
|
|
807
|
-
"unicorn/no-console-spaces": "error",
|
|
808
|
-
"unicorn/no-fn-reference-in-iterator": "off",
|
|
809
|
-
"unicorn/no-for-loop": "warn",
|
|
810
|
-
// 'unicorn/no-for-loop': 'error',
|
|
811
|
-
"unicorn/no-hex-escape": "warn",
|
|
812
|
-
// 'unicorn/no-hex-escape': 'error',
|
|
813
|
-
"unicorn/no-instanceof-array": "error",
|
|
814
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
815
|
-
"unicorn/no-keyword-prefix": "warn",
|
|
816
|
-
"unicorn/no-lonely-if": "error",
|
|
817
|
-
"unicorn/no-nested-ternary": "warn",
|
|
818
|
-
"unicorn/no-new-array": "error",
|
|
819
|
-
"unicorn/no-new-buffer": "error",
|
|
820
|
-
"unicorn/no-null": "warn",
|
|
821
|
-
"unicorn/no-object-as-default-parameter": "warn",
|
|
822
|
-
"unicorn/no-process-exit": "error",
|
|
823
|
-
"unicorn/no-reduce": "off",
|
|
824
|
-
"unicorn/no-static-only-class": "error",
|
|
825
|
-
"unicorn/no-unnecessary-await": "error",
|
|
826
|
-
"unicorn/no-unreadable-array-destructuring": "off",
|
|
827
|
-
"unicorn/no-unsafe-regex": "warn",
|
|
828
|
-
"unicorn/no-unused-properties": "off",
|
|
829
|
-
"unicorn/no-useless-undefined": "warn",
|
|
830
|
-
"unicorn/no-zero-fractions": "warn",
|
|
831
|
-
// 'unicorn/no-zero-fractions': `error`,
|
|
832
|
-
"unicorn/number-literal-case": "error",
|
|
833
|
-
"unicorn/prefer-add-event-listener": "warn",
|
|
834
|
-
// 'unicorn/prefer-add-event-listener': 'error',
|
|
835
|
-
"unicorn/prefer-array-find": "error",
|
|
836
|
-
// 'unicorn/prefer-array-find': 'error',
|
|
837
|
-
"unicorn/prefer-array-flat-map": "error",
|
|
838
|
-
"unicorn/prefer-array-index-of": "error",
|
|
839
|
-
"unicorn/prefer-array-some": "error",
|
|
840
|
-
"unicorn/prefer-at": "error",
|
|
841
|
-
"unicorn/prefer-blob-reading-methods": "error",
|
|
842
|
-
"unicorn/prefer-dataset": "warn",
|
|
843
|
-
"unicorn/prefer-date-now": "error",
|
|
844
|
-
"unicorn/prefer-dom-node-append": "error",
|
|
845
|
-
"unicorn/prefer-dom-node-dataset": "error",
|
|
846
|
-
"unicorn/prefer-dom-node-remove": "error",
|
|
847
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
848
|
-
"unicorn/prefer-event-key": "off",
|
|
849
|
-
"unicorn/prefer-flat-map": "error",
|
|
850
|
-
"unicorn/prefer-includes": "error",
|
|
851
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
852
|
-
"unicorn/prefer-math-trunc": "error",
|
|
853
|
-
"unicorn/prefer-modern-dom-apis": "warn",
|
|
854
|
-
// 'unicorn/prefer-modern-dom-apis': 'error',
|
|
855
|
-
"unicorn/prefer-modern-math-apis": "error",
|
|
856
|
-
"unicorn/prefer-negative-index": "error",
|
|
857
|
-
"unicorn/prefer-node-append": "warn",
|
|
858
|
-
"unicorn/prefer-node-protocol": "error",
|
|
859
|
-
"unicorn/prefer-node-remove": "warn",
|
|
860
|
-
"unicorn/prefer-number-properties": "error",
|
|
861
|
-
"unicorn/prefer-optional-catch-binding": "warn",
|
|
862
|
-
// 'unicorn/prefer-optional-catch-binding': 'error',
|
|
863
|
-
"unicorn/prefer-prototype-methods": "error",
|
|
864
|
-
"unicorn/prefer-query-selector": "warn",
|
|
865
|
-
// 'unicorn/prefer-query-selector': 'error',
|
|
866
|
-
"unicorn/prefer-reflect-apply": "error",
|
|
867
|
-
"unicorn/prefer-regexp-test": "error",
|
|
868
|
-
"unicorn/prefer-replace-all": "warn",
|
|
869
|
-
"unicorn/prefer-set-has": "warn",
|
|
870
|
-
"unicorn/prefer-spread": "error",
|
|
871
|
-
"unicorn/prefer-starts-ends-with": "error",
|
|
872
|
-
"unicorn/prefer-string-replace-all": "error",
|
|
873
|
-
"unicorn/prefer-string-slice": "warn",
|
|
874
|
-
// 'unicorn/prefer-string-slice': 'error',
|
|
875
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
876
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
877
|
-
"unicorn/prefer-top-level-await": "error",
|
|
878
|
-
"unicorn/prefer-trim-start-end": "error",
|
|
879
|
-
"unicorn/prefer-type-error": "error",
|
|
880
|
-
"unicorn/prevent-abbreviations": "off",
|
|
881
|
-
"unicorn/string-content": "off",
|
|
882
|
-
"unicorn/throw-new-error": "warn"
|
|
883
|
-
// 'unicorn/throw-new-error': 'error',
|
|
884
|
-
// 'unicorn/catch-error-name': 0,
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
];
|
|
888
|
-
|
|
889
|
-
// src/configs/unocss.ts
|
|
890
|
-
var unocss = [
|
|
891
|
-
{
|
|
892
|
-
plugins: {
|
|
893
|
-
"@unocss": pluginUnocss
|
|
894
|
-
},
|
|
895
|
-
rules: {
|
|
896
|
-
...pluginUnocss.configs.recommended.rules
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
];
|
|
900
|
-
|
|
901
|
-
// src/configs/vue.ts
|
|
902
|
-
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
903
|
-
import { getPackageInfoSync } from "local-pkg";
|
|
904
|
-
function getVueVersion() {
|
|
905
|
-
const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
|
|
906
|
-
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
907
|
-
return +pkg.version[0];
|
|
908
|
-
}
|
|
909
|
-
return 3;
|
|
910
|
-
}
|
|
911
|
-
var isVue3 = getVueVersion() === 3;
|
|
912
|
-
var reactivityTransform = [
|
|
913
|
-
{
|
|
914
|
-
languageOptions: {
|
|
915
|
-
globals: {
|
|
916
|
-
$: "readonly",
|
|
917
|
-
$$: "readonly",
|
|
918
|
-
$computed: "readonly",
|
|
919
|
-
$customRef: "readonly",
|
|
920
|
-
$ref: "readonly",
|
|
921
|
-
$shallowRef: "readonly",
|
|
922
|
-
$toRef: "readonly"
|
|
923
|
-
}
|
|
924
|
-
},
|
|
925
|
-
plugins: {
|
|
926
|
-
vue: pluginVue
|
|
927
|
-
},
|
|
928
|
-
rules: {
|
|
929
|
-
"vue/no-setup-props-reactivity-loss": "off"
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
];
|
|
933
|
-
var vueCustomRules = {
|
|
934
|
-
"vue/attributes-order": [
|
|
935
|
-
"warn",
|
|
936
|
-
{
|
|
937
|
-
alphabetical: false,
|
|
938
|
-
order: [
|
|
939
|
-
"DEFINITION",
|
|
940
|
-
"LIST_RENDERING",
|
|
941
|
-
"CONDITIONALS",
|
|
942
|
-
"RENDER_MODIFIERS",
|
|
943
|
-
"GLOBAL",
|
|
944
|
-
"UNIQUE",
|
|
945
|
-
"TWO_WAY_BINDING",
|
|
946
|
-
"OTHER_DIRECTIVES",
|
|
947
|
-
"OTHER_ATTR",
|
|
948
|
-
"EVENTS",
|
|
949
|
-
"CONTENT"
|
|
950
|
-
]
|
|
951
|
-
}
|
|
952
|
-
],
|
|
953
|
-
"vue/block-order": [
|
|
954
|
-
"error",
|
|
955
|
-
{
|
|
956
|
-
order: [
|
|
957
|
-
"docs",
|
|
958
|
-
"script[setup]",
|
|
959
|
-
"template",
|
|
960
|
-
"script:not([setup])",
|
|
961
|
-
"style"
|
|
962
|
-
]
|
|
963
|
-
}
|
|
964
|
-
],
|
|
965
|
-
"vue/component-definition-name-casing": ["error", "kebab-case"],
|
|
966
|
-
"vue/component-name-in-template-casing": [
|
|
967
|
-
"error",
|
|
968
|
-
"kebab-case",
|
|
969
|
-
{
|
|
970
|
-
ignores: [],
|
|
971
|
-
registeredComponentsOnly: false
|
|
972
|
-
}
|
|
973
|
-
],
|
|
974
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
975
|
-
"vue/component-tags-order": "off",
|
|
976
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
977
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
978
|
-
"vue/html-self-closing": [
|
|
979
|
-
"error",
|
|
980
|
-
{
|
|
981
|
-
html: {
|
|
982
|
-
component: "always",
|
|
983
|
-
normal: "always",
|
|
984
|
-
void: "always"
|
|
985
|
-
},
|
|
986
|
-
math: "always",
|
|
987
|
-
svg: "always"
|
|
988
|
-
}
|
|
989
|
-
],
|
|
990
|
-
"vue/match-component-file-name": [
|
|
991
|
-
"error",
|
|
992
|
-
{
|
|
993
|
-
extensions: ["vue"],
|
|
994
|
-
shouldMatchCase: false
|
|
995
|
-
}
|
|
996
|
-
],
|
|
997
|
-
"vue/match-component-import-name": "warn",
|
|
998
|
-
"vue/max-attributes-per-line": "off",
|
|
999
|
-
"vue/multi-word-component-names": "error",
|
|
1000
|
-
"vue/no-boolean-default": ["error", "default-false"],
|
|
1001
|
-
"vue/no-constant-condition": "warn",
|
|
1002
|
-
"vue/no-duplicate-attr-inheritance": "warn",
|
|
1003
|
-
"vue/no-empty-pattern": "error",
|
|
1004
|
-
"vue/no-irregular-whitespace": "error",
|
|
1005
|
-
"vue/no-loss-of-precision": "error",
|
|
1006
|
-
"vue/no-multiple-objects-in-class": "error",
|
|
1007
|
-
"vue/no-potential-component-option-typo": [
|
|
1008
|
-
"error",
|
|
1009
|
-
{
|
|
1010
|
-
presets: ["vue", "nuxt"],
|
|
1011
|
-
threshold: 5
|
|
1012
|
-
}
|
|
1013
|
-
],
|
|
1014
|
-
"vue/no-reserved-component-names": "error",
|
|
1015
|
-
"vue/no-static-inline-styles": [
|
|
1016
|
-
"error",
|
|
1017
|
-
{
|
|
1018
|
-
allowBinding: false
|
|
1019
|
-
}
|
|
1020
|
-
],
|
|
1021
|
-
"vue/no-this-in-before-route-enter": "error",
|
|
1022
|
-
// 'vue/no-restricted-static-attribute': [
|
|
1023
|
-
// 'error',
|
|
1024
|
-
// {
|
|
1025
|
-
// key: 'stlye',
|
|
1026
|
-
// message: 'Using "stlye" is not allowed. Use "style" instead.',
|
|
1027
|
-
// },
|
|
1028
|
-
// ],
|
|
1029
|
-
// 'vue/no-template-target-blank': [
|
|
1030
|
-
// 'error',
|
|
1031
|
-
// {
|
|
1032
|
-
// allowReferrer: true,
|
|
1033
|
-
// enforceDynamicLinks: 'always',
|
|
1034
|
-
// },
|
|
1035
|
-
// ],
|
|
1036
|
-
"vue/no-undef-components": [
|
|
1037
|
-
"error",
|
|
1038
|
-
{
|
|
1039
|
-
ignorePatterns: ["lazy-hydrate", "no-ssr", "client-only"]
|
|
1040
|
-
}
|
|
1041
|
-
],
|
|
1042
|
-
"vue/no-unsupported-features": [
|
|
1043
|
-
"error",
|
|
1044
|
-
{
|
|
1045
|
-
ignores: [],
|
|
1046
|
-
version: "^2.7.14"
|
|
1047
|
-
}
|
|
1048
|
-
],
|
|
1049
|
-
"vue/no-unused-properties": [
|
|
1050
|
-
"error",
|
|
1051
|
-
{
|
|
1052
|
-
groups: ["props", "data", "computed", "methods", "setup"],
|
|
1053
|
-
ignorePublicMembers: true
|
|
1054
|
-
}
|
|
1055
|
-
],
|
|
1056
|
-
"vue/no-unused-refs": "error",
|
|
1057
|
-
"vue/no-useless-concat": "warn",
|
|
1058
|
-
"vue/no-useless-mustaches": [
|
|
1059
|
-
"warn",
|
|
1060
|
-
{
|
|
1061
|
-
ignoreIncludesComment: true,
|
|
1062
|
-
ignoreStringEscape: true
|
|
1063
|
-
}
|
|
1064
|
-
],
|
|
1065
|
-
"vue/no-useless-v-bind": [
|
|
1066
|
-
"warn",
|
|
1067
|
-
{
|
|
1068
|
-
ignoreIncludesComment: true,
|
|
1069
|
-
ignoreStringEscape: true
|
|
1070
|
-
}
|
|
1071
|
-
],
|
|
1072
|
-
"vue/no-v-html": "off",
|
|
1073
|
-
"vue/object-curly-spacing": "error",
|
|
1074
|
-
"vue/object-shorthand": [
|
|
1075
|
-
"error",
|
|
1076
|
-
"always",
|
|
1077
|
-
{
|
|
1078
|
-
avoidQuotes: true,
|
|
1079
|
-
ignoreConstructors: false
|
|
1080
|
-
}
|
|
1081
|
-
],
|
|
1082
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1083
|
-
"vue/prefer-prop-type-boolean-first": "error",
|
|
1084
|
-
"vue/prefer-separate-static-class": "error",
|
|
1085
|
-
"vue/prefer-template": "error",
|
|
1086
|
-
"vue/prefer-true-attribute-shorthand": "warn",
|
|
1087
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1088
|
-
"vue/require-default-prop": "error",
|
|
1089
|
-
"vue/require-prop-types": "error",
|
|
1090
|
-
// TODO: отступы в <script>
|
|
1091
|
-
"vue/script-indent": [
|
|
1092
|
-
"error",
|
|
1093
|
-
2,
|
|
1094
|
-
{
|
|
1095
|
-
baseIndent: 1,
|
|
1096
|
-
ignores: [],
|
|
1097
|
-
switchCase: 1
|
|
1098
|
-
}
|
|
1099
|
-
],
|
|
1100
|
-
"vue/space-in-parens": "error",
|
|
1101
|
-
"vue/static-class-names-order": "off",
|
|
1102
|
-
"vue/v-on-handler-style": [
|
|
1103
|
-
"error",
|
|
1104
|
-
["method", "inline-function"],
|
|
1105
|
-
// ["method", "inline-function"] | ["method", "inline"] | "inline-function" | "inline"
|
|
1106
|
-
{
|
|
1107
|
-
ignoreIncludesComment: true
|
|
1108
|
-
}
|
|
1109
|
-
],
|
|
1110
|
-
"vue/valid-v-bind-sync": "error",
|
|
1111
|
-
"vue/valid-v-slot": "error"
|
|
1112
|
-
};
|
|
1113
|
-
var vue3Rules = {
|
|
1114
|
-
...pluginVue.configs.base.rules,
|
|
1115
|
-
...pluginVue.configs["vue3-essential"].rules,
|
|
1116
|
-
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1117
|
-
...pluginVue.configs["vue3-recommended"].rules
|
|
1118
|
-
};
|
|
1119
|
-
var vue2Rules = {
|
|
1120
|
-
...pluginVue.configs.base.rules,
|
|
1121
|
-
...pluginVue.configs.essential.rules,
|
|
1122
|
-
...pluginVue.configs["strongly-recommended"].rules,
|
|
1123
|
-
...pluginVue.configs.recommended.rules
|
|
1124
|
-
};
|
|
1125
|
-
var vue = [
|
|
1126
|
-
{
|
|
1127
|
-
files: [GLOB_VUE],
|
|
1128
|
-
languageOptions: {
|
|
1129
|
-
parser: parserVue,
|
|
1130
|
-
parserOptions: {
|
|
1131
|
-
ecmaFeatures: {
|
|
1132
|
-
jsx: true
|
|
1133
|
-
},
|
|
1134
|
-
extraFileExtensions: [".vue"],
|
|
1135
|
-
parser: "@typescript-eslint/parser",
|
|
1136
|
-
sourceType: "module"
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
plugins: {
|
|
1140
|
-
"@typescript-eslint": tsPlugin,
|
|
1141
|
-
vue: pluginVue
|
|
1142
|
-
},
|
|
1143
|
-
processor: pluginVue.processors[".vue"],
|
|
1144
|
-
rules: {
|
|
1145
|
-
...typescript[0].rules
|
|
1146
|
-
}
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
plugins: {
|
|
1150
|
-
vue: pluginVue
|
|
1151
|
-
},
|
|
1152
|
-
rules: {
|
|
1153
|
-
...isVue3 ? vue3Rules : vue2Rules,
|
|
1154
|
-
...vueCustomRules
|
|
1155
|
-
}
|
|
1156
|
-
},
|
|
1157
|
-
...reactivityTransform,
|
|
1158
|
-
{
|
|
1159
|
-
files: [GLOB_NUXT_PAGE, GLOB_NUXT_LAYOUTS, "app.vue"],
|
|
1160
|
-
rules: {
|
|
1161
|
-
"vue/multi-word-component-names": "off"
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
];
|
|
1165
|
-
|
|
1166
|
-
// src/configs/yml.ts
|
|
1167
|
-
var yml = [
|
|
1168
|
-
{
|
|
1169
|
-
files: [GLOB_YAML],
|
|
1170
|
-
languageOptions: {
|
|
1171
|
-
parser: parserYml
|
|
1172
|
-
},
|
|
1173
|
-
plugins: {
|
|
1174
|
-
yml: pluginYml
|
|
1175
|
-
},
|
|
1176
|
-
rules: {
|
|
1177
|
-
...pluginYml.configs.standard.rules,
|
|
1178
|
-
...pluginYml.configs.prettier.rules,
|
|
1179
|
-
"yml/no-empty-mapping-value": "off"
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
];
|
|
1183
|
-
|
|
1184
|
-
// src/presets.ts
|
|
1185
|
-
var presetJavaScript = [
|
|
1186
|
-
...ignores,
|
|
1187
|
-
...javascript,
|
|
1188
|
-
...comments,
|
|
1189
|
-
...imports,
|
|
1190
|
-
...unicorn,
|
|
1191
|
-
...security,
|
|
1192
|
-
...sonarjs
|
|
1193
|
-
];
|
|
1194
|
-
var presetLangsExtensions = [
|
|
1195
|
-
...markdown,
|
|
1196
|
-
...yml,
|
|
1197
|
-
...jsonc,
|
|
1198
|
-
...sortPackageJson,
|
|
1199
|
-
...sortTsconfig
|
|
1200
|
-
];
|
|
1201
|
-
var basic = [
|
|
1202
|
-
...presetJavaScript,
|
|
1203
|
-
...typescript,
|
|
1204
|
-
...presetLangsExtensions
|
|
1205
|
-
];
|
|
1206
|
-
var all = [...basic, ...vue, ...unocss, ...prettier];
|
|
1207
|
-
function frabbit(config = [], {
|
|
1208
|
-
vue: enableVue = true,
|
|
1209
|
-
prettier: enablePrettier = true,
|
|
1210
|
-
markdown: enableMarkdown = true,
|
|
1211
|
-
unocss: enableUnocss = false
|
|
1212
|
-
} = {}) {
|
|
1213
|
-
const configs = [];
|
|
1214
|
-
configs.push(...basic);
|
|
1215
|
-
if (enableVue) {
|
|
1216
|
-
configs.push(...vue);
|
|
1217
|
-
}
|
|
1218
|
-
if (enableMarkdown) {
|
|
1219
|
-
configs.push(...markdown);
|
|
1220
|
-
}
|
|
1221
|
-
if (enableUnocss) {
|
|
1222
|
-
configs.push(...unocss);
|
|
1223
|
-
}
|
|
1224
|
-
if (enablePrettier) {
|
|
1225
|
-
configs.push(...prettier);
|
|
1226
|
-
}
|
|
1227
|
-
if (Object.keys(config).length > 0) {
|
|
1228
|
-
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1229
|
-
}
|
|
1230
|
-
return configs;
|
|
1231
|
-
}
|
|
1232
|
-
export {
|
|
1233
|
-
GLOB_ALL_SRC,
|
|
1234
|
-
GLOB_CSS,
|
|
1235
|
-
GLOB_DIST,
|
|
1236
|
-
GLOB_EXCLUDE,
|
|
1237
|
-
GLOB_HTML,
|
|
1238
|
-
GLOB_JS,
|
|
1239
|
-
GLOB_JSON,
|
|
1240
|
-
GLOB_JSON5,
|
|
1241
|
-
GLOB_JSONC,
|
|
1242
|
-
GLOB_JSX,
|
|
1243
|
-
GLOB_LESS,
|
|
1244
|
-
GLOB_LOCKFILE,
|
|
1245
|
-
GLOB_MARKDOWN,
|
|
1246
|
-
GLOB_NODE_MODULES,
|
|
1247
|
-
GLOB_NUXT_LAYOUTS,
|
|
1248
|
-
GLOB_NUXT_PAGE,
|
|
1249
|
-
GLOB_SCSS,
|
|
1250
|
-
GLOB_SRC,
|
|
1251
|
-
GLOB_SRC_EXT,
|
|
1252
|
-
GLOB_STYLE,
|
|
1253
|
-
GLOB_TS,
|
|
1254
|
-
GLOB_TSX,
|
|
1255
|
-
GLOB_VUE,
|
|
1256
|
-
GLOB_YAML,
|
|
1257
|
-
all,
|
|
1258
|
-
basic,
|
|
1259
|
-
comments,
|
|
1260
|
-
configPrettier,
|
|
1261
|
-
frabbit,
|
|
1262
|
-
getVueVersion,
|
|
1263
|
-
hasTypeScript,
|
|
1264
|
-
hasVue,
|
|
1265
|
-
ignores,
|
|
1266
|
-
imports,
|
|
1267
|
-
isInEditor,
|
|
1268
|
-
javascript,
|
|
1269
|
-
jsonc,
|
|
1270
|
-
markdown,
|
|
1271
|
-
parserJsonc,
|
|
1272
|
-
parserTypeScript,
|
|
1273
|
-
parserVue,
|
|
1274
|
-
parserYml,
|
|
1275
|
-
pluginAntfu,
|
|
1276
|
-
pluginComments,
|
|
1277
|
-
pluginImport,
|
|
1278
|
-
pluginJsonc,
|
|
1279
|
-
pluginMarkdown,
|
|
1280
|
-
pluginPrettier,
|
|
1281
|
-
pluginSecurity,
|
|
1282
|
-
pluginSonar,
|
|
1283
|
-
pluginTypeScript,
|
|
1284
|
-
pluginUnicorn,
|
|
1285
|
-
pluginUnocss,
|
|
1286
|
-
pluginUnusedImports,
|
|
1287
|
-
pluginVue,
|
|
1288
|
-
pluginYml,
|
|
1289
|
-
basic as presetBasic,
|
|
1290
|
-
presetJavaScript,
|
|
1291
|
-
presetLangsExtensions,
|
|
1292
|
-
prettier,
|
|
1293
|
-
reactivityTransform,
|
|
1294
|
-
security,
|
|
1295
|
-
sonarjs,
|
|
1296
|
-
sortPackageJson,
|
|
1297
|
-
sortTsconfig,
|
|
1298
|
-
typescript,
|
|
1299
|
-
unicorn,
|
|
1300
|
-
unocss,
|
|
1301
|
-
vue,
|
|
1302
|
-
yml
|
|
1303
|
-
};
|