@curev/eslint-config 0.3.6 → 0.4.0

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