@paratco/eslint-config 3.4.0 → 5.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,812 @@
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
+ "unicorn/single-line-block-comment-style": ["off"],
208
+ "unicorn/prefer-promise-try": ["off"],
209
+ "unicorn/prefer-then-catch": ["off"],
210
+ "unicorn/prefer-dom-node-html-methods": ["off"]
211
+ };
212
+
213
+ // src/globs.ts
214
+ var ALL_FILES = ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"];
215
+ var TS_FILES = ["**/*.{ts,mts,cts,tsx}"];
216
+
217
+ // src/configs/base.ts
218
+ var base_default = [
219
+ eslintJS.configs.recommended,
220
+ ...eslintTSConfigs.strictTypeChecked,
221
+ ...eslintTSConfigs.stylisticTypeChecked,
222
+ eslintPluginUnicorn.configs.recommended,
223
+ {
224
+ files: ALL_FILES,
225
+ rules: javascript_default
226
+ },
227
+ {
228
+ files: TS_FILES,
229
+ rules: typescript_default
230
+ },
231
+ {
232
+ files: ALL_FILES,
233
+ rules: unicorn_default
234
+ }
235
+ ];
236
+ // src/configs/react.ts
237
+ import eslintReact from "@eslint-react/eslint-plugin";
238
+ import { configs as reactHooksConfigs } from "eslint-plugin-react-hooks";
239
+ import reactRefreshPlugin from "eslint-plugin-react-refresh";
240
+
241
+ // src/rules/react.ts
242
+ var react_default = {
243
+ "@eslint-react/dom-no-missing-button-type": ["error"],
244
+ "@eslint-react/no-missing-component-display-name": ["error"],
245
+ "@eslint-react/use-state": ["error"],
246
+ "@eslint-react/dom-no-missing-iframe-sandbox": ["error"],
247
+ "@eslint-react/no-missing-key": ["error"],
248
+ "@eslint-react/no-duplicate-key": ["warn"],
249
+ "@eslint-react/jsx-no-comment-textnodes": ["error"],
250
+ "@eslint-react/no-unstable-context-value": ["error"],
251
+ "@eslint-react/no-leaked-conditional-rendering": ["warn"],
252
+ "@eslint-react/dom-no-script-url": ["error"],
253
+ "@eslint-react/dom-no-unsafe-target-blank": ["warn"],
254
+ "@eslint-react/jsx-no-useless-fragment": ["warn"],
255
+ "@eslint-react/no-access-state-in-setstate": ["error"],
256
+ "@eslint-react/no-array-index-key": ["error"],
257
+ "@eslint-react/jsx-no-children-prop": ["error"],
258
+ "@eslint-react/dom-no-dangerously-set-innerhtml": ["error"],
259
+ "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": ["error"],
260
+ "@eslint-react/dom-no-find-dom-node": ["error"],
261
+ "@eslint-react/jsx-no-namespace": ["error"],
262
+ "@eslint-react/no-unstable-default-props": ["error"],
263
+ "@eslint-react/dom-no-render-return-value": ["error"],
264
+ "@eslint-react/dom-no-unknown-property": ["warn"],
265
+ "@eslint-react/no-nested-component-definitions": ["error"],
266
+ "@eslint-react/no-unused-props": ["error"],
267
+ "@eslint-react/no-unused-state": ["error"],
268
+ "@eslint-react/no-set-state-in-component-will-update": ["error"],
269
+ "@eslint-react/dom-no-string-style-prop": ["error"],
270
+ "@eslint-react/dom-no-void-elements-with-children": ["error"]
271
+ };
272
+
273
+ // src/rules/react_kit.ts
274
+ import eslintReactKit from "@eslint-react/kit";
275
+ import { TSESTree } from "@typescript-eslint/types";
276
+ function jsxBooleanValue() {
277
+ return (context) => ({
278
+ JSXAttribute(node) {
279
+ if (node.value !== null) {
280
+ return;
281
+ }
282
+ context.report({
283
+ node,
284
+ message: "Set an explicit value for boolean attributes (e.g. `prop={true}`).",
285
+ fix: (fixer) => fixer.insertTextAfter(node.name, "={true}")
286
+ });
287
+ }
288
+ });
289
+ }
290
+ function jsxFragments(options = {}) {
291
+ const { mode = "syntax" } = options;
292
+ return (context) => {
293
+ function reportSyntaxPreferred(node, pattern) {
294
+ const hasAttributes = node.attributes.length > 0;
295
+ if (hasAttributes) {
296
+ return;
297
+ }
298
+ context.report({
299
+ node,
300
+ message: `Use shorthand fragment syntax '<>...</>' instead of '<${pattern}>...</${pattern}'.`,
301
+ fix(fixer) {
302
+ const closing = node.parent.closingElement;
303
+ if (closing === null) {
304
+ return null;
305
+ }
306
+ return [fixer.replaceText(node, "<>"), fixer.replaceText(closing, "</>")];
307
+ }
308
+ });
309
+ }
310
+ return {
311
+ JSXOpeningElement(node) {
312
+ const name = node.name;
313
+ if (name.type === TSESTree.AST_NODE_TYPES.JSXIdentifier && name.name === "Fragment") {
314
+ if (mode === "syntax") {
315
+ reportSyntaxPreferred(node, "Fragment");
316
+ }
317
+ return;
318
+ }
319
+ if (name.type !== TSESTree.AST_NODE_TYPES.JSXMemberExpression) {
320
+ return;
321
+ }
322
+ if (name.object.type !== TSESTree.AST_NODE_TYPES.JSXIdentifier || name.object.name !== "React" || name.property.name !== "Fragment") {
323
+ return;
324
+ }
325
+ if (mode === "syntax") {
326
+ reportSyntaxPreferred(node, "React.Fragment");
327
+ }
328
+ },
329
+ JSXFragment(node) {
330
+ if (mode === "element") {
331
+ context.report({
332
+ node,
333
+ message: "Use '<React.Fragment>...</React.Fragment>' instead of shorthand '<>...</>'.",
334
+ fix: (fixer) => [
335
+ fixer.replaceText(node.openingFragment, "<React.Fragment>"),
336
+ fixer.replaceText(node.closingFragment, "</React.Fragment>")
337
+ ]
338
+ });
339
+ }
340
+ }
341
+ };
342
+ };
343
+ }
344
+ function jsxNoDuplicateProps(options = {}) {
345
+ const { ignoreCase: isIgnoreCase = false } = options;
346
+ return (context) => ({
347
+ JSXOpeningElement(node) {
348
+ const seen = new Map;
349
+ for (const attr of node.attributes) {
350
+ if (attr.type !== TSESTree.AST_NODE_TYPES.JSXAttribute) {
351
+ continue;
352
+ }
353
+ if (attr.name.type !== TSESTree.AST_NODE_TYPES.JSXIdentifier) {
354
+ continue;
355
+ }
356
+ const name = isIgnoreCase ? attr.name.name.toLowerCase() : attr.name.name;
357
+ if (seen.has(name)) {
358
+ context.report({
359
+ node: attr,
360
+ message: `Duplicate prop "${attr.name.name}" found.`
361
+ });
362
+ } else {
363
+ seen.set(name, attr.name.name);
364
+ }
365
+ }
366
+ }
367
+ });
368
+ }
369
+ var reactKitConfig = eslintReactKit().use(jsxBooleanValue).use(jsxFragments, { mode: "element" }).use(jsxNoDuplicateProps).getConfig();
370
+ var react_kit_default = reactKitConfig;
371
+
372
+ // src/configs/react.ts
373
+ var react_default2 = [
374
+ ...base_default,
375
+ reactHooksConfigs.flat["recommended-latest"],
376
+ reactRefreshPlugin.configs.recommended,
377
+ {
378
+ files: ALL_FILES,
379
+ ...eslintReact.configs["recommended-typescript"],
380
+ rules: {
381
+ ...react_default
382
+ }
383
+ },
384
+ react_kit_default
385
+ ];
386
+
387
+ // src/configs/import.ts
388
+ import { flatConfigs as importXFlatConfigs } from "eslint-plugin-import-x";
389
+ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
390
+ import unusedImports from "eslint-plugin-unused-imports";
391
+
392
+ // src/rules/import.ts
393
+ var import_default = {
394
+ "import-x/no-deprecated": ["error"],
395
+ "import-x/no-empty-named-blocks": ["warn"],
396
+ "import-x/no-extraneous-dependencies": [
397
+ "error",
398
+ { devDependencies: false, optionalDependencies: false }
399
+ ],
400
+ "import-x/no-mutable-exports": ["error"],
401
+ "import-x/no-rename-default": ["off"],
402
+ "import-x/no-unused-modules": ["off", { missingExports: true }],
403
+ "import-x/no-amd": ["error"],
404
+ "import-x/no-commonjs": ["error"],
405
+ "import-x/no-import-module-exports": ["warn"],
406
+ "import-x/no-nodejs-modules": ["off"],
407
+ "import-x/unambiguous": ["error"],
408
+ "import-x/no-absolute-path": ["warn"],
409
+ "import-x/no-cycle": ["error"],
410
+ "import-x/no-dynamic-require": ["off"],
411
+ "import-x/no-internal-modules": ["off"],
412
+ "import-x/no-relative-packages": ["warn"],
413
+ "import-x/no-relative-parent-imports": ["off"],
414
+ "import-x/no-self-import": ["error"],
415
+ "import-x/no-useless-path-segments": [
416
+ "warn",
417
+ {
418
+ noUselessIndex: true
419
+ }
420
+ ],
421
+ "import-x/no-webpack-loader-syntax": ["error"],
422
+ "import-x/consistent-type-specifier-style": ["warn", "prefer-top-level"],
423
+ "import-x/dynamic-import-chunkname": ["off"],
424
+ "import-x/exports-last": ["off"],
425
+ "import-x/extensions": ["error", "never"],
426
+ "import-x/first": ["warn"],
427
+ "import-x/group-exports": ["off"],
428
+ "import-x/max-dependencies": ["off"],
429
+ "import-x/newline-after-import": ["warn"],
430
+ "import-x/no-anonymous-default-export": [
431
+ "error",
432
+ {
433
+ allowArray: false,
434
+ allowArrowFunction: true,
435
+ allowAnonymousClass: false,
436
+ allowAnonymousFunction: false,
437
+ allowCallExpression: true,
438
+ allowNew: false,
439
+ allowLiteral: false,
440
+ allowObject: false
441
+ }
442
+ ],
443
+ "import-x/no-default-export": ["off"],
444
+ "import-x/no-named-default": ["off"],
445
+ "import-x/no-named-export": ["off"],
446
+ "import-x/no-namespace": ["warn"],
447
+ "import-x/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
448
+ "import-x/order": ["warn"],
449
+ "import-x/prefer-default-export": ["off"]
450
+ };
451
+
452
+ // src/configs/import.ts
453
+ function importConfig(typescript) {
454
+ const resolverOptions = { alwaysTryTypes: true, bun: true };
455
+ if (typescript !== undefined) {
456
+ resolverOptions.project = typescript.project;
457
+ }
458
+ return [
459
+ importXFlatConfigs.recommended,
460
+ importXFlatConfigs.typescript,
461
+ {
462
+ files: ALL_FILES,
463
+ plugins: {
464
+ "unused-imports": unusedImports
465
+ },
466
+ settings: {
467
+ "import-x/resolver-next": [createTypeScriptImportResolver(resolverOptions)]
468
+ },
469
+ rules: {
470
+ ...import_default,
471
+ "unused-imports/no-unused-imports": ["error"]
472
+ }
473
+ }
474
+ ];
475
+ }
476
+
477
+ // src/configs/prettierFormatter.ts
478
+ import eslintConfigPrettier from "eslint-config-prettier";
479
+ var prettierFormatter_default = [eslintConfigPrettier];
480
+
481
+ // src/configs/stylisticFormatter.ts
482
+ import stylistic from "@stylistic/eslint-plugin";
483
+
484
+ // src/rules/stylistic.ts
485
+ var stylistic_default = {
486
+ "@stylistic/array-bracket-newline": ["warn"],
487
+ "@stylistic/array-bracket-spacing": ["warn"],
488
+ "@stylistic/array-element-newline": ["warn", "consistent"],
489
+ "@stylistic/arrow-parens": ["warn", "always"],
490
+ "@stylistic/arrow-spacing": ["warn"],
491
+ "@stylistic/block-spacing": ["warn"],
492
+ "@stylistic/brace-style": ["warn", "1tbs"],
493
+ "@stylistic/comma-dangle": ["warn"],
494
+ "@stylistic/comma-spacing": ["warn"],
495
+ "@stylistic/comma-style": ["warn"],
496
+ "@stylistic/computed-property-spacing": ["warn"],
497
+ "@stylistic/curly-newline": ["warn", "always"],
498
+ "@stylistic/dot-location": ["warn", "property"],
499
+ "@stylistic/eol-last": ["warn"],
500
+ "@stylistic/function-call-spacing": ["warn"],
501
+ "@stylistic/function-call-argument-newline": ["warn", "consistent"],
502
+ "@stylistic/function-paren-newline": ["warn", "consistent"],
503
+ "@stylistic/generator-star-spacing": ["warn"],
504
+ "@stylistic/implicit-arrow-linebreak": ["warn"],
505
+ "@stylistic/indent": ["warn", 2],
506
+ "@stylistic/indent-binary-ops": ["warn", 2],
507
+ "@stylistic/jsx-child-element-spacing": ["error"],
508
+ "@stylistic/jsx-closing-bracket-location": ["warn"],
509
+ "@stylistic/jsx-closing-tag-location": ["warn"],
510
+ "@stylistic/jsx-curly-brace-presence": ["warn"],
511
+ "@stylistic/jsx-curly-newline": ["warn"],
512
+ "@stylistic/jsx-curly-spacing": ["warn"],
513
+ "@stylistic/jsx-equals-spacing": ["warn"],
514
+ "@stylistic/jsx-first-prop-new-line": ["warn"],
515
+ "@stylistic/jsx-function-call-newline": ["warn"],
516
+ "@stylistic/jsx-indent-props": ["warn", 2],
517
+ "@stylistic/jsx/jsx-max-props-per-line": ["off"],
518
+ "@stylistic/jsx-newline": ["off"],
519
+ "@stylistic/jsx-one-expression-per-line": ["warn", { allow: "single-child" }],
520
+ "@stylistic/jsx-pascal-case": ["error"],
521
+ "@stylistic/jsx-quotes": ["warn"],
522
+ "@stylistic/jsx-self-closing-comp": ["warn"],
523
+ "@stylistic/jsx-sort-props": [
524
+ "warn",
525
+ {
526
+ callbacksLast: true,
527
+ shorthandFirst: true,
528
+ multiline: "last",
529
+ noSortAlphabetically: true
530
+ }
531
+ ],
532
+ "@stylistic/jsx-tag-spacing": [
533
+ "warn",
534
+ {
535
+ closingSlash: "never",
536
+ beforeSelfClosing: "always",
537
+ afterOpening: "never",
538
+ beforeClosing: "never"
539
+ }
540
+ ],
541
+ "@stylistic/jsx-wrap-multilines": [
542
+ "warn",
543
+ {
544
+ declaration: "parens-new-line",
545
+ assignment: "parens-new-line",
546
+ return: "parens-new-line",
547
+ arrow: "parens-new-line",
548
+ condition: "parens-new-line",
549
+ logical: "parens-new-line",
550
+ prop: "parens-new-line"
551
+ }
552
+ ],
553
+ "@stylistic/key-spacing": "warn",
554
+ "@stylistic/keyword-spacing": "warn",
555
+ "@stylistic/line-comment-position": "warn",
556
+ "@stylistic/linebreak-style": "warn",
557
+ "@stylistic/lines-around-comment": [
558
+ "warn",
559
+ {
560
+ beforeBlockComment: true,
561
+ afterBlockComment: false,
562
+ beforeLineComment: true,
563
+ afterLineComment: false,
564
+ allowBlockStart: true,
565
+ allowBlockEnd: true,
566
+ allowObjectStart: true,
567
+ allowObjectEnd: true,
568
+ allowArrayStart: true,
569
+ allowArrayEnd: true,
570
+ allowClassStart: true,
571
+ allowClassEnd: true,
572
+ afterHashbangComment: true
573
+ }
574
+ ],
575
+ "@stylistic/lines-between-class-members": [
576
+ "warn",
577
+ {
578
+ enforce: [
579
+ {
580
+ blankLine: "always",
581
+ prev: "*",
582
+ next: "method"
583
+ },
584
+ {
585
+ blankLine: "always",
586
+ prev: "method",
587
+ next: "*"
588
+ }
589
+ ]
590
+ }
591
+ ],
592
+ "@stylistic/max-len": [
593
+ "error",
594
+ {
595
+ code: 120,
596
+ tabWidth: 2,
597
+ comments: 120,
598
+ ignoreComments: true,
599
+ ignoreTrailingComments: true,
600
+ ignoreUrls: true,
601
+ ignoreStrings: true,
602
+ ignoreTemplateLiterals: true,
603
+ ignoreRegExpLiterals: true
604
+ }
605
+ ],
606
+ "@stylistic/max-statements-per-line": ["error"],
607
+ "@stylistic/member-delimiter-style": ["warn"],
608
+ "@stylistic/multiline-comment-style": ["off"],
609
+ "@stylistic/multiline-ternary": ["warn", "always-multiline"],
610
+ "@stylistic/new-parens": ["warn"],
611
+ "@stylistic/newline-per-chained-call": ["warn"],
612
+ "@stylistic/no-confusing-arrow": ["warn"],
613
+ "@stylistic/no-extra-parens": ["warn"],
614
+ "@stylistic/no-extra-semi": ["warn"],
615
+ "@stylistic/no-floating-decimal": ["warn"],
616
+ "@stylistic/no-mixed-operators": ["error"],
617
+ "@stylistic/no-mixed-spaces-and-tabs": ["error"],
618
+ "@stylistic/no-multi-spaces": ["warn"],
619
+ "@stylistic/no-multiple-empty-lines": ["warn"],
620
+ "@stylistic/no-tabs": ["error"],
621
+ "@stylistic/no-trailing-spaces": ["warn"],
622
+ "@stylistic/no-whitespace-before-property": ["warn"],
623
+ "@stylistic/nonblock-statement-body-position": ["warn"],
624
+ "@stylistic/object-curly-newline": [
625
+ "warn",
626
+ {
627
+ consistent: true
628
+ }
629
+ ],
630
+ "@stylistic/object-curly-spacing": ["warn"],
631
+ "@stylistic/object-property-newline": [
632
+ "warn",
633
+ {
634
+ allowAllPropertiesOnSameLine: true
635
+ }
636
+ ],
637
+ "@stylistic/one-var-declaration-per-line": ["warn"],
638
+ "@stylistic/operator-linebreak": ["warn"],
639
+ "@stylistic/padded-blocks": ["warn", "never"],
640
+ "@stylistic/padding-line-between-statements": [
641
+ "warn",
642
+ {
643
+ blankLine: "always",
644
+ prev: "*",
645
+ next: "return"
646
+ },
647
+ {
648
+ blankLine: "always",
649
+ prev: "*",
650
+ next: "block-like"
651
+ },
652
+ {
653
+ blankLine: "always",
654
+ prev: "block-like",
655
+ next: "*"
656
+ },
657
+ {
658
+ blankLine: "always",
659
+ prev: "case",
660
+ next: "case"
661
+ },
662
+ {
663
+ blankLine: "never",
664
+ prev: "*",
665
+ next: "break"
666
+ },
667
+ {
668
+ blankLine: "always",
669
+ prev: "*",
670
+ next: "export"
671
+ },
672
+ {
673
+ blankLine: "always",
674
+ prev: "*",
675
+ next: "interface"
676
+ },
677
+ {
678
+ blankLine: "always",
679
+ prev: "interface",
680
+ next: "*"
681
+ },
682
+ {
683
+ blankLine: "always",
684
+ prev: "*",
685
+ next: "class"
686
+ },
687
+ {
688
+ blankLine: "always",
689
+ prev: "class",
690
+ next: "*"
691
+ }
692
+ ],
693
+ "@stylistic/quote-props": ["warn", "as-needed"],
694
+ "@stylistic/quotes": ["warn"],
695
+ "@stylistic/rest-spread-spacing": ["warn"],
696
+ "@stylistic/semi": ["warn"],
697
+ "@stylistic/semi-spacing": ["warn"],
698
+ "@stylistic/semi-style": ["warn"],
699
+ "@stylistic/space-before-blocks": ["warn"],
700
+ "@stylistic/space-before-function-paren": [
701
+ "warn",
702
+ {
703
+ anonymous: "always",
704
+ named: "never",
705
+ asyncArrow: "always"
706
+ }
707
+ ],
708
+ "@stylistic/space-in-parens": ["warn"],
709
+ "@stylistic/space-infix-ops": ["warn"],
710
+ "@stylistic/space-unary-ops": ["warn"],
711
+ "@stylistic/spaced-comment": ["warn"],
712
+ "@stylistic/switch-colon-spacing": ["warn"],
713
+ "@stylistic/template-curly-spacing": ["warn"],
714
+ "@stylistic/template-tag-spacing": ["warn"],
715
+ "@stylistic/type-annotation-spacing": ["warn"],
716
+ "@stylistic/type-generic-spacing": ["warn"],
717
+ "@stylistic/type-named-tuple-spacing": ["warn"],
718
+ "@stylistic/wrap-iife": ["warn", "inside"],
719
+ "@stylistic/wrap-regex": ["warn"],
720
+ "@stylistic/yield-star-spacing": ["warn", "after"]
721
+ };
722
+
723
+ // src/configs/stylisticFormatter.ts
724
+ var stylisticFormatter_default = [
725
+ stylistic.configs.customize({
726
+ jsx: true,
727
+ arrowParens: true,
728
+ blockSpacing: true,
729
+ braceStyle: "stroustrup",
730
+ commaDangle: "never",
731
+ indent: 2,
732
+ semi: true,
733
+ quotes: "double",
734
+ quoteProps: "always"
735
+ }),
736
+ {
737
+ files: ALL_FILES,
738
+ languageOptions: {
739
+ parserOptions: {
740
+ ecmaFeatures: {
741
+ jsx: true
742
+ }
743
+ }
744
+ },
745
+ rules: stylistic_default
746
+ }
747
+ ];
748
+
749
+ // src/index.ts
750
+ function node(typescript) {
751
+ return {
752
+ globals: globals.node,
753
+ parserOptions: {
754
+ ecmaVersion: "latest",
755
+ tsconfigRootDir: typescript?.tsconfigRootDir,
756
+ project: typescript?.project
757
+ }
758
+ };
759
+ }
760
+ function react(typescript) {
761
+ return {
762
+ globals: {
763
+ ...globals.serviceworker,
764
+ ...globals.browser
765
+ },
766
+ parserOptions: {
767
+ ecmaFeatures: { jsx: true },
768
+ tsconfigRootDir: typescript?.tsconfigRootDir,
769
+ project: typescript?.project
770
+ }
771
+ };
772
+ }
773
+ function createConfig(opt) {
774
+ let config;
775
+ if (opt.platform === "node") {
776
+ config = [
777
+ ...base_default,
778
+ {
779
+ files: ALL_FILES,
780
+ languageOptions: node(opt.typescript)
781
+ }
782
+ ];
783
+ } else {
784
+ config = [
785
+ ...react_default2,
786
+ {
787
+ files: ALL_FILES,
788
+ languageOptions: react(opt.typescript)
789
+ }
790
+ ];
791
+ }
792
+ if (opt.useImport === true) {
793
+ config.push(...importConfig(opt.typescript));
794
+ }
795
+ config.push(...opt.style === "stylistic" ? stylisticFormatter_default : prettierFormatter_default);
796
+ if (opt.overrides !== undefined) {
797
+ config.push(...opt.overrides);
798
+ }
799
+ if (opt.ignores !== undefined) {
800
+ config.push({ ignores: opt.ignores });
801
+ }
802
+ if (opt.files !== undefined && opt.files.length > 0) {
803
+ return defineConfig({ files: opt.files, extends: config });
804
+ }
805
+ return config;
806
+ }
807
+ export {
808
+ createConfig
809
+ };
810
+
811
+ //# debugId=C40081A34E0D82FD64756E2164756E21
812
+ //# sourceMappingURL=index.js.map