@ntnyq/eslint-config 2.0.0-beta.26 → 2.0.0-beta.28
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/dist/index.cjs +363 -126
- package/dist/index.d.cts +39 -16
- package/dist/index.d.ts +39 -16
- package/dist/index.js +346 -116
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/env.ts
|
|
2
|
+
import { isPackageExists } from "local-pkg";
|
|
3
|
+
var hasTypeScript = isPackageExists("typescript");
|
|
4
|
+
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
5
|
+
var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
6
|
+
|
|
7
|
+
// src/globs.ts
|
|
2
8
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
3
9
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
4
10
|
var GLOB_JS = "**/*.?([cm])js";
|
|
@@ -44,19 +50,30 @@ var GLOB_EXCLUDE = [
|
|
|
44
50
|
"**/__snapshots__",
|
|
45
51
|
"**/auto-import?(s).d.ts",
|
|
46
52
|
"**/components.d.ts",
|
|
47
|
-
"**/output",
|
|
48
53
|
"**/coverage",
|
|
54
|
+
"**/fixtures",
|
|
55
|
+
"**/output",
|
|
56
|
+
"**/public",
|
|
57
|
+
"**/static",
|
|
49
58
|
"**/temp",
|
|
50
59
|
"**/cache",
|
|
51
|
-
"**/fixtures",
|
|
52
60
|
"**/.vitepress/cache",
|
|
61
|
+
"**/.eslintcache",
|
|
62
|
+
"**/.stylelintcache",
|
|
63
|
+
"**/.vite-inspect",
|
|
53
64
|
"**/.nuxt",
|
|
54
65
|
"**/.output",
|
|
66
|
+
"**/.tsup",
|
|
55
67
|
"**/.nitro",
|
|
56
68
|
"**/.vercel",
|
|
57
69
|
"**/.changeset",
|
|
58
70
|
"**/.npmrc",
|
|
59
|
-
"**/.yarnrc"
|
|
71
|
+
"**/.yarnrc",
|
|
72
|
+
// Force lint
|
|
73
|
+
"!.github",
|
|
74
|
+
"!.vitepress",
|
|
75
|
+
"!.vuepress",
|
|
76
|
+
"!.vscode"
|
|
60
77
|
];
|
|
61
78
|
|
|
62
79
|
// src/presets.ts
|
|
@@ -75,68 +92,68 @@ import { default as default5 } from "eslint-plugin-unicorn";
|
|
|
75
92
|
import { default as default6 } from "eslint-plugin-prettier";
|
|
76
93
|
import { default as default7 } from "eslint-plugin-markdown";
|
|
77
94
|
import { default as default8 } from "eslint-plugin-eslint-comments";
|
|
78
|
-
import
|
|
79
|
-
import
|
|
95
|
+
import tseslint from "typescript-eslint";
|
|
96
|
+
import { default as default9 } from "eslint-plugin-yml";
|
|
80
97
|
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
81
|
-
import
|
|
98
|
+
import { default as default10 } from "eslint-plugin-import-x";
|
|
82
99
|
import * as parserYaml from "yaml-eslint-parser";
|
|
83
100
|
import * as parserVue from "vue-eslint-parser";
|
|
84
101
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
85
|
-
|
|
102
|
+
// @__NO_SIDE_EFFECTS__
|
|
103
|
+
function interopDefault(m) {
|
|
104
|
+
return m.default || m;
|
|
105
|
+
}
|
|
86
106
|
|
|
87
107
|
// src/configs/typescript.ts
|
|
88
108
|
import { defineFlatConfig } from "eslint-define-config";
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
plugins: {
|
|
99
|
-
"@typescript-eslint": default9
|
|
100
|
-
},
|
|
101
|
-
rules: {
|
|
102
|
-
...default9.configs.recommended.rules,
|
|
103
|
-
...default9.configs.stylistic.rules,
|
|
104
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
105
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
106
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
107
|
-
"error",
|
|
108
|
-
{
|
|
109
|
-
prefer: "type-imports",
|
|
110
|
-
fixStyle: "separate-type-imports",
|
|
111
|
-
disallowTypeAnnotations: false
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
"@typescript-eslint/consistent-type-assertions": [
|
|
115
|
-
"error",
|
|
116
|
-
{
|
|
117
|
-
assertionStyle: "as",
|
|
118
|
-
objectLiteralTypeAssertions: "allow-as-parameter"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"@typescript-eslint/prefer-as-const": "warn",
|
|
122
|
-
"@typescript-eslint/ban-types": "off",
|
|
123
|
-
"@typescript-eslint/camelcase": "off",
|
|
124
|
-
"@typescript-eslint/no-namespace": "off",
|
|
125
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
|
126
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
127
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
128
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
129
|
-
"@typescript-eslint/naming-convention": "off",
|
|
130
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
131
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
132
|
-
"@typescript-eslint/triple-slash-reference": "off",
|
|
133
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
|
134
|
-
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
135
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
136
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
137
|
-
"@typescript-eslint/consistent-indexed-object-style": "off"
|
|
109
|
+
var typescriptCore = tseslint.config({
|
|
110
|
+
extends: [...tseslint.configs.recommended],
|
|
111
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
112
|
+
languageOptions: {
|
|
113
|
+
parser: tseslint.parser,
|
|
114
|
+
parserOptions: {
|
|
115
|
+
sourceType: "module"
|
|
138
116
|
}
|
|
139
117
|
},
|
|
118
|
+
rules: {
|
|
119
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
120
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
121
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
122
|
+
"error",
|
|
123
|
+
{
|
|
124
|
+
prefer: "type-imports",
|
|
125
|
+
fixStyle: "separate-type-imports",
|
|
126
|
+
disallowTypeAnnotations: false
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
130
|
+
"error",
|
|
131
|
+
{
|
|
132
|
+
assertionStyle: "as",
|
|
133
|
+
objectLiteralTypeAssertions: "allow-as-parameter"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"@typescript-eslint/prefer-as-const": "warn",
|
|
137
|
+
"@typescript-eslint/ban-types": "off",
|
|
138
|
+
"@typescript-eslint/camelcase": "off",
|
|
139
|
+
"@typescript-eslint/no-namespace": "off",
|
|
140
|
+
"@typescript-eslint/ban-ts-ignore": "off",
|
|
141
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
142
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
143
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
144
|
+
"@typescript-eslint/naming-convention": "off",
|
|
145
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
146
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
147
|
+
"@typescript-eslint/triple-slash-reference": "off",
|
|
148
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
|
149
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
150
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
151
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
152
|
+
"@typescript-eslint/consistent-indexed-object-style": "off"
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var typescript = defineFlatConfig([
|
|
156
|
+
...typescriptCore,
|
|
140
157
|
{
|
|
141
158
|
files: ["**/*.d.ts"],
|
|
142
159
|
rules: {
|
|
@@ -152,7 +169,7 @@ var typescript = defineFlatConfig([
|
|
|
152
169
|
}
|
|
153
170
|
},
|
|
154
171
|
{
|
|
155
|
-
files: [
|
|
172
|
+
files: [GLOB_JS, "**/*.cjs"],
|
|
156
173
|
rules: {
|
|
157
174
|
"@typescript-eslint/no-var-requires": "off"
|
|
158
175
|
}
|
|
@@ -168,19 +185,28 @@ function getVueVersion() {
|
|
|
168
185
|
return 3;
|
|
169
186
|
}
|
|
170
187
|
var isVue3 = getVueVersion() === 3;
|
|
171
|
-
var vueBaseRules = {};
|
|
172
188
|
var vue2Rules = {
|
|
173
|
-
...
|
|
189
|
+
...default3.configs.base.rules,
|
|
190
|
+
...default3.configs.essential.rules,
|
|
191
|
+
...default3.configs["strongly-recommended"].rules,
|
|
192
|
+
...default3.configs.recommended.rules
|
|
174
193
|
};
|
|
175
194
|
var vue3Rules = {
|
|
176
|
-
...
|
|
195
|
+
...default3.configs.base.rules,
|
|
196
|
+
...default3.configs["vue3-essential"].rules,
|
|
197
|
+
...default3.configs["vue3-strongly-recommended"].rules,
|
|
198
|
+
...default3.configs["vue3-recommended"].rules
|
|
177
199
|
};
|
|
178
200
|
var vue = defineFlatConfig2([
|
|
201
|
+
...tseslint.config({
|
|
202
|
+
files: [GLOB_VUE],
|
|
203
|
+
extends: typescriptCore
|
|
204
|
+
}),
|
|
179
205
|
{
|
|
180
206
|
files: [GLOB_VUE],
|
|
181
207
|
plugins: {
|
|
182
208
|
vue: default3,
|
|
183
|
-
"@typescript-eslint":
|
|
209
|
+
"@typescript-eslint": tseslint.plugin
|
|
184
210
|
},
|
|
185
211
|
languageOptions: {
|
|
186
212
|
parser: parserVue,
|
|
@@ -195,14 +221,220 @@ var vue = defineFlatConfig2([
|
|
|
195
221
|
},
|
|
196
222
|
processor: default3.processors[".vue"],
|
|
197
223
|
rules: {
|
|
198
|
-
...
|
|
224
|
+
...isVue3 ? vue3Rules : vue2Rules,
|
|
225
|
+
// OFF
|
|
226
|
+
"vue/no-v-html": "off",
|
|
227
|
+
"vue/require-prop-types": "off",
|
|
228
|
+
"vue/require-default-prop": "off",
|
|
229
|
+
"vue/multi-word-component-names": "off",
|
|
230
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
231
|
+
"vue/html-self-closing": [
|
|
232
|
+
"error",
|
|
233
|
+
{
|
|
234
|
+
html: {
|
|
235
|
+
void: "always",
|
|
236
|
+
normal: "always",
|
|
237
|
+
component: "always"
|
|
238
|
+
},
|
|
239
|
+
svg: "always",
|
|
240
|
+
math: "always"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"vue/block-tag-newline": [
|
|
244
|
+
"error",
|
|
245
|
+
{
|
|
246
|
+
singleline: "always",
|
|
247
|
+
multiline: "always"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"vue/component-name-in-template-casing": [
|
|
251
|
+
"error",
|
|
252
|
+
"PascalCase",
|
|
253
|
+
{
|
|
254
|
+
// Force auto-import components to be PascalCase
|
|
255
|
+
registeredComponentsOnly: false,
|
|
256
|
+
ignores: ["slot", "component"]
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
260
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
261
|
+
"vue/define-macros-order": [
|
|
262
|
+
"error",
|
|
263
|
+
{
|
|
264
|
+
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"vue/html-comment-content-spacing": [
|
|
268
|
+
"error",
|
|
269
|
+
"always",
|
|
270
|
+
{
|
|
271
|
+
exceptions: ["-"]
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
275
|
+
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
276
|
+
"vue/block-spacing": ["error", "always"],
|
|
277
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
278
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
279
|
+
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
280
|
+
"vue/comma-style": ["error", "last"],
|
|
281
|
+
"vue/dot-location": ["error", "property"],
|
|
282
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
283
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
284
|
+
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
285
|
+
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
286
|
+
"vue/no-empty-pattern": "error",
|
|
287
|
+
"vue/no-loss-of-precision": "error",
|
|
288
|
+
"vue/no-irregular-whitespace": "error",
|
|
289
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
290
|
+
"vue/require-typed-object-prop": "error",
|
|
291
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
292
|
+
"vue/no-restricted-syntax": [
|
|
293
|
+
"error",
|
|
294
|
+
"DebuggerStatement",
|
|
295
|
+
"LabeledStatement",
|
|
296
|
+
"WithStatement"
|
|
297
|
+
],
|
|
298
|
+
"vue/no-sparse-arrays": "error",
|
|
299
|
+
"vue/no-deprecated-model-definition": [
|
|
300
|
+
"error",
|
|
301
|
+
{
|
|
302
|
+
allowVue3Compat: true
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
"vue/object-curly-newline": [
|
|
306
|
+
"error",
|
|
307
|
+
{
|
|
308
|
+
multiline: true,
|
|
309
|
+
consistent: true
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"vue/no-static-inline-styles": [
|
|
313
|
+
"error",
|
|
314
|
+
{
|
|
315
|
+
allowBinding: true
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
319
|
+
"vue/object-property-newline": [
|
|
320
|
+
"error",
|
|
321
|
+
{
|
|
322
|
+
allowMultiplePropertiesPerLine: true
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"vue/object-shorthand": [
|
|
326
|
+
"error",
|
|
327
|
+
"always",
|
|
328
|
+
{
|
|
329
|
+
ignoreConstructors: false,
|
|
330
|
+
avoidQuotes: true
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
334
|
+
"vue/prefer-template": "error",
|
|
335
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
336
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
337
|
+
"vue/space-in-parens": ["error", "never"],
|
|
338
|
+
"vue/space-infix-ops": "error",
|
|
339
|
+
"vue/space-unary-ops": [
|
|
340
|
+
"error",
|
|
341
|
+
{
|
|
342
|
+
words: true,
|
|
343
|
+
nonwords: false
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
"vue/template-curly-spacing": "error",
|
|
347
|
+
"vue/block-order": [
|
|
348
|
+
"error",
|
|
349
|
+
{
|
|
350
|
+
order: ["script", "template", "style"]
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
"vue/attributes-order": [
|
|
354
|
+
"error",
|
|
355
|
+
{
|
|
356
|
+
order: [
|
|
357
|
+
"EVENTS",
|
|
358
|
+
// `@click="functionCall"`, `v-on="event"`
|
|
359
|
+
"TWO_WAY_BINDING",
|
|
360
|
+
// `v-model`
|
|
361
|
+
"OTHER_DIRECTIVES",
|
|
362
|
+
// `v-custom-directive`
|
|
363
|
+
"LIST_RENDERING",
|
|
364
|
+
// `v-for item in items`
|
|
365
|
+
"CONDITIONALS",
|
|
366
|
+
// `v-if`, `v-show`, `v-cloak`
|
|
367
|
+
"CONTENT",
|
|
368
|
+
// `v-text`, `v-html`
|
|
369
|
+
"SLOT",
|
|
370
|
+
// `v-slot`, `slot`
|
|
371
|
+
"UNIQUE",
|
|
372
|
+
// `ref`, `key`
|
|
373
|
+
"DEFINITION",
|
|
374
|
+
// `is`, `v-is`
|
|
375
|
+
"ATTR_DYNAMIC",
|
|
376
|
+
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
377
|
+
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
378
|
+
"RENDER_MODIFIERS",
|
|
379
|
+
// `v-once`, `v-pre`
|
|
380
|
+
"GLOBAL",
|
|
381
|
+
// `id`
|
|
382
|
+
"ATTR_STATIC",
|
|
383
|
+
// `prop="foo", `static attributes
|
|
384
|
+
"ATTR_SHORTHAND_BOOL"
|
|
385
|
+
// `disabled`, prop shorthand
|
|
386
|
+
],
|
|
387
|
+
alphabetical: false
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
"vue/order-in-components": [
|
|
391
|
+
"error",
|
|
392
|
+
{
|
|
393
|
+
order: [
|
|
394
|
+
"el",
|
|
395
|
+
"name",
|
|
396
|
+
"key",
|
|
397
|
+
"parent",
|
|
398
|
+
"functional",
|
|
399
|
+
["provide", "inject"],
|
|
400
|
+
["delimiters", "comments"],
|
|
401
|
+
["components", "directives", "filters"],
|
|
402
|
+
"extends",
|
|
403
|
+
"mixins",
|
|
404
|
+
"layout",
|
|
405
|
+
"middleware",
|
|
406
|
+
"validate",
|
|
407
|
+
"scrollToTop",
|
|
408
|
+
"transition",
|
|
409
|
+
"loading",
|
|
410
|
+
"inheritAttrs",
|
|
411
|
+
"model",
|
|
412
|
+
["props", "propsData"],
|
|
413
|
+
"emits",
|
|
414
|
+
"setup",
|
|
415
|
+
"asyncData",
|
|
416
|
+
"computed",
|
|
417
|
+
"data",
|
|
418
|
+
"fetch",
|
|
419
|
+
"head",
|
|
420
|
+
"methods",
|
|
421
|
+
["template", "render"],
|
|
422
|
+
"watch",
|
|
423
|
+
"watchQuery",
|
|
424
|
+
"LIFECYCLE_HOOKS",
|
|
425
|
+
"renderError",
|
|
426
|
+
"ROUTER_GUARDS"
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
"vue/max-attributes-per-line": [
|
|
431
|
+
"error",
|
|
432
|
+
{
|
|
433
|
+
singleline: 1,
|
|
434
|
+
multiline: 1
|
|
435
|
+
}
|
|
436
|
+
]
|
|
199
437
|
}
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
plugins: {
|
|
203
|
-
vue: default3
|
|
204
|
-
},
|
|
205
|
-
rules: isVue3 ? vue3Rules : vue2Rules
|
|
206
438
|
}
|
|
207
439
|
]);
|
|
208
440
|
|
|
@@ -215,11 +447,11 @@ var yml = defineFlatConfig3([
|
|
|
215
447
|
parser: parserYaml
|
|
216
448
|
},
|
|
217
449
|
plugins: {
|
|
218
|
-
yml:
|
|
450
|
+
yml: default9
|
|
219
451
|
},
|
|
220
452
|
rules: {
|
|
221
|
-
...
|
|
222
|
-
...
|
|
453
|
+
...default9.configs.standard.rules,
|
|
454
|
+
...default9.configs.prettier.rules,
|
|
223
455
|
"yml/no-empty-mapping-value": "off",
|
|
224
456
|
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
|
|
225
457
|
}
|
|
@@ -490,7 +722,7 @@ import { defineFlatConfig as defineFlatConfig7 } from "eslint-define-config";
|
|
|
490
722
|
var imports = defineFlatConfig7([
|
|
491
723
|
{
|
|
492
724
|
plugins: {
|
|
493
|
-
import:
|
|
725
|
+
import: default10
|
|
494
726
|
},
|
|
495
727
|
settings: {
|
|
496
728
|
"import/resolver": {
|
|
@@ -636,42 +868,28 @@ var prettier = defineFlatConfig10([
|
|
|
636
868
|
// src/configs/markdown.ts
|
|
637
869
|
import { defineFlatConfig as defineFlatConfig11 } from "eslint-define-config";
|
|
638
870
|
var markdown = defineFlatConfig11([
|
|
639
|
-
|
|
640
|
-
files: [GLOB_MARKDOWN],
|
|
641
|
-
plugins: {
|
|
642
|
-
markdown: default7
|
|
643
|
-
},
|
|
644
|
-
processor: "markdown/markdown"
|
|
645
|
-
},
|
|
871
|
+
...default7.configs.recommended,
|
|
646
872
|
{
|
|
647
873
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
648
|
-
languageOptions: {
|
|
649
|
-
parserOptions: {
|
|
650
|
-
ecmaFeatures: {
|
|
651
|
-
impliedStrict: true
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
},
|
|
655
|
-
plugins: {
|
|
656
|
-
"@typescript-eslint": default9
|
|
657
|
-
},
|
|
658
874
|
rules: {
|
|
659
|
-
...default7.configs["recommended-legacy"].overrides[1].rules,
|
|
660
875
|
"no-undef": "off",
|
|
661
876
|
"no-alert": "off",
|
|
662
877
|
"no-console": "off",
|
|
663
878
|
"no-unused-vars": "off",
|
|
664
879
|
"no-unused-expressions": "off",
|
|
665
880
|
"no-restricted-imports": "off",
|
|
881
|
+
"node/prefer-global/buffer": "off",
|
|
882
|
+
"node/prefer-global/process": "off",
|
|
666
883
|
"import/no-unresolved": "off",
|
|
884
|
+
"unused-imports/no-unused-imports": "off",
|
|
885
|
+
"unused-imports/no-unused-vars": "off",
|
|
667
886
|
"@typescript-eslint/comma-dangle": "off",
|
|
668
887
|
"@typescript-eslint/no-redeclare": "off",
|
|
888
|
+
"@typescript-eslint/no-namespace": "off",
|
|
669
889
|
"@typescript-eslint/no-unused-vars": "off",
|
|
670
890
|
"@typescript-eslint/no-var-requires": "off",
|
|
671
891
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
672
|
-
"@typescript-eslint/no-use-before-define": "off"
|
|
673
|
-
"unused-imports/no-unused-imports": "off",
|
|
674
|
-
"unused-imports/no-unused-vars": "off"
|
|
892
|
+
"@typescript-eslint/no-use-before-define": "off"
|
|
675
893
|
}
|
|
676
894
|
}
|
|
677
895
|
]);
|
|
@@ -1078,34 +1296,39 @@ var ignores = defineFlatConfig14([
|
|
|
1078
1296
|
]);
|
|
1079
1297
|
|
|
1080
1298
|
// src/presets.ts
|
|
1081
|
-
var
|
|
1299
|
+
var presetJavaScript = [
|
|
1082
1300
|
...ignores,
|
|
1083
1301
|
...javascript,
|
|
1084
1302
|
...jsx,
|
|
1085
1303
|
...node,
|
|
1086
|
-
...typescript,
|
|
1087
1304
|
...imports,
|
|
1088
1305
|
...unicorn,
|
|
1089
1306
|
...comments
|
|
1090
|
-
]
|
|
1091
|
-
var
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
const configs = defineFlatConfig15([...
|
|
1307
|
+
];
|
|
1308
|
+
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1309
|
+
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
1310
|
+
var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
|
|
1311
|
+
var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
|
|
1312
|
+
var presetAll = [...presetCommon, ...vue, ...unocss];
|
|
1313
|
+
function ntnyq(config = [], {
|
|
1314
|
+
vue: enableVue = hasVue,
|
|
1315
|
+
unocss: enableUnoCSS = hasUnoCSS,
|
|
1316
|
+
prettier: enablePrettier = true,
|
|
1317
|
+
markdown: enableMarkdown = true
|
|
1318
|
+
} = {}) {
|
|
1319
|
+
const configs = defineFlatConfig15([...presetBasic, ...yml, ...presetJsonc]);
|
|
1103
1320
|
if (enableVue) {
|
|
1104
1321
|
configs.push(...vue);
|
|
1105
1322
|
}
|
|
1106
1323
|
if (enableUnoCSS) {
|
|
1107
1324
|
configs.push(...unocss);
|
|
1108
1325
|
}
|
|
1326
|
+
if (enablePrettier) {
|
|
1327
|
+
configs.push(...prettier);
|
|
1328
|
+
}
|
|
1329
|
+
if (enableMarkdown) {
|
|
1330
|
+
configs.push(...markdown);
|
|
1331
|
+
}
|
|
1109
1332
|
if (Object.keys(config).length > 0) {
|
|
1110
1333
|
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1111
1334
|
}
|
|
@@ -1134,13 +1357,14 @@ export {
|
|
|
1134
1357
|
GLOB_TSX,
|
|
1135
1358
|
GLOB_VUE,
|
|
1136
1359
|
GLOB_YAML,
|
|
1137
|
-
all,
|
|
1138
|
-
basic,
|
|
1139
1360
|
comments,
|
|
1140
|
-
common,
|
|
1141
1361
|
getVueVersion,
|
|
1362
|
+
hasTypeScript,
|
|
1363
|
+
hasUnoCSS,
|
|
1364
|
+
hasVue,
|
|
1142
1365
|
ignores,
|
|
1143
1366
|
imports,
|
|
1367
|
+
interopDefault,
|
|
1144
1368
|
javascript,
|
|
1145
1369
|
jsonc,
|
|
1146
1370
|
jsx,
|
|
@@ -1148,24 +1372,30 @@ export {
|
|
|
1148
1372
|
node,
|
|
1149
1373
|
ntnyq,
|
|
1150
1374
|
parserJsonc,
|
|
1151
|
-
parserTs,
|
|
1152
1375
|
parserVue,
|
|
1153
1376
|
parserYaml,
|
|
1154
1377
|
default8 as pluginComments,
|
|
1155
|
-
pluginImport,
|
|
1378
|
+
default10 as pluginImport,
|
|
1156
1379
|
pluginJsonc,
|
|
1157
1380
|
default7 as pluginMarkdown,
|
|
1158
1381
|
default2 as pluginNode,
|
|
1159
1382
|
default6 as pluginPrettier,
|
|
1160
|
-
default9 as pluginTs,
|
|
1161
1383
|
default5 as pluginUnicorn,
|
|
1162
1384
|
default4 as pluginUnoCSS,
|
|
1163
1385
|
default3 as pluginVue,
|
|
1164
|
-
pluginYaml,
|
|
1386
|
+
default9 as pluginYaml,
|
|
1387
|
+
presetAll,
|
|
1388
|
+
presetBasic,
|
|
1389
|
+
presetCommon,
|
|
1390
|
+
presetJavaScript,
|
|
1391
|
+
presetJsonc,
|
|
1392
|
+
presetLanguageExtensions,
|
|
1165
1393
|
prettier,
|
|
1166
1394
|
sortPackageJson,
|
|
1167
1395
|
sortTsConfig,
|
|
1396
|
+
tseslint,
|
|
1168
1397
|
typescript,
|
|
1398
|
+
typescriptCore,
|
|
1169
1399
|
unicorn,
|
|
1170
1400
|
unocss,
|
|
1171
1401
|
vue,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.28",
|
|
5
5
|
"description": "ESLint flat config of ntnyq",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -51,10 +51,8 @@
|
|
|
51
51
|
"eslint": "^8.57.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@eslint/js": "^9.
|
|
55
|
-
"@
|
|
56
|
-
"@typescript-eslint/parser": "^7.7.0",
|
|
57
|
-
"@unocss/eslint-plugin": "^0.59.3",
|
|
54
|
+
"@eslint/js": "^9.1.1",
|
|
55
|
+
"@unocss/eslint-plugin": "^0.59.4",
|
|
58
56
|
"eslint-config-prettier": "^9.1.0",
|
|
59
57
|
"eslint-define-config": "^2.1.0",
|
|
60
58
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
@@ -70,6 +68,7 @@
|
|
|
70
68
|
"jsonc-eslint-parser": "^2.4.0",
|
|
71
69
|
"local-pkg": "^0.5.0",
|
|
72
70
|
"prettier": "^3.2.5",
|
|
71
|
+
"typescript-eslint": "^7.7.1",
|
|
73
72
|
"vue-eslint-parser": "^9.4.2",
|
|
74
73
|
"yaml-eslint-parser": "^1.2.2"
|
|
75
74
|
},
|
|
@@ -77,10 +76,10 @@
|
|
|
77
76
|
"@ntnyq/prettier-config": "^1.21.2",
|
|
78
77
|
"@types/node": "^20.12.7",
|
|
79
78
|
"bumpp": "^9.4.0",
|
|
80
|
-
"eslint": "^9.
|
|
79
|
+
"eslint": "^9.1.1",
|
|
81
80
|
"husky": "^9.0.11",
|
|
82
81
|
"nano-staged": "^0.8.0",
|
|
83
|
-
"npm-run-
|
|
82
|
+
"npm-run-all2": "^6.1.2",
|
|
84
83
|
"rimraf": "^5.0.5",
|
|
85
84
|
"tsup": "^8.0.2",
|
|
86
85
|
"typescript": "^5.4.5"
|