@curev/eslint-config 0.3.7 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2076 +1,72 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const fs = require('node:fs');
6
- const process = require('node:process');
7
- const localPkg = require('local-pkg');
8
- const pluginCurev = require('@curev/eslint-plugin');
9
- const pluginComments = require('eslint-plugin-eslint-comments');
10
- const pluginImport = require('eslint-plugin-i');
11
- const pluginNode = require('eslint-plugin-n');
12
- const pluginUnicorn = require('eslint-plugin-unicorn');
13
- const pluginUnusedImports = require('eslint-plugin-unused-imports');
14
- const globals = require('globals');
15
- const eslintMergeProcessors = require('eslint-merge-processors');
16
-
17
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
18
-
19
- function _interopNamespaceCompat(e) {
20
- if (e && typeof e === 'object' && 'default' in e) return e;
21
- const n = Object.create(null);
22
- if (e) {
23
- for (const k in e) {
24
- n[k] = e[k];
25
- }
26
- }
27
- n.default = e;
28
- return n;
29
- }
30
-
31
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
32
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
33
- const pluginCurev__default = /*#__PURE__*/_interopDefaultCompat(pluginCurev);
34
- const pluginComments__default = /*#__PURE__*/_interopDefaultCompat(pluginComments);
35
- const pluginImport__namespace = /*#__PURE__*/_interopNamespaceCompat(pluginImport);
36
- const pluginNode__default = /*#__PURE__*/_interopDefaultCompat(pluginNode);
37
- const pluginUnicorn__default = /*#__PURE__*/_interopDefaultCompat(pluginUnicorn);
38
- const pluginUnusedImports__default = /*#__PURE__*/_interopDefaultCompat(pluginUnusedImports);
39
- const globals__default = /*#__PURE__*/_interopDefaultCompat(globals);
40
-
41
- async function comments() {
42
- return [
43
- {
44
- name: "curev:eslint-comments",
45
- plugins: {
46
- "eslint-comments": pluginComments__default
47
- },
48
- rules: {
49
- "eslint-comments/no-aggregating-enable": "error",
50
- "eslint-comments/no-duplicate-disable": "error",
51
- "eslint-comments/no-unlimited-disable": "error",
52
- "eslint-comments/no-unused-enable": "error"
53
- }
54
- }
55
- ];
56
- }
57
-
58
- const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
59
- const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
60
- const GLOB_JS = "**/*.?([cm])js";
61
- const GLOB_JSX = "**/*.?([cm])jsx";
62
- const GLOB_TS = "**/*.?([cm])ts";
63
- const GLOB_TSX = "**/*.?([cm])tsx";
64
- const GLOB_STYLE = "**/*.{c,le,sc}ss";
65
- const GLOB_CSS = "**/*.css";
66
- const GLOB_POSTCSS = "**/*.{p,post}css";
67
- const GLOB_LESS = "**/*.less";
68
- const GLOB_SCSS = "**/*.scss";
69
- const GLOB_JSON = "**/*.json";
70
- const GLOB_JSON5 = "**/*.json5";
71
- const GLOB_JSONC = "**/*.jsonc";
72
- const GLOB_MARKDOWN = "**/*.md";
73
- const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
74
- const GLOB_SVELTE = "**/*.svelte";
75
- const GLOB_VUE = "**/*.vue";
76
- const GLOB_YAML = "**/*.y?(a)ml";
77
- const GLOB_TOML = "**/*.toml";
78
- const GLOB_HTML = "**/*.htm?(l)";
79
- const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
80
- const GLOB_TESTS = [
81
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
82
- `**/*.spec.${GLOB_SRC_EXT}`,
83
- `**/*.test.${GLOB_SRC_EXT}`,
84
- `**/*.bench.${GLOB_SRC_EXT}`,
85
- `**/*.benchmark.${GLOB_SRC_EXT}`
86
- ];
87
- const GLOB_ALL_SRC = [
88
- GLOB_SRC,
89
- GLOB_STYLE,
90
- GLOB_JSON,
91
- GLOB_JSON5,
92
- GLOB_MARKDOWN,
93
- GLOB_SVELTE,
94
- GLOB_VUE,
95
- GLOB_YAML,
96
- GLOB_HTML
97
- ];
98
- const GLOB_EXCLUDE = [
99
- "**/node_modules",
100
- "**/dist",
101
- "**/package-lock.json",
102
- "**/yarn.lock",
103
- "**/pnpm-lock.yaml",
104
- "**/bun.lockb",
105
- "**/output",
106
- "**/coverage",
107
- "**/temp",
108
- "**/.temp",
109
- "**/tmp",
110
- "**/.tmp",
111
- "**/.history",
112
- "**/.vitepress/cache",
113
- "**/.nuxt",
114
- "**/.next",
115
- "**/.vercel",
116
- "**/.changeset",
117
- "**/.idea",
118
- "**/.cache",
119
- "**/.output",
120
- "**/.vite-inspect",
121
- "**/CHANGELOG*.md",
122
- "**/*.min.*",
123
- "**/LICENSE*",
124
- "**/__snapshots__",
125
- "**/auto-import?(s).d.ts",
126
- "**/components.d.ts"
127
- ];
128
-
129
- async function ignores() {
130
- return [
131
- {
132
- ignores: GLOB_EXCLUDE
133
- }
134
- ];
135
- }
136
-
137
- async function imports(options = {}) {
138
- const {
139
- stylistic = true
140
- } = options;
141
- return [
142
- {
143
- name: "curev:imports",
144
- plugins: {
145
- curev: pluginCurev__default,
146
- import: pluginImport__namespace
147
- },
148
- rules: {
149
- "curev/import-dedupe": "error",
150
- "curev/no-import-dist": "error",
151
- "curev/no-import-node-modules-by-path": "error",
152
- "import/first": "error",
153
- "import/no-duplicates": "error",
154
- "import/no-mutable-exports": "error",
155
- "import/no-named-default": "error",
156
- "import/no-self-import": "error",
157
- "import/no-webpack-loader-syntax": "error",
158
- "import/order": "error",
159
- ...stylistic ? {
160
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
161
- } : {}
162
- }
163
- },
164
- {
165
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
166
- name: "curev:imports:bin",
167
- rules: {
168
- "curev/no-import-dist": "off",
169
- "curev/no-import-node-modules-by-path": "off"
170
- }
171
- }
172
- ];
173
- }
174
-
175
- async function javascript(options = {}) {
176
- const {
177
- isInEditor = false,
178
- overrides = {}
179
- } = options;
180
- return [
181
- {
182
- languageOptions: {
183
- ecmaVersion: 2022,
184
- globals: {
185
- ...globals__default.browser,
186
- ...globals__default.es2021,
187
- ...globals__default.node,
188
- document: "readonly",
189
- navigator: "readonly",
190
- window: "readonly"
191
- },
192
- parserOptions: {
193
- ecmaFeatures: {
194
- jsx: true
195
- },
196
- ecmaVersion: 2022,
197
- sourceType: "module"
198
- },
199
- sourceType: "module"
200
- },
201
- linterOptions: {
202
- reportUnusedDisableDirectives: true
203
- },
204
- name: "curev:javascript",
205
- plugins: {
206
- "curev": pluginCurev__default,
207
- "unused-imports": pluginUnusedImports__default
208
- },
209
- rules: {
210
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
211
- "array-callback-return": ["error", {
212
- allowImplicit: false,
213
- checkForEach: false
214
- }],
215
- "block-scoped-var": "error",
216
- "camelcase": ["error", {
217
- allow: ["^UNSAFE_"],
218
- ignoreGlobals: true,
219
- ignoreImports: true,
220
- properties: "never"
221
- }],
222
- "constructor-super": "error",
223
- "default-case-last": "error",
224
- "eqeqeq": ["error", "always", { null: "ignore" }],
225
- "import/export": "error",
226
- "import/first": "error",
227
- "import/no-absolute-path": ["error", { amd: false, commonjs: true, esmodule: true }],
228
- "import/no-duplicates": "error",
229
- "import/no-named-default": "error",
230
- "import/no-webpack-loader-syntax": "error",
231
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
232
- "no-alert": "error",
233
- "no-array-constructor": "error",
234
- "no-async-promise-executor": "error",
235
- "no-caller": "error",
236
- "no-case-declarations": "error",
237
- "no-class-assign": "error",
238
- "no-compare-neg-zero": "error",
239
- "no-cond-assign": "error",
240
- "no-console": ["error", { allow: ["warn", "error"] }],
241
- "no-const-assign": "error",
242
- "no-constant-condition": ["error", { checkLoops: false }],
243
- "no-control-regex": "error",
244
- "no-debugger": "error",
245
- "no-delete-var": "error",
246
- "no-dupe-args": "error",
247
- "no-dupe-class-members": "error",
248
- "no-dupe-keys": "error",
249
- "no-duplicate-case": "error",
250
- "no-empty": ["error", { allowEmptyCatch: true }],
251
- "no-empty-character-class": "error",
252
- "no-empty-pattern": "error",
253
- "no-eval": "error",
254
- "no-ex-assign": "error",
255
- "no-extend-native": "error",
256
- "no-extra-bind": "error",
257
- "no-extra-boolean-cast": "error",
258
- "no-fallthrough": "error",
259
- "no-func-assign": "error",
260
- "no-global-assign": "error",
261
- "no-implied-eval": "error",
262
- "no-import-assign": "error",
263
- "no-invalid-regexp": "error",
264
- "no-irregular-whitespace": "error",
265
- "no-iterator": "error",
266
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
267
- "no-lone-blocks": "error",
268
- "no-loss-of-precision": "error",
269
- "no-misleading-character-class": "error",
270
- "no-multi-str": "error",
271
- "no-new": "error",
272
- "no-new-func": "error",
273
- "no-new-wrappers": "error",
274
- "no-obj-calls": "error",
275
- "no-octal": "error",
276
- "no-octal-escape": "error",
277
- "no-proto": "error",
278
- "no-prototype-builtins": "error",
279
- "no-redeclare": ["error", { builtinGlobals: false }],
280
- "no-regex-spaces": "error",
281
- "no-restricted-globals": [
282
- "error",
283
- { message: "Use `globalThis` instead.", name: "global" },
284
- { message: "Use `globalThis` instead.", name: "self" }
285
- ],
286
- "no-restricted-properties": [
287
- "error",
288
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
289
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
290
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
291
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
292
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
293
- ],
294
- "no-restricted-syntax": [
295
- "error",
296
- "DebuggerStatement",
297
- "LabeledStatement",
298
- "WithStatement",
299
- "TSEnumDeclaration[const=true]",
300
- "TSExportAssignment"
301
- ],
302
- "no-return-assign": ["error", "except-parens"],
303
- "no-self-assign": ["error", { props: true }],
304
- "no-self-compare": "error",
305
- "no-sequences": "error",
306
- "no-shadow-restricted-names": "error",
307
- "no-sparse-arrays": "error",
308
- "no-template-curly-in-string": "error",
309
- "no-this-before-super": "error",
310
- "no-throw-literal": "error",
311
- "no-undef": "error",
312
- "no-undef-init": "error",
313
- "no-unexpected-multiline": "error",
314
- "no-unmodified-loop-condition": "error",
315
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
316
- "no-unreachable": "error",
317
- "no-unreachable-loop": "error",
318
- "no-unsafe-finally": "error",
319
- "no-unsafe-negation": "error",
320
- "no-unused-expressions": ["error", {
321
- allowShortCircuit: true,
322
- allowTaggedTemplates: true,
323
- allowTernary: true
324
- }],
325
- "no-unused-vars": ["error", {
326
- args: "none",
327
- caughtErrors: "none",
328
- ignoreRestSiblings: true,
329
- vars: "all"
330
- }],
331
- "no-use-before-define": ["error", { classes: false, functions: false, variables: false }],
332
- "no-useless-backreference": "error",
333
- "no-useless-call": "error",
334
- "no-useless-catch": "error",
335
- "no-useless-computed-key": "error",
336
- "no-useless-constructor": "error",
337
- "no-useless-escape": "error",
338
- "no-useless-rename": "error",
339
- "no-useless-return": "error",
340
- "no-var": "warn",
341
- "no-void": "error",
342
- "no-with": "error",
343
- "object-shorthand": ["warn", "properties"],
344
- "one-var": ["error", { initialized: "never" }],
345
- "prefer-arrow-callback": [
346
- "error",
347
- {
348
- allowNamedFunctions: false,
349
- allowUnboundThis: true
350
- }
351
- ],
352
- "prefer-const": ["error", { destructuring: "all" }],
353
- "prefer-exponentiation-operator": "error",
354
- "prefer-promise-reject-errors": "error",
355
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
356
- "prefer-rest-params": "error",
357
- "prefer-spread": "error",
358
- "prefer-template": "error",
359
- "sort-imports": [
360
- "error",
361
- {
362
- allowSeparatedGroups: false,
363
- ignoreCase: false,
364
- ignoreDeclarationSort: true,
365
- ignoreMemberSort: false,
366
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
367
- }
368
- ],
369
- "symbol-description": "error",
370
- "unicode-bom": ["error", "never"],
371
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
372
- "unused-imports/no-unused-vars": [
373
- "error",
374
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
375
- ],
376
- "use-isnan": ["error", {
377
- enforceForIndexOf: true,
378
- enforceForSwitchCase: true
379
- }],
380
- "valid-typeof": ["error", { requireStringLiterals: true }],
381
- "vars-on-top": "error",
382
- "yoda": ["error", "never"],
383
- ...overrides
384
- },
385
- settings: {
386
- env: {
387
- browser: true,
388
- es6: true,
389
- node: true
390
- }
391
- }
392
- },
393
- {
394
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
395
- name: "curev:scripts-overrides",
396
- rules: {
397
- "no-console": "off"
398
- }
399
- }
400
- ];
401
- }
402
-
403
- const parserPlain = {
404
- meta: {
405
- name: "parser-plain"
406
- },
407
- parseForESLint: (code) => ({
408
- ast: {
409
- body: [],
410
- comments: [],
411
- loc: { end: code.length, start: 0 },
412
- range: [0, code.length],
413
- tokens: [],
414
- type: "Program"
415
- },
416
- scopeManager: null,
417
- services: { isPlain: true },
418
- visitorKeys: {
419
- Program: []
420
- }
421
- })
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
422
11
  };
