@paratco/eslint-config 3.3.2 → 4.0.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.js ADDED
@@ -0,0 +1,809 @@
1
+ // src/index.ts
2
+ import { defineConfig } from "eslint/config";
3
+ import globals from "globals";
4
+
5
+ // src/configs/base.ts
6
+ import eslintJS from "@eslint/js";
7
+ import { configs as eslintTSConfigs } from "typescript-eslint";
8
+ import eslintPluginUnicorn from "eslint-plugin-unicorn";
9
+
10
+ // src/rules/javascript.ts
11
+ var javascript_default = {
12
+ eqeqeq: ["warn"],
13
+ curly: ["warn", "all"],
14
+ "no-restricted-imports": [
15
+ "error",
16
+ {
17
+ patterns: [
18
+ {
19
+ regex: "^(node:)?process$",
20
+ message: "Please dont import node:process."
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "no-unused-vars": [
26
+ "error",
27
+ {
28
+ args: "all",
29
+ argsIgnorePattern: "^_",
30
+ caughtErrors: "all",
31
+ caughtErrorsIgnorePattern: "^_",
32
+ destructuredArrayIgnorePattern: "^_",
33
+ ignoreRestSiblings: true
34
+ }
35
+ ],
36
+ "no-fallthrough": [
37
+ "error",
38
+ {
39
+ allowEmptyCase: true
40
+ }
41
+ ]
42
+ };
43
+
44
+ // src/rules/typescript.ts
45
+ var typescript_default = {
46
+ "class-methods-use-this": "off",
47
+ "@typescript-eslint/class-methods-use-this": [
48
+ "error",
49
+ {
50
+ ignoreOverrideMethods: true,
51
+ ignoreClassesThatImplementAnInterface: true
52
+ }
53
+ ],
54
+ "consistent-return": "off",
55
+ "@typescript-eslint/consistent-return": "off",
56
+ "@typescript-eslint/consistent-type-exports": [
57
+ "error",
58
+ {
59
+ fixMixedExportsWithInlineTypeSpecifier: true
60
+ }
61
+ ],
62
+ "@typescript-eslint/consistent-type-imports": ["error"],
63
+ "default-param-last": "off",
64
+ "@typescript-eslint/default-param-last": ["error"],
65
+ "@typescript-eslint/explicit-function-return-type": [
66
+ "error",
67
+ {
68
+ allowExpressions: true
69
+ }
70
+ ],
71
+ "@typescript-eslint/explicit-member-accessibility": [
72
+ "error",
73
+ {
74
+ accessibility: "no-public",
75
+ overrides: {
76
+ constructors: "off"
77
+ }
78
+ }
79
+ ],
80
+ "@typescript-eslint/explicit-module-boundary-types": ["error"],
81
+ "init-declarations": "off",
82
+ "@typescript-eslint/init-declarations": ["off"],
83
+ "max-params": "off",
84
+ "@typescript-eslint/max-params": ["off"],
85
+ "@typescript-eslint/member-ordering": [
86
+ "error",
87
+ { default: ["constructor", "field", "static-method", "method", "signature"] }
88
+ ],
89
+ "@typescript-eslint/method-signature-style": ["error"],
90
+ "@typescript-eslint/naming-convention": [
91
+ "error",
92
+ {
93
+ selector: "function",
94
+ format: ["PascalCase", "camelCase"]
95
+ }
96
+ ],
97
+ "no-dupe-class-members": "off",
98
+ "@typescript-eslint/no-dupe-class-members": ["off"],
99
+ "@typescript-eslint/no-import-type-side-effects": ["error"],
100
+ "no-invalid-this": "off",
101
+ "@typescript-eslint/no-invalid-this": ["error"],
102
+ "no-loop-func": "off",
103
+ "@typescript-eslint/no-loop-func": ["error"],
104
+ "no-magic-numbers": "off",
105
+ "@typescript-eslint/no-magic-numbers": ["off"],
106
+ "no-redeclare": "off",
107
+ "@typescript-eslint/no-redeclare": ["off"],
108
+ "no-restricted-imports": "off",
109
+ "@typescript-eslint/no-restricted-imports": [
110
+ "error",
111
+ {
112
+ patterns: [
113
+ {
114
+ regex: "^(node:)?process$",
115
+ message: "Please dont import node:process."
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ "no-shadow": "off",
121
+ "@typescript-eslint/no-shadow": ["error"],
122
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": ["off"],
123
+ "@typescript-eslint/no-unnecessary-qualifier": ["warn"],
124
+ "@typescript-eslint/no-unnecessary-type-conversion": ["warn"],
125
+ "@typescript-eslint/no-unsafe-type-assertion": ["off"],
126
+ "no-use-before-define": "off",
127
+ "@typescript-eslint/no-use-before-define": ["error"],
128
+ "@typescript-eslint/no-useless-empty-export": ["warn"],
129
+ "@typescript-eslint/parameter-properties": ["error"],
130
+ "prefer-destructuring": "off",
131
+ "@typescript-eslint/prefer-destructuring": ["off"],
132
+ "@typescript-eslint/prefer-enum-initializers": ["off"],
133
+ "@typescript-eslint/prefer-readonly": ["warn"],
134
+ "@typescript-eslint/prefer-readonly-parameter-types": ["off"],
135
+ "@typescript-eslint/promise-function-async": ["error"],
136
+ "@typescript-eslint/require-array-sort-compare": ["error"],
137
+ "@typescript-eslint/strict-boolean-expressions": [
138
+ "error",
139
+ {
140
+ allowString: false,
141
+ allowNumber: false,
142
+ allowNullableObject: false
143
+ }
144
+ ],
145
+ "@typescript-eslint/switch-exhaustiveness-check": ["error"],
146
+ "@typescript-eslint/restrict-template-expressions": [
147
+ "error",
148
+ {
149
+ allowBoolean: true,
150
+ allowNumber: true,
151
+ allowRegExp: true
152
+ }
153
+ ],
154
+ "@typescript-eslint/no-unnecessary-type-parameters": ["off"],
155
+ "no-unused-vars": ["off"],
156
+ "@typescript-eslint/no-unused-vars": [
157
+ "error",
158
+ {
159
+ args: "all",
160
+ argsIgnorePattern: "^_",
161
+ caughtErrors: "all",
162
+ caughtErrorsIgnorePattern: "^_",
163
+ destructuredArrayIgnorePattern: "^_",
164
+ ignoreRestSiblings: true
165
+ }
166
+ ],
167
+ "@typescript-eslint/prefer-optional-chain": ["off"],
168
+ "@typescript-eslint/no-unnecessary-type-assertion": ["off"]
169
+ };
170
+
171
+ // src/rules/unicorn.ts
172
+ var unicorn_default = {
173
+ "unicorn/catch-error-name": [
174
+ "error",
175
+ {
176
+ ignore: [String.raw`^error[\da-zA-Z_]*$`]
177
+ }
178
+ ],
179
+ "unicorn/filename-case": ["off"],
180
+ "unicorn/prevent-abbreviations": ["off"],
181
+ "unicorn/no-null": ["off"],
182
+ "unicorn/no-negated-condition": ["off"],
183
+ "unicorn/switch-case-braces": ["off"],
184
+ "unicorn/prefer-spread": ["off"],
185
+ "unicorn/prefer-at": ["off"],
186
+ "unicorn/prefer-ternary": ["warn", "only-single-line"],
187
+ "unicorn/no-typeof-undefined": ["off"],
188
+ "unicorn/no-static-only-class": ["off"],
189
+ "unicorn/no-top-level-side-effects": ["off"],
190
+ "unicorn/no-break-in-nested-loop": ["off"],
191
+ "unicorn/prefer-short-arrow-method": ["off"],
192
+ "unicorn/max-nested-calls": ["off"],
193
+ "unicorn/consistent-boolean-name": ["off"],
194
+ "unicorn/consistent-class-member-order": ["off"],
195
+ "unicorn/prefer-uint8array-base64": ["error"],
196
+ "unicorn/prefer-iterator-to-array": ["off"],
197
+ "unicorn/prefer-split-limit": ["off"],
198
+ "unicorn/prefer-minimal-ternary": ["off"],
199
+ "unicorn/no-non-function-verb-prefix": ["off"],
200
+ "unicorn/prefer-https": ["off"],
201
+ "unicorn/class-reference-in-static-methods": ["off"],
202
+ "unicorn/prefer-await": ["off"],
203
+ "unicorn/no-top-level-assignment-in-function": ["off"],
204
+ "unicorn/no-unsafe-string-replacement": ["warn"],
205
+ "unicorn/name-replacements": "off",
206
+ "unicorn/no-nonstandard-builtin-properties": ["off"]
207
+ };
208
+
209
+ // src/configs/base.ts
210
+ var base_default = [
211
+ eslintJS.configs.recommended,
212
+ ...eslintTSConfigs.strictTypeChecked,
213
+ ...eslintTSConfigs.stylisticTypeChecked,
214
+ eslintPluginUnicorn.configs.recommended,
215
+ {
216
+ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
217
+ rules: javascript_default
218
+ },
219
+ {
220
+ files: ["**/*.{ts,tsx}"],
221
+ rules: typescript_default
222
+ },
223
+ {
224
+ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
225
+ rules: unicorn_default
226
+ }
227
+ ];
228
+ // src/configs/react.ts
229
+ import eslintReact from "@eslint-react/eslint-plugin";
230
+ import { configs as reactHooksConfigs } from "eslint-plugin-react-hooks";
231
+ import reactRefreshPlugin from "eslint-plugin-react-refresh";
232
+
233
+ // src/rules/react.ts
234
+ var react_default = {
235
+ "@eslint-react/dom-no-missing-button-type": ["error"],
236
+ "@eslint-react/no-missing-component-display-name": ["error"],
237
+ "@eslint-react/use-state": ["error"],
238
+ "@eslint-react/dom-no-missing-iframe-sandbox": ["error"],
239
+ "@eslint-react/no-missing-key": ["error"],
240
+ "@eslint-react/no-duplicate-key": ["warn"],
241
+ "@eslint-react/jsx-no-comment-textnodes": ["error"],
242
+ "@eslint-react/no-unstable-context-value": ["error"],
243
+ "@eslint-react/no-leaked-conditional-rendering": ["warn"],
244
+ "@eslint-react/dom-no-script-url": ["error"],
245
+ "@eslint-react/dom-no-unsafe-target-blank": ["warn"],
246
+ "@eslint-react/jsx-no-useless-fragment": ["warn"],
247
+ "@eslint-react/no-access-state-in-setstate": ["error"],
248
+ "@eslint-react/no-array-index-key": ["error"],
249
+ "@eslint-react/jsx-no-children-prop": ["error"],
250
+ "@eslint-react/dom-no-dangerously-set-innerhtml": ["error"],
251
+ "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": ["error"],
252
+ "@eslint-react/dom-no-find-dom-node": ["error"],
253
+ "@eslint-react/jsx-no-namespace": ["error"],
254
+ "@eslint-react/no-unstable-default-props": ["error"],
255
+ "@eslint-react/dom-no-render-return-value": ["error"],
256
+ "@eslint-react/dom-no-unknown-property": ["warn"],
257
+ "@eslint-react/no-nested-component-definitions": ["error"],
258
+ "@eslint-react/no-unused-props": ["error"],
259
+ "@eslint-react/no-unused-state": ["error"],
260
+ "@eslint-react/no-set-state-in-component-will-update": ["error"],
261
+ "@eslint-react/dom-no-string-style-prop": ["error"],
262
+ "@eslint-react/dom-no-void-elements-with-children": ["error"]
263
+ };
264
+
265
+ // src/rules/react_kit.ts
266
+ import eslintReactKit from "@eslint-react/kit";
267
+ import { TSESTree } from "@typescript-eslint/types";
268
+ function jsxBooleanValue() {
269
+ return (context) => ({
270
+ JSXAttribute(node) {
271
+ if (node.value !== null) {
272
+ return;
273
+ }
274
+ context.report({
275
+ node,
276
+ message: "Set an explicit value for boolean attributes (e.g. `prop={true}`).",
277
+ fix: (fixer) => fixer.insertTextAfter(node.name, "={true}")
278
+ });
279
+ }
280
+ });
281
+ }
282
+ function jsxFragments(options = {}) {
283
+ const { mode = "syntax" } = options;
284
+ return (context) => {
285
+ function reportSyntaxPreferred(node, pattern) {
286
+ const hasAttributes = node.attributes.length > 0;
287
+ if (hasAttributes) {
288
+ return;
289
+ }
290
+ context.report({
291
+ node,
292
+ message: `Use shorthand fragment syntax '<>...</>' instead of '<${pattern}>...</${pattern}'.`,
293
+ fix(fixer) {
294
+ const closing = node.parent.closingElement;
295
+ if (closing === null) {
296
+ return null;
297
+ }
298
+ return [fixer.replaceText(node, "<>"), fixer.replaceText(closing, "</>")];
299
+ }
300
+ });
301
+ }
302
+ return {
303
+ JSXOpeningElement(node) {
304
+ const name = node.name;
305
+ if (name.type === TSESTree.AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") {
306
+ if (mode === "syntax") {
307
+ reportSyntaxPreferred(node, "Fragment");
308
+ }
309
+ return;
310
+ }
311
+ if (name.type !== TSESTree.AST_NODE_TYPES.JSXMemberExpression) {
312
+ return;
313
+ }
314
+ if (name.object.type !== TSESTree.AST_NODE_TYPES.JSXIdentifier || name.object.name !== "React" || name.property.name !== "Fragment") {
315
+ return;
316
+ }
317
+ if (mode === "syntax") {
318
+ reportSyntaxPreferred(node, "React.Fragment");
319
+ }
320
+ },
321
+ JSXFragment(node) {
322
+ if (mode === "element") {
323
+ context.report({
324
+ node,
325
+ message: "Use '<React.Fragment>...</React.Fragment>' instead of shorthand '<>...</>'.",
326
+ fix: (fixer) => [
327
+ fixer.replaceText(node.openingFragment, "<React.Fragment>"),
328
+ fixer.replaceText(node.closingFragment, "</React.Fragment>")
329
+ ]
330
+ });
331
+ }
332
+ }
333
+ };
334
+ };
335
+ }
336
+ function jsxNoDuplicateProps(options = {}) {
337
+ const { ignoreCase: isIgnoreCase = false } = options;
338
+ return (context) => ({
339
+ JSXOpeningElement(node) {
340
+ const seen = new Map;
341
+ for (const attr of node.attributes) {
342
+ if (attr.type !== TSESTree.AST_NODE_TYPES.JSXAttribute) {
343
+ continue;
344
+ }
345
+ if (attr.name.type !== TSESTree.AST_NODE_TYPES.JSXIdentifier) {
346
+ continue;
347
+ }
348
+ const name = isIgnoreCase ? attr.name.name.toLowerCase() : attr.name.name;
349
+ if (seen.has(name)) {
350
+ context.report({
351
+ node: attr,
352
+ message: `Duplicate prop "${attr.name.name}" found.`
353
+ });
354
+ } else {
355
+ seen.set(name, attr.name.name);
356
+ }
357
+ }
358
+ }
359
+ });
360
+ }
361
+ var reactKitConfig = eslintReactKit().use(jsxBooleanValue).use(jsxFragments, { mode: "element" }).use(jsxNoDuplicateProps).getConfig();
362
+ var react_kit_default = reactKitConfig;
363
+
364
+ // src/configs/react.ts
365
+ var react_default2 = [
366
+ ...base_default,
367
+ reactHooksConfigs.flat["recommended-latest"],
368
+ reactRefreshPlugin.configs.recommended,
369
+ {
370
+ files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
371
+ ...eslintReact.configs["recommended-typescript"],
372
+ rules: {
373
+ ...react_default
374
+ }
375
+ },
376
+ react_kit_default
377
+ ];
378
+
379
+ // src/configs/import.ts
380
+ import { flatConfigs as importXFlatConfigs } from "eslint-plugin-import-x";
381
+ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
382
+ import unusedImports from "eslint-plugin-unused-imports";
383
+
384
+ // src/rules/import.ts
385
+ var import_default = {
386
+ "import-x/no-deprecated": ["error"],
387
+ "import-x/no-empty-named-blocks": ["warn"],
388
+ "import-x/no-extraneous-dependencies": [
389
+ "error",
390
+ { devDependencies: false, optionalDependencies: false }
391
+ ],
392
+ "import-x/no-mutable-exports": ["error"],
393
+ "import-x/no-rename-default": ["off"],
394
+ "import-x/no-unused-modules": ["off", { missingExports: true }],
395
+ "import-x/no-amd": ["error"],
396
+ "import-x/no-commonjs": ["error"],
397
+ "import-x/no-import-module-exports": ["warn"],
398
+ "import-x/no-nodejs-modules": ["off"],
399
+ "import-x/unambiguous": ["error"],
400
+ "import-x/no-absolute-path": ["warn"],
401
+ "import-x/no-cycle": ["error"],
402
+ "import-x/no-dynamic-require": ["off"],
403
+ "import-x/no-internal-modules": ["off"],
404
+ "import-x/no-relative-packages": ["warn"],
405
+ "import-x/no-relative-parent-imports": ["off"],
406
+ "import-x/no-self-import": ["error"],
407
+ "import-x/no-useless-path-segments": [
408
+ "warn",
409
+ {
410
+ noUselessIndex: true
411
+ }
412
+ ],
413
+ "import-x/no-webpack-loader-syntax": ["error"],
414
+ "import-x/consistent-type-specifier-style": ["warn", "prefer-top-level"],
415
+ "import-x/dynamic-import-chunkname": ["off"],
416
+ "import-x/exports-last": ["off"],
417
+ "import-x/extensions": ["error", "never"],
418
+ "import-x/first": ["warn"],
419
+ "import-x/group-exports": ["off"],
420
+ "import-x/max-dependencies": ["off"],
421
+ "import-x/newline-after-import": ["warn"],
422
+ "import-x/no-anonymous-default-export": [
423
+ "error",
424
+ {
425
+ allowArray: false,
426
+ allowArrowFunction: true,
427
+ allowAnonymousClass: false,
428
+ allowAnonymousFunction: false,
429
+ allowCallExpression: true,
430
+ allowNew: false,
431
+ allowLiteral: false,
432
+ allowObject: false
433
+ }
434
+ ],
435
+ "import-x/no-default-export": ["off"],
436
+ "import-x/no-named-default": ["off"],
437
+ "import-x/no-named-export": ["off"],
438
+ "import-x/no-namespace": ["warn"],
439
+ "import-x/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
440
+ "import-x/order": ["warn"],
441
+ "import-x/prefer-default-export": ["off"]
442
+ };
443
+
444
+ // src/configs/import.ts
445
+ function importConfig(typescript) {
446
+ const resolverOptions = { alwaysTryTypes: true, bun: true };
447
+ if (typescript !== undefined) {
448
+ resolverOptions.project = typescript.project;
449
+ }
450
+ return [
451
+ importXFlatConfigs.recommended,
452
+ importXFlatConfigs.typescript,
453
+ {
454
+ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
455
+ plugins: {
456
+ "unused-imports": unusedImports
457
+ },
458
+ settings: {
459
+ "import-x/resolver-next": [createTypeScriptImportResolver(resolverOptions)]
460
+ },
461
+ rules: {
462
+ ...import_default,
463
+ "unused-imports/no-unused-imports": ["error"]
464
+ }
465
+ }
466
+ ];
467
+ }
468
+
469
+ // src/configs/prettierFormatter.ts
470
+ import eslintConfigPrettier from "eslint-config-prettier";
471
+ var prettierFormatter_default = [eslintConfigPrettier];
472
+
473
+ // src/configs/stylisticFormatter.ts
474
+ import stylistic from "@stylistic/eslint-plugin";
475
+
476
+ // src/rules/stylistic.ts
477
+ var stylistic_default = {
478
+ "@stylistic/array-bracket-newline": ["warn"],
479
+ "@stylistic/array-bracket-spacing": ["warn"],
480
+ "@stylistic/array-element-newline": ["warn", "consistent"],
481
+ "@stylistic/arrow-parens": ["warn", "always"],
482
+ "@stylistic/arrow-spacing": ["warn"],
483
+ "@stylistic/block-spacing": ["warn"],
484
+ "@stylistic/brace-style": ["warn", "1tbs"],
485
+ "@stylistic/comma-dangle": ["warn"],
486
+ "@stylistic/comma-spacing": ["warn"],
487
+ "@stylistic/comma-style": ["warn"],
488
+ "@stylistic/computed-property-spacing": ["warn"],
489
+ "@stylistic/curly-newline": ["warn", "always"],
490
+ "@stylistic/dot-location": ["warn", "property"],
491
+ "@stylistic/eol-last": ["warn"],
492
+ "@stylistic/function-call-spacing": ["warn"],
493
+ "@stylistic/function-call-argument-newline": ["warn", "consistent"],
494
+ "@stylistic/function-paren-newline": ["warn", "consistent"],
495
+ "@stylistic/generator-star-spacing": ["warn"],
496
+ "@stylistic/implicit-arrow-linebreak": ["warn"],
497
+ "@stylistic/indent": ["warn", 2],
498
+ "@stylistic/indent-binary-ops": ["warn", 2],
499
+ "@stylistic/jsx-child-element-spacing": ["error"],
500
+ "@stylistic/jsx-closing-bracket-location": ["warn"],
501
+ "@stylistic/jsx-closing-tag-location": ["warn"],
502
+ "@stylistic/jsx-curly-brace-presence": ["warn"],
503
+ "@stylistic/jsx-curly-newline": ["warn"],
504
+ "@stylistic/jsx-curly-spacing": ["warn"],
505
+ "@stylistic/jsx-equals-spacing": ["warn"],
506
+ "@stylistic/jsx-first-prop-new-line": ["warn"],
507
+ "@stylistic/jsx-function-call-newline": ["warn"],
508
+ "@stylistic/jsx-indent-props": ["warn", 2],
509
+ "@stylistic/jsx/jsx-max-props-per-line": ["off"],
510
+ "@stylistic/jsx-newline": ["off"],
511
+ "@stylistic/jsx-one-expression-per-line": ["warn", { allow: "single-child" }],
512
+ "@stylistic/jsx-pascal-case": ["error"],
513
+ "@stylistic/jsx-quotes": ["warn"],
514
+ "@stylistic/jsx-self-closing-comp": ["warn"],
515
+ "@stylistic/jsx-sort-props": [
516
+ "warn",
517
+ {
518
+ callbacksLast: true,
519
+ shorthandFirst: true,
520
+ multiline: "last",
521
+ noSortAlphabetically: true
522
+ }
523
+ ],
524
+ "@stylistic/jsx-tag-spacing": [
525
+ "warn",
526
+ {
527
+ closingSlash: "never",
528
+ beforeSelfClosing: "always",
529
+ afterOpening: "never",
530
+ beforeClosing: "never"
531
+ }
532
+ ],
533
+ "@stylistic/jsx-wrap-multilines": [
534
+ "warn",
535
+ {
536
+ declaration: "parens-new-line",
537
+ assignment: "parens-new-line",
538
+ return: "parens-new-line",
539
+ arrow: "parens-new-line",
540
+ condition: "parens-new-line",
541
+ logical: "parens-new-line",
542
+ prop: "parens-new-line"
543
+ }
544
+ ],
545
+ "@stylistic/key-spacing": "warn",
546
+ "@stylistic/keyword-spacing": "warn",
547
+ "@stylistic/line-comment-position": "warn",
548
+ "@stylistic/linebreak-style": "warn",
549
+ "@stylistic/lines-around-comment": [
550
+ "warn",
551
+ {
552
+ beforeBlockComment: true,
553
+ afterBlockComment: false,
554
+ beforeLineComment: true,
555
+ afterLineComment: false,
556
+ allowBlockStart: true,
557
+ allowBlockEnd: true,
558
+ allowObjectStart: true,
559
+ allowObjectEnd: true,
560
+ allowArrayStart: true,
561
+ allowArrayEnd: true,
562
+ allowClassStart: true,
563
+ allowClassEnd: true,
564
+ afterHashbangComment: true
565
+ }
566
+ ],
567
+ "@stylistic/lines-between-class-members": [
568
+ "warn",
569
+ {
570
+ enforce: [
571
+ {
572
+ blankLine: "never",
573
+ prev: "field",
574
+ next: "field"
575
+ },
576
+ {
577
+ blankLine: "always",
578
+ prev: "*",
579
+ next: "method"
580
+ },
581
+ {
582
+ blankLine: "always",
583
+ prev: "method",
584
+ next: "*"
585
+ }
586
+ ]
587
+ }
588
+ ],
589
+ "@stylistic/max-len": [
590
+ "error",
591
+ {
592
+ code: 120,
593
+ tabWidth: 2,
594
+ comments: 120,
595
+ ignoreComments: true,
596
+ ignoreTrailingComments: true,
597
+ ignoreUrls: true,
598
+ ignoreStrings: true,
599
+ ignoreTemplateLiterals: true,
600
+ ignoreRegExpLiterals: true
601
+ }
602
+ ],
603
+ "@stylistic/max-statements-per-line": ["error"],
604
+ "@stylistic/member-delimiter-style": ["warn"],
605
+ "@stylistic/multiline-comment-style": ["off"],
606
+ "@stylistic/multiline-ternary": ["warn", "always-multiline"],
607
+ "@stylistic/new-parens": ["warn"],
608
+ "@stylistic/newline-per-chained-call": ["warn"],
609
+ "@stylistic/no-confusing-arrow": ["warn"],
610
+ "@stylistic/no-extra-parens": ["warn"],
611
+ "@stylistic/no-extra-semi": ["warn"],
612
+ "@stylistic/no-floating-decimal": ["warn"],
613
+ "@stylistic/no-mixed-operators": ["error"],
614
+ "@stylistic/no-mixed-spaces-and-tabs": ["error"],
615
+ "@stylistic/no-multi-spaces": ["warn"],
616
+ "@stylistic/no-multiple-empty-lines": ["warn"],
617
+ "@stylistic/no-tabs": ["error"],
618
+ "@stylistic/no-trailing-spaces": ["warn"],
619
+ "@stylistic/no-whitespace-before-property": ["warn"],
620
+ "@stylistic/nonblock-statement-body-position": ["warn"],
621
+ "@stylistic/object-curly-newline": [
622
+ "warn",
623
+ {
624
+ consistent: true
625
+ }
626
+ ],
627
+ "@stylistic/object-curly-spacing": ["warn"],
628
+ "@stylistic/object-property-newline": [
629
+ "warn",
630
+ {
631
+ allowAllPropertiesOnSameLine: true
632
+ }
633
+ ],
634
+ "@stylistic/one-var-declaration-per-line": ["warn"],
635
+ "@stylistic/operator-linebreak": ["warn"],
636
+ "@stylistic/padded-blocks": ["warn", "never"],
637
+ "@stylistic/padding-line-between-statements": [
638
+ "warn",
639
+ {
640
+ blankLine: "always",
641
+ prev: "*",
642
+ next: "return"
643
+ },
644
+ {
645
+ blankLine: "always",
646
+ prev: "*",
647
+ next: "block-like"
648
+ },
649
+ {
650
+ blankLine: "always",
651
+ prev: "block-like",
652
+ next: "*"
653
+ },
654
+ {
655
+ blankLine: "always",
656
+ prev: "case",
657
+ next: "case"
658
+ },
659
+ {
660
+ blankLine: "never",
661
+ prev: "*",
662
+ next: "break"
663
+ },
664
+ {
665
+ blankLine: "always",
666
+ prev: "*",
667
+ next: "export"
668
+ },
669
+ {
670
+ blankLine: "always",
671
+ prev: "*",
672
+ next: "interface"
673
+ },
674
+ {
675
+ blankLine: "always",
676
+ prev: "interface",
677
+ next: "*"
678
+ },
679
+ {
680
+ blankLine: "always",
681
+ prev: "*",
682
+ next: "class"
683
+ },
684
+ {
685
+ blankLine: "always",
686
+ prev: "class",
687
+ next: "*"
688
+ }
689
+ ],
690
+ "@stylistic/quote-props": ["warn", "as-needed"],
691
+ "@stylistic/quotes": ["warn"],
692
+ "@stylistic/rest-spread-spacing": ["warn"],
693
+ "@stylistic/semi": ["warn"],
694
+ "@stylistic/semi-spacing": ["warn"],
695
+ "@stylistic/semi-style": ["warn"],
696
+ "@stylistic/space-before-blocks": ["warn"],
697
+ "@stylistic/space-before-function-paren": [
698
+ "warn",
699
+ {
700
+ anonymous: "always",
701
+ named: "never",
702
+ asyncArrow: "always"
703
+ }
704
+ ],
705
+ "@stylistic/space-in-parens": ["warn"],
706
+ "@stylistic/space-infix-ops": ["warn"],
707
+ "@stylistic/space-unary-ops": ["warn"],
708
+ "@stylistic/spaced-comment": ["warn"],
709
+ "@stylistic/switch-colon-spacing": ["warn"],
710
+ "@stylistic/template-curly-spacing": ["warn"],
711
+ "@stylistic/template-tag-spacing": ["warn"],
712
+ "@stylistic/type-annotation-spacing": ["warn"],
713
+ "@stylistic/type-generic-spacing": ["warn"],
714
+ "@stylistic/type-named-tuple-spacing": ["warn"],
715
+ "@stylistic/wrap-iife": ["warn", "inside"],
716
+ "@stylistic/wrap-regex": ["warn"],
717
+ "@stylistic/yield-star-spacing": ["warn", "after"]
718
+ };
719
+
720
+ // src/configs/stylisticFormatter.ts
721
+ var stylisticFormatter_default = [
722
+ stylistic.configs.customize({
723
+ jsx: true,
724
+ arrowParens: true,
725
+ blockSpacing: true,
726
+ braceStyle: "stroustrup",
727
+ commaDangle: "never",
728
+ indent: 2,
729
+ semi: true,
730
+ quotes: "double",
731
+ quoteProps: "always"
732
+ }),
733
+ {
734
+ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
735
+ languageOptions: {
736
+ parserOptions: {
737
+ ecmaFeatures: {
738
+ jsx: true
739
+ }
740
+ }
741
+ },
742
+ rules: stylistic_default
743
+ }
744
+ ];
745
+
746
+ // src/index.ts
747
+ function node(typescript) {
748
+ return {
749
+ globals: globals.node,
750
+ parserOptions: {
751
+ ecmaVersion: "latest",
752
+ tsconfigRootDir: typescript?.tsconfigRootDir,
753
+ project: typescript?.project
754
+ }
755
+ };
756
+ }
757
+ function react(typescript) {
758
+ return {
759
+ globals: {
760
+ ...globals.serviceworker,
761
+ ...globals.browser
762
+ },
763
+ parserOptions: {
764
+ ecmaFeatures: { jsx: true },
765
+ tsconfigRootDir: typescript?.tsconfigRootDir,
766
+ project: typescript?.project
767
+ }
768
+ };
769
+ }
770
+ function createConfig(opt) {
771
+ let config;
772
+ if (opt.platform === "node") {
773
+ config = [
774
+ ...base_default,
775
+ {
776
+ files: ["**/*.{ts,js}"],
777
+ languageOptions: node(opt.typescript)
778
+ }
779
+ ];
780
+ } else {
781
+ config = [
782
+ ...react_default2,
783
+ {
784
+ files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
785
+ languageOptions: react(opt.typescript)
786
+ }
787
+ ];
788
+ }
789
+ if (opt.useImport === true) {
790
+ config.push(...importConfig(opt.typescript));
791
+ }
792
+ config.push(...opt.style === "stylistic" ? stylisticFormatter_default : prettierFormatter_default);
793
+ if (opt.overrides !== undefined) {
794
+ config.push(...opt.overrides);
795
+ }
796
+ if (opt.ignores !== undefined) {
797
+ config.push({ ignores: opt.ignores });
798
+ }
799
+ if (opt.files !== undefined && opt.files.length > 0) {
800
+ return defineConfig({ files: opt.files, extends: config });
801
+ }
802
+ return config;
803
+ }
804
+ export {
805
+ createConfig
806
+ };
807
+
808
+ //# debugId=A22F85388EC5A25C64756E2164756E21
809
+ //# sourceMappingURL=index.js.map