@ntnyq/eslint-config 4.0.0-beta.1 → 4.0.0-beta.11
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/README.md +51 -13
- package/dist/index.d.ts +15462 -14302
- package/dist/index.js +1483 -1172
- package/package.json +56 -42
package/dist/index.js
CHANGED
|
@@ -4,13 +4,15 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
|
4
4
|
// src/configs/vue.ts
|
|
5
5
|
import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
|
|
6
6
|
|
|
7
|
+
// src/eslint/configs.ts
|
|
8
|
+
import { configs } from "typescript-eslint";
|
|
9
|
+
|
|
7
10
|
// src/eslint/parsers.ts
|
|
8
|
-
import tseslint from "typescript-eslint";
|
|
9
11
|
import * as parserVue from "vue-eslint-parser";
|
|
10
12
|
import * as parserToml from "toml-eslint-parser";
|
|
11
13
|
import * as parserYaml from "yaml-eslint-parser";
|
|
12
14
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
13
|
-
|
|
15
|
+
import { parser } from "typescript-eslint";
|
|
14
16
|
var parserPlain = {
|
|
15
17
|
meta: {
|
|
16
18
|
name: "plain-eslint-parser"
|
|
@@ -33,56 +35,62 @@ var parserPlain = {
|
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
// src/eslint/plugins.ts
|
|
36
|
-
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
37
38
|
import * as pluginDepend from "eslint-plugin-depend";
|
|
39
|
+
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
38
40
|
import { default as default2 } from "eslint-plugin-n";
|
|
39
41
|
import { default as default3 } from "eslint-plugin-vue";
|
|
40
42
|
import { default as default4 } from "eslint-plugin-yml";
|
|
41
43
|
import { default as default5 } from "eslint-plugin-svgo";
|
|
42
44
|
import { default as default6 } from "eslint-plugin-toml";
|
|
43
|
-
import { default as default7 } from "eslint
|
|
44
|
-
import { default as default8 } from "
|
|
45
|
-
import { default as default9 } from "eslint-plugin-
|
|
46
|
-
import { default as default10 } from "eslint-plugin-
|
|
47
|
-
import { default as default11 } from "eslint-plugin-
|
|
45
|
+
import { default as default7 } from "@eslint/markdown";
|
|
46
|
+
import { default as default8 } from "eslint-plugin-antfu";
|
|
47
|
+
import { default as default9 } from "eslint-plugin-jsdoc";
|
|
48
|
+
import { default as default10 } from "eslint-plugin-jsonc";
|
|
49
|
+
import { default as default11 } from "eslint-plugin-ntnyq";
|
|
50
|
+
import { default as default12 } from "eslint-plugin-pinia";
|
|
51
|
+
import { default as default13 } from "eslint-plugin-format";
|
|
48
52
|
import { plugin } from "typescript-eslint";
|
|
49
|
-
import { default as
|
|
50
|
-
import { default as
|
|
51
|
-
import { default as
|
|
52
|
-
import { default as
|
|
53
|
-
import { default as
|
|
54
|
-
import { default as
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as
|
|
57
|
-
import { default as
|
|
58
|
-
import { default as
|
|
59
|
-
|
|
60
|
-
// src/eslint/configs.ts
|
|
61
|
-
import { configs } from "typescript-eslint";
|
|
53
|
+
import { default as default14 } from "@unocss/eslint-plugin";
|
|
54
|
+
import { default as default15 } from "@vitest/eslint-plugin";
|
|
55
|
+
import { default as default16 } from "eslint-plugin-unicorn";
|
|
56
|
+
import { default as default17 } from "eslint-plugin-import-x";
|
|
57
|
+
import { default as default18 } from "eslint-plugin-prettier";
|
|
58
|
+
import { default as default19 } from "eslint-plugin-de-morgan";
|
|
59
|
+
import { default as default20 } from "eslint-plugin-no-only-tests";
|
|
60
|
+
import { default as default21 } from "eslint-plugin-github-action";
|
|
61
|
+
import { default as default22 } from "eslint-plugin-perfectionist";
|
|
62
|
+
import { default as default23 } from "eslint-plugin-unused-imports";
|
|
63
|
+
import { default as default24 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
62
64
|
|
|
63
65
|
// src/eslint/resolvers.ts
|
|
64
66
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
65
|
-
var createNodeResolver =
|
|
67
|
+
var createNodeResolver = default17.createNodeResolver;
|
|
66
68
|
|
|
67
69
|
// src/eslint/processors.ts
|
|
68
|
-
import {
|
|
69
|
-
import { processorPassThrough } from "eslint-merge-processors";
|
|
70
|
-
import { default as default22 } from "eslint-processor-vue-blocks";
|
|
70
|
+
import { default as default25 } from "eslint-processor-vue-blocks";
|
|
71
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
71
72
|
|
|
72
73
|
// src/globs.ts
|
|
73
74
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
74
75
|
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
75
76
|
var GLOB_JS = "**/*.?([cm])js";
|
|
76
77
|
var GLOB_JSX = `${GLOB_JS}x`;
|
|
78
|
+
var GLOB_JSX_ONLY = "**/*.jsx";
|
|
77
79
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
78
80
|
var GLOB_TSX = `${GLOB_TS}x`;
|
|
81
|
+
var GLOB_TSX_ONLY = "**/*.tsx";
|
|
79
82
|
var GLOB_DTS = "**/*.d.?([cm])ts";
|
|
80
83
|
var GLOB_TYPES = [GLOB_DTS, `**/types/${GLOB_TS}`, `**/types.ts`];
|
|
84
|
+
var GLOB_TYPE_TEST = [
|
|
85
|
+
`**/*.test-d.${GLOB_SRC_EXT}`,
|
|
86
|
+
`**/*.spec-d.${GLOB_SRC_EXT}`
|
|
87
|
+
];
|
|
81
88
|
var GLOB_TEST = [
|
|
82
89
|
`**/*.test.${GLOB_SRC_EXT}`,
|
|
83
90
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
84
91
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
85
|
-
`**/*.benchmark.${GLOB_SRC_EXT}
|
|
92
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`,
|
|
93
|
+
...GLOB_TYPE_TEST
|
|
86
94
|
];
|
|
87
95
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
88
96
|
var GLOB_CSS = "**/*.css";
|
|
@@ -93,6 +101,7 @@ var GLOB_JSON = "**/*.json";
|
|
|
93
101
|
var GLOB_JSON5 = "**/*.json5";
|
|
94
102
|
var GLOB_JSONC = "**/*.jsonc";
|
|
95
103
|
var GLOB_PACKAGE_JSON = "**/package.json";
|
|
104
|
+
var GLOB_TSCONFIG_JSON = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
96
105
|
var GLOB_SVG = "**/*.svg";
|
|
97
106
|
var GLOB_VUE = "**/*.vue";
|
|
98
107
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
@@ -123,7 +132,7 @@ var GLOB_LOCKFILE = [
|
|
|
123
132
|
"**/package-lock.json",
|
|
124
133
|
"**/yarn.lock",
|
|
125
134
|
"**/pnpm-lock.yaml",
|
|
126
|
-
"**/bun.
|
|
135
|
+
"**/bun.lock?(b)",
|
|
127
136
|
"**/deno.lock"
|
|
128
137
|
];
|
|
129
138
|
var GLOB_EXCLUDE = [
|
|
@@ -178,58 +187,50 @@ var GLOB_EXCLUDE = [
|
|
|
178
187
|
// src/configs/vue.ts
|
|
179
188
|
var sharedRules = {
|
|
180
189
|
...default3.configs.base.rules,
|
|
181
|
-
...default3.configs
|
|
182
|
-
...default3.configs["
|
|
183
|
-
...default3.configs
|
|
190
|
+
...default3.configs.essential.rules,
|
|
191
|
+
...default3.configs["strongly-recommended"].rules,
|
|
192
|
+
...default3.configs.recommended.rules
|
|
184
193
|
};
|
|
185
194
|
var disabledRules = {
|
|
186
|
-
"vue/no-v-html": "off",
|
|
187
|
-
"vue/require-prop-types": "off",
|
|
188
|
-
"vue/require-default-prop": "off",
|
|
189
195
|
"vue/multi-word-component-names": "off",
|
|
196
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
197
|
+
"vue/no-v-html": "off",
|
|
190
198
|
"vue/no-v-text-v-html-on-component": "off",
|
|
191
|
-
"vue/
|
|
199
|
+
"vue/require-default-prop": "off",
|
|
200
|
+
"vue/require-prop-types": "off"
|
|
192
201
|
};
|
|
193
202
|
var extensionRules = {
|
|
194
|
-
"vue/prefer-template": "error",
|
|
195
|
-
"vue/no-sparse-arrays": "error",
|
|
196
|
-
"vue/no-empty-pattern": "error",
|
|
197
|
-
"vue/space-infix-ops": "error",
|
|
198
|
-
"vue/no-loss-of-precision": "error",
|
|
199
|
-
"vue/no-constant-condition": "error",
|
|
200
|
-
"vue/template-curly-spacing": "error",
|
|
201
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
202
|
-
"vue/comma-style": ["error", "last"],
|
|
203
|
-
"vue/block-spacing": ["error", "always"],
|
|
204
|
-
"vue/dot-location": ["error", "property"],
|
|
205
|
-
"vue/space-in-parens": ["error", "never"],
|
|
206
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
207
|
-
"vue/no-extra-parens": ["error", "functions"],
|
|
208
203
|
"vue/array-bracket-spacing": ["error", "never"],
|
|
209
|
-
"vue/
|
|
210
|
-
"vue/
|
|
211
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
212
|
-
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
204
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
205
|
+
"vue/block-spacing": ["error", "always"],
|
|
213
206
|
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
214
|
-
"vue/comma-
|
|
207
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
208
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
209
|
+
"vue/comma-style": ["error", "last"],
|
|
210
|
+
"vue/dot-location": ["error", "property"],
|
|
215
211
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
216
|
-
"vue/
|
|
217
|
-
"vue/
|
|
218
|
-
"vue/
|
|
219
|
-
"vue/
|
|
212
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
213
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
214
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
215
|
+
"vue/no-constant-condition": "error",
|
|
216
|
+
"vue/no-empty-pattern": "error",
|
|
217
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
218
|
+
"vue/no-loss-of-precision": "error",
|
|
219
|
+
"vue/no-restricted-syntax": [
|
|
220
220
|
"error",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
221
|
+
"DebuggerStatement",
|
|
222
|
+
"LabeledStatement",
|
|
223
|
+
"WithStatement"
|
|
225
224
|
],
|
|
225
|
+
"vue/no-sparse-arrays": "error",
|
|
226
226
|
"vue/object-curly-newline": [
|
|
227
227
|
"error",
|
|
228
228
|
{
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
consistent: true,
|
|
230
|
+
multiline: true
|
|
231
231
|
}
|
|
232
232
|
],
|
|
233
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
233
234
|
"vue/object-property-newline": [
|
|
234
235
|
"error",
|
|
235
236
|
{
|
|
@@ -240,143 +241,165 @@ var extensionRules = {
|
|
|
240
241
|
"error",
|
|
241
242
|
"always",
|
|
242
243
|
{
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
avoidQuotes: true,
|
|
245
|
+
ignoreConstructors: false
|
|
245
246
|
}
|
|
246
|
-
]
|
|
247
|
+
],
|
|
248
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
249
|
+
"vue/prefer-template": "error",
|
|
250
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
251
|
+
"vue/space-in-parens": ["error", "never"],
|
|
252
|
+
"vue/space-infix-ops": "error",
|
|
253
|
+
"vue/space-unary-ops": [
|
|
254
|
+
"error",
|
|
255
|
+
{
|
|
256
|
+
nonwords: false,
|
|
257
|
+
words: true
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"vue/template-curly-spacing": "error"
|
|
247
261
|
};
|
|
248
262
|
var unCategorizedRules = {
|
|
249
|
-
"vue/
|
|
250
|
-
"vue/no-useless-v-bind": "error",
|
|
251
|
-
"vue/valid-define-options": "error",
|
|
252
|
-
"vue/prefer-define-options": "error",
|
|
253
|
-
"vue/prefer-use-template-ref": "error",
|
|
254
|
-
"vue/no-irregular-whitespace": "error",
|
|
255
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
256
|
-
"vue/no-deprecated-delete-set": "error",
|
|
257
|
-
"vue/no-empty-component-block": "error",
|
|
258
|
-
"vue/require-typed-object-prop": "error",
|
|
259
|
-
"vue/no-unused-emit-declarations": "error",
|
|
260
|
-
"vue/padding-line-between-blocks": "error",
|
|
261
|
-
"vue/no-multiple-objects-in-class": "error",
|
|
262
|
-
"vue/prefer-separate-static-class": "error",
|
|
263
|
-
"vue/no-ref-object-reactivity-loss": "error",
|
|
264
|
-
"vue/prefer-prop-type-boolean-first": "error",
|
|
265
|
-
"vue/html-comment-indent": ["error", 2],
|
|
266
|
-
"vue/next-tick-style": ["error", "promise"],
|
|
267
|
-
"vue/v-for-delimiter-style": ["error", "in"],
|
|
268
|
-
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
269
|
-
"vue/slot-name-casing": ["error", "kebab-case"],
|
|
270
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
271
|
-
"vue/define-props-declaration": ["error", "type-based"],
|
|
272
|
-
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
273
|
-
"vue/prefer-true-attribute-shorthand": ["error", "always"],
|
|
274
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
275
|
-
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
276
|
-
"vue/html-button-has-type": [
|
|
263
|
+
"vue/block-order": [
|
|
277
264
|
"error",
|
|
278
265
|
{
|
|
279
|
-
|
|
280
|
-
submit: true,
|
|
281
|
-
reset: true
|
|
266
|
+
order: ["script", "template", "style"]
|
|
282
267
|
}
|
|
283
268
|
],
|
|
284
|
-
"vue/
|
|
269
|
+
"vue/block-tag-newline": [
|
|
285
270
|
"error",
|
|
286
271
|
{
|
|
287
|
-
|
|
272
|
+
multiline: "always",
|
|
273
|
+
singleline: "always"
|
|
288
274
|
}
|
|
289
275
|
],
|
|
290
|
-
"vue/
|
|
276
|
+
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
277
|
+
"vue/component-name-in-template-casing": [
|
|
291
278
|
"error",
|
|
279
|
+
"PascalCase",
|
|
292
280
|
{
|
|
293
|
-
|
|
281
|
+
ignores: ["slot", "component"],
|
|
282
|
+
// Force auto-import components to be PascalCase
|
|
283
|
+
registeredComponentsOnly: false
|
|
294
284
|
}
|
|
295
285
|
],
|
|
296
|
-
"vue/
|
|
286
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
287
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
288
|
+
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
289
|
+
"vue/define-macros-order": [
|
|
297
290
|
"error",
|
|
298
291
|
{
|
|
299
|
-
|
|
292
|
+
defineExposeLast: true,
|
|
293
|
+
order: [
|
|
294
|
+
"defineProps",
|
|
295
|
+
"defineEmits",
|
|
296
|
+
"defineOptions",
|
|
297
|
+
"defineSlots",
|
|
298
|
+
"defineModel"
|
|
299
|
+
]
|
|
300
300
|
}
|
|
301
301
|
],
|
|
302
|
-
"vue/
|
|
302
|
+
"vue/define-props-declaration": ["error", "type-based"],
|
|
303
|
+
"vue/enforce-style-attribute": [
|
|
303
304
|
"error",
|
|
304
305
|
{
|
|
305
|
-
|
|
306
|
-
multiline: "always"
|
|
306
|
+
allow: ["scoped", "plain"]
|
|
307
307
|
}
|
|
308
308
|
],
|
|
309
|
-
"vue/
|
|
309
|
+
"vue/html-button-has-type": [
|
|
310
310
|
"error",
|
|
311
311
|
{
|
|
312
|
-
|
|
312
|
+
button: true,
|
|
313
|
+
reset: true,
|
|
314
|
+
submit: true
|
|
313
315
|
}
|
|
314
316
|
],
|
|
315
317
|
"vue/html-comment-content-newline": [
|
|
316
318
|
"error",
|
|
317
319
|
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
multiline: "always",
|
|
321
|
+
singleline: "ignore"
|
|
320
322
|
},
|
|
321
323
|
{
|
|
322
324
|
exceptions: ["*"]
|
|
323
325
|
}
|
|
324
326
|
],
|
|
325
|
-
"vue/
|
|
327
|
+
"vue/html-comment-content-spacing": [
|
|
326
328
|
"error",
|
|
329
|
+
"always",
|
|
327
330
|
{
|
|
328
|
-
|
|
331
|
+
exceptions: ["-"]
|
|
329
332
|
}
|
|
330
333
|
],
|
|
334
|
+
"vue/html-comment-indent": ["error", 2],
|
|
335
|
+
"vue/next-tick-style": ["error", "promise"],
|
|
336
|
+
"vue/no-deprecated-delete-set": "error",
|
|
331
337
|
"vue/no-deprecated-model-definition": [
|
|
332
338
|
"error",
|
|
333
339
|
{
|
|
334
340
|
allowVue3Compat: true
|
|
335
341
|
}
|
|
336
342
|
],
|
|
337
|
-
"vue/
|
|
343
|
+
"vue/no-duplicate-attr-inheritance": [
|
|
338
344
|
"error",
|
|
339
|
-
"PascalCase",
|
|
340
345
|
{
|
|
341
|
-
|
|
342
|
-
registeredComponentsOnly: false,
|
|
343
|
-
ignores: ["slot", "component"]
|
|
346
|
+
checkMultiRootNodes: true
|
|
344
347
|
}
|
|
345
348
|
],
|
|
346
|
-
"vue/
|
|
349
|
+
"vue/no-empty-component-block": "error",
|
|
350
|
+
"vue/no-irregular-whitespace": "error",
|
|
351
|
+
"vue/no-multiple-objects-in-class": "error",
|
|
352
|
+
"vue/no-ref-object-reactivity-loss": "error",
|
|
353
|
+
"vue/no-required-prop-with-default": [
|
|
347
354
|
"error",
|
|
348
355
|
{
|
|
349
|
-
|
|
350
|
-
defineExposeLast: true
|
|
356
|
+
autofix: true
|
|
351
357
|
}
|
|
352
358
|
],
|
|
353
|
-
"vue/
|
|
359
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
360
|
+
"vue/no-static-inline-styles": [
|
|
354
361
|
"error",
|
|
355
|
-
"always",
|
|
356
362
|
{
|
|
357
|
-
|
|
363
|
+
allowBinding: true
|
|
358
364
|
}
|
|
359
365
|
],
|
|
366
|
+
"vue/no-unused-emit-declarations": "error",
|
|
367
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
368
|
+
"vue/no-useless-v-bind": "error",
|
|
369
|
+
"vue/no-v-text": "error",
|
|
370
|
+
"vue/padding-line-between-blocks": "error",
|
|
371
|
+
"vue/prefer-define-options": "error",
|
|
372
|
+
"vue/prefer-prop-type-boolean-first": "error",
|
|
373
|
+
"vue/prefer-separate-static-class": "error",
|
|
374
|
+
"vue/prefer-true-attribute-shorthand": ["error", "always"],
|
|
375
|
+
"vue/prefer-use-template-ref": "error",
|
|
360
376
|
"vue/require-macro-variable-name": [
|
|
361
377
|
"error",
|
|
362
378
|
{
|
|
363
|
-
defineProps: "props",
|
|
364
379
|
defineEmits: "emits",
|
|
380
|
+
defineProps: "props",
|
|
365
381
|
defineSlots: "slots",
|
|
366
|
-
|
|
367
|
-
|
|
382
|
+
useAttrs: "attrs",
|
|
383
|
+
useSlots: "slots"
|
|
368
384
|
}
|
|
369
|
-
]
|
|
385
|
+
],
|
|
386
|
+
"vue/require-typed-object-prop": "error",
|
|
387
|
+
"vue/slot-name-casing": ["error", "kebab-case"],
|
|
388
|
+
"vue/v-for-delimiter-style": ["error", "in"],
|
|
389
|
+
"vue/valid-define-options": "error"
|
|
370
390
|
};
|
|
371
391
|
var configVue = (options = {}) => {
|
|
372
|
-
const {
|
|
392
|
+
const {
|
|
393
|
+
files = [GLOB_VUE],
|
|
394
|
+
extraFileExtensions = []
|
|
395
|
+
} = options;
|
|
373
396
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
374
397
|
function getVueProcessor() {
|
|
375
398
|
const processorVueSFC = default3.processors[".vue"];
|
|
376
399
|
if (!sfcBlocks) return processorVueSFC;
|
|
377
400
|
return mergeProcessors2([
|
|
378
401
|
processorVueSFC,
|
|
379
|
-
|
|
402
|
+
default25({
|
|
380
403
|
...sfcBlocks,
|
|
381
404
|
blocks: {
|
|
382
405
|
styles: true,
|
|
@@ -389,45 +412,32 @@ var configVue = (options = {}) => {
|
|
|
389
412
|
{
|
|
390
413
|
name: "ntnyq/vue/setup",
|
|
391
414
|
plugins: {
|
|
392
|
-
|
|
393
|
-
|
|
415
|
+
"@typescript-eslint": plugin,
|
|
416
|
+
vue: default3
|
|
394
417
|
}
|
|
395
418
|
},
|
|
396
419
|
{
|
|
397
420
|
name: "ntnyq/vue/rules",
|
|
398
421
|
files,
|
|
422
|
+
processor: getVueProcessor(),
|
|
399
423
|
languageOptions: {
|
|
400
424
|
parser: parserVue,
|
|
401
425
|
parserOptions: {
|
|
402
|
-
sourceType: "module",
|
|
403
426
|
ecmaVersion: "latest",
|
|
404
|
-
extraFileExtensions
|
|
405
|
-
parser
|
|
427
|
+
extraFileExtensions,
|
|
428
|
+
parser,
|
|
429
|
+
sourceType: "module",
|
|
406
430
|
ecmaFeatures: {
|
|
407
431
|
jsx: true
|
|
408
432
|
}
|
|
409
433
|
}
|
|
410
434
|
},
|
|
411
|
-
processor: getVueProcessor(),
|
|
412
435
|
rules: {
|
|
413
436
|
...sharedRules,
|
|
414
|
-
"vue/html-self-closing": [
|
|
415
|
-
"error",
|
|
416
|
-
{
|
|
417
|
-
html: {
|
|
418
|
-
void: "always",
|
|
419
|
-
normal: "always",
|
|
420
|
-
component: "always"
|
|
421
|
-
},
|
|
422
|
-
svg: "always",
|
|
423
|
-
math: "always"
|
|
424
|
-
}
|
|
425
|
-
],
|
|
426
|
-
"vue/this-in-template": ["error", "never"],
|
|
427
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
428
437
|
"vue/attributes-order": [
|
|
429
438
|
"error",
|
|
430
439
|
{
|
|
440
|
+
alphabetical: false,
|
|
431
441
|
order: [
|
|
432
442
|
"EVENTS",
|
|
433
443
|
// `@click="functionCall"`, `v-on="event"`
|
|
@@ -458,8 +468,26 @@ var configVue = (options = {}) => {
|
|
|
458
468
|
// `prop="foo", `static attributes
|
|
459
469
|
"ATTR_SHORTHAND_BOOL"
|
|
460
470
|
// `disabled`, prop shorthand
|
|
461
|
-
]
|
|
462
|
-
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
"vue/html-self-closing": [
|
|
475
|
+
"error",
|
|
476
|
+
{
|
|
477
|
+
math: "always",
|
|
478
|
+
svg: "always",
|
|
479
|
+
html: {
|
|
480
|
+
component: "always",
|
|
481
|
+
normal: "always",
|
|
482
|
+
void: "always"
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"vue/max-attributes-per-line": [
|
|
487
|
+
"error",
|
|
488
|
+
{
|
|
489
|
+
multiline: 1,
|
|
490
|
+
singleline: 1
|
|
463
491
|
}
|
|
464
492
|
],
|
|
465
493
|
"vue/order-in-components": [
|
|
@@ -485,6 +513,8 @@ var configVue = (options = {}) => {
|
|
|
485
513
|
"inheritAttrs",
|
|
486
514
|
"model",
|
|
487
515
|
["props", "propsData"],
|
|
516
|
+
"slots",
|
|
517
|
+
"expose",
|
|
488
518
|
"emits",
|
|
489
519
|
"setup",
|
|
490
520
|
"asyncData",
|
|
@@ -502,13 +532,8 @@ var configVue = (options = {}) => {
|
|
|
502
532
|
]
|
|
503
533
|
}
|
|
504
534
|
],
|
|
505
|
-
"vue/
|
|
506
|
-
|
|
507
|
-
{
|
|
508
|
-
singleline: 1,
|
|
509
|
-
multiline: 1
|
|
510
|
-
}
|
|
511
|
-
],
|
|
535
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
536
|
+
"vue/this-in-template": ["error", "never"],
|
|
512
537
|
...disabledRules,
|
|
513
538
|
...extensionRules,
|
|
514
539
|
...unCategorizedRules,
|
|
@@ -520,26 +545,29 @@ var configVue = (options = {}) => {
|
|
|
520
545
|
};
|
|
521
546
|
|
|
522
547
|
// src/configs/yml.ts
|
|
523
|
-
var configYml = (options = {}) =>
|
|
524
|
-
{
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
548
|
+
var configYml = (options = {}) => {
|
|
549
|
+
const { files = [GLOB_YAML] } = options;
|
|
550
|
+
return [
|
|
551
|
+
{
|
|
552
|
+
name: "ntnyq/yml",
|
|
553
|
+
files,
|
|
554
|
+
plugins: {
|
|
555
|
+
yml: default4
|
|
556
|
+
},
|
|
557
|
+
languageOptions: {
|
|
558
|
+
parser: parserYaml
|
|
559
|
+
},
|
|
560
|
+
rules: {
|
|
561
|
+
...default4.configs.standard.rules,
|
|
562
|
+
...default4.configs.prettier.rules,
|
|
563
|
+
"yml/no-empty-mapping-value": "off",
|
|
564
|
+
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
565
|
+
// Overrides rules
|
|
566
|
+
...options.overrides
|
|
567
|
+
}
|
|
540
568
|
}
|
|
541
|
-
|
|
542
|
-
|
|
569
|
+
];
|
|
570
|
+
};
|
|
543
571
|
|
|
544
572
|
// src/configs/node.ts
|
|
545
573
|
var configNode = (options = {}) => [
|
|
@@ -567,10 +595,12 @@ var configNode = (options = {}) => [
|
|
|
567
595
|
var configSort = (options = {}) => {
|
|
568
596
|
const configs2 = [];
|
|
569
597
|
const {
|
|
570
|
-
|
|
571
|
-
|
|
598
|
+
additionalJsonFiles = [],
|
|
599
|
+
additionalYamlFiles = [],
|
|
572
600
|
i18nLocale: enableSortI18nLocale = true,
|
|
573
|
-
|
|
601
|
+
packageJson: enableSortPackageJson = true,
|
|
602
|
+
pnpmWorkspace: enableSortPnpmWorkspace = true,
|
|
603
|
+
tsconfig: enableSortTsconfig = true
|
|
574
604
|
} = options;
|
|
575
605
|
if (enableSortTsconfig) {
|
|
576
606
|
configs2.push({
|
|
@@ -580,10 +610,20 @@ var configSort = (options = {}) => {
|
|
|
580
610
|
"jsonc/sort-keys": [
|
|
581
611
|
"error",
|
|
582
612
|
{
|
|
583
|
-
|
|
584
|
-
|
|
613
|
+
pathPattern: "^$",
|
|
614
|
+
order: [
|
|
615
|
+
"extends",
|
|
616
|
+
"compilerOptions",
|
|
617
|
+
"references",
|
|
618
|
+
"files",
|
|
619
|
+
"include",
|
|
620
|
+
"exclude",
|
|
621
|
+
// vue.volar
|
|
622
|
+
"vueCompilerOptions"
|
|
623
|
+
]
|
|
585
624
|
},
|
|
586
625
|
{
|
|
626
|
+
pathPattern: "^compilerOptions$",
|
|
587
627
|
order: [
|
|
588
628
|
/* Projects */
|
|
589
629
|
"incremental",
|
|
@@ -623,6 +663,8 @@ var configSort = (options = {}) => {
|
|
|
623
663
|
"resolveJsonModule",
|
|
624
664
|
"allowArbitraryExtensions",
|
|
625
665
|
"noResolve",
|
|
666
|
+
"erasableSyntaxOnly",
|
|
667
|
+
"libReplacement",
|
|
626
668
|
/* JavaScript Support */
|
|
627
669
|
"allowJs",
|
|
628
670
|
"checkJs",
|
|
@@ -652,6 +694,7 @@ var configSort = (options = {}) => {
|
|
|
652
694
|
"declarationDir",
|
|
653
695
|
"preserveValueImports",
|
|
654
696
|
/* Interop Constraints */
|
|
697
|
+
"isolatedDeclarations",
|
|
655
698
|
"isolatedModules",
|
|
656
699
|
"verbatimModuleSyntax",
|
|
657
700
|
"allowSyntheticDefaultImports",
|
|
@@ -680,9 +723,17 @@ var configSort = (options = {}) => {
|
|
|
680
723
|
"useUnknownInCatchVariables",
|
|
681
724
|
/* Completeness */
|
|
682
725
|
"skipDefaultLibCheck",
|
|
683
|
-
"skipLibCheck"
|
|
684
|
-
|
|
685
|
-
|
|
726
|
+
"skipLibCheck",
|
|
727
|
+
{
|
|
728
|
+
order: {
|
|
729
|
+
type: "asc"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
order: { type: "asc" },
|
|
736
|
+
pathPattern: "^vueCompilerOptions$"
|
|
686
737
|
}
|
|
687
738
|
]
|
|
688
739
|
}
|
|
@@ -693,6 +744,25 @@ var configSort = (options = {}) => {
|
|
|
693
744
|
name: "ntnyq/sort/package-json",
|
|
694
745
|
files: ["**/package.json"],
|
|
695
746
|
rules: {
|
|
747
|
+
"jsonc/sort-array-values": [
|
|
748
|
+
"error",
|
|
749
|
+
{
|
|
750
|
+
order: { type: "asc" },
|
|
751
|
+
pathPattern: "^files$"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
order: { type: "asc" },
|
|
755
|
+
pathPattern: "^keywords$"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
order: { type: "asc" },
|
|
759
|
+
pathPattern: "^activationEvents$"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
order: { type: "asc" },
|
|
763
|
+
pathPattern: "^contributes.*$"
|
|
764
|
+
}
|
|
765
|
+
],
|
|
696
766
|
"jsonc/sort-keys": [
|
|
697
767
|
"error",
|
|
698
768
|
{
|
|
@@ -784,12 +854,17 @@ var configSort = (options = {}) => {
|
|
|
784
854
|
"prettier",
|
|
785
855
|
"nano-staged",
|
|
786
856
|
"lint-staged",
|
|
787
|
-
"eslintConfig"
|
|
857
|
+
"eslintConfig",
|
|
858
|
+
{
|
|
859
|
+
order: {
|
|
860
|
+
type: "asc"
|
|
861
|
+
}
|
|
862
|
+
}
|
|
788
863
|
]
|
|
789
864
|
},
|
|
790
865
|
{
|
|
791
|
-
|
|
792
|
-
|
|
866
|
+
order: { type: "asc" },
|
|
867
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
793
868
|
},
|
|
794
869
|
{
|
|
795
870
|
order: { type: "asc" },
|
|
@@ -797,7 +872,18 @@ var configSort = (options = {}) => {
|
|
|
797
872
|
},
|
|
798
873
|
{
|
|
799
874
|
pathPattern: "^exports.*$",
|
|
800
|
-
order: [
|
|
875
|
+
order: [
|
|
876
|
+
"./package.json",
|
|
877
|
+
"types",
|
|
878
|
+
"import",
|
|
879
|
+
"require",
|
|
880
|
+
"default",
|
|
881
|
+
{
|
|
882
|
+
order: {
|
|
883
|
+
type: "asc"
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
]
|
|
801
887
|
},
|
|
802
888
|
// VSCode extension
|
|
803
889
|
{
|
|
@@ -809,15 +895,27 @@ var configSort = (options = {}) => {
|
|
|
809
895
|
* @see {@link https://pnpm.io/package_json#publishconfig}
|
|
810
896
|
*/
|
|
811
897
|
{
|
|
812
|
-
|
|
813
|
-
|
|
898
|
+
pathPattern: "^publishConfig.*$",
|
|
899
|
+
order: [
|
|
900
|
+
"./package.json",
|
|
901
|
+
"types",
|
|
902
|
+
"import",
|
|
903
|
+
"require",
|
|
904
|
+
"default",
|
|
905
|
+
{
|
|
906
|
+
order: {
|
|
907
|
+
type: "asc"
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
]
|
|
814
911
|
},
|
|
815
912
|
// npm scripts
|
|
816
913
|
{
|
|
817
|
-
|
|
818
|
-
|
|
914
|
+
order: { type: "asc" },
|
|
915
|
+
pathPattern: "^scripts$"
|
|
819
916
|
},
|
|
820
917
|
{
|
|
918
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$",
|
|
821
919
|
order: [
|
|
822
920
|
// client hooks only
|
|
823
921
|
"pre-commit",
|
|
@@ -830,27 +928,7 @@ var configSort = (options = {}) => {
|
|
|
830
928
|
"post-merge",
|
|
831
929
|
"pre-push",
|
|
832
930
|
"pre-auto-gc"
|
|
833
|
-
]
|
|
834
|
-
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
835
|
-
}
|
|
836
|
-
],
|
|
837
|
-
"jsonc/sort-array-values": [
|
|
838
|
-
"error",
|
|
839
|
-
{
|
|
840
|
-
pathPattern: "^files$",
|
|
841
|
-
order: { type: "asc" }
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
pathPattern: "^keywords$",
|
|
845
|
-
order: { type: "asc" }
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
pathPattern: "^activationEvents$",
|
|
849
|
-
order: { type: "asc" }
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
pathPattern: "^contributes.*$",
|
|
853
|
-
order: { type: "asc" }
|
|
931
|
+
]
|
|
854
932
|
}
|
|
855
933
|
]
|
|
856
934
|
}
|
|
@@ -860,26 +938,26 @@ var configSort = (options = {}) => {
|
|
|
860
938
|
configs2.push(
|
|
861
939
|
{
|
|
862
940
|
name: "ntnyq/sort/i18n-locale/json",
|
|
863
|
-
files: ["**/{locales
|
|
941
|
+
files: ["**/{i18n,langs,locales}/*.json"],
|
|
864
942
|
rules: {
|
|
865
943
|
"jsonc/sort-keys": [
|
|
866
944
|
"error",
|
|
867
945
|
{
|
|
868
|
-
|
|
869
|
-
|
|
946
|
+
order: { type: "asc" },
|
|
947
|
+
pathPattern: ".*"
|
|
870
948
|
}
|
|
871
949
|
]
|
|
872
950
|
}
|
|
873
951
|
},
|
|
874
952
|
{
|
|
875
953
|
name: "ntnyq/sort/i18n-locale/yaml",
|
|
876
|
-
files: ["**/{locales
|
|
954
|
+
files: ["**/{i18n,langs,locales}/*.y?(a)ml"],
|
|
877
955
|
rules: {
|
|
878
956
|
"yml/sort-keys": [
|
|
879
957
|
"error",
|
|
880
958
|
{
|
|
881
|
-
|
|
882
|
-
|
|
959
|
+
order: { type: "asc" },
|
|
960
|
+
pathPattern: ".*"
|
|
883
961
|
}
|
|
884
962
|
]
|
|
885
963
|
}
|
|
@@ -894,8 +972,38 @@ var configSort = (options = {}) => {
|
|
|
894
972
|
"yml/sort-keys": [
|
|
895
973
|
"error",
|
|
896
974
|
{
|
|
897
|
-
|
|
898
|
-
|
|
975
|
+
order: { type: "asc" },
|
|
976
|
+
pathPattern: ".*"
|
|
977
|
+
}
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
if (additionalJsonFiles.length) {
|
|
983
|
+
configs2.push({
|
|
984
|
+
name: "ntnyq/sort/additional-json",
|
|
985
|
+
files: additionalJsonFiles,
|
|
986
|
+
rules: {
|
|
987
|
+
"jsonc/sort-keys": [
|
|
988
|
+
"error",
|
|
989
|
+
{
|
|
990
|
+
order: { type: "asc" },
|
|
991
|
+
pathPattern: ".*"
|
|
992
|
+
}
|
|
993
|
+
]
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
if (additionalYamlFiles.length) {
|
|
998
|
+
configs2.push({
|
|
999
|
+
name: "ntnyq/sort/additional-yaml",
|
|
1000
|
+
files: additionalYamlFiles,
|
|
1001
|
+
rules: {
|
|
1002
|
+
"yml/sort-keys": [
|
|
1003
|
+
"error",
|
|
1004
|
+
{
|
|
1005
|
+
order: { type: "asc" },
|
|
1006
|
+
pathPattern: ".*"
|
|
899
1007
|
}
|
|
900
1008
|
]
|
|
901
1009
|
}
|
|
@@ -904,88 +1012,233 @@ var configSort = (options = {}) => {
|
|
|
904
1012
|
return configs2;
|
|
905
1013
|
};
|
|
906
1014
|
|
|
907
|
-
// src/configs/
|
|
908
|
-
var
|
|
909
|
-
{
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
"toml/no-space-dots": "error",
|
|
925
|
-
"toml/spaced-comment": "error",
|
|
926
|
-
"toml/precision-of-integer": "error",
|
|
927
|
-
"toml/table-bracket-spacing": "error",
|
|
928
|
-
"toml/array-bracket-newline": "error",
|
|
929
|
-
"toml/inline-table-curly-spacing": "error",
|
|
930
|
-
"toml/padding-line-between-pairs": "error",
|
|
931
|
-
"toml/padding-line-between-tables": "error",
|
|
932
|
-
"toml/no-unreadable-number-separator": "error",
|
|
933
|
-
"toml/precision-of-fractional-seconds": "error",
|
|
934
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
935
|
-
"toml/indent": ["error", 2],
|
|
936
|
-
"toml/array-bracket-spacing": ["error", "never"],
|
|
937
|
-
"toml/array-element-newline": ["error", "never"],
|
|
938
|
-
// Overrides rules
|
|
939
|
-
...options.overrides
|
|
1015
|
+
// src/configs/svgo.ts
|
|
1016
|
+
var configSVGO = (options = {}) => {
|
|
1017
|
+
const { files = [GLOB_SVG], ignores = [] } = options;
|
|
1018
|
+
return [
|
|
1019
|
+
{
|
|
1020
|
+
name: "ntnyq/svgo",
|
|
1021
|
+
files,
|
|
1022
|
+
ignores,
|
|
1023
|
+
plugins: {
|
|
1024
|
+
svgo: default5
|
|
1025
|
+
},
|
|
1026
|
+
languageOptions: {
|
|
1027
|
+
parser: parserPlain
|
|
1028
|
+
},
|
|
1029
|
+
rules: {
|
|
1030
|
+
"svgo/svgo": "error"
|
|
1031
|
+
}
|
|
940
1032
|
}
|
|
941
|
-
|
|
942
|
-
|
|
1033
|
+
];
|
|
1034
|
+
};
|
|
943
1035
|
|
|
944
|
-
// src/
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1036
|
+
// src/utils/env.ts
|
|
1037
|
+
import { resolve } from "node:path";
|
|
1038
|
+
import process from "node:process";
|
|
1039
|
+
import { isPackageExists } from "local-pkg";
|
|
1040
|
+
var hasPinia = () => isPackageExists("pinia");
|
|
1041
|
+
var hasVitest = () => isPackageExists("vitest");
|
|
1042
|
+
var hasTypeScript = () => isPackageExists("typescript");
|
|
1043
|
+
var hasShadcnVue = () => isPackageExists("radix-vue") && isPackageExists("clsx");
|
|
1044
|
+
var hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
1045
|
+
var hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
1046
|
+
paths: [
|
|
1047
|
+
resolve(process.cwd(), "playground"),
|
|
1048
|
+
resolve(process.cwd(), "docs")
|
|
1049
|
+
]
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// src/utils/toArray.ts
|
|
1053
|
+
function toArray(val) {
|
|
1054
|
+
val = val ?? [];
|
|
1055
|
+
return Array.isArray(val) ? val : [val];
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// src/utils/resolveSubOptions.ts
|
|
1059
|
+
function resolveSubOptions(options, key) {
|
|
1060
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// src/utils/getOverrides.ts
|
|
1064
|
+
function getOverrides(options, key) {
|
|
1065
|
+
const subOptions = resolveSubOptions(options, key);
|
|
1066
|
+
return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// src/utils/combineConfigs.ts
|
|
1070
|
+
async function combineConfigs(...configs2) {
|
|
1071
|
+
const resolved = await Promise.all(configs2);
|
|
1072
|
+
return resolved.flat();
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
// src/utils/ensurePackages.ts
|
|
1076
|
+
import process3 from "node:process";
|
|
1077
|
+
import { fileURLToPath } from "node:url";
|
|
1078
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1079
|
+
|
|
1080
|
+
// src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
|
|
1081
|
+
import process2 from "node:process";
|
|
1082
|
+
function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
|
|
1083
|
+
return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || process2.env.npm_lifecycle_script?.startsWith("nano-staged") || process2.env.npm_lifecycle_script?.startsWith("tsx"));
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// src/utils/ensurePackages.ts
|
|
1087
|
+
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
1088
|
+
var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
|
|
1089
|
+
function isPackageInScope(name) {
|
|
1090
|
+
return isPackageExists2(name, {
|
|
1091
|
+
paths: [scopeUrl]
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
async function ensurePackages(packages) {
|
|
1095
|
+
if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
const nonExistingPackages = packages.filter(
|
|
1099
|
+
(pkg) => !!pkg && !isPackageInScope(pkg)
|
|
1100
|
+
);
|
|
1101
|
+
if (nonExistingPackages.length === 0) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
const { confirm } = await import("@clack/prompts");
|
|
1105
|
+
const confirmInstall = await confirm({
|
|
1106
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
1107
|
+
});
|
|
1108
|
+
if (confirmInstall) {
|
|
1109
|
+
try {
|
|
1110
|
+
const { installPackage } = await import("@antfu/install-pkg");
|
|
1111
|
+
await installPackage(nonExistingPackages, { dev: true });
|
|
1112
|
+
} catch (err) {
|
|
1113
|
+
console.log(err);
|
|
954
1114
|
}
|
|
955
1115
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// src/utils/interopDefault.ts
|
|
1119
|
+
async function interopDefault(mod) {
|
|
1120
|
+
const resolved = await mod;
|
|
1121
|
+
return resolved.default || resolved;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// src/utils/mergePrettierOptions.ts
|
|
1125
|
+
function mergePrettierOptions(options = {}, overrides = {}) {
|
|
1126
|
+
const result = {
|
|
1127
|
+
...options,
|
|
1128
|
+
...overrides,
|
|
1129
|
+
plugins: [
|
|
1130
|
+
// built-in plugins
|
|
1131
|
+
...options.plugins || [],
|
|
1132
|
+
// custom plugins
|
|
1133
|
+
...overrides.plugins || []
|
|
1134
|
+
]
|
|
1135
|
+
};
|
|
1136
|
+
return result;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// src/configs/test.ts
|
|
1140
|
+
var configTest = (options = {}) => {
|
|
1141
|
+
const {
|
|
1142
|
+
// default test files
|
|
1143
|
+
files = [...GLOB_TEST],
|
|
1144
|
+
vitest: enableVitest = hasVitest()
|
|
1145
|
+
} = options;
|
|
1146
|
+
const configs2 = [
|
|
961
1147
|
{
|
|
962
|
-
name: "ntnyq/
|
|
1148
|
+
name: "ntnyq/test/setup",
|
|
963
1149
|
plugins: {
|
|
964
|
-
|
|
965
|
-
}
|
|
966
|
-
|
|
1150
|
+
"no-only-tests": default20
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
name: "ntnyq/test/base",
|
|
1155
|
+
files,
|
|
967
1156
|
rules: {
|
|
968
|
-
|
|
1157
|
+
"max-lines-per-function": "off",
|
|
1158
|
+
"no-unused-expressions": "off",
|
|
1159
|
+
"no-only-tests/no-only-tests": "error",
|
|
969
1160
|
// Overrides rules
|
|
970
|
-
...options.
|
|
1161
|
+
...options.overrides
|
|
971
1162
|
}
|
|
972
1163
|
}
|
|
973
1164
|
];
|
|
1165
|
+
if (enableVitest) {
|
|
1166
|
+
configs2.push({
|
|
1167
|
+
name: "ntnyq/test/vitest",
|
|
1168
|
+
files,
|
|
1169
|
+
plugins: {
|
|
1170
|
+
vitest: default15
|
|
1171
|
+
},
|
|
1172
|
+
settings: {
|
|
1173
|
+
/**
|
|
1174
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/tree/main?tab=readme-ov-file#enabling-with-type-testing
|
|
1175
|
+
*/
|
|
1176
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/issues/664
|
|
1177
|
+
// vitest: {
|
|
1178
|
+
// typecheck: true,
|
|
1179
|
+
// },
|
|
1180
|
+
},
|
|
1181
|
+
rules: {
|
|
1182
|
+
...default15.configs.recommended.rules,
|
|
1183
|
+
"vitest/expect-expect": [
|
|
1184
|
+
"error",
|
|
1185
|
+
{
|
|
1186
|
+
assertFunctionNames: [
|
|
1187
|
+
"expect",
|
|
1188
|
+
"assert",
|
|
1189
|
+
/**
|
|
1190
|
+
* type test
|
|
1191
|
+
*/
|
|
1192
|
+
"expectTypeOf",
|
|
1193
|
+
"assertType"
|
|
1194
|
+
]
|
|
1195
|
+
}
|
|
1196
|
+
],
|
|
1197
|
+
// Overrides rules
|
|
1198
|
+
...options.overridesVitestRules
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
return configs2;
|
|
974
1203
|
};
|
|
975
1204
|
|
|
976
|
-
// src/configs/
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
|
|
1205
|
+
// src/configs/toml.ts
|
|
1206
|
+
var configToml = (options = {}) => {
|
|
1207
|
+
const { files = [GLOB_TOML] } = options;
|
|
980
1208
|
return [
|
|
981
|
-
|
|
982
|
-
name: "ntnyq/
|
|
1209
|
+
{
|
|
1210
|
+
name: "ntnyq/toml",
|
|
983
1211
|
files,
|
|
1212
|
+
plugins: {
|
|
1213
|
+
toml: default6
|
|
1214
|
+
},
|
|
1215
|
+
languageOptions: {
|
|
1216
|
+
parser: parserToml
|
|
1217
|
+
},
|
|
984
1218
|
rules: {
|
|
985
|
-
"
|
|
986
|
-
|
|
1219
|
+
"toml/array-bracket-newline": "error",
|
|
1220
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
1221
|
+
"toml/array-element-newline": ["error", "never"],
|
|
1222
|
+
"toml/comma-style": "error",
|
|
1223
|
+
"toml/indent": ["error", 2],
|
|
1224
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1225
|
+
"toml/key-spacing": "error",
|
|
1226
|
+
"toml/keys-order": "error",
|
|
1227
|
+
"toml/no-space-dots": "error",
|
|
1228
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1229
|
+
"toml/padding-line-between-pairs": "error",
|
|
1230
|
+
"toml/padding-line-between-tables": "error",
|
|
1231
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1232
|
+
"toml/precision-of-integer": "error",
|
|
1233
|
+
"toml/quoted-keys": "error",
|
|
1234
|
+
"toml/spaced-comment": "error",
|
|
1235
|
+
"toml/table-bracket-spacing": "error",
|
|
1236
|
+
"toml/tables-order": "error",
|
|
1237
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1238
|
+
// Overrides rules
|
|
1239
|
+
...options.overrides
|
|
987
1240
|
}
|
|
988
|
-
}
|
|
1241
|
+
}
|
|
989
1242
|
];
|
|
990
1243
|
};
|
|
991
1244
|
|
|
@@ -994,14 +1247,14 @@ var configAntfu = (options = {}) => [
|
|
|
994
1247
|
{
|
|
995
1248
|
name: "ntnyq/antfu",
|
|
996
1249
|
plugins: {
|
|
997
|
-
antfu:
|
|
1250
|
+
antfu: default8
|
|
998
1251
|
},
|
|
999
1252
|
rules: {
|
|
1000
1253
|
// required `object-curly-newline` to be disabled
|
|
1001
1254
|
// 'antfu/consistent-list-newline': 'error',
|
|
1002
1255
|
"antfu/import-dedupe": "error",
|
|
1003
|
-
"antfu/no-import-dist": "error",
|
|
1004
1256
|
"antfu/indent-unindent": "error",
|
|
1257
|
+
"antfu/no-import-dist": "error",
|
|
1005
1258
|
"antfu/no-import-node-modules-by-path": "error",
|
|
1006
1259
|
// Overrides rules
|
|
1007
1260
|
...options.overrides
|
|
@@ -1028,7 +1281,7 @@ var configJsdoc = (options = {}) => [
|
|
|
1028
1281
|
{
|
|
1029
1282
|
name: "ntnyq/jsdoc",
|
|
1030
1283
|
plugins: {
|
|
1031
|
-
jsdoc:
|
|
1284
|
+
jsdoc: default9
|
|
1032
1285
|
},
|
|
1033
1286
|
rules: {
|
|
1034
1287
|
// Disabled rules
|
|
@@ -1036,34 +1289,19 @@ var configJsdoc = (options = {}) => [
|
|
|
1036
1289
|
// Use `jsdoc/sort-tags`
|
|
1037
1290
|
"jsdoc/text-escaping": "off",
|
|
1038
1291
|
// No need
|
|
1039
|
-
|
|
1040
|
-
"jsdoc/
|
|
1041
|
-
"jsdoc/
|
|
1042
|
-
"jsdoc/
|
|
1043
|
-
"jsdoc/
|
|
1292
|
+
"jsdoc/check-access": "warn",
|
|
1293
|
+
"jsdoc/implements-on-classes": "warn",
|
|
1294
|
+
"jsdoc/require-param-name": "warn",
|
|
1295
|
+
"jsdoc/require-property": "warn",
|
|
1296
|
+
"jsdoc/require-property-description": "warn",
|
|
1297
|
+
"jsdoc/require-property-name": "warn",
|
|
1298
|
+
"jsdoc/require-returns-check": "warn",
|
|
1299
|
+
"jsdoc/require-returns-description": "warn",
|
|
1300
|
+
"jsdoc/require-yields-check": "warn",
|
|
1044
1301
|
"jsdoc/check-alignment": "error",
|
|
1045
|
-
"jsdoc/multiline-blocks": "error",
|
|
1046
|
-
"jsdoc/check-param-names": "error",
|
|
1047
|
-
"jsdoc/no-multi-asterisks": "error",
|
|
1048
1302
|
"jsdoc/check-line-alignment": "error",
|
|
1303
|
+
"jsdoc/check-param-names": "error",
|
|
1049
1304
|
"jsdoc/check-property-names": "error",
|
|
1050
|
-
"jsdoc/require-asterisk-prefix": "error",
|
|
1051
|
-
"jsdoc/no-blank-block-descriptions": "error",
|
|
1052
|
-
"jsdoc/require-hyphen-before-param-description": "error",
|
|
1053
|
-
"jsdoc/no-bad-blocks": [
|
|
1054
|
-
"error",
|
|
1055
|
-
{
|
|
1056
|
-
ignore: [
|
|
1057
|
-
// built-in default
|
|
1058
|
-
"ts-check",
|
|
1059
|
-
"ts-expect-error",
|
|
1060
|
-
"ts-ignore",
|
|
1061
|
-
"ts-nocheck",
|
|
1062
|
-
// useful
|
|
1063
|
-
"vite-ignore"
|
|
1064
|
-
]
|
|
1065
|
-
}
|
|
1066
|
-
],
|
|
1067
1305
|
"jsdoc/check-tag-names": [
|
|
1068
1306
|
"error",
|
|
1069
1307
|
{
|
|
@@ -1084,62 +1322,96 @@ var configJsdoc = (options = {}) => [
|
|
|
1084
1322
|
]
|
|
1085
1323
|
}
|
|
1086
1324
|
],
|
|
1087
|
-
"jsdoc/check-
|
|
1088
|
-
|
|
1089
|
-
"jsdoc/
|
|
1090
|
-
"jsdoc/
|
|
1091
|
-
"jsdoc/
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1325
|
+
"jsdoc/check-types": "error",
|
|
1326
|
+
// Fixable rules
|
|
1327
|
+
"jsdoc/empty-tags": "error",
|
|
1328
|
+
"jsdoc/multiline-blocks": "error",
|
|
1329
|
+
"jsdoc/no-bad-blocks": [
|
|
1330
|
+
"error",
|
|
1331
|
+
{
|
|
1332
|
+
ignore: [
|
|
1333
|
+
// built-in default
|
|
1334
|
+
"ts-check",
|
|
1335
|
+
"ts-expect-error",
|
|
1336
|
+
"ts-ignore",
|
|
1337
|
+
"ts-nocheck",
|
|
1338
|
+
// useful
|
|
1339
|
+
"vite-ignore"
|
|
1340
|
+
]
|
|
1341
|
+
}
|
|
1342
|
+
],
|
|
1343
|
+
"jsdoc/no-blank-block-descriptions": "error",
|
|
1344
|
+
"jsdoc/no-blank-blocks": "error",
|
|
1345
|
+
"jsdoc/no-defaults": "error",
|
|
1346
|
+
"jsdoc/no-multi-asterisks": "error",
|
|
1347
|
+
"jsdoc/require-asterisk-prefix": "error",
|
|
1348
|
+
"jsdoc/require-hyphen-before-param-description": "error",
|
|
1096
1349
|
// TypeScript rules overrides
|
|
1097
1350
|
...options.typescript ? typescriptRules : javscriptRules,
|
|
1098
1351
|
// Overrides rules
|
|
1099
1352
|
...options.overrides
|
|
1100
1353
|
}
|
|
1101
|
-
}
|
|
1102
|
-
];
|
|
1354
|
+
}
|
|
1355
|
+
];
|
|
1356
|
+
|
|
1357
|
+
// src/configs/jsonc.ts
|
|
1358
|
+
var configJsonc = (options = {}) => {
|
|
1359
|
+
const { files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC] } = options;
|
|
1360
|
+
return [
|
|
1361
|
+
{
|
|
1362
|
+
name: "ntnyq/jsonc",
|
|
1363
|
+
files,
|
|
1364
|
+
plugins: {
|
|
1365
|
+
jsonc: default10
|
|
1366
|
+
},
|
|
1367
|
+
languageOptions: {
|
|
1368
|
+
parser: parserJsonc
|
|
1369
|
+
},
|
|
1370
|
+
rules: {
|
|
1371
|
+
...default10.configs["recommended-with-jsonc"].rules,
|
|
1372
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1373
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1374
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1375
|
+
"jsonc/indent": ["error", 2],
|
|
1376
|
+
"jsonc/key-spacing": [
|
|
1377
|
+
"error",
|
|
1378
|
+
{
|
|
1379
|
+
afterColon: true,
|
|
1380
|
+
beforeColon: false
|
|
1381
|
+
}
|
|
1382
|
+
],
|
|
1383
|
+
"jsonc/no-octal-escape": "error",
|
|
1384
|
+
"jsonc/object-curly-newline": [
|
|
1385
|
+
"error",
|
|
1386
|
+
{
|
|
1387
|
+
consistent: true,
|
|
1388
|
+
multiline: true
|
|
1389
|
+
}
|
|
1390
|
+
],
|
|
1391
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1392
|
+
"jsonc/object-property-newline": [
|
|
1393
|
+
"error",
|
|
1394
|
+
{
|
|
1395
|
+
allowMultiplePropertiesPerLine: true
|
|
1396
|
+
}
|
|
1397
|
+
],
|
|
1398
|
+
// Overrides rules
|
|
1399
|
+
...options.overrides
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
];
|
|
1403
|
+
};
|
|
1103
1404
|
|
|
1104
|
-
// src/configs/
|
|
1105
|
-
var
|
|
1405
|
+
// src/configs/ntnyq.ts
|
|
1406
|
+
var configNtnyq = (options = {}) => [
|
|
1106
1407
|
{
|
|
1107
|
-
name: "ntnyq/
|
|
1108
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1408
|
+
name: "ntnyq/ntnyq",
|
|
1109
1409
|
plugins: {
|
|
1110
|
-
|
|
1111
|
-
},
|
|
1112
|
-
languageOptions: {
|
|
1113
|
-
parser: parserJsonc
|
|
1410
|
+
ntnyq: default11
|
|
1114
1411
|
},
|
|
1115
1412
|
rules: {
|
|
1116
|
-
|
|
1117
|
-
"
|
|
1118
|
-
"jsonc/indent": ["error", 2],
|
|
1119
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1120
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1121
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1122
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1123
|
-
"jsonc/key-spacing": [
|
|
1124
|
-
"error",
|
|
1125
|
-
{
|
|
1126
|
-
beforeColon: false,
|
|
1127
|
-
afterColon: true
|
|
1128
|
-
}
|
|
1129
|
-
],
|
|
1130
|
-
"jsonc/object-curly-newline": [
|
|
1131
|
-
"error",
|
|
1132
|
-
{
|
|
1133
|
-
multiline: true,
|
|
1134
|
-
consistent: true
|
|
1135
|
-
}
|
|
1136
|
-
],
|
|
1137
|
-
"jsonc/object-property-newline": [
|
|
1138
|
-
"error",
|
|
1139
|
-
{
|
|
1140
|
-
allowMultiplePropertiesPerLine: true
|
|
1141
|
-
}
|
|
1142
|
-
],
|
|
1413
|
+
"ntnyq/no-duplicate-exports": "error",
|
|
1414
|
+
"ntnyq/prefer-newline-after-file-header": "error",
|
|
1143
1415
|
// Overrides rules
|
|
1144
1416
|
...options.overrides
|
|
1145
1417
|
}
|
|
@@ -1154,15 +1426,14 @@ var configPinia = (options = {}) => {
|
|
|
1154
1426
|
name: "ntnyq/pinia",
|
|
1155
1427
|
files,
|
|
1156
1428
|
plugins: {
|
|
1157
|
-
pinia:
|
|
1429
|
+
pinia: default12
|
|
1158
1430
|
},
|
|
1159
1431
|
rules: {
|
|
1160
|
-
"pinia/
|
|
1432
|
+
"pinia/never-export-initialized-store": "error",
|
|
1161
1433
|
"pinia/no-duplicate-store-ids": "error",
|
|
1162
1434
|
"pinia/no-return-global-properties": "error",
|
|
1163
1435
|
"pinia/no-store-to-refs-in-store": "error",
|
|
1164
|
-
"pinia/
|
|
1165
|
-
"pinia/require-setup-store-properties-export": "error",
|
|
1436
|
+
"pinia/prefer-single-store-per-file": "error",
|
|
1166
1437
|
"pinia/prefer-use-store-naming-convention": [
|
|
1167
1438
|
"error",
|
|
1168
1439
|
{
|
|
@@ -1170,6 +1441,7 @@ var configPinia = (options = {}) => {
|
|
|
1170
1441
|
storeSuffix: "Store"
|
|
1171
1442
|
}
|
|
1172
1443
|
],
|
|
1444
|
+
"pinia/require-setup-store-properties-export": "error",
|
|
1173
1445
|
// Overrides rules
|
|
1174
1446
|
...options.overrides
|
|
1175
1447
|
}
|
|
@@ -1177,21 +1449,6 @@ var configPinia = (options = {}) => {
|
|
|
1177
1449
|
];
|
|
1178
1450
|
};
|
|
1179
1451
|
|
|
1180
|
-
// src/configs/ntnyq.ts
|
|
1181
|
-
import { createConfig as createNtnyqConfig } from "eslint-plugin-ntnyq";
|
|
1182
|
-
var configNtnyq = (options = {}) => [
|
|
1183
|
-
{
|
|
1184
|
-
...createNtnyqConfig({
|
|
1185
|
-
rules: {
|
|
1186
|
-
"ntnyq/prefer-newline-after-file-header": "error",
|
|
1187
|
-
// Overrides rules
|
|
1188
|
-
...options.overrides
|
|
1189
|
-
}
|
|
1190
|
-
}),
|
|
1191
|
-
name: "ntnyq/ntnyq"
|
|
1192
|
-
}
|
|
1193
|
-
];
|
|
1194
|
-
|
|
1195
1452
|
// src/configs/depend.ts
|
|
1196
1453
|
var configDepend = (options = {}) => {
|
|
1197
1454
|
const {
|
|
@@ -1233,196 +1490,152 @@ var configDepend = (options = {}) => {
|
|
|
1233
1490
|
return configs2;
|
|
1234
1491
|
};
|
|
1235
1492
|
|
|
1236
|
-
// src/
|
|
1237
|
-
var
|
|
1238
|
-
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1239
|
-
const recommendedRules2 = {
|
|
1240
|
-
...recommendedConfig.rules
|
|
1241
|
-
};
|
|
1242
|
-
if (options.severity === "warn") {
|
|
1243
|
-
for (const key in recommendedRules2) {
|
|
1244
|
-
if (recommendedRules2[key] === "error") {
|
|
1245
|
-
recommendedRules2[key] = "warn";
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
return [
|
|
1250
|
-
{
|
|
1251
|
-
...recommendedConfig,
|
|
1252
|
-
name: "ntnyq/regexp",
|
|
1253
|
-
rules: {
|
|
1254
|
-
...recommendedRules2,
|
|
1255
|
-
// Overrides rules
|
|
1256
|
-
...options.overrides
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
];
|
|
1260
|
-
};
|
|
1261
|
-
|
|
1262
|
-
// src/configs/unocss.ts
|
|
1263
|
-
var configUnoCSS = (options = {}) => [
|
|
1264
|
-
{
|
|
1265
|
-
name: "ntnyq/unocss",
|
|
1266
|
-
plugins: {
|
|
1267
|
-
unocss: default13
|
|
1268
|
-
},
|
|
1269
|
-
rules: {
|
|
1270
|
-
"unocss/order": "error",
|
|
1271
|
-
"unocss/order-attributify": options.attributify ? "error" : "off",
|
|
1272
|
-
// Overrides rules
|
|
1273
|
-
...options.overrides
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
];
|
|
1277
|
-
|
|
1278
|
-
// src/constants.ts
|
|
1279
|
-
var DEFAULT_PRETTIER_OPTIONS = {
|
|
1280
|
-
// Include parentheses around a sole arrow function parameter
|
|
1493
|
+
// src/constants/prettier.ts
|
|
1494
|
+
var PRETTIER_DEFAULT_OPTIONS = {
|
|
1281
1495
|
arrowParens: "avoid",
|
|
1282
|
-
// Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
|
|
1283
1496
|
bracketSameLine: false,
|
|
1284
|
-
// Print spaces between brackets in object literals.
|
|
1285
1497
|
bracketSpacing: true,
|
|
1286
|
-
// Control whether Prettier formats quoted code embedded in the file
|
|
1287
1498
|
embeddedLanguageFormatting: "auto",
|
|
1288
|
-
// End of line
|
|
1289
1499
|
endOfLine: "lf",
|
|
1290
|
-
|
|
1500
|
+
experimentalOperatorPosition: "start",
|
|
1501
|
+
experimentalTernaries: false,
|
|
1291
1502
|
htmlWhitespaceSensitivity: "css",
|
|
1292
|
-
// Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
|
|
1293
1503
|
insertPragma: false,
|
|
1294
|
-
// Use single quotes instead of double quotes in JSX
|
|
1295
1504
|
jsxSingleQuote: true,
|
|
1296
|
-
|
|
1297
|
-
printWidth:
|
|
1298
|
-
// By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
|
|
1505
|
+
objectWrap: "preserve",
|
|
1506
|
+
printWidth: 80,
|
|
1299
1507
|
proseWrap: "preserve",
|
|
1300
|
-
// Change when properties in objects are quoted
|
|
1301
1508
|
quoteProps: "as-needed",
|
|
1302
1509
|
rangeEnd: Number.POSITIVE_INFINITY,
|
|
1303
|
-
// Format only a segment of a file.
|
|
1304
1510
|
rangeStart: 0,
|
|
1305
|
-
// Specify which parser to use.
|
|
1306
|
-
// parser: undefined,
|
|
1307
|
-
// Specify the file name to use to infer which parser to use.
|
|
1308
|
-
// filepath: undefined,
|
|
1309
|
-
// Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
1310
1511
|
requirePragma: false,
|
|
1311
|
-
// Use semicolons or not
|
|
1312
1512
|
semi: false,
|
|
1313
|
-
// Enforce single attribute per line in HTML, Vue and JSX
|
|
1314
1513
|
singleAttributePerLine: true,
|
|
1315
|
-
// Use single quotes instead of double quotes
|
|
1316
1514
|
singleQuote: true,
|
|
1317
|
-
// Specify the number of spaces per indentation-level
|
|
1318
1515
|
tabWidth: 2,
|
|
1319
|
-
// Print trailing commas wherever possible when multi-line
|
|
1320
1516
|
trailingComma: "all",
|
|
1321
|
-
// Indent lines with tabs instead of spaces
|
|
1322
1517
|
useTabs: false,
|
|
1323
|
-
// Whether or not to indent the code inside <script> and <style> tags in Vue files
|
|
1324
1518
|
vueIndentScriptAndStyle: false
|
|
1325
1519
|
};
|
|
1326
1520
|
|
|
1327
|
-
// src/
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
var
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1521
|
+
// src/constants/perfectionist.ts
|
|
1522
|
+
var PERFECTIONIST_COMMON_RULE_OPTIONS = {
|
|
1523
|
+
fallbackSort: { order: "asc", type: "alphabetical" },
|
|
1524
|
+
ignoreCase: true,
|
|
1525
|
+
order: "asc",
|
|
1526
|
+
type: "alphabetical"
|
|
1527
|
+
};
|
|
1528
|
+
var PERFECTIONIST_EXTRA_RULE_OPTIONS = {
|
|
1529
|
+
newlinesBetween: "ignore",
|
|
1530
|
+
partitionByComment: ["@pg", "@perfectionist-group"]
|
|
1531
|
+
};
|
|
1532
|
+
var PERFECTIONIST_SORT_OBJECTS_GROUPS = [
|
|
1533
|
+
"property",
|
|
1534
|
+
"multiline-property",
|
|
1535
|
+
"method",
|
|
1536
|
+
"multiline-method",
|
|
1537
|
+
"unknown"
|
|
1538
|
+
];
|
|
1539
|
+
var PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS = [
|
|
1540
|
+
"required-property",
|
|
1541
|
+
"optional-property",
|
|
1542
|
+
"required-method",
|
|
1543
|
+
"optional-method",
|
|
1544
|
+
"required-multiline-property",
|
|
1545
|
+
"optional-multiline-property",
|
|
1546
|
+
"required-multiline-method",
|
|
1547
|
+
"optional-multiline-method",
|
|
1548
|
+
"unknown",
|
|
1549
|
+
"index-signature",
|
|
1550
|
+
"multiline-index-signature"
|
|
1551
|
+
];
|
|
1552
|
+
var PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS = [
|
|
1553
|
+
/**
|
|
1554
|
+
* eg. 'foobar', 24, false
|
|
1555
|
+
*/
|
|
1556
|
+
"literal",
|
|
1557
|
+
/**
|
|
1558
|
+
* eg. number, string
|
|
1559
|
+
*/
|
|
1560
|
+
"keyword",
|
|
1561
|
+
/**
|
|
1562
|
+
* eg. FooBar
|
|
1563
|
+
*/
|
|
1564
|
+
"named",
|
|
1565
|
+
/**
|
|
1566
|
+
* eg. Foo & Bar
|
|
1567
|
+
*/
|
|
1568
|
+
"intersection",
|
|
1569
|
+
/**
|
|
1570
|
+
* eg. Foobar extends string ? Foo : Bar
|
|
1571
|
+
*/
|
|
1572
|
+
"conditional",
|
|
1573
|
+
/**
|
|
1574
|
+
* eg. (...args: any[]) => void
|
|
1575
|
+
*/
|
|
1576
|
+
"function",
|
|
1577
|
+
/**
|
|
1578
|
+
* eg. import('eslint').Linter
|
|
1579
|
+
*/
|
|
1580
|
+
"import",
|
|
1581
|
+
/**
|
|
1582
|
+
* eg. { foo: string; bar: number; }
|
|
1583
|
+
*/
|
|
1584
|
+
"object",
|
|
1585
|
+
/**
|
|
1586
|
+
* eg. keyof T
|
|
1587
|
+
*/
|
|
1588
|
+
"operator",
|
|
1589
|
+
/**
|
|
1590
|
+
* eg. [string, number]
|
|
1591
|
+
*/
|
|
1592
|
+
"tuple",
|
|
1593
|
+
/**
|
|
1594
|
+
* eg. Foo | Bar
|
|
1595
|
+
*/
|
|
1596
|
+
"union",
|
|
1597
|
+
/**
|
|
1598
|
+
* eg. null | undefined
|
|
1599
|
+
*/
|
|
1600
|
+
"nullish"
|
|
1601
|
+
];
|
|
1602
|
+
var PERFECTIONIST_SORT_IMPORTS_GROUPS = [
|
|
1603
|
+
// Side effect style imports (e.g. 'normalize.css')
|
|
1604
|
+
"side-effect-style",
|
|
1605
|
+
// Styles (e.g. *.{css,scss,less})
|
|
1606
|
+
"style",
|
|
1607
|
+
// Node.js built-in modules. (e.g. fs, path)
|
|
1608
|
+
"builtin",
|
|
1609
|
+
// External modules installed in the project (e.g. vue, lodash)
|
|
1610
|
+
"external",
|
|
1611
|
+
// Internal modules (e.g. @/utils, @/components)
|
|
1612
|
+
"internal",
|
|
1613
|
+
// Modules from parent directory (e.g. ../utils)
|
|
1614
|
+
"parent",
|
|
1615
|
+
// Modules from the same directory (e.g. ./utils)
|
|
1616
|
+
"sibling",
|
|
1617
|
+
// Main file from the current directory (e.g. ./index)
|
|
1618
|
+
"index",
|
|
1619
|
+
// TypeScript object-imports (e.g. import log = console.log)
|
|
1620
|
+
"object",
|
|
1621
|
+
// Side effect imports (e.g. import 'babel-polyfill')
|
|
1622
|
+
"side-effect",
|
|
1623
|
+
/**
|
|
1624
|
+
* Type import at the end
|
|
1625
|
+
*/
|
|
1626
|
+
"builtin-type",
|
|
1627
|
+
"external-type",
|
|
1628
|
+
"internal-type",
|
|
1629
|
+
"parent-type",
|
|
1630
|
+
"sibling-type",
|
|
1631
|
+
"index-type",
|
|
1632
|
+
"type",
|
|
1633
|
+
/**
|
|
1634
|
+
* Imports that don’t fit into any other group
|
|
1635
|
+
*/
|
|
1636
|
+
"unknown"
|
|
1637
|
+
];
|
|
1638
|
+
var PERFECTIONIST_SORT_CLASSES_GROUPS = ["unknown"];
|
|
1426
1639
|
|
|
1427
1640
|
// src/configs/format.ts
|
|
1428
1641
|
var configFormat = (options = {}) => {
|
|
@@ -1433,14 +1646,14 @@ var configFormat = (options = {}) => {
|
|
|
1433
1646
|
prettierOptions = {}
|
|
1434
1647
|
} = options;
|
|
1435
1648
|
const sharedPrettierOptions = {
|
|
1436
|
-
...
|
|
1649
|
+
...PRETTIER_DEFAULT_OPTIONS,
|
|
1437
1650
|
...prettierOptions
|
|
1438
1651
|
};
|
|
1439
1652
|
const configs2 = [
|
|
1440
1653
|
{
|
|
1441
1654
|
name: "ntnyq/format/setup",
|
|
1442
1655
|
plugins: {
|
|
1443
|
-
format:
|
|
1656
|
+
format: default13
|
|
1444
1657
|
}
|
|
1445
1658
|
}
|
|
1446
1659
|
];
|
|
@@ -1508,11 +1721,53 @@ var configFormat = (options = {}) => {
|
|
|
1508
1721
|
})
|
|
1509
1722
|
]
|
|
1510
1723
|
}
|
|
1511
|
-
});
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
return configs2;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1729
|
+
// src/configs/regexp.ts
|
|
1730
|
+
var configRegexp = (options = {}) => {
|
|
1731
|
+
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1732
|
+
const recommendedRules2 = {
|
|
1733
|
+
...recommendedConfig.rules
|
|
1734
|
+
};
|
|
1735
|
+
if (options.severity === "warn") {
|
|
1736
|
+
for (const key in recommendedRules2) {
|
|
1737
|
+
if (recommendedRules2[key] === "error") {
|
|
1738
|
+
recommendedRules2[key] = "warn";
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1512
1741
|
}
|
|
1513
|
-
return
|
|
1742
|
+
return [
|
|
1743
|
+
{
|
|
1744
|
+
...recommendedConfig,
|
|
1745
|
+
name: "ntnyq/regexp",
|
|
1746
|
+
rules: {
|
|
1747
|
+
...recommendedRules2,
|
|
1748
|
+
// Overrides rules
|
|
1749
|
+
...options.overrides
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
];
|
|
1514
1753
|
};
|
|
1515
1754
|
|
|
1755
|
+
// src/configs/unocss.ts
|
|
1756
|
+
var configUnoCSS = (options = {}) => [
|
|
1757
|
+
{
|
|
1758
|
+
name: "ntnyq/unocss",
|
|
1759
|
+
plugins: {
|
|
1760
|
+
unocss: default14
|
|
1761
|
+
},
|
|
1762
|
+
rules: {
|
|
1763
|
+
"unocss/order-attributify": options.attributify ? "error" : "off",
|
|
1764
|
+
"unocss/order": "error",
|
|
1765
|
+
// Overrides rules
|
|
1766
|
+
...options.overrides
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
];
|
|
1770
|
+
|
|
1516
1771
|
// src/configs/command.ts
|
|
1517
1772
|
import { builtinCommands } from "eslint-plugin-command/commands";
|
|
1518
1773
|
import createCommandConfig from "eslint-plugin-command/config";
|
|
@@ -1553,7 +1808,10 @@ var regexper = defineCommand({
|
|
|
1553
1808
|
removeComment: false,
|
|
1554
1809
|
message: "Update the regexper link",
|
|
1555
1810
|
fix(fixer) {
|
|
1556
|
-
return fixer.replaceTextRange(
|
|
1811
|
+
return fixer.replaceTextRange(
|
|
1812
|
+
[indexStart, indexEnd],
|
|
1813
|
+
`@regexper ${url}`
|
|
1814
|
+
);
|
|
1557
1815
|
}
|
|
1558
1816
|
});
|
|
1559
1817
|
}
|
|
@@ -1595,39 +1853,50 @@ var configIgnores = (customIgnores = []) => [
|
|
|
1595
1853
|
// src/configs/importX.ts
|
|
1596
1854
|
var configImportX = (options = {}) => {
|
|
1597
1855
|
const {
|
|
1598
|
-
typescript: enableTypeScript,
|
|
1599
1856
|
// use typescript resolve if possible
|
|
1600
|
-
preferTypeScriptResolver = true
|
|
1857
|
+
preferTypeScriptResolver = true,
|
|
1858
|
+
typescript: enableTypeScript
|
|
1601
1859
|
} = options;
|
|
1602
1860
|
return [
|
|
1603
1861
|
{
|
|
1604
1862
|
name: "ntnyq/import-x",
|
|
1605
1863
|
plugins: {
|
|
1606
|
-
"import-x":
|
|
1864
|
+
"import-x": default17
|
|
1607
1865
|
},
|
|
1608
1866
|
settings: {
|
|
1609
1867
|
"import-x/resolver-next": [
|
|
1610
1868
|
enableTypeScript && preferTypeScriptResolver ? createTypeScriptImportResolver({
|
|
1611
|
-
extensions: [
|
|
1869
|
+
extensions: [
|
|
1870
|
+
".ts",
|
|
1871
|
+
".tsx",
|
|
1872
|
+
".d.ts",
|
|
1873
|
+
".js",
|
|
1874
|
+
".jsx",
|
|
1875
|
+
".json",
|
|
1876
|
+
".node"
|
|
1877
|
+
]
|
|
1612
1878
|
}) : createNodeResolver({
|
|
1613
1879
|
extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
|
|
1614
1880
|
})
|
|
1615
1881
|
]
|
|
1616
1882
|
},
|
|
1617
1883
|
rules: {
|
|
1618
|
-
"import-x/no-unresolved": "off",
|
|
1619
1884
|
"import-x/no-absolute-path": "off",
|
|
1620
1885
|
"import-x/no-named-as-default-member": "off",
|
|
1621
1886
|
"import-x/no-named-default": "off",
|
|
1887
|
+
"import-x/no-unresolved": "off",
|
|
1622
1888
|
// disabled in favor or `perfectionist/sort-imports`
|
|
1623
1889
|
"import-x/order": "off",
|
|
1624
|
-
"import-x/
|
|
1890
|
+
"import-x/consistent-type-specifier-style": [
|
|
1891
|
+
"error",
|
|
1892
|
+
"prefer-top-level"
|
|
1893
|
+
],
|
|
1625
1894
|
"import-x/export": "error",
|
|
1626
|
-
"import-x/
|
|
1895
|
+
"import-x/first": "error",
|
|
1896
|
+
"import-x/newline-after-import": "error",
|
|
1627
1897
|
"import-x/no-duplicates": "error",
|
|
1628
1898
|
"import-x/no-mutable-exports": "error",
|
|
1629
|
-
"import-x/
|
|
1630
|
-
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
1899
|
+
"import-x/no-self-import": "error",
|
|
1631
1900
|
// Overrides rules
|
|
1632
1901
|
...options.overrides
|
|
1633
1902
|
}
|
|
@@ -1639,51 +1908,50 @@ var configImportX = (options = {}) => {
|
|
|
1639
1908
|
var disabledRules2 = {
|
|
1640
1909
|
"unicorn/better-regex": "off",
|
|
1641
1910
|
"unicorn/explicit-length-check": "off",
|
|
1642
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1643
1911
|
"unicorn/no-array-callback-reference": "off",
|
|
1644
1912
|
/**
|
|
1645
1913
|
* @see https://caniuse.com/?search=globalThis
|
|
1646
1914
|
*/
|
|
1647
|
-
"unicorn/prefer-global-this": "off"
|
|
1915
|
+
"unicorn/prefer-global-this": "off",
|
|
1916
|
+
"unicorn/prefer-top-level-await": "off"
|
|
1648
1917
|
};
|
|
1649
1918
|
var configUnicorn = (options = {}) => [
|
|
1650
1919
|
{
|
|
1651
1920
|
name: "ntnyq/unicorn",
|
|
1652
1921
|
plugins: {
|
|
1653
|
-
unicorn:
|
|
1922
|
+
unicorn: default16
|
|
1654
1923
|
},
|
|
1655
1924
|
rules: {
|
|
1925
|
+
"unicorn/consistent-assert": "error",
|
|
1926
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
1927
|
+
"unicorn/error-message": "error",
|
|
1656
1928
|
"unicorn/escape-case": "error",
|
|
1929
|
+
"unicorn/new-for-builtins": "error",
|
|
1930
|
+
"unicorn/no-accessor-recursion": "error",
|
|
1931
|
+
"unicorn/no-console-spaces": "error",
|
|
1657
1932
|
"unicorn/no-for-loop": "error",
|
|
1933
|
+
"unicorn/no-hex-escape": "error",
|
|
1934
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1658
1935
|
"unicorn/no-lonely-if": "error",
|
|
1659
|
-
"unicorn/error-message": "error",
|
|
1660
1936
|
"unicorn/no-new-buffer": "error",
|
|
1661
|
-
"unicorn/no-
|
|
1662
|
-
"unicorn/throw-new-error": "error",
|
|
1663
|
-
"unicorn/prefer-includes": "error",
|
|
1664
|
-
"unicorn/new-for-builtins": "error",
|
|
1665
|
-
"unicorn/prefer-type-error": "error",
|
|
1666
|
-
"unicorn/prefer-math-trunc": "error",
|
|
1667
|
-
"unicorn/no-console-spaces": "error",
|
|
1668
|
-
"unicorn/no-zero-fractions": "error",
|
|
1669
|
-
"unicorn/prefer-regexp-test": "error",
|
|
1670
|
-
"unicorn/number-literal-case": "error",
|
|
1937
|
+
"unicorn/no-static-only-class": "error",
|
|
1671
1938
|
"unicorn/no-typeof-undefined": "error",
|
|
1939
|
+
"unicorn/no-unnecessary-await": "error",
|
|
1940
|
+
"unicorn/prefer-includes": "error",
|
|
1941
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
1672
1942
|
"unicorn/prefer-math-min-max": "error",
|
|
1943
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1944
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
1945
|
+
"unicorn/prefer-negative-index": "error",
|
|
1673
1946
|
"unicorn/prefer-node-protocol": "error",
|
|
1674
|
-
"unicorn/
|
|
1675
|
-
"unicorn/
|
|
1947
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1948
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
1676
1949
|
"unicorn/prefer-reflect-apply": "error",
|
|
1677
|
-
"unicorn/prefer-negative-index": "error",
|
|
1678
1950
|
"unicorn/prefer-structured-clone": "error",
|
|
1679
|
-
"unicorn/custom-error-definition": "error",
|
|
1680
|
-
"unicorn/prefer-modern-math-apis": "error",
|
|
1681
|
-
"unicorn/prefer-number-properties": "error",
|
|
1682
|
-
"unicorn/prefer-prototype-methods": "error",
|
|
1683
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
1684
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1685
|
-
"unicorn/consistent-existence-index-check": "error",
|
|
1686
1951
|
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1952
|
+
/**
|
|
1953
|
+
* @pg Error
|
|
1954
|
+
*/
|
|
1687
1955
|
"unicorn/catch-error-name": [
|
|
1688
1956
|
"error",
|
|
1689
1957
|
{
|
|
@@ -1691,32 +1959,56 @@ var configUnicorn = (options = {}) => [
|
|
|
1691
1959
|
ignore: ["^_."]
|
|
1692
1960
|
}
|
|
1693
1961
|
],
|
|
1962
|
+
"unicorn/custom-error-definition": "error",
|
|
1963
|
+
"unicorn/prefer-type-error": "error",
|
|
1964
|
+
"unicorn/throw-new-error": "error",
|
|
1965
|
+
/**
|
|
1966
|
+
* @pg Number
|
|
1967
|
+
*/
|
|
1968
|
+
"unicorn/no-zero-fractions": "error",
|
|
1969
|
+
"unicorn/number-literal-case": "error",
|
|
1970
|
+
"unicorn/prefer-number-properties": "error",
|
|
1971
|
+
/**
|
|
1972
|
+
* @pg RegExp
|
|
1973
|
+
*/
|
|
1974
|
+
"unicorn/prefer-regexp-test": "error",
|
|
1975
|
+
/**
|
|
1976
|
+
* @pg Date
|
|
1977
|
+
*/
|
|
1978
|
+
"unicorn/consistent-date-clone": "error",
|
|
1694
1979
|
"unicorn/prefer-date-now": "error",
|
|
1695
|
-
|
|
1980
|
+
/**
|
|
1981
|
+
* @pg String
|
|
1982
|
+
*/
|
|
1696
1983
|
"unicorn/prefer-code-point": "error",
|
|
1697
1984
|
"unicorn/prefer-string-slice": "error",
|
|
1698
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
1699
1985
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1986
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
1987
|
+
/**
|
|
1988
|
+
* @pg DOM
|
|
1989
|
+
*/
|
|
1990
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1991
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1704
1992
|
"unicorn/prefer-dom-node-append": "error",
|
|
1705
1993
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
1706
|
-
"unicorn/prefer-
|
|
1994
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1707
1995
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1708
|
-
"unicorn/
|
|
1709
|
-
|
|
1710
|
-
|
|
1996
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
1997
|
+
"unicorn/prefer-query-selector": "error",
|
|
1998
|
+
/**
|
|
1999
|
+
* @pg Array
|
|
2000
|
+
*/
|
|
2001
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1711
2002
|
"unicorn/no-array-push-push": "error",
|
|
2003
|
+
"unicorn/no-new-array": "error",
|
|
1712
2004
|
"unicorn/prefer-array-find": "error",
|
|
1713
|
-
"unicorn/prefer-array-some": "error",
|
|
1714
|
-
"unicorn/no-instanceof-array": "error",
|
|
1715
2005
|
"unicorn/prefer-array-flat-map": "error",
|
|
1716
2006
|
"unicorn/prefer-array-index-of": "error",
|
|
2007
|
+
"unicorn/prefer-array-some": "error",
|
|
1717
2008
|
"unicorn/require-array-join-separator": "error",
|
|
1718
|
-
|
|
1719
|
-
|
|
2009
|
+
/**
|
|
2010
|
+
* @pg Set
|
|
2011
|
+
*/
|
|
1720
2012
|
"unicorn/prefer-set-has": "error",
|
|
1721
2013
|
"unicorn/prefer-set-size": "error",
|
|
1722
2014
|
...disabledRules2,
|
|
@@ -1726,106 +2018,13 @@ var configUnicorn = (options = {}) => [
|
|
|
1726
2018
|
}
|
|
1727
2019
|
];
|
|
1728
2020
|
|
|
1729
|
-
// src/configs/
|
|
1730
|
-
|
|
1731
|
-
var configSpecials = (options = {}) => {
|
|
1732
|
-
const {
|
|
1733
|
-
// Enable shadcn-vue support
|
|
1734
|
-
shadcnVue: enableShadcnVue = hasShadcnVue
|
|
1735
|
-
} = options;
|
|
1736
|
-
const configs2 = [
|
|
1737
|
-
{
|
|
1738
|
-
name: "ntnyq/specials/scripts",
|
|
1739
|
-
files: [`**/scripts/${GLOB_SRC}`],
|
|
1740
|
-
rules: {
|
|
1741
|
-
"no-console": "off",
|
|
1742
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1743
|
-
// Overrides rules
|
|
1744
|
-
...options.overridesScriptsRules
|
|
1745
|
-
}
|
|
1746
|
-
},
|
|
1747
|
-
{
|
|
1748
|
-
name: "ntnyq/specials/cli",
|
|
1749
|
-
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1750
|
-
rules: {
|
|
1751
|
-
"no-console": "off",
|
|
1752
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1753
|
-
// Overrides rules
|
|
1754
|
-
...options.overridesCliRules
|
|
1755
|
-
}
|
|
1756
|
-
},
|
|
1757
|
-
{
|
|
1758
|
-
name: "ntnyq/specials/userscript",
|
|
1759
|
-
files: [`**/*.user.${GLOB_SRC_EXT}`],
|
|
1760
|
-
languageOptions: {
|
|
1761
|
-
globals: {
|
|
1762
|
-
...globals.greasemonkey
|
|
1763
|
-
}
|
|
1764
|
-
},
|
|
1765
|
-
rules: {
|
|
1766
|
-
camelcase: [
|
|
1767
|
-
"error",
|
|
1768
|
-
{
|
|
1769
|
-
allow: ["^GM_.+"]
|
|
1770
|
-
}
|
|
1771
|
-
],
|
|
1772
|
-
// Overrides rules
|
|
1773
|
-
...options.overridesUserScriptsRules
|
|
1774
|
-
}
|
|
1775
|
-
},
|
|
1776
|
-
{
|
|
1777
|
-
name: "ntnyq/specials/config-file",
|
|
1778
|
-
files: [`**/*.config*.${GLOB_SRC_EXT}`],
|
|
1779
|
-
plugins: {
|
|
1780
|
-
"import-x": default16,
|
|
1781
|
-
perfectionist: default19
|
|
1782
|
-
},
|
|
1783
|
-
rules: {
|
|
1784
|
-
"no-console": "off",
|
|
1785
|
-
"import-x/no-default-export": "off",
|
|
1786
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1787
|
-
"perfectionist/sort-objects": [
|
|
1788
|
-
"error",
|
|
1789
|
-
{
|
|
1790
|
-
type: "alphabetical",
|
|
1791
|
-
order: "asc",
|
|
1792
|
-
partitionByComment: true,
|
|
1793
|
-
groups: ["unknown", "method", "multiline"]
|
|
1794
|
-
}
|
|
1795
|
-
],
|
|
1796
|
-
...options.overridesConfigFileRules
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
];
|
|
1800
|
-
if (enableShadcnVue) {
|
|
1801
|
-
const shadcnOptions = resolveSubOptions(options, "shadcnVue");
|
|
1802
|
-
configs2.push({
|
|
1803
|
-
name: "ntnyq/specials/shadcn-vue",
|
|
1804
|
-
files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
|
|
1805
|
-
rules: {
|
|
1806
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
1807
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
|
1808
|
-
// Overrides rules
|
|
1809
|
-
...shadcnOptions.overridesRules
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
|
-
}
|
|
1813
|
-
if (options.specialCaseConfigs) {
|
|
1814
|
-
configs2.push(...options.specialCaseConfigs);
|
|
1815
|
-
}
|
|
1816
|
-
return configs2;
|
|
1817
|
-
};
|
|
1818
|
-
|
|
1819
|
-
// src/configs/comments.ts
|
|
1820
|
-
var configComments = (options = {}) => [
|
|
2021
|
+
// src/configs/deMorgan.ts
|
|
2022
|
+
var configDeMorgan = (options = {}) => [
|
|
1821
2023
|
{
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
"@eslint-community/eslint-comments": default21
|
|
1825
|
-
},
|
|
2024
|
+
...default19.configs.recommended,
|
|
2025
|
+
name: "ntnyq/de-morgan",
|
|
1826
2026
|
rules: {
|
|
1827
|
-
...
|
|
1828
|
-
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
2027
|
+
...default19.configs.recommended.rules,
|
|
1829
2028
|
// Overrides rules
|
|
1830
2029
|
...options.overrides
|
|
1831
2030
|
}
|
|
@@ -1838,21 +2037,14 @@ var configMarkdown = (options = {}) => {
|
|
|
1838
2037
|
/**
|
|
1839
2038
|
* code block files
|
|
1840
2039
|
*/
|
|
1841
|
-
files = [
|
|
1842
|
-
|
|
1843
|
-
* other extensions
|
|
1844
|
-
*/
|
|
1845
|
-
extensions = [],
|
|
1846
|
-
/**
|
|
1847
|
-
* disbale type aware linting
|
|
1848
|
-
*/
|
|
1849
|
-
disableTypeAwareLinting = false
|
|
2040
|
+
files = [GLOB_MARKDOWN_CODE],
|
|
2041
|
+
extraFileExtensions = []
|
|
1850
2042
|
} = options;
|
|
1851
2043
|
const configs2 = [
|
|
1852
2044
|
/**
|
|
1853
2045
|
* extracting code blocks to be linted individually
|
|
1854
2046
|
*/
|
|
1855
|
-
...
|
|
2047
|
+
...default7.configs.processor.map((config) => ({
|
|
1856
2048
|
...config,
|
|
1857
2049
|
name: `ntnyq/${config.name}`
|
|
1858
2050
|
})),
|
|
@@ -1864,7 +2056,7 @@ var configMarkdown = (options = {}) => {
|
|
|
1864
2056
|
files,
|
|
1865
2057
|
ignores: [GLOB_MARKDOWN_NESTED],
|
|
1866
2058
|
processor: mergeProcessors([
|
|
1867
|
-
|
|
2059
|
+
default7.processors.markdown,
|
|
1868
2060
|
// Just pass through processor
|
|
1869
2061
|
processorPassThrough
|
|
1870
2062
|
])
|
|
@@ -1877,52 +2069,49 @@ var configMarkdown = (options = {}) => {
|
|
|
1877
2069
|
}
|
|
1878
2070
|
},
|
|
1879
2071
|
{
|
|
1880
|
-
name: "ntnyq/markdown/disabled
|
|
2072
|
+
name: "ntnyq/markdown/disabled",
|
|
1881
2073
|
files: [
|
|
1882
2074
|
...files,
|
|
1883
|
-
//
|
|
1884
|
-
...
|
|
2075
|
+
// more nested extensions to disable
|
|
2076
|
+
...extraFileExtensions.map((ext) => `${GLOB_MARKDOWN}/**/*${ext}`)
|
|
1885
2077
|
],
|
|
1886
2078
|
languageOptions: {
|
|
1887
2079
|
parserOptions: {
|
|
2080
|
+
// type-aware lint related parserOptions
|
|
2081
|
+
project: false,
|
|
2082
|
+
projectService: false,
|
|
1888
2083
|
ecmaFeatures: {
|
|
1889
2084
|
impliedStrict: true
|
|
1890
2085
|
}
|
|
1891
2086
|
}
|
|
1892
2087
|
},
|
|
1893
2088
|
rules: {
|
|
1894
|
-
"
|
|
2089
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
2090
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
2091
|
+
"@typescript-eslint/no-namespace": "off",
|
|
2092
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
2093
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
2094
|
+
"@typescript-eslint/no-unused-expressions": "off",
|
|
2095
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
2096
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
2097
|
+
"import-x/no-unresolved": "off",
|
|
1895
2098
|
"no-alert": "off",
|
|
1896
2099
|
"no-console": "off",
|
|
1897
|
-
"no-unused-vars": "off",
|
|
1898
|
-
"no-unused-expressions": "off",
|
|
1899
2100
|
"no-restricted-imports": "off",
|
|
2101
|
+
"no-undef": "off",
|
|
2102
|
+
"no-unused-expressions": "off",
|
|
2103
|
+
"no-unused-vars": "off",
|
|
1900
2104
|
"node/prefer-global/buffer": "off",
|
|
1901
2105
|
"node/prefer-global/process": "off",
|
|
1902
|
-
"import-x/no-unresolved": "off",
|
|
1903
2106
|
"unused-imports/no-unused-imports": "off",
|
|
1904
2107
|
"unused-imports/no-unused-vars": "off",
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
"@typescript-eslint/no-namespace": "off",
|
|
1908
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
1909
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
1910
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
1911
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
1912
|
-
"@typescript-eslint/no-unused-expressions": "off",
|
|
1913
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
|
2108
|
+
// disable all type-aware rules of @typescript-eslint
|
|
2109
|
+
...configs.disableTypeChecked.rules,
|
|
1914
2110
|
// Overrides rules
|
|
1915
2111
|
...options.overrides
|
|
1916
2112
|
}
|
|
1917
2113
|
}
|
|
1918
2114
|
];
|
|
1919
|
-
if (disableTypeAwareLinting) {
|
|
1920
|
-
configs2.push({
|
|
1921
|
-
...configs.disableTypeChecked,
|
|
1922
|
-
name: "ntnyq/markdown/disable/type-aware",
|
|
1923
|
-
files: [GLOB_MARKDOWN_CODE]
|
|
1924
|
-
});
|
|
1925
|
-
}
|
|
1926
2115
|
return configs2;
|
|
1927
2116
|
};
|
|
1928
2117
|
|
|
@@ -1937,7 +2126,7 @@ var configPrettier = (options = {}) => {
|
|
|
1937
2126
|
{
|
|
1938
2127
|
name: "ntnyq/prettier",
|
|
1939
2128
|
plugins: {
|
|
1940
|
-
prettier:
|
|
2129
|
+
prettier: default18
|
|
1941
2130
|
},
|
|
1942
2131
|
rules: {
|
|
1943
2132
|
"vue/array-bracket-newline": "off",
|
|
@@ -1977,26 +2166,131 @@ var configPrettier = (options = {}) => {
|
|
|
1977
2166
|
"vue/space-infix-ops": "off",
|
|
1978
2167
|
"vue/space-unary-ops": "off",
|
|
1979
2168
|
"vue/template-curly-spacing": "off",
|
|
1980
|
-
...
|
|
2169
|
+
...default18.configs.recommended.rules,
|
|
1981
2170
|
"prettier/prettier": options.severity || "warn",
|
|
1982
2171
|
// Overrides rules
|
|
1983
|
-
...options.overrides
|
|
2172
|
+
...options.overrides
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
/**
|
|
2176
|
+
* Languages that prettier currently does not support
|
|
2177
|
+
*/
|
|
2178
|
+
{
|
|
2179
|
+
name: "ntnyq/prettier/disabled",
|
|
2180
|
+
files: [...disabledFiles, ...userDisabledFiles],
|
|
2181
|
+
plugins: {
|
|
2182
|
+
prettier: default18
|
|
2183
|
+
},
|
|
2184
|
+
rules: {
|
|
2185
|
+
"prettier/prettier": "off"
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
];
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
// src/configs/specials.ts
|
|
2192
|
+
import globals from "globals";
|
|
2193
|
+
var configSpecials = (options = {}) => {
|
|
2194
|
+
const {
|
|
2195
|
+
// Enable shadcn-vue support
|
|
2196
|
+
shadcnVue: enableShadcnVue = hasShadcnVue()
|
|
2197
|
+
} = options;
|
|
2198
|
+
const configs2 = [
|
|
2199
|
+
{
|
|
2200
|
+
name: "ntnyq/specials/scripts",
|
|
2201
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
2202
|
+
rules: {
|
|
2203
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2204
|
+
"no-console": "off",
|
|
2205
|
+
// Overrides rules
|
|
2206
|
+
...options.overridesScriptsRules
|
|
2207
|
+
}
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
name: "ntnyq/specials/cli",
|
|
2211
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
2212
|
+
rules: {
|
|
2213
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2214
|
+
"no-console": "off",
|
|
2215
|
+
// Overrides rules
|
|
2216
|
+
...options.overridesCliRules
|
|
1984
2217
|
}
|
|
1985
2218
|
},
|
|
1986
|
-
/**
|
|
1987
|
-
* Languages that prettier currently does not support
|
|
1988
|
-
*/
|
|
1989
2219
|
{
|
|
1990
|
-
name: "ntnyq/
|
|
1991
|
-
files: [
|
|
2220
|
+
name: "ntnyq/specials/bin",
|
|
2221
|
+
files: [`**/bin/${GLOB_SRC}`, `**/bin.${GLOB_SRC_EXT}`],
|
|
2222
|
+
rules: {
|
|
2223
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2224
|
+
"antfu/no-import-dist": "off",
|
|
2225
|
+
"no-console": "off",
|
|
2226
|
+
// Overrides rules
|
|
2227
|
+
...options.overridesBinRules
|
|
2228
|
+
}
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
name: "ntnyq/specials/userscript",
|
|
2232
|
+
files: [`**/*.user.${GLOB_SRC_EXT}`],
|
|
2233
|
+
languageOptions: {
|
|
2234
|
+
globals: {
|
|
2235
|
+
...globals.greasemonkey
|
|
2236
|
+
}
|
|
2237
|
+
},
|
|
2238
|
+
rules: {
|
|
2239
|
+
camelcase: [
|
|
2240
|
+
"error",
|
|
2241
|
+
{
|
|
2242
|
+
allow: ["^GM_.+"]
|
|
2243
|
+
}
|
|
2244
|
+
],
|
|
2245
|
+
// Overrides rules
|
|
2246
|
+
...options.overridesUserScriptsRules
|
|
2247
|
+
}
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
name: "ntnyq/specials/config-file",
|
|
2251
|
+
files: [`**/*.config*.${GLOB_SRC_EXT}`],
|
|
1992
2252
|
plugins: {
|
|
1993
|
-
|
|
2253
|
+
"import-x": default17,
|
|
2254
|
+
perfectionist: default22
|
|
1994
2255
|
},
|
|
1995
2256
|
rules: {
|
|
1996
|
-
"
|
|
2257
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2258
|
+
"import-x/no-default-export": "off",
|
|
2259
|
+
"no-console": "off",
|
|
2260
|
+
"perfectionist/sort-objects": [
|
|
2261
|
+
"error",
|
|
2262
|
+
{
|
|
2263
|
+
...PERFECTIONIST_COMMON_RULE_OPTIONS,
|
|
2264
|
+
...PERFECTIONIST_EXTRA_RULE_OPTIONS,
|
|
2265
|
+
groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
|
|
2266
|
+
}
|
|
2267
|
+
],
|
|
2268
|
+
...options.overridesConfigFileRules
|
|
1997
2269
|
}
|
|
1998
2270
|
}
|
|
1999
2271
|
];
|
|
2272
|
+
if (enableShadcnVue) {
|
|
2273
|
+
const shadcnOptions = resolveSubOptions(options, "shadcnVue");
|
|
2274
|
+
configs2.push({
|
|
2275
|
+
name: "ntnyq/specials/shadcn-vue",
|
|
2276
|
+
files: shadcnOptions.files || [
|
|
2277
|
+
"**/components/ui/**/*.ts",
|
|
2278
|
+
"**/components/ui/**/*.vue"
|
|
2279
|
+
],
|
|
2280
|
+
rules: {
|
|
2281
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
2282
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
2283
|
+
"import-x/consistent-type-specifier-style": "off",
|
|
2284
|
+
"vue/define-emits-declaration": "off",
|
|
2285
|
+
// Overrides rules
|
|
2286
|
+
...shadcnOptions.overridesRules
|
|
2287
|
+
}
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
if (options.specialCaseConfigs) {
|
|
2291
|
+
configs2.push(...options.specialCaseConfigs);
|
|
2292
|
+
}
|
|
2293
|
+
return configs2;
|
|
2000
2294
|
};
|
|
2001
2295
|
|
|
2002
2296
|
// src/configs/gitignore.ts
|
|
@@ -2016,25 +2310,25 @@ import jsConfig from "@eslint/js";
|
|
|
2016
2310
|
import globals2 from "globals";
|
|
2017
2311
|
var strictRules = {
|
|
2018
2312
|
complexity: ["error", { max: 30 }],
|
|
2019
|
-
"max-params": ["error", { max: 5 }],
|
|
2020
2313
|
"max-depth": ["error", { max: 5 }],
|
|
2021
|
-
"max-nested-callbacks": ["error", { max: 10 }],
|
|
2022
2314
|
"max-lines": [
|
|
2023
2315
|
"error",
|
|
2024
2316
|
{
|
|
2025
2317
|
max: 1e3,
|
|
2026
|
-
|
|
2027
|
-
|
|
2318
|
+
skipBlankLines: true,
|
|
2319
|
+
skipComments: true
|
|
2028
2320
|
}
|
|
2029
2321
|
],
|
|
2030
2322
|
"max-lines-per-function": [
|
|
2031
2323
|
"error",
|
|
2032
2324
|
{
|
|
2033
2325
|
max: 200,
|
|
2034
|
-
|
|
2035
|
-
|
|
2326
|
+
skipBlankLines: true,
|
|
2327
|
+
skipComments: true
|
|
2036
2328
|
}
|
|
2037
|
-
]
|
|
2329
|
+
],
|
|
2330
|
+
"max-nested-callbacks": ["error", { max: 10 }],
|
|
2331
|
+
"max-params": ["error", { max: 5 }]
|
|
2038
2332
|
};
|
|
2039
2333
|
var configJavaScript = (options = {}) => [
|
|
2040
2334
|
{
|
|
@@ -2044,38 +2338,50 @@ var configJavaScript = (options = {}) => [
|
|
|
2044
2338
|
{
|
|
2045
2339
|
name: "ntnyq/js/core",
|
|
2046
2340
|
languageOptions: {
|
|
2341
|
+
sourceType: "module",
|
|
2047
2342
|
globals: {
|
|
2048
2343
|
...globals2.browser,
|
|
2049
2344
|
...globals2.es2021,
|
|
2050
2345
|
...globals2.node
|
|
2051
|
-
}
|
|
2052
|
-
sourceType: "module"
|
|
2346
|
+
}
|
|
2053
2347
|
},
|
|
2054
2348
|
rules: {
|
|
2055
|
-
"
|
|
2349
|
+
"consistent-return": "off",
|
|
2056
2350
|
"no-return-assign": "off",
|
|
2057
2351
|
"no-useless-escape": "off",
|
|
2058
|
-
"
|
|
2352
|
+
"require-await": "off",
|
|
2059
2353
|
// disabled in favor of `perfectionist/sort-named-imports`
|
|
2060
2354
|
"sort-imports": "off",
|
|
2061
2355
|
// standard v17.0.0
|
|
2062
|
-
"accessor-pairs": [
|
|
2356
|
+
"accessor-pairs": [
|
|
2357
|
+
"error",
|
|
2358
|
+
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
2359
|
+
],
|
|
2360
|
+
"array-callback-return": "error",
|
|
2361
|
+
"block-scoped-var": "error",
|
|
2063
2362
|
camelcase: [
|
|
2064
2363
|
"error",
|
|
2065
2364
|
{
|
|
2066
2365
|
allow: ["^UNSAFE_"],
|
|
2067
|
-
|
|
2068
|
-
|
|
2366
|
+
ignoreGlobals: true,
|
|
2367
|
+
properties: "never"
|
|
2069
2368
|
}
|
|
2070
2369
|
],
|
|
2071
2370
|
"constructor-super": "error",
|
|
2072
2371
|
curly: ["error", "multi-line"],
|
|
2073
2372
|
"default-case-last": "error",
|
|
2074
2373
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
2075
|
-
|
|
2374
|
+
// best-practice
|
|
2375
|
+
eqeqeq: ["error", "smart"],
|
|
2376
|
+
"new-cap": [
|
|
2377
|
+
"error",
|
|
2378
|
+
{ capIsNew: false, newIsCap: true, properties: true }
|
|
2379
|
+
],
|
|
2380
|
+
"no-alert": "error",
|
|
2076
2381
|
"no-array-constructor": "error",
|
|
2077
2382
|
"no-async-promise-executor": "error",
|
|
2078
2383
|
"no-caller": "error",
|
|
2384
|
+
"no-case-declarations": "error",
|
|
2079
2385
|
"no-class-assign": "error",
|
|
2080
2386
|
"no-compare-neg-zero": "error",
|
|
2081
2387
|
"no-cond-assign": "error",
|
|
@@ -2088,10 +2394,10 @@ var configJavaScript = (options = {}) => [
|
|
|
2088
2394
|
"no-dupe-class-members": "error",
|
|
2089
2395
|
"no-dupe-keys": "error",
|
|
2090
2396
|
"no-duplicate-case": "error",
|
|
2091
|
-
"no-useless-backreference": "error",
|
|
2092
2397
|
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
2093
2398
|
"no-empty-character-class": "error",
|
|
2094
2399
|
"no-empty-pattern": "error",
|
|
2400
|
+
"no-empty-static-block": "error",
|
|
2095
2401
|
"no-eval": "error",
|
|
2096
2402
|
"no-ex-assign": "error",
|
|
2097
2403
|
"no-extend-native": "error",
|
|
@@ -2109,15 +2415,16 @@ var configJavaScript = (options = {}) => [
|
|
|
2109
2415
|
"no-lone-blocks": "error",
|
|
2110
2416
|
"no-loss-of-precision": "error",
|
|
2111
2417
|
"no-misleading-character-class": "error",
|
|
2112
|
-
"no-
|
|
2113
|
-
"no-useless-catch": "error",
|
|
2418
|
+
"no-multi-str": "error",
|
|
2114
2419
|
"no-new": "error",
|
|
2115
2420
|
"no-new-func": "error",
|
|
2421
|
+
"no-new-native-nonconstructor": "error",
|
|
2116
2422
|
"no-new-wrappers": "error",
|
|
2117
2423
|
"no-obj-calls": "error",
|
|
2118
2424
|
"no-octal": "error",
|
|
2119
2425
|
"no-octal-escape": "error",
|
|
2120
2426
|
"no-proto": "error",
|
|
2427
|
+
"no-prototype-builtins": "error",
|
|
2121
2428
|
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
2122
2429
|
"no-regex-spaces": "error",
|
|
2123
2430
|
"no-self-assign": ["error", { props: true }],
|
|
@@ -2141,8 +2448,8 @@ var configJavaScript = (options = {}) => [
|
|
|
2141
2448
|
"error",
|
|
2142
2449
|
{
|
|
2143
2450
|
allowShortCircuit: true,
|
|
2144
|
-
|
|
2145
|
-
|
|
2451
|
+
allowTaggedTemplates: true,
|
|
2452
|
+
allowTernary: true
|
|
2146
2453
|
}
|
|
2147
2454
|
],
|
|
2148
2455
|
"no-unused-vars": [
|
|
@@ -2154,38 +2461,35 @@ var configJavaScript = (options = {}) => [
|
|
|
2154
2461
|
vars: "all"
|
|
2155
2462
|
}
|
|
2156
2463
|
],
|
|
2464
|
+
"no-use-before-define": [
|
|
2465
|
+
"error",
|
|
2466
|
+
{
|
|
2467
|
+
allowNamedExports: false,
|
|
2468
|
+
classes: false,
|
|
2469
|
+
functions: false,
|
|
2470
|
+
variables: true
|
|
2471
|
+
}
|
|
2472
|
+
],
|
|
2473
|
+
"no-useless-backreference": "error",
|
|
2157
2474
|
"no-useless-call": "error",
|
|
2475
|
+
"no-useless-catch": "error",
|
|
2158
2476
|
"no-useless-computed-key": "error",
|
|
2159
2477
|
"no-useless-constructor": "error",
|
|
2160
2478
|
"no-useless-rename": "error",
|
|
2161
2479
|
"no-useless-return": "error",
|
|
2162
|
-
"prefer-promise-reject-errors": "error",
|
|
2163
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
2164
|
-
"symbol-description": "error",
|
|
2165
|
-
"unicode-bom": ["error", "never"],
|
|
2166
|
-
"use-isnan": [
|
|
2167
|
-
"error",
|
|
2168
|
-
{
|
|
2169
|
-
enforceForSwitchCase: true,
|
|
2170
|
-
enforceForIndexOf: true
|
|
2171
|
-
}
|
|
2172
|
-
],
|
|
2173
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
2174
|
-
yoda: ["error", "never"],
|
|
2175
2480
|
// es6+
|
|
2176
2481
|
"no-var": "error",
|
|
2177
|
-
"
|
|
2178
|
-
"
|
|
2179
|
-
"
|
|
2180
|
-
"no-empty-static-block": "error",
|
|
2181
|
-
"no-new-native-nonconstructor": "error",
|
|
2182
|
-
"prefer-const": [
|
|
2482
|
+
"no-void": "error",
|
|
2483
|
+
"no-with": "error",
|
|
2484
|
+
"object-shorthand": [
|
|
2183
2485
|
"error",
|
|
2486
|
+
"always",
|
|
2184
2487
|
{
|
|
2185
|
-
|
|
2186
|
-
|
|
2488
|
+
avoidQuotes: true,
|
|
2489
|
+
ignoreConstructors: false
|
|
2187
2490
|
}
|
|
2188
2491
|
],
|
|
2492
|
+
"one-var": ["error", "never"],
|
|
2189
2493
|
"prefer-arrow-callback": [
|
|
2190
2494
|
"error",
|
|
2191
2495
|
{
|
|
@@ -2193,34 +2497,30 @@ var configJavaScript = (options = {}) => [
|
|
|
2193
2497
|
allowUnboundThis: true
|
|
2194
2498
|
}
|
|
2195
2499
|
],
|
|
2196
|
-
"
|
|
2500
|
+
"prefer-const": [
|
|
2197
2501
|
"error",
|
|
2198
|
-
"always",
|
|
2199
2502
|
{
|
|
2200
|
-
|
|
2201
|
-
|
|
2503
|
+
destructuring: "all",
|
|
2504
|
+
ignoreReadBeforeAssign: true
|
|
2202
2505
|
}
|
|
2203
2506
|
],
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
"
|
|
2207
|
-
"
|
|
2208
|
-
"
|
|
2209
|
-
"
|
|
2210
|
-
"
|
|
2211
|
-
"
|
|
2212
|
-
"no-void": "error",
|
|
2213
|
-
"vars-on-top": "error",
|
|
2214
|
-
"one-var": ["error", "never"],
|
|
2215
|
-
"no-use-before-define": [
|
|
2507
|
+
"prefer-promise-reject-errors": "error",
|
|
2508
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
2509
|
+
"prefer-rest-params": "error",
|
|
2510
|
+
"prefer-spread": "error",
|
|
2511
|
+
"prefer-template": "error",
|
|
2512
|
+
"symbol-description": "error",
|
|
2513
|
+
"unicode-bom": ["error", "never"],
|
|
2514
|
+
"use-isnan": [
|
|
2216
2515
|
"error",
|
|
2217
2516
|
{
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
variables: true,
|
|
2221
|
-
allowNamedExports: false
|
|
2517
|
+
enforceForIndexOf: true,
|
|
2518
|
+
enforceForSwitchCase: true
|
|
2222
2519
|
}
|
|
2223
2520
|
],
|
|
2521
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
2522
|
+
"vars-on-top": "error",
|
|
2523
|
+
yoda: ["error", "never"],
|
|
2224
2524
|
// Strict rules
|
|
2225
2525
|
...options.strict ? strictRules : {},
|
|
2226
2526
|
// Overrides rules
|
|
@@ -2231,7 +2531,7 @@ var configJavaScript = (options = {}) => [
|
|
|
2231
2531
|
var configJSX = () => [
|
|
2232
2532
|
{
|
|
2233
2533
|
name: "ntnyq/jsx",
|
|
2234
|
-
files: [
|
|
2534
|
+
files: [GLOB_JSX_ONLY],
|
|
2235
2535
|
languageOptions: {
|
|
2236
2536
|
parserOptions: {
|
|
2237
2537
|
ecmaFeatures: {
|
|
@@ -2245,44 +2545,47 @@ var configJSX = () => [
|
|
|
2245
2545
|
// src/configs/typescript.ts
|
|
2246
2546
|
import process4 from "node:process";
|
|
2247
2547
|
var typeAwareRules = {
|
|
2548
|
+
// too strict
|
|
2549
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
2248
2550
|
"dot-notation": "off",
|
|
2249
|
-
"require-await": "off",
|
|
2250
2551
|
"no-implied-eval": "off",
|
|
2251
2552
|
"no-throw-literal": "off",
|
|
2252
|
-
|
|
2253
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
2254
|
-
"@typescript-eslint/require-await": "error",
|
|
2255
|
-
"@typescript-eslint/unbound-method": "error",
|
|
2256
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
|
2553
|
+
"require-await": "off",
|
|
2257
2554
|
"@typescript-eslint/await-thenable": "error",
|
|
2555
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
2556
|
+
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
2557
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
2258
2558
|
"@typescript-eslint/no-for-in-array": "error",
|
|
2259
2559
|
"@typescript-eslint/no-implied-eval": "error",
|
|
2260
|
-
"@typescript-eslint/
|
|
2261
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
|
2560
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
2262
2561
|
"@typescript-eslint/no-misused-spread": "error",
|
|
2562
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
2563
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
2263
2564
|
"@typescript-eslint/no-unsafe-argument": "error",
|
|
2264
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
2265
2565
|
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
2266
|
-
"@typescript-eslint/no-
|
|
2566
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
2567
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
2568
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
2569
|
+
"@typescript-eslint/only-throw-error": "error",
|
|
2267
2570
|
"@typescript-eslint/promise-function-async": "error",
|
|
2571
|
+
"@typescript-eslint/require-await": "error",
|
|
2268
2572
|
"@typescript-eslint/restrict-plus-operands": "error",
|
|
2269
|
-
"@typescript-eslint/triple-slash-reference": "error",
|
|
2270
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
2271
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
2272
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
2273
2573
|
"@typescript-eslint/restrict-template-expressions": "error",
|
|
2274
|
-
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
2275
|
-
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
2276
2574
|
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
|
2277
|
-
"@typescript-eslint/
|
|
2575
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
2576
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
2577
|
+
"@typescript-eslint/unbound-method": "error"
|
|
2278
2578
|
};
|
|
2279
|
-
var recommendedRules = configs.recommended.reduce(
|
|
2280
|
-
|
|
2281
|
-
|
|
2579
|
+
var recommendedRules = configs.recommended.reduce(
|
|
2580
|
+
(rules, config) => {
|
|
2581
|
+
return { ...rules, ...config.rules || {} };
|
|
2582
|
+
},
|
|
2583
|
+
{}
|
|
2584
|
+
);
|
|
2282
2585
|
var configTypeScript = (options = {}) => {
|
|
2283
2586
|
const enableTypeAwareLint = !!options?.tsconfigPath;
|
|
2284
2587
|
const {
|
|
2285
|
-
|
|
2588
|
+
extraFileExtensions = [],
|
|
2286
2589
|
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
2287
2590
|
ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
|
|
2288
2591
|
overridesTypeAwareRules = {},
|
|
@@ -2291,19 +2594,19 @@ var configTypeScript = (options = {}) => {
|
|
|
2291
2594
|
const files = options.files ?? [
|
|
2292
2595
|
GLOB_TS,
|
|
2293
2596
|
GLOB_TSX,
|
|
2294
|
-
// Enable typescript in these
|
|
2295
|
-
...
|
|
2597
|
+
// Enable typescript in these files
|
|
2598
|
+
...extraFileExtensions.map((ext) => `**/*${ext}`)
|
|
2296
2599
|
];
|
|
2297
2600
|
function createParserConfig(enableTypeAware = false, files2 = [], ignores = []) {
|
|
2298
2601
|
const typescriptParserOptions = {
|
|
2299
|
-
extraFileExtensions
|
|
2602
|
+
extraFileExtensions,
|
|
2300
2603
|
sourceType: "module",
|
|
2301
2604
|
...enableTypeAware ? {
|
|
2605
|
+
tsconfigRootDir: process4.cwd(),
|
|
2302
2606
|
projectService: {
|
|
2303
2607
|
allowDefaultProject: ["./*.js"],
|
|
2304
2608
|
defaultProject: options.tsconfigPath
|
|
2305
|
-
}
|
|
2306
|
-
tsconfigRootDir: process4.cwd()
|
|
2609
|
+
}
|
|
2307
2610
|
} : {},
|
|
2308
2611
|
...parserOptions
|
|
2309
2612
|
};
|
|
@@ -2312,7 +2615,7 @@ var configTypeScript = (options = {}) => {
|
|
|
2312
2615
|
files: files2,
|
|
2313
2616
|
ignores: [...ignores],
|
|
2314
2617
|
languageOptions: {
|
|
2315
|
-
parser
|
|
2618
|
+
parser,
|
|
2316
2619
|
parserOptions: typescriptParserOptions
|
|
2317
2620
|
}
|
|
2318
2621
|
};
|
|
@@ -2323,7 +2626,7 @@ var configTypeScript = (options = {}) => {
|
|
|
2323
2626
|
name: "ntnyq/ts/setup",
|
|
2324
2627
|
plugins: {
|
|
2325
2628
|
"@typescript-eslint": plugin,
|
|
2326
|
-
antfu:
|
|
2629
|
+
antfu: default8
|
|
2327
2630
|
}
|
|
2328
2631
|
},
|
|
2329
2632
|
...enableTypeAwareLint ? [
|
|
@@ -2335,100 +2638,103 @@ var configTypeScript = (options = {}) => {
|
|
|
2335
2638
|
files,
|
|
2336
2639
|
rules: {
|
|
2337
2640
|
...recommendedRules,
|
|
2338
|
-
"@typescript-eslint/
|
|
2339
|
-
"@typescript-eslint/
|
|
2641
|
+
"@typescript-eslint/consistent-indexed-object-style": "off",
|
|
2642
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2643
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
2644
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
2340
2645
|
"@typescript-eslint/naming-convention": "off",
|
|
2341
2646
|
"@typescript-eslint/no-empty-function": "off",
|
|
2647
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
2648
|
+
"@typescript-eslint/no-namespace": "off",
|
|
2342
2649
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
2343
2650
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
2344
|
-
"
|
|
2345
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
2346
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
2347
|
-
"@typescript-eslint/consistent-indexed-object-style": "off",
|
|
2348
|
-
"@typescript-eslint/prefer-as-const": "warn",
|
|
2651
|
+
"default-param-last": "off",
|
|
2349
2652
|
// Disabled in favor of enhanced ts rules
|
|
2350
2653
|
"no-redeclare": "off",
|
|
2351
2654
|
"no-unused-vars": "off",
|
|
2352
|
-
"default-param-last": "off",
|
|
2353
2655
|
"no-use-before-define": "off",
|
|
2354
2656
|
"no-useless-constructor": "off",
|
|
2355
|
-
"@typescript-eslint/
|
|
2356
|
-
"@typescript-eslint/
|
|
2357
|
-
"@typescript-eslint/no-redeclare": [
|
|
2657
|
+
"@typescript-eslint/prefer-as-const": "warn",
|
|
2658
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
2358
2659
|
"error",
|
|
2359
2660
|
{
|
|
2360
|
-
|
|
2361
|
-
|
|
2661
|
+
minimumDescriptionLength: 1,
|
|
2662
|
+
"ts-check": false,
|
|
2663
|
+
"ts-expect-error": "allow-with-description",
|
|
2664
|
+
"ts-ignore": "allow-with-description",
|
|
2665
|
+
"ts-nocheck": "allow-with-description"
|
|
2362
2666
|
}
|
|
2363
2667
|
],
|
|
2364
|
-
|
|
2668
|
+
// Extra rules
|
|
2669
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
2670
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
2671
|
+
"error",
|
|
2672
|
+
"constructor"
|
|
2673
|
+
],
|
|
2674
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
2365
2675
|
"error",
|
|
2366
2676
|
{
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
variables: true,
|
|
2370
|
-
allowNamedExports: false,
|
|
2371
|
-
enums: true,
|
|
2372
|
-
typedefs: false,
|
|
2373
|
-
ignoreTypeReferences: false
|
|
2677
|
+
assertionStyle: "as",
|
|
2678
|
+
objectLiteralTypeAssertions: "allow-as-parameter"
|
|
2374
2679
|
}
|
|
2375
2680
|
],
|
|
2376
|
-
"@typescript-eslint/
|
|
2681
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
2377
2682
|
"error",
|
|
2378
2683
|
{
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
caughtErrors: "all",
|
|
2383
|
-
caughtErrorsIgnorePattern: "^_",
|
|
2384
|
-
destructuredArrayIgnorePattern: "^_",
|
|
2385
|
-
varsIgnorePattern: "^_",
|
|
2386
|
-
ignoreRestSiblings: true
|
|
2684
|
+
disallowTypeAnnotations: false,
|
|
2685
|
+
fixStyle: "separate-type-imports",
|
|
2686
|
+
prefer: "type-imports"
|
|
2387
2687
|
}
|
|
2388
2688
|
],
|
|
2389
|
-
|
|
2390
|
-
"@typescript-eslint/
|
|
2391
|
-
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
|
|
2392
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
2689
|
+
"@typescript-eslint/default-param-last": "error",
|
|
2690
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
2393
2691
|
"error",
|
|
2394
2692
|
{
|
|
2395
|
-
|
|
2396
|
-
"
|
|
2397
|
-
"ts-expect-error": "allow-with-description",
|
|
2398
|
-
"ts-ignore": "allow-with-description",
|
|
2399
|
-
"ts-nocheck": "allow-with-description"
|
|
2693
|
+
allowInterfaces: "always",
|
|
2694
|
+
allowObjectTypes: "always"
|
|
2400
2695
|
}
|
|
2401
2696
|
],
|
|
2402
|
-
"@typescript-eslint/no-
|
|
2697
|
+
"@typescript-eslint/no-redeclare": [
|
|
2403
2698
|
"error",
|
|
2404
2699
|
{
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
allowTaggedTemplates: true
|
|
2700
|
+
builtinGlobals: false,
|
|
2701
|
+
ignoreDeclarationMerge: true
|
|
2408
2702
|
}
|
|
2409
2703
|
],
|
|
2410
|
-
"@typescript-eslint/
|
|
2704
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
2411
2705
|
"error",
|
|
2412
2706
|
{
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2707
|
+
allowShortCircuit: true,
|
|
2708
|
+
allowTaggedTemplates: true,
|
|
2709
|
+
allowTernary: true
|
|
2416
2710
|
}
|
|
2417
2711
|
],
|
|
2418
|
-
"@typescript-eslint/no-
|
|
2712
|
+
"@typescript-eslint/no-unused-vars": [
|
|
2419
2713
|
"error",
|
|
2420
2714
|
{
|
|
2421
|
-
|
|
2422
|
-
|
|
2715
|
+
// Args after the last used will be reported
|
|
2716
|
+
args: "after-used",
|
|
2717
|
+
argsIgnorePattern: "^_",
|
|
2718
|
+
caughtErrors: "all",
|
|
2719
|
+
caughtErrorsIgnorePattern: "^_",
|
|
2720
|
+
destructuredArrayIgnorePattern: "^_",
|
|
2721
|
+
ignoreRestSiblings: true,
|
|
2722
|
+
varsIgnorePattern: "^_"
|
|
2423
2723
|
}
|
|
2424
2724
|
],
|
|
2425
|
-
"@typescript-eslint/
|
|
2725
|
+
"@typescript-eslint/no-use-before-define": [
|
|
2426
2726
|
"error",
|
|
2427
2727
|
{
|
|
2428
|
-
|
|
2429
|
-
|
|
2728
|
+
allowNamedExports: false,
|
|
2729
|
+
classes: false,
|
|
2730
|
+
enums: true,
|
|
2731
|
+
functions: false,
|
|
2732
|
+
ignoreTypeReferences: false,
|
|
2733
|
+
typedefs: false,
|
|
2734
|
+
variables: true
|
|
2430
2735
|
}
|
|
2431
2736
|
],
|
|
2737
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
2432
2738
|
// Overrides rules
|
|
2433
2739
|
...options.overrides
|
|
2434
2740
|
}
|
|
@@ -2449,11 +2755,15 @@ var configTypeScript = (options = {}) => {
|
|
|
2449
2755
|
name: "ntnyq/ts/types",
|
|
2450
2756
|
files: [...GLOB_TYPES],
|
|
2451
2757
|
rules: {
|
|
2452
|
-
"no-use-before-define": "off",
|
|
2453
|
-
"no-restricted-syntax": "off",
|
|
2454
|
-
"import-x/no-duplicates": "off",
|
|
2758
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
2455
2759
|
"import-x/newline-after-import": "off",
|
|
2456
|
-
"
|
|
2760
|
+
"import-x/no-duplicates": "off",
|
|
2761
|
+
"no-restricted-syntax": "off",
|
|
2762
|
+
"no-use-before-define": "off",
|
|
2763
|
+
// `var` is special for type extend
|
|
2764
|
+
// e.g: extend globalThis
|
|
2765
|
+
"no-var": "off",
|
|
2766
|
+
"vars-on-top": "off"
|
|
2457
2767
|
}
|
|
2458
2768
|
}
|
|
2459
2769
|
];
|
|
@@ -2462,7 +2772,9 @@ var configTypeScript = (options = {}) => {
|
|
|
2462
2772
|
// src/configs/eslintPlugin.ts
|
|
2463
2773
|
var configESLintPlugin = async (options = {}) => {
|
|
2464
2774
|
await ensurePackages(["eslint-plugin-eslint-plugin"]);
|
|
2465
|
-
const pluginESLintPlugin = await interopDefault(
|
|
2775
|
+
const pluginESLintPlugin = await interopDefault(
|
|
2776
|
+
import("eslint-plugin-eslint-plugin")
|
|
2777
|
+
);
|
|
2466
2778
|
return [
|
|
2467
2779
|
{
|
|
2468
2780
|
...pluginESLintPlugin.configs["flat/all"],
|
|
@@ -2482,19 +2794,20 @@ var configESLintPlugin = async (options = {}) => {
|
|
|
2482
2794
|
import { createConfig } from "eslint-plugin-github-action";
|
|
2483
2795
|
var configGitHubAction = (options = {}) => {
|
|
2484
2796
|
const {
|
|
2485
|
-
|
|
2797
|
+
files = [GLOB_GITHUB_ACTION],
|
|
2798
|
+
rules = {},
|
|
2486
2799
|
overrides: overridesRules = {},
|
|
2487
|
-
// Config options
|
|
2488
2800
|
...restOptions
|
|
2489
2801
|
} = options;
|
|
2490
2802
|
return [
|
|
2491
2803
|
createConfig({
|
|
2492
2804
|
name: "ntnyq/github-action",
|
|
2493
|
-
files
|
|
2805
|
+
files,
|
|
2494
2806
|
rules: {
|
|
2495
2807
|
"github-action/no-invalid-key": "error",
|
|
2496
2808
|
"github-action/prefer-file-extension": "error",
|
|
2497
2809
|
"github-action/require-action-name": "error",
|
|
2810
|
+
...rules,
|
|
2498
2811
|
...overridesRules
|
|
2499
2812
|
},
|
|
2500
2813
|
...restOptions
|
|
@@ -2503,191 +2816,209 @@ var configGitHubAction = (options = {}) => {
|
|
|
2503
2816
|
};
|
|
2504
2817
|
|
|
2505
2818
|
// src/configs/perfectionist.ts
|
|
2506
|
-
var INTERFACE_OR_OBJECT_TYPES_GROUPS = [
|
|
2507
|
-
"required-property",
|
|
2508
|
-
"optional-property",
|
|
2509
|
-
"required-method",
|
|
2510
|
-
"optional-method",
|
|
2511
|
-
"required-multiline-property",
|
|
2512
|
-
"optional-multiline-property",
|
|
2513
|
-
"required-multiline-method",
|
|
2514
|
-
"optional-multiline-method",
|
|
2515
|
-
"unknown",
|
|
2516
|
-
"index-signature",
|
|
2517
|
-
"multiline-index-signature"
|
|
2518
|
-
];
|
|
2519
|
-
var INTERSECTION_OR_UNION_TYPES_GROUPS = [
|
|
2520
|
-
/**
|
|
2521
|
-
* eg. 'foobar', 24, false
|
|
2522
|
-
*/
|
|
2523
|
-
"literal",
|
|
2524
|
-
/**
|
|
2525
|
-
* eg. number, string
|
|
2526
|
-
*/
|
|
2527
|
-
"keyword",
|
|
2528
|
-
/**
|
|
2529
|
-
* eg. FooBar
|
|
2530
|
-
*/
|
|
2531
|
-
"named",
|
|
2532
|
-
/**
|
|
2533
|
-
* eg. Foo & Bar
|
|
2534
|
-
*/
|
|
2535
|
-
"intersection",
|
|
2536
|
-
/**
|
|
2537
|
-
* eg. Foobar extends string ? Foo : Bar
|
|
2538
|
-
*/
|
|
2539
|
-
"conditional",
|
|
2540
|
-
/**
|
|
2541
|
-
* eg. (...args: any[]) => void
|
|
2542
|
-
*/
|
|
2543
|
-
"function",
|
|
2544
|
-
/**
|
|
2545
|
-
* eg. import('eslint').Linter
|
|
2546
|
-
*/
|
|
2547
|
-
"import",
|
|
2548
|
-
/**
|
|
2549
|
-
* eg. { foo: string; bar: number; }
|
|
2550
|
-
*/
|
|
2551
|
-
"object",
|
|
2552
|
-
/**
|
|
2553
|
-
* eg. keyof T
|
|
2554
|
-
*/
|
|
2555
|
-
"operator",
|
|
2556
|
-
/**
|
|
2557
|
-
* eg. [string, number]
|
|
2558
|
-
*/
|
|
2559
|
-
"tuple",
|
|
2560
|
-
/**
|
|
2561
|
-
* eg. Foo | Bar
|
|
2562
|
-
*/
|
|
2563
|
-
"union",
|
|
2564
|
-
/**
|
|
2565
|
-
* eg. null | undefined
|
|
2566
|
-
*/
|
|
2567
|
-
"nullish"
|
|
2568
|
-
];
|
|
2569
2819
|
var configPerfectionist = (options = {}) => {
|
|
2570
2820
|
const {
|
|
2571
|
-
|
|
2572
|
-
sortTypes: enableSortTypes = true,
|
|
2821
|
+
partitionByComment = PERFECTIONIST_EXTRA_RULE_OPTIONS.partitionByComment,
|
|
2573
2822
|
sortConstants: enableSortConstants = true,
|
|
2574
|
-
|
|
2823
|
+
sortEnums: enableSortEnums = true,
|
|
2824
|
+
sortTypes: enableSortTypes = true
|
|
2575
2825
|
} = options;
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2826
|
+
const commonRuleOptions = {
|
|
2827
|
+
...PERFECTIONIST_COMMON_RULE_OPTIONS
|
|
2828
|
+
};
|
|
2829
|
+
const commonRuleOptionsWithNewlinesBetween = {
|
|
2830
|
+
...commonRuleOptions,
|
|
2831
|
+
newlinesBetween: "ignore"
|
|
2832
|
+
};
|
|
2833
|
+
const commonRuleOptionsWithPartitionByComment = {
|
|
2834
|
+
...commonRuleOptions,
|
|
2835
|
+
partitionByComment
|
|
2836
|
+
};
|
|
2837
|
+
const commonRuleOptionsWithBoth = {
|
|
2838
|
+
...commonRuleOptionsWithNewlinesBetween,
|
|
2839
|
+
...commonRuleOptionsWithPartitionByComment
|
|
2840
|
+
};
|
|
2841
|
+
const commonRules = {
|
|
2842
|
+
"perfectionist/sort-exports": [
|
|
2843
|
+
"error",
|
|
2844
|
+
{
|
|
2845
|
+
...commonRuleOptionsWithPartitionByComment,
|
|
2846
|
+
groupKind: "values-first",
|
|
2847
|
+
type: "line-length"
|
|
2848
|
+
}
|
|
2849
|
+
],
|
|
2850
|
+
"perfectionist/sort-imports": [
|
|
2851
|
+
"error",
|
|
2852
|
+
{
|
|
2853
|
+
...commonRuleOptionsWithBoth,
|
|
2854
|
+
groups: PERFECTIONIST_SORT_IMPORTS_GROUPS,
|
|
2855
|
+
internalPattern: ["^~/.+", "^@/.+", "^#.+"]
|
|
2856
|
+
}
|
|
2857
|
+
],
|
|
2858
|
+
"perfectionist/sort-named-exports": [
|
|
2859
|
+
"error",
|
|
2860
|
+
{
|
|
2861
|
+
...commonRuleOptionsWithPartitionByComment,
|
|
2862
|
+
groupKind: "values-first",
|
|
2863
|
+
ignoreAlias: false
|
|
2864
|
+
}
|
|
2865
|
+
],
|
|
2866
|
+
"perfectionist/sort-named-imports": [
|
|
2867
|
+
"error",
|
|
2868
|
+
{
|
|
2869
|
+
...commonRuleOptionsWithPartitionByComment,
|
|
2870
|
+
groupKind: "values-first",
|
|
2871
|
+
ignoreAlias: false
|
|
2872
|
+
}
|
|
2873
|
+
]
|
|
2874
|
+
};
|
|
2875
|
+
const sharedRules2 = {
|
|
2876
|
+
"perfectionist/sort-enums": [
|
|
2877
|
+
"error",
|
|
2878
|
+
{
|
|
2879
|
+
...commonRuleOptionsWithBoth
|
|
2880
|
+
}
|
|
2881
|
+
]
|
|
2882
|
+
};
|
|
2883
|
+
const sortEnumsRules = {
|
|
2884
|
+
"perfectionist/sort-modules": [
|
|
2885
|
+
"error",
|
|
2886
|
+
{
|
|
2887
|
+
...commonRuleOptionsWithBoth
|
|
2888
|
+
}
|
|
2889
|
+
]
|
|
2890
|
+
};
|
|
2891
|
+
const sortTypesRules = {
|
|
2892
|
+
"perfectionist/sort-heritage-clauses": [
|
|
2893
|
+
"error",
|
|
2894
|
+
{
|
|
2895
|
+
...commonRuleOptions
|
|
2896
|
+
}
|
|
2897
|
+
],
|
|
2898
|
+
"perfectionist/sort-interfaces": [
|
|
2899
|
+
"error",
|
|
2900
|
+
{
|
|
2901
|
+
...commonRuleOptionsWithBoth,
|
|
2902
|
+
groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
|
|
2903
|
+
}
|
|
2904
|
+
],
|
|
2905
|
+
"perfectionist/sort-intersection-types": [
|
|
2906
|
+
"error",
|
|
2907
|
+
{
|
|
2908
|
+
...commonRuleOptionsWithBoth,
|
|
2909
|
+
groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
|
|
2910
|
+
}
|
|
2911
|
+
],
|
|
2912
|
+
"perfectionist/sort-object-types": [
|
|
2913
|
+
"error",
|
|
2914
|
+
{
|
|
2915
|
+
...commonRuleOptionsWithBoth,
|
|
2916
|
+
groups: PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS
|
|
2917
|
+
}
|
|
2918
|
+
],
|
|
2919
|
+
"perfectionist/sort-union-types": [
|
|
2920
|
+
"error",
|
|
2921
|
+
{
|
|
2922
|
+
...commonRuleOptionsWithBoth,
|
|
2923
|
+
groups: PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS
|
|
2924
|
+
}
|
|
2925
|
+
]
|
|
2926
|
+
};
|
|
2927
|
+
const sortConstantsRules = {
|
|
2928
|
+
"perfectionist/sort-maps": [
|
|
2929
|
+
"error",
|
|
2930
|
+
{
|
|
2931
|
+
...commonRuleOptionsWithBoth
|
|
2932
|
+
}
|
|
2933
|
+
],
|
|
2934
|
+
"perfectionist/sort-objects": [
|
|
2935
|
+
"error",
|
|
2936
|
+
{
|
|
2937
|
+
...commonRuleOptionsWithBoth,
|
|
2938
|
+
groups: PERFECTIONIST_SORT_OBJECTS_GROUPS
|
|
2939
|
+
}
|
|
2940
|
+
],
|
|
2941
|
+
"perfectionist/sort-sets": [
|
|
2942
|
+
"error",
|
|
2943
|
+
{
|
|
2944
|
+
...commonRuleOptionsWithBoth
|
|
2945
|
+
}
|
|
2946
|
+
]
|
|
2947
|
+
};
|
|
2948
|
+
const extraRules = {
|
|
2949
|
+
"perfectionist/sort-array-includes": [
|
|
2950
|
+
"error",
|
|
2951
|
+
{
|
|
2952
|
+
...commonRuleOptionsWithBoth,
|
|
2953
|
+
groups: ["literal", "spread"]
|
|
2954
|
+
}
|
|
2955
|
+
],
|
|
2956
|
+
"perfectionist/sort-classes": [
|
|
2957
|
+
"error",
|
|
2958
|
+
{
|
|
2959
|
+
...commonRuleOptionsWithBoth,
|
|
2960
|
+
groups: PERFECTIONIST_SORT_CLASSES_GROUPS
|
|
2961
|
+
}
|
|
2962
|
+
],
|
|
2963
|
+
"perfectionist/sort-decorators": [
|
|
2964
|
+
"error",
|
|
2965
|
+
{
|
|
2966
|
+
...commonRuleOptionsWithPartitionByComment
|
|
2967
|
+
}
|
|
2968
|
+
],
|
|
2969
|
+
"perfectionist/sort-jsx-props": [
|
|
2970
|
+
"error",
|
|
2971
|
+
{
|
|
2972
|
+
...commonRuleOptions,
|
|
2973
|
+
groups: ["shorthand", "multiline", "unknown"]
|
|
2974
|
+
}
|
|
2975
|
+
],
|
|
2976
|
+
"perfectionist/sort-switch-case": [
|
|
2977
|
+
"error",
|
|
2978
|
+
{
|
|
2979
|
+
...commonRuleOptions
|
|
2980
|
+
}
|
|
2981
|
+
],
|
|
2982
|
+
"perfectionist/sort-variable-declarations": [
|
|
2983
|
+
"error",
|
|
2984
|
+
{
|
|
2985
|
+
...commonRuleOptionsWithPartitionByComment
|
|
2986
|
+
}
|
|
2987
|
+
]
|
|
2988
|
+
};
|
|
2586
2989
|
const configs2 = [
|
|
2587
2990
|
{
|
|
2588
|
-
name: "ntnyq/perfectionist/common",
|
|
2991
|
+
name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
|
|
2589
2992
|
plugins: {
|
|
2590
|
-
perfectionist:
|
|
2993
|
+
perfectionist: default22
|
|
2591
2994
|
},
|
|
2592
2995
|
rules: {
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
"style",
|
|
2602
|
-
// Node.js built-in modules. (e.g. fs, path)
|
|
2603
|
-
"builtin",
|
|
2604
|
-
// External modules installed in the project (e.g. vue, lodash)
|
|
2605
|
-
"external",
|
|
2606
|
-
// Internal modules (e.g. @/utils, @/components)
|
|
2607
|
-
"internal",
|
|
2608
|
-
// Modules from parent directory (e.g. ../utils)
|
|
2609
|
-
"parent",
|
|
2610
|
-
// Modules from the same directory (e.g. ./utils)
|
|
2611
|
-
"sibling",
|
|
2612
|
-
// Main file from the current directory (e.g. ./index)
|
|
2613
|
-
"index",
|
|
2614
|
-
// TypeScript object-imports (e.g. import log = console.log)
|
|
2615
|
-
"object",
|
|
2616
|
-
// Side effect imports (e.g. import 'babel-polyfill')
|
|
2617
|
-
"side-effect",
|
|
2618
|
-
/**
|
|
2619
|
-
* Type import at the end
|
|
2620
|
-
*/
|
|
2621
|
-
"builtin-type",
|
|
2622
|
-
"external-type",
|
|
2623
|
-
"internal-type",
|
|
2624
|
-
"parent-type",
|
|
2625
|
-
"sibling-type",
|
|
2626
|
-
"index-type",
|
|
2627
|
-
"type",
|
|
2628
|
-
/**
|
|
2629
|
-
* Imports that don’t fit into any other group
|
|
2630
|
-
*/
|
|
2631
|
-
"unknown"
|
|
2632
|
-
],
|
|
2633
|
-
internalPattern: ["^~/.+", "^@/.+", "^#.+"]
|
|
2634
|
-
}
|
|
2635
|
-
],
|
|
2636
|
-
"perfectionist/sort-exports": [
|
|
2637
|
-
"error",
|
|
2638
|
-
{
|
|
2639
|
-
...getCommonRuleOptions({
|
|
2640
|
-
disableNewlinesBetween: true
|
|
2641
|
-
}),
|
|
2642
|
-
type: "line-length",
|
|
2643
|
-
groupKind: "values-first"
|
|
2644
|
-
}
|
|
2645
|
-
],
|
|
2646
|
-
"perfectionist/sort-named-exports": [
|
|
2647
|
-
"error",
|
|
2648
|
-
{
|
|
2649
|
-
...getCommonRuleOptions({
|
|
2650
|
-
disableNewlinesBetween: true
|
|
2651
|
-
}),
|
|
2652
|
-
ignoreAlias: false,
|
|
2653
|
-
groupKind: "values-first"
|
|
2654
|
-
}
|
|
2655
|
-
],
|
|
2656
|
-
"perfectionist/sort-named-imports": [
|
|
2657
|
-
"error",
|
|
2658
|
-
{
|
|
2659
|
-
...getCommonRuleOptions({
|
|
2660
|
-
disableNewlinesBetween: true
|
|
2661
|
-
}),
|
|
2662
|
-
ignoreAlias: false,
|
|
2663
|
-
groupKind: "values-first"
|
|
2664
|
-
}
|
|
2665
|
-
],
|
|
2996
|
+
...commonRules,
|
|
2997
|
+
...options.all ? {
|
|
2998
|
+
...sharedRules2,
|
|
2999
|
+
...sortEnumsRules,
|
|
3000
|
+
...sortTypesRules,
|
|
3001
|
+
...sortConstantsRules,
|
|
3002
|
+
...extraRules
|
|
3003
|
+
} : {},
|
|
2666
3004
|
// Overrides rules
|
|
2667
3005
|
...options.overrides
|
|
2668
3006
|
}
|
|
2669
3007
|
}
|
|
2670
3008
|
];
|
|
3009
|
+
if (options.all) {
|
|
3010
|
+
return configs2;
|
|
3011
|
+
}
|
|
2671
3012
|
if (enableSortEnums) {
|
|
2672
3013
|
configs2.push({
|
|
2673
3014
|
name: "ntnyq/perfectionist/enums",
|
|
2674
3015
|
files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
|
|
2675
3016
|
plugins: {
|
|
2676
|
-
perfectionist:
|
|
3017
|
+
perfectionist: default22
|
|
2677
3018
|
},
|
|
2678
3019
|
rules: {
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
{
|
|
2682
|
-
...getCommonRuleOptions()
|
|
2683
|
-
}
|
|
2684
|
-
],
|
|
2685
|
-
"perfectionist/sort-modules": [
|
|
2686
|
-
"error",
|
|
2687
|
-
{
|
|
2688
|
-
...getCommonRuleOptions()
|
|
2689
|
-
}
|
|
2690
|
-
],
|
|
3020
|
+
...sharedRules2,
|
|
3021
|
+
...sortEnumsRules,
|
|
2691
3022
|
// Overrides rules
|
|
2692
3023
|
...options.overridesEnumsRules
|
|
2693
3024
|
}
|
|
@@ -2698,52 +3029,11 @@ var configPerfectionist = (options = {}) => {
|
|
|
2698
3029
|
name: "ntnyq/perfectionist/types",
|
|
2699
3030
|
files: [...GLOB_TYPES],
|
|
2700
3031
|
plugins: {
|
|
2701
|
-
perfectionist:
|
|
3032
|
+
perfectionist: default22
|
|
2702
3033
|
},
|
|
2703
3034
|
rules: {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
{
|
|
2707
|
-
...getCommonRuleOptions({
|
|
2708
|
-
disableNewlinesBetween: true,
|
|
2709
|
-
disablePartitionByComment: true
|
|
2710
|
-
})
|
|
2711
|
-
}
|
|
2712
|
-
],
|
|
2713
|
-
"perfectionist/sort-interfaces": [
|
|
2714
|
-
"error",
|
|
2715
|
-
{
|
|
2716
|
-
...getCommonRuleOptions(),
|
|
2717
|
-
groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
|
|
2718
|
-
}
|
|
2719
|
-
],
|
|
2720
|
-
"perfectionist/sort-intersection-types": [
|
|
2721
|
-
"error",
|
|
2722
|
-
{
|
|
2723
|
-
...getCommonRuleOptions(),
|
|
2724
|
-
groups: INTERSECTION_OR_UNION_TYPES_GROUPS
|
|
2725
|
-
}
|
|
2726
|
-
],
|
|
2727
|
-
"perfectionist/sort-modules": [
|
|
2728
|
-
"error",
|
|
2729
|
-
{
|
|
2730
|
-
...getCommonRuleOptions()
|
|
2731
|
-
}
|
|
2732
|
-
],
|
|
2733
|
-
"perfectionist/sort-object-types": [
|
|
2734
|
-
"error",
|
|
2735
|
-
{
|
|
2736
|
-
...getCommonRuleOptions(),
|
|
2737
|
-
groups: INTERFACE_OR_OBJECT_TYPES_GROUPS
|
|
2738
|
-
}
|
|
2739
|
-
],
|
|
2740
|
-
"perfectionist/sort-union-types": [
|
|
2741
|
-
"error",
|
|
2742
|
-
{
|
|
2743
|
-
...getCommonRuleOptions(),
|
|
2744
|
-
groups: INTERSECTION_OR_UNION_TYPES_GROUPS
|
|
2745
|
-
}
|
|
2746
|
-
],
|
|
3035
|
+
...sharedRules2,
|
|
3036
|
+
...sortTypesRules,
|
|
2747
3037
|
// Overrides rules
|
|
2748
3038
|
...options.overridesTypesRules
|
|
2749
3039
|
}
|
|
@@ -2754,34 +3044,11 @@ var configPerfectionist = (options = {}) => {
|
|
|
2754
3044
|
name: "ntnyq/perfectionist/constants",
|
|
2755
3045
|
files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
|
|
2756
3046
|
plugins: {
|
|
2757
|
-
perfectionist:
|
|
3047
|
+
perfectionist: default22
|
|
2758
3048
|
},
|
|
2759
3049
|
rules: {
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
{
|
|
2763
|
-
...getCommonRuleOptions()
|
|
2764
|
-
}
|
|
2765
|
-
],
|
|
2766
|
-
"perfectionist/sort-objects": [
|
|
2767
|
-
"error",
|
|
2768
|
-
{
|
|
2769
|
-
...getCommonRuleOptions(),
|
|
2770
|
-
groups: ["property", "multiline-property", "method", "multiline-method", "unknown"]
|
|
2771
|
-
}
|
|
2772
|
-
],
|
|
2773
|
-
"perfectionist/sort-sets": [
|
|
2774
|
-
"error",
|
|
2775
|
-
{
|
|
2776
|
-
...getCommonRuleOptions()
|
|
2777
|
-
}
|
|
2778
|
-
],
|
|
2779
|
-
"perfectionist/sort-modules": [
|
|
2780
|
-
"error",
|
|
2781
|
-
{
|
|
2782
|
-
...getCommonRuleOptions()
|
|
2783
|
-
}
|
|
2784
|
-
],
|
|
3050
|
+
...sharedRules2,
|
|
3051
|
+
...sortConstantsRules,
|
|
2785
3052
|
// Overrides rules
|
|
2786
3053
|
...options.overridesConstantsRules
|
|
2787
3054
|
}
|
|
@@ -2795,7 +3062,7 @@ var configUnusedImports = (options = {}) => [
|
|
|
2795
3062
|
{
|
|
2796
3063
|
name: "ntnyq/unused-imports",
|
|
2797
3064
|
plugins: {
|
|
2798
|
-
"unused-imports":
|
|
3065
|
+
"unused-imports": default23
|
|
2799
3066
|
},
|
|
2800
3067
|
rules: {
|
|
2801
3068
|
"@typescript-eslint/no-unused-vars": "off",
|
|
@@ -2803,14 +3070,14 @@ var configUnusedImports = (options = {}) => [
|
|
|
2803
3070
|
"unused-imports/no-unused-vars": [
|
|
2804
3071
|
"error",
|
|
2805
3072
|
{
|
|
2806
|
-
vars: "all",
|
|
2807
|
-
varsIgnorePattern: "^_",
|
|
2808
3073
|
args: "after-used",
|
|
2809
3074
|
argsIgnorePattern: "^_",
|
|
2810
|
-
ignoreRestSiblings: true,
|
|
2811
|
-
destructuredArrayIgnorePattern: "^_",
|
|
2812
3075
|
caughtErrors: "all",
|
|
2813
|
-
caughtErrorsIgnorePattern: "^_"
|
|
3076
|
+
caughtErrorsIgnorePattern: "^_",
|
|
3077
|
+
destructuredArrayIgnorePattern: "^_",
|
|
3078
|
+
ignoreRestSiblings: true,
|
|
3079
|
+
vars: "all",
|
|
3080
|
+
varsIgnorePattern: "^_"
|
|
2814
3081
|
}
|
|
2815
3082
|
],
|
|
2816
3083
|
// Overrides rules
|
|
@@ -2819,21 +3086,40 @@ var configUnusedImports = (options = {}) => [
|
|
|
2819
3086
|
}
|
|
2820
3087
|
];
|
|
2821
3088
|
|
|
3089
|
+
// src/configs/eslintComments.ts
|
|
3090
|
+
var configESLintComments = (options = {}) => [
|
|
3091
|
+
{
|
|
3092
|
+
name: "ntnyq/eslint-comments",
|
|
3093
|
+
plugins: {
|
|
3094
|
+
"@eslint-community/eslint-comments": default24
|
|
3095
|
+
},
|
|
3096
|
+
rules: {
|
|
3097
|
+
...default24.configs.recommended.rules,
|
|
3098
|
+
"@eslint-community/eslint-comments/disable-enable-pair": [
|
|
3099
|
+
"error",
|
|
3100
|
+
{ allowWholeFile: true }
|
|
3101
|
+
],
|
|
3102
|
+
// Overrides rules
|
|
3103
|
+
...options.overrides
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
];
|
|
3107
|
+
|
|
2822
3108
|
// src/core.ts
|
|
2823
3109
|
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2824
3110
|
const {
|
|
2825
3111
|
/**
|
|
2826
|
-
*
|
|
3112
|
+
* Shareable options
|
|
2827
3113
|
*/
|
|
2828
|
-
|
|
3114
|
+
shareable = {},
|
|
2829
3115
|
/**
|
|
2830
3116
|
* Conditional by deps
|
|
2831
3117
|
*/
|
|
2832
|
-
vue: enableVue = hasVue,
|
|
2833
|
-
pinia: enablePinia = hasPinia,
|
|
2834
|
-
test: enableTest = hasVitest,
|
|
2835
|
-
unocss: enableUnoCSS = hasUnoCSS,
|
|
2836
|
-
typescript: enableTypeScript = hasTypeScript,
|
|
3118
|
+
vue: enableVue = hasVue(),
|
|
3119
|
+
pinia: enablePinia = hasPinia(),
|
|
3120
|
+
test: enableTest = hasVitest(),
|
|
3121
|
+
unocss: enableUnoCSS = hasUnoCSS(),
|
|
3122
|
+
typescript: enableTypeScript = hasTypeScript(),
|
|
2837
3123
|
/**
|
|
2838
3124
|
* Enabled by default
|
|
2839
3125
|
*/
|
|
@@ -2846,6 +3132,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2846
3132
|
depend: enableDepend = true,
|
|
2847
3133
|
regexp: enableRegexp = true,
|
|
2848
3134
|
unicorn: enableUnicorn = true,
|
|
3135
|
+
deMorgan: enableDeMorgan = true,
|
|
2849
3136
|
prettier: enablePrettier = true,
|
|
2850
3137
|
markdown: enableMarkdown = true,
|
|
2851
3138
|
gitignore: enableGitIgnore = true,
|
|
@@ -2856,8 +3143,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2856
3143
|
eslintPlugin: enableESLintPlugin = false
|
|
2857
3144
|
} = options;
|
|
2858
3145
|
const configs2 = [];
|
|
3146
|
+
const { extraFileExtensions = [] } = shareable;
|
|
2859
3147
|
if (enableVue) {
|
|
2860
|
-
|
|
3148
|
+
extraFileExtensions.push(".vue");
|
|
2861
3149
|
}
|
|
2862
3150
|
if (enableGitIgnore) {
|
|
2863
3151
|
configs2.push(configGitIgnore(resolveSubOptions(options, "gitignore")));
|
|
@@ -2879,8 +3167,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2879
3167
|
overrides: getOverrides(options, "jsdoc"),
|
|
2880
3168
|
...resolveSubOptions(options, "jsdoc")
|
|
2881
3169
|
}),
|
|
2882
|
-
|
|
2883
|
-
overrides: getOverrides(options, "
|
|
3170
|
+
configESLintComments({
|
|
3171
|
+
overrides: getOverrides(options, "eslintComments")
|
|
2884
3172
|
}),
|
|
2885
3173
|
configJavaScript({
|
|
2886
3174
|
...resolveSubOptions(options, "javascript"),
|
|
@@ -2910,6 +3198,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2910
3198
|
})
|
|
2911
3199
|
);
|
|
2912
3200
|
}
|
|
3201
|
+
if (enableDeMorgan) {
|
|
3202
|
+
configs2.push(
|
|
3203
|
+
configDeMorgan({
|
|
3204
|
+
overrides: getOverrides(options, "deMorgan")
|
|
3205
|
+
})
|
|
3206
|
+
);
|
|
3207
|
+
}
|
|
2913
3208
|
if (enableRegexp) {
|
|
2914
3209
|
configs2.push(
|
|
2915
3210
|
configRegexp({
|
|
@@ -2922,8 +3217,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2922
3217
|
configs2.push(
|
|
2923
3218
|
configTypeScript({
|
|
2924
3219
|
...resolveSubOptions(options, "typescript"),
|
|
2925
|
-
|
|
2926
|
-
|
|
3220
|
+
overrides: getOverrides(options, "typescript"),
|
|
3221
|
+
extraFileExtensions
|
|
2927
3222
|
})
|
|
2928
3223
|
);
|
|
2929
3224
|
}
|
|
@@ -2932,13 +3227,15 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2932
3227
|
configVue({
|
|
2933
3228
|
...resolveSubOptions(options, "vue"),
|
|
2934
3229
|
typescript: !!enableTypeScript,
|
|
2935
|
-
overrides: getOverrides(options, "vue")
|
|
3230
|
+
overrides: getOverrides(options, "vue"),
|
|
3231
|
+
extraFileExtensions
|
|
2936
3232
|
})
|
|
2937
3233
|
);
|
|
2938
3234
|
}
|
|
2939
3235
|
if (enableYML) {
|
|
2940
3236
|
configs2.push(
|
|
2941
3237
|
configYml({
|
|
3238
|
+
...resolveSubOptions(options, "yml"),
|
|
2942
3239
|
overrides: getOverrides(options, "yml")
|
|
2943
3240
|
})
|
|
2944
3241
|
);
|
|
@@ -2946,6 +3243,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2946
3243
|
if (enableTOML) {
|
|
2947
3244
|
configs2.push(
|
|
2948
3245
|
configToml({
|
|
3246
|
+
...resolveSubOptions(options, "toml"),
|
|
2949
3247
|
overrides: getOverrides(options, "toml")
|
|
2950
3248
|
})
|
|
2951
3249
|
);
|
|
@@ -2953,6 +3251,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2953
3251
|
if (enableJSONC) {
|
|
2954
3252
|
configs2.push(
|
|
2955
3253
|
configJsonc({
|
|
3254
|
+
...resolveSubOptions(options, "jsonc"),
|
|
2956
3255
|
overrides: getOverrides(options, "jsonc")
|
|
2957
3256
|
})
|
|
2958
3257
|
);
|
|
@@ -2963,9 +3262,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2963
3262
|
if (enableTest) {
|
|
2964
3263
|
configs2.push(
|
|
2965
3264
|
configTest({
|
|
2966
|
-
|
|
2967
|
-
}),
|
|
2968
|
-
configVitest({
|
|
3265
|
+
...resolveSubOptions(options, "test"),
|
|
2969
3266
|
overrides: getOverrides(options, "test")
|
|
2970
3267
|
})
|
|
2971
3268
|
);
|
|
@@ -2981,8 +3278,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2981
3278
|
configs2.push(
|
|
2982
3279
|
configMarkdown({
|
|
2983
3280
|
...resolveSubOptions(options, "markdown"),
|
|
2984
|
-
|
|
2985
|
-
|
|
3281
|
+
overrides: getOverrides(options, "markdown"),
|
|
3282
|
+
extraFileExtensions
|
|
2986
3283
|
})
|
|
2987
3284
|
);
|
|
2988
3285
|
}
|
|
@@ -3039,7 +3336,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3039
3336
|
return composer;
|
|
3040
3337
|
}
|
|
3041
3338
|
export {
|
|
3042
|
-
DEFAULT_PRETTIER_OPTIONS,
|
|
3043
3339
|
GLOB_ALL_SRC,
|
|
3044
3340
|
GLOB_ASTRO,
|
|
3045
3341
|
GLOB_ASTRO_TS,
|
|
@@ -3054,6 +3350,7 @@ export {
|
|
|
3054
3350
|
GLOB_JSON5,
|
|
3055
3351
|
GLOB_JSONC,
|
|
3056
3352
|
GLOB_JSX,
|
|
3353
|
+
GLOB_JSX_ONLY,
|
|
3057
3354
|
GLOB_LESS,
|
|
3058
3355
|
GLOB_LOCKFILE,
|
|
3059
3356
|
GLOB_MARKDOWN,
|
|
@@ -3072,15 +3369,27 @@ export {
|
|
|
3072
3369
|
GLOB_TEST,
|
|
3073
3370
|
GLOB_TOML,
|
|
3074
3371
|
GLOB_TS,
|
|
3372
|
+
GLOB_TSCONFIG_JSON,
|
|
3075
3373
|
GLOB_TSX,
|
|
3374
|
+
GLOB_TSX_ONLY,
|
|
3076
3375
|
GLOB_TYPES,
|
|
3376
|
+
GLOB_TYPE_TEST,
|
|
3077
3377
|
GLOB_VUE,
|
|
3078
3378
|
GLOB_YAML,
|
|
3379
|
+
PERFECTIONIST_COMMON_RULE_OPTIONS,
|
|
3380
|
+
PERFECTIONIST_EXTRA_RULE_OPTIONS,
|
|
3381
|
+
PERFECTIONIST_SORT_CLASSES_GROUPS,
|
|
3382
|
+
PERFECTIONIST_SORT_IMPORTS_GROUPS,
|
|
3383
|
+
PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS,
|
|
3384
|
+
PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS,
|
|
3385
|
+
PERFECTIONIST_SORT_OBJECTS_GROUPS,
|
|
3386
|
+
PRETTIER_DEFAULT_OPTIONS,
|
|
3079
3387
|
combineConfigs,
|
|
3080
3388
|
configAntfu,
|
|
3081
3389
|
configCommand,
|
|
3082
|
-
|
|
3390
|
+
configDeMorgan,
|
|
3083
3391
|
configDepend,
|
|
3392
|
+
configESLintComments,
|
|
3084
3393
|
configESLintPlugin,
|
|
3085
3394
|
configFormat,
|
|
3086
3395
|
configGitHubAction,
|
|
@@ -3107,10 +3416,9 @@ export {
|
|
|
3107
3416
|
configUnicorn,
|
|
3108
3417
|
configUnoCSS,
|
|
3109
3418
|
configUnusedImports,
|
|
3110
|
-
configVitest,
|
|
3111
3419
|
configVue,
|
|
3112
3420
|
configYml,
|
|
3113
|
-
configs as
|
|
3421
|
+
configs as configsTypeScript,
|
|
3114
3422
|
createNodeResolver,
|
|
3115
3423
|
createTypeScriptImportResolver,
|
|
3116
3424
|
defineESLintConfig,
|
|
@@ -3129,34 +3437,37 @@ export {
|
|
|
3129
3437
|
parserJsonc,
|
|
3130
3438
|
parserPlain,
|
|
3131
3439
|
parserToml,
|
|
3132
|
-
parserTypeScript,
|
|
3440
|
+
parser as parserTypeScript,
|
|
3133
3441
|
parserVue,
|
|
3134
3442
|
parserYaml,
|
|
3135
|
-
|
|
3136
|
-
|
|
3443
|
+
default8 as pluginAntfu,
|
|
3444
|
+
default24 as pluginComments,
|
|
3445
|
+
default19 as pluginDeMorgan,
|
|
3137
3446
|
pluginDepend,
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3447
|
+
default13 as pluginFormat,
|
|
3448
|
+
default21 as pluginGitHubAction,
|
|
3449
|
+
default17 as pluginImportX,
|
|
3450
|
+
default9 as pluginJsdoc,
|
|
3451
|
+
default10 as pluginJsonc,
|
|
3452
|
+
default7 as pluginMarkdown,
|
|
3453
|
+
default20 as pluginNoOnlyTests,
|
|
3144
3454
|
default2 as pluginNode,
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3455
|
+
default11 as pluginNtnyq,
|
|
3456
|
+
default22 as pluginPerfectionist,
|
|
3457
|
+
default12 as pluginPinia,
|
|
3458
|
+
default18 as pluginPrettier,
|
|
3148
3459
|
pluginRegexp,
|
|
3149
3460
|
default5 as pluginSvgo,
|
|
3150
3461
|
default6 as pluginToml,
|
|
3151
3462
|
plugin as pluginTypeScript,
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3463
|
+
default16 as pluginUnicorn,
|
|
3464
|
+
default14 as pluginUnoCSS,
|
|
3465
|
+
default23 as pluginUnusedImports,
|
|
3466
|
+
default15 as pluginVitest,
|
|
3156
3467
|
default3 as pluginVue,
|
|
3157
3468
|
default4 as pluginYml,
|
|
3158
3469
|
processorPassThrough,
|
|
3159
|
-
|
|
3470
|
+
default25 as processorVueBlocks,
|
|
3160
3471
|
resolveSubOptions,
|
|
3161
3472
|
toArray
|
|
3162
3473
|
};
|