423
- async function combine(...configs) {
424
- const resolved = await Promise.all(configs);
425
- return resolved.flat();
426
- }
427
- function renameRules(rules, from, to) {
428
- return Object.fromEntries(
429
- Object.entries(rules).map(([key, value]) => {
430
- if (key.startsWith(from)) {
431
- return [to + key.slice(from.length), value];
432
- }
433
- return [key, value];
434
- })
435
- );
436
- }
437
- function toArray(value) {
438
- return Array.isArray(value) ? value : [value];
439
- }
440
- async function interopDefault(m) {
441
- const resolved = await m;
442
- return resolved.default || resolved;
443
- }
444
- async function ensurePackages(packages) {
445
- if (process__default.env.CI || process__default.stdout.isTTY === false) {
446
- return;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
447
17
  }
448
- const nonExistingPackages = packages.filter((i) => !localPkg.isPackageExists(i));
449
- if (nonExistingPackages.length === 0) {
450
- return;
451
- }
452
- const { default: prompts } = await import('prompts');
453
- const { result } = await prompts([
454
- {
455
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
456
- name: "result",
457
- type: "confirm"
458
- }
459
- ]);
460
- if (result) {
461
- await import('@antfu/install-pkg').then((i) => i.installPackage(nonExistingPackages, { dev: true }));
462
- }
463
- }
464
-
465
- async function jsdoc(options = {}) {
466
- const {
467
- stylistic = true
468
- } = options;
469
- return [
470
- {
471
- name: "curev:jsdoc",
472
- plugins: {
473
- jsdoc: await interopDefault(import('eslint-plugin-jsdoc'))
474
- },
475
- rules: {
476
- "jsdoc/check-access": "warn",
477
- "jsdoc/check-param-names": "warn",
478
- "jsdoc/check-property-names": "warn",
479
- "jsdoc/check-types": "warn",
480
- "jsdoc/empty-tags": "warn",
481
- "jsdoc/implements-on-classes": "warn",
482
- "jsdoc/no-defaults": "warn",
483
- "jsdoc/no-multi-asterisks": "warn",
484
- "jsdoc/require-param-name": "warn",
485
- "jsdoc/require-property": "warn",
486
- "jsdoc/require-property-description": "warn",
487
- "jsdoc/require-property-name": "warn",
488
- "jsdoc/require-returns-check": "warn",
489
- "jsdoc/require-returns-description": "warn",
490
- "jsdoc/require-yields-check": "warn",
491
- ...stylistic ? {
492
- "jsdoc/check-alignment": "warn",
493
- "jsdoc/multiline-blocks": "warn"
494
- } : {}
495
- }
496
- }
497
- ];
498
- }
499
-
500
- async function jsonc(options = {}) {
501
- const {
502
- files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
503
- overrides = {},
504
- stylistic = true
505
- } = options;
506
- const {
507
- indent = 2
508
- } = typeof stylistic === "boolean" ? {} : stylistic;
509
- const [
510
- pluginJsonc,
511
- parserJsonc
512
- ] = await Promise.all([
513
- interopDefault(import('eslint-plugin-jsonc')),
514
- interopDefault(import('jsonc-eslint-parser'))
515
- ]);
516
- return [
517
- {
518
- name: "curev:jsonc:setup",
519
- plugins: {
520
- jsonc: pluginJsonc
521
- }
522
- },
523
- {
524
- files,
525
- languageOptions: {
526
- parser: parserJsonc
527
- },
528
- name: "curev:jsonc:rules",
529
- rules: {
530
- "jsonc/no-bigint-literals": "error",
531
- "jsonc/no-binary-expression": "error",
532
- "jsonc/no-binary-numeric-literals": "error",
533
- "jsonc/no-dupe-keys": "error",
534
- "jsonc/no-escape-sequence-in-identifier": "error",
535
- "jsonc/no-floating-decimal": "error",
536
- "jsonc/no-hexadecimal-numeric-literals": "error",
537
- "jsonc/no-infinity": "error",
538
- "jsonc/no-multi-str": "error",
539
- "jsonc/no-nan": "error",
540
- "jsonc/no-number-props": "error",
541
- "jsonc/no-numeric-separators": "error",
542
- "jsonc/no-octal": "error",
543
- "jsonc/no-octal-escape": "error",
544
- "jsonc/no-octal-numeric-literals": "error",
545
- "jsonc/no-parenthesized": "error",
546
- "jsonc/no-plus-sign": "error",
547
- "jsonc/no-regexp-literals": "error",
548
- "jsonc/no-sparse-arrays": "error",
549
- "jsonc/no-template-literals": "error",
550
- "jsonc/no-undefined-value": "error",
551
- "jsonc/no-unicode-codepoint-escapes": "error",
552
- "jsonc/no-useless-escape": "error",
553
- "jsonc/space-unary-ops": "error",
554
- "jsonc/valid-json-number": "error",
555
- "jsonc/vue-custom-block/no-parsing-error": "error",
556
- ...stylistic ? {
557
- "jsonc/array-bracket-spacing": ["error", "never"],
558
- "jsonc/comma-dangle": ["error", "never"],
559
- "jsonc/comma-style": ["error", "last"],
560
- "jsonc/indent": ["error", indent],
561
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
562
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
563
- "jsonc/object-curly-spacing": ["error", "always"],
564
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
565
- "jsonc/quote-props": "error",
566
- "jsonc/quotes": "error"
567
- } : {},
568
- ...overrides
569
- }
570
- }
571
- ];
572
- }
573
-
574
- async function markdown(options = {}) {
575
- const {
576
- componentExts = [],
577
- files = [GLOB_MARKDOWN],
578
- overrides = {}
579
- } = options;
580
- const markdown2 = await interopDefault(import('eslint-plugin-markdown'));
581
- return [
582
- {
583
- name: "curev:markdown:setup",
584
- plugins: {
585
- markdown: markdown2
586
- }
587
- },
588
- {
589
- files,
590
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
591
- name: "curev:markdown:processor",
592
- // `eslint-plugin-markdown` only creates virtual files for code blocks,
593
- // but not the markdown file itself. We use `eslint-merge-processors` to
594
- // add a pass-through processor for the markdown file itself.
595
- processor: eslintMergeProcessors.mergeProcessors([
596
- markdown2.processors.markdown,
597
- eslintMergeProcessors.processorPassThrough
598
- ])
599
- },
600
- {
601
- files,
602
- languageOptions: {
603
- parser: parserPlain
604
- },
605
- name: "curev:markdown:parser"
606
- },
607
- {
608
- files: [
609
- GLOB_MARKDOWN_CODE,
610
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
611
- ],
612
- languageOptions: {
613
- parserOptions: {
614
- ecmaFeatures: {
615
- impliedStrict: true
616
- }
617
- }
618
- },
619
- name: "curev:markdown:disables",
620
- rules: {
621
- "import/newline-after-import": "off",
622
- "no-alert": "off",
623
- "no-console": "off",
624
- "no-labels": "off",
625
- "no-lone-blocks": "off",
626
- "no-restricted-syntax": "off",
627
- "no-undef": "off",
628
- "no-unused-expressions": "off",
629
- "no-unused-labels": "off",
630
- "no-unused-vars": "off",
631
- "node/prefer-global/process": "off",
632
- "style/comma-dangle": "off",
633
- "style/eol-last": "off",
634
- "ts/consistent-type-imports": "off",
635
- "ts/no-namespace": "off",
636
- "ts/no-redeclare": "off",
637
- "ts/no-require-imports": "off",
638
- "ts/no-unused-vars": "off",
639
- "ts/no-use-before-define": "off",
640
- "ts/no-var-requires": "off",
641
- "unicode-bom": "off",
642
- "unused-imports/no-unused-imports": "off",
643
- "unused-imports/no-unused-vars": "off",
644
- // Type aware rules
645
- ...{
646
- "ts/await-thenable": "off",
647
- "ts/dot-notation": "off",
648
- "ts/no-floating-promises": "off",
649
- "ts/no-for-in-array": "off",
650
- "ts/no-implied-eval": "off",
651
- "ts/no-misused-promises": "off",
652
- "ts/no-throw-literal": "off",
653
- "ts/no-unnecessary-type-assertion": "off",
654
- "ts/no-unsafe-argument": "off",
655
- "ts/no-unsafe-assignment": "off",
656
- "ts/no-unsafe-call": "off",
657
- "ts/no-unsafe-member-access": "off",
658
- "ts/no-unsafe-return": "off",
659
- "ts/restrict-plus-operands": "off",
660
- "ts/restrict-template-expressions": "off",
661
- "ts/unbound-method": "off"
662
- },
663
- ...overrides
664
- }
665
- }
666
- ];
667
- }
668
-
669
- async function node() {
670
- return [
671
- {
672
- name: "curev:node",
673
- plugins: {
674
- node: pluginNode__default
675
- },
676
- rules: {
677
- "node/handle-callback-err": ["error", "^(err|error)$"],
678
- "node/no-callback-literal": "error",
679
- "node/no-deprecated-api": "error",
680
- "node/no-exports-assign": "error",
681
- "node/no-new-require": "error",
682
- "node/no-path-concat": "error",
683
- "node/prefer-global/buffer": ["error", "never"],
684
- "node/prefer-global/process": ["error", "never"],
685
- "node/process-exit-as-throw": "error"
686
- }
687
- }
688
- ];
689
- }
690
-
691
- const StylisticConfigDefaults = {
692
- arrowParens: true,
693
- braceStyle: "1tbs",
694
- commaDangle: "never",
695
- indent: 2,
696
- jsx: true,
697
- quotes: "double",
698
- semi: true
18
+ return to;
699
19
  };
700
- async function stylistic(options = {}) {
701
- const mergeOptions = {
702
- ...StylisticConfigDefaults,
703
- ...options
704
- };
705
- const { overrides = {} } = mergeOptions;
706
- const pluginStylistic = await interopDefault(import('@stylistic/eslint-plugin'));
707
- const config = pluginStylistic.configs.customize({
708
- flat: true,
709
- pluginName: "style",
710
- ...mergeOptions
711
- });
712
- return [
713
- {
714
- name: "curev:stylistic",
715
- plugins: {
716
- curev: pluginCurev__default,
717
- style: pluginStylistic
718
- },
719
- rules: {
720
- ...config.rules,
721
- "curev/consistent-list-newline": "error",
722
- "curev/if-newline": "off",
723
- "curev/max-statements-per-line": ["error", { max: 1 }],
724
- "curev/top-level-function": "error",
725
- "curly": ["error", "all"],
726
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
727
- "style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
728
- "style/max-statements-per-line": ["off"],
729
- "style/multiline-ternary": ["error", "always-multiline"],
730
- "style/no-extra-parens": ["error", "functions"],
731
- "style/no-mixed-operators": ["error", {
732
- allowSamePrecedence: true,
733
- groups: [
734
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
735
- ["&&", "||"],
736
- ["in", "instanceof"]
737
- ]
738
- }],
739
- "style/no-multiple-empty-lines": [
740
- "error",
741
- {
742
- max: 3,
743
- maxBOF: 0,
744
- maxEOF: 1
745
- }
746
- ],
747
- "style/object-curly-newline": ["error", { consistent: true, multiline: true }],
748
- "style/object-curly-spacing": ["error", "always"],
749
- "style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
750
- "style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
751
- "style/rest-spread-spacing": ["error", "never"],
752
- "style/semi-spacing": ["error", { after: true, before: false }],
753
- "style/template-curly-spacing": ["error", "never"],
754
- "style/template-tag-spacing": ["error", "never"],
755
- "style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
756
- "style/yield-star-spacing": ["error", "both"],
757
- ...overrides
758
- }
759
- }
760
- ];
761
- }
762
-
763
- async function formatters(options = {}, stylistic = {}) {
764
- await ensurePackages([
765
- "eslint-plugin-format"
766
- ]);
767
- if (options === true) {
768
- options = {
769
- css: true,
770
- graphql: true,
771
- html: true,
772
- markdown: true
773
- };
774
- }
775
- const {
776
- indent,
777
- quotes,
778
- semi
779
- } = {
780
- ...StylisticConfigDefaults,
781
- ...stylistic
782
- };
783
- const prettierOptions = Object.assign(
784
- {
785
- endOfLine: "auto",
786
- semi,
787
- singleQuote: quotes === "single",
788
- tabWidth: typeof indent === "number" ? indent : 2,
789
- trailingComma: "all",
790
- useTabs: indent === "tab"
791
- },
792
- options.prettierOptions || {}
793
- );
794
- const dprintOptions = Object.assign(
795
- {
796
- indentWidth: typeof indent === "number" ? indent : 2,
797
- quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
798
- useTabs: indent === "tab"
799
- },
800
- options.dprintOptions || {}
801
- );
802
- const pluginFormat = await interopDefault(import('eslint-plugin-format'));
803
- const configs = [
804
- {
805
- name: "curev:formatters:setup",
806
- plugins: {
807
- format: pluginFormat
808
- }
809
- }
810
- ];
811
- if (options.css) {
812
- configs.push(
813
- {
814
- files: [GLOB_CSS, GLOB_POSTCSS],
815
- languageOptions: {
816
- parser: parserPlain
817
- },
818
- name: "curev:formatter:css",
819
- rules: {
820
- "format/prettier": [
821
- "error",
822
- {
823
- ...prettierOptions,
824
- parser: "css"
825
- }
826
- ]
827
- }
828
- },
829
- {
830
- files: [GLOB_SCSS],
831
- languageOptions: {
832
- parser: parserPlain
833
- },
834
- name: "curev:formatter:scss",
835
- rules: {
836
- "format/prettier": [
837
- "error",
838
- {
839
- ...prettierOptions,
840
- parser: "scss"
841
- }
842
- ]
843
- }
844
- },
845
- {
846
- files: [GLOB_LESS],
847
- languageOptions: {
848
- parser: parserPlain
849
- },
850
- name: "curev:formatter:less",
851
- rules: {
852
- "format/prettier": [
853
- "error",
854
- {
855
- ...prettierOptions,
856
- parser: "less"
857
- }
858
- ]
859
- }
860
- }
861
- );
862
- }
863
- if (options.html) {
864
- configs.push({
865
- files: ["**/*.html"],
866
- languageOptions: {
867
- parser: parserPlain
868
- },
869
- name: "curev:formatter:html",
870
- rules: {
871
- "format/prettier": [
872
- "error",
873
- {
874
- ...prettierOptions,
875
- parser: "html"
876
- }
877
- ]
878
- }
879
- });
880
- }
881
- if (options.markdown) {
882
- const formater = options.markdown === true ? "prettier" : options.markdown;
883
- configs.push({
884
- files: [GLOB_MARKDOWN],
885
- languageOptions: {
886
- parser: parserPlain
887
- },
888
- name: "curev:formatter:markdown",
889
- rules: {
890
- [`format/${formater}`]: [
891
- "error",
892
- formater === "prettier" ? {
893
- printWidth: 120,
894
- ...prettierOptions,
895
- embeddedLanguageFormatting: "off",
896
- parser: "markdown"
897
- } : {
898
- ...dprintOptions,
899
- language: "markdown"
900
- }
901
- ]
902
- }
903
- });
904
- }
905
- if (options.graphql) {
906
- configs.push({
907
- files: ["**/*.graphql"],
908
- languageOptions: {
909
- parser: parserPlain
910
- },
911
- name: "curev:formatter:graphql",
912
- rules: {
913
- "format/prettier": [
914
- "error",
915
- {
916
- ...prettierOptions,
917
- parser: "graphql"
918
- }
919
- ]
920
- }
921
- });
922
- }
923
- return configs;
924
- }
925
-
926
- const ReactRefreshAllowConstantExportPackages = [
927
- "vite"
928
- ];
929
- async function react(options = {}) {
930
- const {
931
- files = [GLOB_JSX, GLOB_TSX],
932
- overrides = {},
933
- typescript = true
934
- } = options;
935
- await ensurePackages([
936
- "eslint-plugin-react",
937
- "eslint-plugin-react-hooks",
938
- "eslint-plugin-react-refresh"
939
- ]);
940
- const [
941
- pluginReact,
942
- pluginReactHooks,
943
- pluginReactRefresh
944
- ] = await Promise.all([
945
- interopDefault(import('eslint-plugin-react')),
946
- interopDefault(import('eslint-plugin-react-hooks')),
947
- interopDefault(import('eslint-plugin-react-refresh'))
948
- ]);
949
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
950
- (i) => localPkg.isPackageExists(i)
951
- );
952
- return [
953
- {
954
- name: "curev:react:setup",
955
- plugins: {
956
- "react": pluginReact,
957
- "react-hooks": pluginReactHooks,
958
- "react-refresh": pluginReactRefresh
959
- },
960
- settings: {
961
- react: {
962
- version: "detect"
963
- }
964
- }
965
- },
966
- {
967
- files,
968
- languageOptions: {
969
- parserOptions: {
970
- ecmaFeatures: {
971
- jsx: true
972
- }
973
- }
974
- },
975
- name: "curev:react:rules",
976
- rules: {
977
- // recommended rules react
978
- "react/display-name": "error",
979
- "react/jsx-key": "error",
980
- "react/jsx-no-comment-textnodes": "error",
981
- "react/jsx-no-duplicate-props": "error",
982
- "react/jsx-no-target-blank": "error",
983
- "react/jsx-no-undef": "error",
984
- "react/jsx-uses-react": "error",
985
- "react/jsx-uses-vars": "error",
986
- "react/no-children-prop": "error",
987
- "react/no-danger-with-children": "error",
988
- "react/no-deprecated": "error",
989
- "react/no-direct-mutation-state": "error",
990
- "react/no-find-dom-node": "error",
991
- "react/no-is-mounted": "error",
992
- "react/no-render-return-value": "error",
993
- "react/no-string-refs": "error",
994
- "react/no-unescaped-entities": "error",
995
- "react/no-unknown-property": "error",
996
- "react/no-unsafe": "off",
997
- "react/prop-types": "error",
998
- "react/react-in-jsx-scope": "off",
999
- "react/require-render-return": "error",
1000
- // recommended rules react-hooks
1001
- "react-hooks/exhaustive-deps": "warn",
1002
- "react-hooks/rules-of-hooks": "error",
1003
- // react refresh
1004
- "react-refresh/only-export-components": [
1005
- "warn",
1006
- { allowConstantExport: isAllowConstantExport }
1007
- ],
1008
- ...typescript ? {
1009
- "react/jsx-no-undef": "off",
1010
- "react/prop-type": "off"
1011
- } : {},
1012
- // overrides
1013
- ...overrides
1014
- }
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ curev: () => curev,
34
+ default: () => index_default,
35
+ defaultConfig: () => defaultConfig
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_eslint_config = require("@antfu/eslint-config");
39
+ var import_defu = __toESM(require("defu"), 1);
40
+ var defaultConfig = {
41
+ stylistic: {
42
+ indent: 2,
43
+ semi: true,
44
+ quotes: "double",
45
+ overrides: {
46
+ "style/comma-dangle": ["error", "only-multiline"],
47
+ "style/brace-style": ["error", "1tbs"],
48
+ "style/arrow-parens": ["error", "always"],
49
+ "curly": ["error", "multi-line", "consistent"],
50
+ "style/no-mixed-operators": ["error", {
51
+ allowSamePrecedence: false
52
+ }],
53
+ "style/no-confusing-arrow": ["error", {
54
+ allowParens: true,
55
+ onlyOneSimpleParam: true
56
+ }]
1015
57
  }
1016
- ];
1017
- }
1018
-
1019
- async function sortPackageJson() {
1020
- return [
1021
- {
1022
- files: ["**/package.json"],
1023
- name: "curev:sort-package-json",
1024
- rules: {
1025
- "jsonc/sort-array-values": [
1026
- "error",
1027
- {
1028
- order: { type: "asc" },
1029
- pathPattern: "^files$"
1030
- }
1031
- ],
1032
- "jsonc/sort-keys": [
1033
- "error",
1034
- {
1035
- order: [
1036
- "publisher",
1037
- "name",
1038
- "displayName",
1039
- "type",
1040
- "version",
1041
- "private",
1042
- "packageManager",
1043
- "description",
1044
- "author",
1045
- "license",
1046
- "funding",
1047
- "homepage",
1048
- "repository",
1049
- "bugs",
1050
- "keywords",
1051
- "categories",
1052
- "sideEffects",
1053
- "exports",
1054
- "main",
1055
- "module",
1056
- "unpkg",
1057
- "jsdelivr",
1058
- "types",
1059
- "typesVersions",
1060
- "bin",
1061
- "icon",
1062
- "files",
1063
- "engines",
1064
- "activationEvents",
1065
- "contributes",
1066
- "scripts",
1067
- "peerDependencies",
1068
- "peerDependenciesMeta",
1069
- "dependencies",
1070
- "optionalDependencies",
1071
- "devDependencies",
1072
- "pnpm",
1073
- "overrides",
1074
- "resolutions",
1075
- "husky",
1076
- "simple-git-hooks",
1077
- "lint-staged",
1078
- "eslintConfig"
1079
- ],
1080
- pathPattern: "^$"
1081
- },
1082
- {
1083
- order: { type: "asc" },
1084
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1085
- },
1086
- {
1087
- order: { type: "asc" },
1088
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1089
- },
1090
- {
1091
- order: [
1092
- "types",
1093
- "import",
1094
- "require",
1095
- "default"
1096
- ],
1097
- pathPattern: "^exports.*$"
1098
- }
1099
- ]
1100
- }
1101
- }
1102
- ];
1103
- }
1104
- function sortTsconfig() {
1105
- return [
1106
- {
1107
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1108
- name: "curev:sort-tsconfig",
1109
- rules: {
1110
- "jsonc/sort-keys": [
1111
- "error",
1112
- {
1113
- order: [
1114
- "extends",
1115
- "compilerOptions",
1116
- "references",
1117
- "files",
1118
- "include",
1119
- "exclude"
1120
- ],
1121
- pathPattern: "^$"
1122
- },
1123
- {
1124
- order: [
1125
- /* Projects */
1126
- "incremental",
1127
- "composite",
1128
- "tsBuildInfoFile",
1129
- "disableSourceOfProjectReferenceRedirect",
1130
- "disableSolutionSearching",
1131
- "disableReferencedProjectLoad",
1132
- /* Language and Environment */
1133
- "target",
1134
- "jsx",
1135
- "jsxFactory",
1136
- "jsxFragmentFactory",
1137
- "jsxImportSource",
1138
- "lib",
1139
- "moduleDetection",
1140
- "noLib",
1141
- "reactNamespace",
1142
- "useDefineForClassFields",
1143
- "emitDecoratorMetadata",
1144
- "experimentalDecorators",
1145
- /* Modules */
1146
- "baseUrl",
1147
- "rootDir",
1148
- "rootDirs",
1149
- "customConditions",
1150
- "module",
1151
- "moduleResolution",
1152
- "moduleSuffixes",
1153
- "noResolve",
1154
- "paths",
1155
- "resolveJsonModule",
1156
- "resolvePackageJsonExports",
1157
- "resolvePackageJsonImports",
1158
- "typeRoots",
1159
- "types",
1160
- "allowArbitraryExtensions",
1161
- "allowImportingTsExtensions",
1162
- "allowUmdGlobalAccess",
1163
- /* JavaScript Support */
1164
- "allowJs",
1165
- "checkJs",
1166
- "maxNodeModuleJsDepth",
1167
- /* Type Checking */
1168
- "strict",
1169
- "strictBindCallApply",
1170
- "strictFunctionTypes",
1171
- "strictNullChecks",
1172
- "strictPropertyInitialization",
1173
- "allowUnreachableCode",
1174
- "allowUnusedLabels",
1175
- "alwaysStrict",
1176
- "exactOptionalPropertyTypes",
1177
- "noFallthroughCasesInSwitch",
1178
- "noImplicitAny",
1179
- "noImplicitOverride",
1180
- "noImplicitReturns",
1181
- "noImplicitThis",
1182
- "noPropertyAccessFromIndexSignature",
1183
- "noUncheckedIndexedAccess",
1184
- "noUnusedLocals",
1185
- "noUnusedParameters",
1186
- "useUnknownInCatchVariables",
1187
- /* Emit */
1188
- "declaration",
1189
- "declarationDir",
1190
- "declarationMap",
1191
- "downlevelIteration",
1192
- "emitBOM",
1193
- "emitDeclarationOnly",
1194
- "importHelpers",
1195
- "importsNotUsedAsValues",
1196
- "inlineSourceMap",
1197
- "inlineSources",
1198
- "mapRoot",
1199
- "newLine",
1200
- "noEmit",
1201
- "noEmitHelpers",
1202
- "noEmitOnError",
1203
- "outDir",
1204
- "outFile",
1205
- "preserveConstEnums",
1206
- "preserveValueImports",
1207
- "removeComments",
1208
- "sourceMap",
1209
- "sourceRoot",
1210
- "stripInternal",
1211
- /* Interop Constraints */
1212
- "allowSyntheticDefaultImports",
1213
- "esModuleInterop",
1214
- "forceConsistentCasingInFileNames",
1215
- "isolatedModules",
1216
- "preserveSymlinks",
1217
- "verbatimModuleSyntax",
1218
- /* Completeness */
1219
- "skipDefaultLibCheck",
1220
- "skipLibCheck"
1221
- ],
1222
- pathPattern: "^compilerOptions$"
1223
- }
1224
- ]
1225
- }
1226
- }
1227
- ];
1228
- }
1229
-
1230
- async function svelte(options = {}) {
1231
- const {
1232
- files = [GLOB_SVELTE],
1233
- overrides = {},
1234
- stylistic = true
1235
- } = options;
1236
- const {
1237
- indent = 2,
1238
- quotes = "single"
1239
- } = typeof stylistic === "boolean" ? {} : stylistic;
1240
- await ensurePackages([
1241
- "eslint-plugin-svelte"
1242
- ]);
1243
- const [
1244
- pluginSvelte,
1245
- parserSvelte
1246
- ] = await Promise.all([
1247
- interopDefault(import('eslint-plugin-svelte')),
1248
- interopDefault(import('svelte-eslint-parser'))
1249
- ]);
1250
- return [
1251
- {
1252
- name: "curev:svelte:setup",
1253
- plugins: {
1254
- svelte: pluginSvelte
1255
- }
1256
- },
1257
- {
1258
- files,
1259
- languageOptions: {
1260
- parser: parserSvelte,
1261
- parserOptions: {
1262
- extraFileExtensions: [".svelte"],
1263
- parser: options.typescript ? await interopDefault(import('@typescript-eslint/parser')) : null
1264
- }
1265
- },
1266
- name: "curev:svelte:rules",
1267
- processor: pluginSvelte.processors[".svelte"],
1268
- rules: {
1269
- "import/no-mutable-exports": "off",
1270
- "no-undef": "off",
1271
- // incompatible with most recent (attribute-form) generic types RFC
1272
- "no-unused-vars": ["error", {
1273
- args: "none",
1274
- caughtErrors: "none",
1275
- ignoreRestSiblings: true,
1276
- vars: "all",
1277
- varsIgnorePattern: "^\\$\\$Props$"
1278
- }],
1279
- "svelte/comment-directive": "error",
1280
- "svelte/no-at-debug-tags": "warn",
1281
- "svelte/no-at-html-tags": "error",
1282
- "svelte/no-dupe-else-if-blocks": "error",
1283
- "svelte/no-dupe-style-properties": "error",
1284
- "svelte/no-dupe-use-directives": "error",
1285
- "svelte/no-dynamic-slot-name": "error",
1286
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1287
- "svelte/no-inner-declarations": "error",
1288
- "svelte/no-not-function-handler": "error",
1289
- "svelte/no-object-in-text-mustaches": "error",
1290
- "svelte/no-reactive-functions": "error",
1291
- "svelte/no-reactive-literals": "error",
1292
- "svelte/no-shorthand-style-property-overrides": "error",
1293
- "svelte/no-unknown-style-directive-property": "error",
1294
- "svelte/no-unused-svelte-ignore": "error",
1295
- "svelte/no-useless-mustaches": "error",
1296
- "svelte/require-store-callbacks-use-set-param": "error",
1297
- "svelte/system": "error",
1298
- "svelte/valid-compile": "error",
1299
- "svelte/valid-each-key": "error",
1300
- "unused-imports/no-unused-vars": [
1301
- "error",
1302
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
1303
- ],
1304
- ...stylistic ? {
1305
- "style/no-trailing-spaces": "off",
1306
- // superseded by svelte/no-trailing-spaces
1307
- "svelte/derived-has-same-inputs-outputs": "error",
1308
- "svelte/html-closing-bracket-spacing": "error",
1309
- "svelte/html-quotes": ["error", { prefer: quotes }],
1310
- "svelte/indent": ["error", { alignAttributesVertically: true, indent }],
1311
- "svelte/mustache-spacing": "error",
1312
- "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1313
- "svelte/no-trailing-spaces": "error",
1314
- "svelte/spaced-html-comment": "error"
1315
- } : {},
1316
- ...overrides
1317
- }
1318
- }
1319
- ];
1320
- }
1321
-
1322
- async function test(options = {}) {
1323
- const {
1324
- files = GLOB_TESTS,
1325
- isInEditor = false,
1326
- overrides = {}
1327
- } = options;
1328
- const [
1329
- pluginVitest,
1330
- pluginNoOnlyTests
1331
- ] = await Promise.all([
1332
- interopDefault(import('eslint-plugin-vitest')),
1333
- // @ts-expect-error missing types
1334
- interopDefault(import('eslint-plugin-no-only-tests'))
1335
- ]);
1336
- return [
1337
- {
1338
- name: "curev:test:setup",
1339
- plugins: {
1340
- test: {
1341
- ...pluginVitest,
1342
- rules: {
1343
- ...pluginVitest.rules,
1344
- // extend `test/no-only-tests` rule
1345
- ...pluginNoOnlyTests.rules
1346
- }
1347
- }
1348
- }
1349
- },
1350
- {
1351
- files,
1352
- name: "curev:test:rules",
1353
- rules: {
1354
- "node/prefer-global/process": "off",
1355
- "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1356
- "test/no-identical-title": "error",
1357
- "test/no-import-node-test": "error",
1358
- "test/no-only-tests": isInEditor ? "off" : "error",
1359
- "test/prefer-hooks-in-order": "error",
1360
- "test/prefer-lowercase-title": "error",
1361
- ...overrides
1362
- }
1363
- }
1364
- ];
1365
- }
1366
-
1367
- async function typescript(options = {}) {
1368
- const {
1369
- componentExts = [],
1370
- overrides = {},
1371
- parserOptions = {}
1372
- } = options;
1373
- const files = options.files ?? [
1374
- GLOB_SRC,
1375
- ...componentExts.map((ext) => `**/*.${ext}`)
1376
- ];
1377
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1378
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1379
- const isTypeAware = !!tsconfigPath;
1380
- const typeAwareRules = {
1381
- "dot-notation": "off",
1382
- "no-implied-eval": "off",
1383
- "no-throw-literal": "off",
1384
- "ts/await-thenable": "error",
1385
- "ts/dot-notation": ["error", { allowKeywords: true }],
1386
- "ts/no-floating-promises": "error",
1387
- "ts/no-for-in-array": "error",
1388
- "ts/no-implied-eval": "error",
1389
- "ts/no-misused-promises": "error",
1390
- "ts/no-throw-literal": "error",
1391
- "ts/no-unnecessary-type-assertion": "error",
1392
- "ts/no-unsafe-argument": "error",
1393
- "ts/no-unsafe-assignment": "error",
1394
- "ts/no-unsafe-call": "error",
1395
- "ts/no-unsafe-member-access": "error",
1396
- "ts/no-unsafe-return": "error",
1397
- "ts/restrict-plus-operands": "error",
1398
- "ts/restrict-template-expressions": "error",
1399
- "ts/unbound-method": "error"
1400
- };
1401
- const [
1402
- pluginTs,
1403
- parserTs
1404
- ] = await Promise.all([
1405
- interopDefault(import('@typescript-eslint/eslint-plugin')),
1406
- interopDefault(import('@typescript-eslint/parser'))
1407
- ]);
1408
- function makeParser(typeAware, files2, ignores) {
1409
- return {
1410
- files: files2,
1411
- ...ignores ? { ignores } : {},
1412
- languageOptions: {
1413
- parser: parserTs,
1414
- parserOptions: {
1415
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1416
- sourceType: "module",
1417
- ...typeAware ? {
1418
- project: tsconfigPath,
1419
- tsconfigRootDir: process__default.cwd()
1420
- } : {},
1421
- ...parserOptions
1422
- }
1423
- },
1424
- name: `curev:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1425
- };
1426
- }
1427
- return [
1428
- {
1429
- // Install the plugins without globs, so they can be configured separately.
1430
- name: "curev:typescript:setup",
1431
- plugins: {
1432
- curev: pluginCurev__default,
1433
- ts: pluginTs
1434
- }
1435
- },
1436
- // assign type-aware parser for type-aware files and type-unaware parser for the rest
1437
- ...isTypeAware ? [
1438
- makeParser(true, filesTypeAware),
1439
- makeParser(false, files, filesTypeAware)
1440
- ] : [makeParser(false, files)],
1441
- {
1442
- files,
1443
- name: "curev:typescript:rules",
1444
- rules: {
1445
- ...renameRules(
1446
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
1447
- "@typescript-eslint/",
1448
- "ts/"
1449
- ),
1450
- ...renameRules(
1451
- pluginTs.configs.strict.rules,
1452
- "@typescript-eslint/",
1453
- "ts/"
1454
- ),
1455
- "no-dupe-class-members": "off",
1456
- "no-loss-of-precision": "off",
1457
- "no-redeclare": "off",
1458
- "no-use-before-define": "off",
1459
- "no-useless-constructor": "off",
1460
- "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1461
- "ts/ban-types": ["error", { types: { Function: false } }],
1462
- "ts/consistent-type-definitions": ["error", "interface"],
1463
- "ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
1464
- "ts/no-dupe-class-members": "error",
1465
- "ts/no-dynamic-delete": "off",
1466
- "ts/no-explicit-any": "off",
1467
- "ts/no-extraneous-class": "off",
1468
- "ts/no-import-type-side-effects": "error",
1469
- "ts/no-invalid-void-type": "off",
1470
- "ts/no-loss-of-precision": "error",
1471
- "ts/no-non-null-assertion": "off",
1472
- "ts/no-redeclare": "error",
1473
- "ts/no-require-imports": "error",
1474
- "ts/no-unused-vars": "off",
1475
- "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1476
- "ts/no-useless-constructor": "off",
1477
- "ts/prefer-ts-expect-error": "error",
1478
- "ts/triple-slash-reference": "off",
1479
- "ts/unified-signatures": "off",
1480
- ...overrides
1481
- }
1482
- },
1483
- {
1484
- files: filesTypeAware,
1485
- name: "curev:typescript:rules-type-aware",
1486
- rules: {
1487
- ...tsconfigPath ? typeAwareRules : {},
1488
- ...overrides
1489
- }
1490
- },
1491
- {
1492
- files: ["**/*.d.ts"],
1493
- name: "curev:typescript:dts-overrides",
1494
- rules: {
1495
- "eslint-comments/no-unlimited-disable": "off",
1496
- "import/no-duplicates": "off",
1497
- "no-restricted-syntax": "off",
1498
- "unused-imports/no-unused-vars": "off"
1499
- }
1500
- },
1501
- {
1502
- files: ["**/*.{test,spec}.ts?(x)"],
1503
- name: "curev:typescript:tests-overrides",
1504
- rules: {
1505
- "no-unused-expressions": "off"
1506
- }
1507
- },
1508
- {
1509
- files: ["**/*.js", "**/*.cjs"],
1510
- name: "curev:typescript:javascript-overrides",
1511
- rules: {
1512
- "ts/no-require-imports": "off",
1513
- "ts/no-var-requires": "off"
1514
- }
1515
- }
1516
- ];
1517
- }
1518
-
1519
- async function unicorn() {
1520
- return [
1521
- {
1522
- name: "curev:unicorn",
1523
- plugins: {
1524
- unicorn: pluginUnicorn__default
1525
- },
1526
- rules: {
1527
- // Pass error message when throwing errors
1528
- "unicorn/error-message": "error",
1529
- // Uppercase regex escapes
1530
- "unicorn/escape-case": "error",
1531
- // Array.isArray instead of instanceof
1532
- "unicorn/no-instanceof-array": "error",
1533
- // Ban `new Array` as `Array` constructor's params are ambiguous
1534
- "unicorn/no-new-array": "error",
1535
- // Prevent deprecated `new Buffer()`
1536
- "unicorn/no-new-buffer": "error",
1537
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1538
- "unicorn/number-literal-case": "error",
1539
- // textContent instead of innerText
1540
- "unicorn/prefer-dom-node-text-content": "error",
1541
- // includes over indexOf when checking for existence
1542
- "unicorn/prefer-includes": "error",
1543
- // Prefer using the node: protocol
1544
- "unicorn/prefer-node-protocol": "error",
1545
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1546
- "unicorn/prefer-number-properties": "error",
1547
- // String methods startsWith/endsWith instead of more complicated stuff
1548
- "unicorn/prefer-string-starts-ends-with": "error",
1549
- // Enforce throwing type error when throwing error while checking typeof
1550
- "unicorn/prefer-type-error": "error",
1551
- // Use new when throwing error
1552
- "unicorn/throw-new-error": "error"
1553
- }
1554
- }
1555
- ];
1556
- }
1557
-
1558
- async function unocss(options = {}) {
1559
- const {
1560
- attributify = true,
1561
- strict = false
1562
- } = options;
1563
- await ensurePackages([
1564
- "@unocss/eslint-plugin"
1565
- ]);
1566
- const [
1567
- pluginUnoCSS
1568
- ] = await Promise.all([
1569
- interopDefault(import('@unocss/eslint-plugin'))
1570
- ]);
1571
- return [
1572
- {
1573
- name: "curev:unocss",
1574
- plugins: {
1575
- unocss: pluginUnoCSS
1576
- },
1577
- rules: {
1578
- "unocss/order": "warn",
1579
- ...attributify ? {
1580
- "unocss/order-attributify": "warn"
1581
- } : {},
1582
- ...strict ? {
1583
- "unocss/blocklist": "error"
1584
- } : {}
1585
- }
1586
- }
1587
- ];
1588
- }
1589
-
1590
- async function vue(options = {}) {
1591
- const {
1592
- files = [GLOB_VUE],
1593
- overrides = {},
1594
- stylistic = true,
1595
- vueVersion = 3
1596
- } = options;
1597
- const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1598
- const {
1599
- indent = 2
1600
- } = typeof stylistic === "boolean" ? {} : stylistic;
1601
- const [
1602
- pluginVue,
1603
- parserVue,
1604
- processorVueBlocks
1605
- ] = await Promise.all([
1606
- // @ts-expect-error missing types
1607
- interopDefault(import('eslint-plugin-vue')),
1608
- interopDefault(import('vue-eslint-parser')),
1609
- interopDefault(import('eslint-processor-vue-blocks'))
1610
- ]);
1611
- return [
1612
- {
1613
- name: "curev:vue:setup",
1614
- plugins: {
1615
- vue: pluginVue
1616
- }
1617
- },
1618
- {
1619
- files,
1620
- languageOptions: {
1621
- parser: parserVue,
1622
- parserOptions: {
1623
- ecmaFeatures: {
1624
- jsx: true
1625
- },
1626
- extraFileExtensions: [".vue"],
1627
- parser: options.typescript ? await interopDefault(import('@typescript-eslint/parser')) : null,
1628
- sourceType: "module"
1629
- }
1630
- },
1631
- name: "curev:vue:rules",
1632
- processor: sfcBlocks === false ? pluginVue.processors[".vue"] : eslintMergeProcessors.mergeProcessors([
1633
- pluginVue.processors[".vue"],
1634
- processorVueBlocks({
1635
- ...sfcBlocks,
1636
- blocks: {
1637
- styles: true,
1638
- ...sfcBlocks.blocks
1639
- }
1640
- })
1641
- ]),
1642
- rules: {
1643
- ...pluginVue.configs.base.rules,
1644
- ...vueVersion === 2 ? {
1645
- ...pluginVue.configs.essential.rules,
1646
- ...pluginVue.configs["strongly-recommended"].rules,
1647
- ...pluginVue.configs.recommended.rules
1648
- } : {
1649
- ...pluginVue.configs["vue3-essential"].rules,
1650
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
1651
- ...pluginVue.configs["vue3-recommended"].rules
1652
- },
1653
- "node/prefer-global/process": "off",
1654
- "vue/block-order": ["error", {
1655
- order: ["script", "template", "style"]
1656
- }],
1657
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
1658
- "vue/component-options-name-casing": ["error", "PascalCase"],
1659
- "vue/custom-event-name-casing": ["error", "camelCase"],
1660
- "vue/define-macros-order": ["error", {
1661
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
1662
- }],
1663
- "vue/dot-location": ["error", "property"],
1664
- "vue/dot-notation": ["error", { allowKeywords: true }],
1665
- "vue/eqeqeq": ["error", "smart"],
1666
- "vue/html-indent": ["error", indent],
1667
- "vue/html-quotes": ["error", "double"],
1668
- "vue/max-attributes-per-line": "off",
1669
- "vue/multi-word-component-names": "off",
1670
- "vue/no-dupe-keys": "off",
1671
- "vue/no-empty-pattern": "error",
1672
- "vue/no-irregular-whitespace": "error",
1673
- "vue/no-loss-of-precision": "error",
1674
- "vue/no-restricted-syntax": [
1675
- "error",
1676
- "DebuggerStatement",
1677
- "LabeledStatement",
1678
- "WithStatement"
1679
- ],
1680
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
1681
- "vue/no-setup-props-reactivity-loss": "off",
1682
- "vue/no-sparse-arrays": "error",
1683
- "vue/no-unused-refs": "error",
1684
- "vue/no-useless-v-bind": "error",
1685
- "vue/no-v-html": "off",
1686
- "vue/object-shorthand": [
1687
- "error",
1688
- "always",
1689
- {
1690
- avoidQuotes: true,
1691
- ignoreConstructors: false
1692
- }
1693
- ],
1694
- "vue/prefer-separate-static-class": "error",
1695
- "vue/prefer-template": "error",
1696
- "vue/prop-name-casing": ["error", "camelCase"],
1697
- "vue/require-default-prop": "off",
1698
- "vue/require-prop-types": "off",
1699
- "vue/space-infix-ops": "error",
1700
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1701
- ...stylistic ? {
1702
- "vue/array-bracket-spacing": ["error", "never"],
1703
- "vue/arrow-spacing": ["error", { after: true, before: true }],
1704
- "vue/block-spacing": ["error", "always"],
1705
- "vue/block-tag-newline": ["error", {
1706
- multiline: "always",
1707
- singleline: "always"
1708
- }],
1709
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1710
- "vue/comma-dangle": ["error", "always-multiline"],
1711
- "vue/comma-spacing": ["error", { after: true, before: false }],
1712
- "vue/comma-style": ["error", "last"],
1713
- "vue/html-comment-content-spacing": ["error", "always", {
1714
- exceptions: ["-"]
1715
- }],
1716
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1717
- "vue/keyword-spacing": ["error", { after: true, before: true }],
1718
- "vue/object-curly-newline": "off",
1719
- "vue/object-curly-spacing": ["error", "always"],
1720
- "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1721
- "vue/operator-linebreak": ["error", "before"],
1722
- "vue/padding-line-between-blocks": ["error", "always"],
1723
- "vue/quote-props": ["error", "consistent-as-needed"],
1724
- "vue/space-in-parens": ["error", "never"],
1725
- "vue/template-curly-spacing": "error"
1726
- } : {},
1727
- ...overrides
1728
- }
1729
- }
1730
- ];
1731
- }
1732
-
1733
- async function yaml(options = {}) {
1734
- const {
1735
- files = [GLOB_YAML],
1736
- overrides = {},
1737
- stylistic = true
1738
- } = options;
1739
- const {
1740
- indent = 2,
1741
- quotes = "single"
1742
- } = typeof stylistic === "boolean" ? {} : stylistic;
1743
- const [
1744
- pluginYaml,
1745
- parserYaml
1746
- ] = await Promise.all([
1747
- interopDefault(import('eslint-plugin-yml')),
1748
- interopDefault(import('yaml-eslint-parser'))
1749
- ]);
1750
- return [
1751
- {
1752
- name: "curev:yaml:setup",
1753
- plugins: {
1754
- yaml: pluginYaml
1755
- }
1756
- },
1757
- {
1758
- files,
1759
- languageOptions: {
1760
- parser: parserYaml
1761
- },
1762
- name: "curev:yaml:rules",
1763
- rules: {
1764
- "style/spaced-comment": "off",
1765
- "yaml/block-mapping": "error",
1766
- "yaml/block-sequence": "error",
1767
- "yaml/no-empty-key": "error",
1768
- "yaml/no-empty-sequence-entry": "error",
1769
- "yaml/no-irregular-whitespace": "error",
1770
- "yaml/plain-scalar": "error",
1771
- "yaml/vue-custom-block/no-parsing-error": "error",
1772
- ...stylistic ? {
1773
- "yaml/block-mapping-question-indicator-newline": "error",
1774
- "yaml/block-sequence-hyphen-indicator-newline": "error",
1775
- "yaml/flow-mapping-curly-newline": "error",
1776
- "yaml/flow-mapping-curly-spacing": "error",
1777
- "yaml/flow-sequence-bracket-newline": "error",
1778
- "yaml/flow-sequence-bracket-spacing": "error",
1779
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1780
- "yaml/key-spacing": "error",
1781
- "yaml/no-tab-indent": "error",
1782
- "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
1783
- "yaml/spaced-comment": "error"
1784
- } : {},
1785
- ...overrides
1786
- }
1787
- }
1788
- ];
1789
- }
1790
-
1791
- async function toml(options = {}) {
1792
- const {
1793
- files = [GLOB_TOML],
1794
- overrides = {},
1795
- stylistic = true
1796
- } = options;
1797
- const {
1798
- indent = 2
1799
- } = typeof stylistic === "boolean" ? {} : stylistic;
1800
- const [
1801
- pluginToml,
1802
- parserToml
1803
- ] = await Promise.all([
1804
- interopDefault(import('eslint-plugin-toml')),
1805
- interopDefault(import('toml-eslint-parser'))
1806
- ]);
1807
- return [
1808
- {
1809
- name: "curev:toml:setup",
1810
- plugins: {
1811
- toml: pluginToml
1812
- }
1813
- },
1814
- {
1815
- files,
1816
- languageOptions: {
1817
- parser: parserToml
1818
- },
1819
- name: "curev:toml:rules",
1820
- rules: {
1821
- "style/spaced-comment": "off",
1822
- "toml/comma-style": "error",
1823
- "toml/keys-order": "error",
1824
- "toml/no-space-dots": "error",
1825
- "toml/no-unreadable-number-separator": "error",
1826
- "toml/precision-of-fractional-seconds": "error",
1827
- "toml/precision-of-integer": "error",
1828
- "toml/tables-order": "error",
1829
- "toml/vue-custom-block/no-parsing-error": "error",
1830
- ...stylistic ? {
1831
- "toml/array-bracket-newline": "error",
1832
- "toml/array-bracket-spacing": "error",
1833
- "toml/array-element-newline": "error",
1834
- "toml/indent": ["error", indent === "tab" ? 2 : indent],
1835
- "toml/inline-table-curly-spacing": "error",
1836
- "toml/key-spacing": "error",
1837
- "toml/padding-line-between-pairs": "error",
1838
- "toml/padding-line-between-tables": "error",
1839
- "toml/quoted-keys": "error",
1840
- "toml/spaced-comment": "error",
1841
- "toml/table-bracket-spacing": "error"
1842
- } : {},
1843
- ...overrides
1844
- }
1845
- }
1846
- ];
1847
- }
1848
-
1849
- const flatConfigProps = [
1850
- "name",
1851
- "files",
1852
- "ignores",
1853
- "languageOptions",
1854
- "linterOptions",
1855
- "processor",
1856
- "plugins",
1857
- "rules",
1858
- "settings"
1859
- ];
1860
- const VuePackages = [
1861
- "vue",
1862
- "nuxt",
1863
- "vitepress",
1864
- "@slidev/cli"
1865
- ];
1866
- async function curev(options = {}, ...userConfigs) {
1867
- const {
1868
- componentExts = [],
1869
- gitignore: enableGitignore = true,
1870
- isInEditor = !!((process__default.env.VSCODE_PID || process__default.env.JETBRAINS_IDE || process__default.env.VIM) && !process__default.env.CI),
1871
- react: enableReact = false,
1872
- svelte: enableSvelte = false,
1873
- typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
1874
- unocss: enableUnoCSS = false,
1875
- vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i))
1876
- } = options;
1877
- const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1878
- if (stylisticOptions && !("jsx" in stylisticOptions)) {
1879
- stylisticOptions.jsx = options.jsx ?? true;
1880
- }
1881
- const configs = [];
1882
- if (enableGitignore) {
1883
- if (typeof enableGitignore !== "boolean") {
1884
- configs.push(interopDefault(import('eslint-config-flat-gitignore')).then((r) => [r(enableGitignore)]));
1885
- } else {
1886
- if (fs__default.existsSync(".gitignore")) {
1887
- configs.push(interopDefault(import('eslint-config-flat-gitignore')).then((r) => [r()]));
1888
- }
1889
- }
1890
- }
1891
- configs.push(
1892
- ignores(),
1893
- javascript({
1894
- isInEditor,
1895
- overrides: getOverrides(options, "javascript")
1896
- }),
1897
- comments(),
1898
- node(),
1899
- jsdoc({
1900
- stylistic: stylisticOptions
1901
- }),
1902
- imports({
1903
- stylistic: stylisticOptions
1904
- }),
1905
- unicorn()
1906
- );
1907
- if (enableVue) {
1908
- componentExts.push("vue");
1909
- }
1910
- if (enableTypeScript) {
1911
- configs.push(typescript({
1912
- ...resolveSubOptions(options, "typescript"),
1913
- componentExts,
1914
- overrides: getOverrides(options, "typescript")
1915
- }));
1916
- }
1917
- if (stylisticOptions) {
1918
- configs.push(stylistic({
1919
- ...stylisticOptions,
1920
- overrides: getOverrides(options, "stylistic")
1921
- }));
1922
- }
1923
- if (options.test ?? true) {
1924
- configs.push(test({
1925
- isInEditor,
1926
- overrides: getOverrides(options, "test")
1927
- }));
1928
- }
1929
- if (enableVue) {
1930
- configs.push(vue({
1931
- ...resolveSubOptions(options, "vue"),
1932
- overrides: getOverrides(options, "vue"),
1933
- stylistic: stylisticOptions,
1934
- typescript: !!enableTypeScript
1935
- }));
1936
- }
1937
- if (enableReact) {
1938
- configs.push(react({
1939
- overrides: getOverrides(options, "react"),
1940
- typescript: !!enableTypeScript
1941
- }));
1942
- }
1943
- if (enableSvelte) {
1944
- configs.push(svelte({
1945
- overrides: getOverrides(options, "svelte"),
1946
- stylistic: stylisticOptions,
1947
- typescript: !!enableTypeScript
1948
- }));
1949
- }
1950
- if (enableUnoCSS) {
1951
- configs.push(unocss({
1952
- ...resolveSubOptions(options, "unocss"),
1953
- overrides: getOverrides(options, "unocss")
1954
- }));
1955
- }
1956
- if (options.jsonc ?? true) {
1957
- configs.push(
1958
- jsonc({
1959
- overrides: getOverrides(options, "jsonc"),
1960
- stylistic: stylisticOptions
1961
- }),
1962
- sortPackageJson(),
1963
- sortTsconfig()
1964
- );
1965
- }
1966
- if (options.yaml ?? true) {
1967
- configs.push(yaml({
1968
- overrides: getOverrides(options, "yaml"),
1969
- stylistic: stylisticOptions
1970
- }));
1971
- }
1972
- if (options.toml ?? true) {
1973
- configs.push(toml({
1974
- overrides: getOverrides(options, "toml"),
1975
- stylistic: stylisticOptions
1976
- }));
1977
- }
1978
- if (options.markdown ?? true) {
1979
- configs.push(
1980
- markdown(
1981
- {
1982
- componentExts,
1983
- overrides: getOverrides(options, "markdown")
1984
- }
1985
- )
1986
- );
1987
- }
1988
- if (options.formatters) {
1989
- configs.push(formatters(
1990
- options.formatters,
1991
- typeof stylisticOptions === "boolean" ? {} : stylisticOptions
1992
- ));
1993
- }
1994
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
1995
- if (key in options) {
1996
- acc[key] = options[key];
1997
- }
1998
- return acc;
1999
- }, {});
2000
- if (Object.keys(fusedConfig).length) {
2001
- configs.push([fusedConfig]);
2002
- }
2003
- const merged = combine(
2004
- ...configs,
2005
- ...userConfigs
2006
- );
2007
- return merged;
2008
- }
2009
- function resolveSubOptions(options, key) {
2010
- return typeof options[key] === "boolean" ? {} : options[key] || {};
2011
- }
2012
- function getOverrides(options, key) {
2013
- const sub = resolveSubOptions(options, key);
2014
- return {
2015
- ...options.overrides?.[key],
2016
- ..."overrides" in sub ? sub.overrides : {}
2017
- };
2018
- }
2019
-
2020
- exports.GLOB_ALL_SRC = GLOB_ALL_SRC;
2021
- exports.GLOB_CSS = GLOB_CSS;
2022
- exports.GLOB_EXCLUDE = GLOB_EXCLUDE;
2023
- exports.GLOB_HTML = GLOB_HTML;
2024
- exports.GLOB_JS = GLOB_JS;
2025
- exports.GLOB_JSON = GLOB_JSON;
2026
- exports.GLOB_JSON5 = GLOB_JSON5;
2027
- exports.GLOB_JSONC = GLOB_JSONC;
2028
- exports.GLOB_JSX = GLOB_JSX;
2029
- exports.GLOB_LESS = GLOB_LESS;
2030
- exports.GLOB_MARKDOWN = GLOB_MARKDOWN;
2031
- exports.GLOB_MARKDOWN_CODE = GLOB_MARKDOWN_CODE;
2032
- exports.GLOB_MARKDOWN_IN_MARKDOWN = GLOB_MARKDOWN_IN_MARKDOWN;
2033
- exports.GLOB_POSTCSS = GLOB_POSTCSS;
2034
- exports.GLOB_SCSS = GLOB_SCSS;
2035
- exports.GLOB_SRC = GLOB_SRC;
2036
- exports.GLOB_SRC_EXT = GLOB_SRC_EXT;
2037
- exports.GLOB_STYLE = GLOB_STYLE;
2038
- exports.GLOB_SVELTE = GLOB_SVELTE;
2039
- exports.GLOB_TESTS = GLOB_TESTS;
2040
- exports.GLOB_TOML = GLOB_TOML;
2041
- exports.GLOB_TS = GLOB_TS;
2042
- exports.GLOB_TSX = GLOB_TSX;
2043
- exports.GLOB_VUE = GLOB_VUE;
2044
- exports.GLOB_YAML = GLOB_YAML;
2045
- exports.StylisticConfigDefaults = StylisticConfigDefaults;
2046
- exports.combine = combine;
2047
- exports.comments = comments;
2048
- exports.curev = curev;
2049
- exports.default = curev;
2050
- exports.ensurePackages = ensurePackages;
2051
- exports.formatters = formatters;
2052
- exports.getOverrides = getOverrides;
2053
- exports.ignores = ignores;
2054
- exports.imports = imports;
2055
- exports.interopDefault = interopDefault;
2056
- exports.javascript = javascript;
2057
- exports.jsdoc = jsdoc;
2058
- exports.jsonc = jsonc;
2059
- exports.markdown = markdown;
2060
- exports.node = node;
2061
- exports.parserPlain = parserPlain;
2062
- exports.react = react;
2063
- exports.renameRules = renameRules;
2064
- exports.resolveSubOptions = resolveSubOptions;
2065
- exports.sortPackageJson = sortPackageJson;
2066
- exports.sortTsconfig = sortTsconfig;
2067
- exports.stylistic = stylistic;
2068
- exports.svelte = svelte;
2069
- exports.test = test;
2070
- exports.toArray = toArray;
2071
- exports.toml = toml;
2072
- exports.typescript = typescript;
2073
- exports.unicorn = unicorn;
2074
- exports.unocss = unocss;
2075
- exports.vue = vue;
2076
- exports.yaml = yaml;
58
+ },
59
+ regexp: false
60
+ };
61
+ function curev(options = {}, ...userConfigs) {
62
+ return (0, import_eslint_config.antfu)((0, import_defu.default)(
63
+ options,
64
+ defaultConfig
65
+ ), ...userConfigs);
66
+ }
67
+ var index_default = curev;
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ curev,
71
+ defaultConfig
72
+ });