@nelsonlaidev/oxlint-config 0.4.0 → 1.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.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { mergeWith, pick } from "es-toolkit/object";
2
- import { isPackageExists } from "local-pkg";
1
+ import { merge } from "ts-deepmerge";
3
2
  //#region src/globs.ts
4
3
  const GLOB_SRC_EXT = "{js,jsx,ts,tsx,cjs,cts,mjs,mts}";
5
4
  const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
@@ -9,17 +8,17 @@ const GLOB_TS = "**/*.{ts,cts,mts}";
9
8
  const GLOB_TSX = "**/*.{tsx,ctsx,mtsx}";
10
9
  //#endregion
11
10
  //#region src/configs/command.ts
12
- const command = () => [{
11
+ const command = () => ({
13
12
  files: [GLOB_SRC],
14
13
  jsPlugins: [{
15
14
  name: "command",
16
15
  specifier: "eslint-plugin-command"
17
16
  }],
18
17
  rules: { "command/command": "error" }
19
- }];
18
+ });
20
19
  //#endregion
21
20
  //#region src/configs/de-morgan.ts
22
- const deMorgan = () => [{
21
+ const deMorgan = () => ({
23
22
  files: [GLOB_SRC],
24
23
  jsPlugins: [{
25
24
  name: "de-morgan",
@@ -29,10 +28,10 @@ const deMorgan = () => [{
29
28
  "de-morgan/no-negated-conjunction": "error",
30
29
  "de-morgan/no-negated-disjunction": "error"
31
30
  }
32
- }];
31
+ });
33
32
  //#endregion
34
33
  //#region src/configs/eslint.ts
35
- const eslint = () => [{
34
+ const eslint = () => ({
36
35
  files: [GLOB_SRC],
37
36
  plugins: ["eslint"],
38
37
  rules: {
@@ -130,10 +129,10 @@ const eslint = () => [{
130
129
  "eslint/use-isnan": "error",
131
130
  "eslint/valid-typeof": "error"
132
131
  }
133
- }];
132
+ });
134
133
  //#endregion
135
134
  //#region src/configs/import-sort.ts
136
- const importSort = () => [{
135
+ const importSort = () => ({
137
136
  files: [GLOB_SRC],
138
137
  jsPlugins: [{
139
138
  name: "import-sort",
@@ -160,10 +159,10 @@ const importSort = () => [{
160
159
  ["^\\.\\.", "^\\."]
161
160
  ] }]
162
161
  }
163
- }];
162
+ });
164
163
  //#endregion
165
164
  //#region src/configs/imports.ts
166
- const imports = () => [{
165
+ const imports = () => ({
167
166
  files: [GLOB_SRC],
168
167
  plugins: ["import"],
169
168
  rules: {
@@ -188,20 +187,20 @@ const imports = () => [{
188
187
  "import/no-self-import": "error",
189
188
  "import/no-webpack-loader-syntax": "error"
190
189
  }
191
- }];
190
+ });
192
191
  //#endregion
193
192
  //#region src/configs/jsdoc.ts
194
- const jsdoc = () => [{
193
+ const jsdoc = () => ({
195
194
  files: [GLOB_SRC],
196
195
  plugins: ["jsdoc"],
197
196
  rules: {
198
197
  "jsdoc/check-tag-names": "error",
199
198
  "jsdoc/empty-tags": "error"
200
199
  }
201
- }];
200
+ });
202
201
  //#endregion
203
202
  //#region src/configs/jsx-a11y.ts
204
- const jsxA11y = () => [{
203
+ const jsxA11y = () => ({
205
204
  files: [GLOB_SRC],
206
205
  plugins: ["jsx-a11y"],
207
206
  rules: {
@@ -351,10 +350,10 @@ const jsxA11y = () => [{
351
350
  "jsx-a11y/scope": "error",
352
351
  "jsx-a11y/tabindex-no-positive": "error"
353
352
  }
354
- }];
353
+ });
355
354
  //#endregion
356
355
  //#region src/configs/nelsonlaidev.ts
357
- const nelsonlaidev = () => [{
356
+ const nelsonlaidev = () => ({
358
357
  files: [GLOB_SRC],
359
358
  jsPlugins: [{
360
359
  name: "nelsonlaidev",
@@ -367,49 +366,20 @@ const nelsonlaidev = () => [{
367
366
  "nelsonlaidev/shadcn-cva-variants-suffix": "error",
368
367
  "nelsonlaidev/shadcn-prefer-spinner": "error"
369
368
  }
370
- }];
371
- //#endregion
372
- //#region src/configs/nextjs.ts
373
- const nextjs = () => [{
374
- files: [GLOB_SRC],
375
- plugins: ["nextjs"],
376
- rules: {
377
- "nextjs/google-font-display": "error",
378
- "nextjs/google-font-preconnect": "error",
379
- "nextjs/inline-script-id": "error",
380
- "nextjs/next-script-for-ga": "error",
381
- "nextjs/no-assign-module-variable": "error",
382
- "nextjs/no-async-client-component": "error",
383
- "nextjs/no-before-interactive-script-outside-document": "error",
384
- "nextjs/no-css-tags": "error",
385
- "nextjs/no-document-import-in-page": "error",
386
- "nextjs/no-duplicate-head": "error",
387
- "nextjs/no-head-element": "error",
388
- "nextjs/no-head-import-in-document": "error",
389
- "nextjs/no-html-link-for-pages": "error",
390
- "nextjs/no-img-element": "error",
391
- "nextjs/no-page-custom-font": "error",
392
- "nextjs/no-script-component-in-head": "error",
393
- "nextjs/no-styled-jsx-in-document": "error",
394
- "nextjs/no-sync-scripts": "error",
395
- "nextjs/no-title-in-document-head": "error",
396
- "nextjs/no-typos": "error",
397
- "nextjs/no-unwanted-polyfillio": "error"
398
- }
399
- }];
369
+ });
400
370
  //#endregion
401
371
  //#region src/configs/node.ts
402
- const node = () => [{
372
+ const node = () => ({
403
373
  files: [GLOB_SRC],
404
374
  plugins: ["node"],
405
375
  rules: {
406
376
  "node/no-exports-assign": "error",
407
377
  "node/no-path-concat": "error"
408
378
  }
409
- }];
379
+ });
410
380
  //#endregion
411
381
  //#region src/configs/oxc.ts
412
- const oxc = () => [{
382
+ const oxc = () => ({
413
383
  files: [GLOB_SRC],
414
384
  plugins: ["oxc"],
415
385
  rules: {
@@ -435,60 +405,10 @@ const oxc = () => [{
435
405
  "oxc/only-used-in-recursion": "error",
436
406
  "oxc/uninvoked-array-callback": "error"
437
407
  }
438
- }];
439
- //#endregion
440
- //#region src/configs/playwright.ts
441
- const playwright = (config) => [{
442
- files: config.files,
443
- jsPlugins: [{
444
- name: "playwright",
445
- specifier: "eslint-plugin-playwright"
446
- }],
447
- rules: {
448
- "eslint/no-empty-pattern": "off",
449
- "playwright/consistent-spacing-between-blocks": "error",
450
- "playwright/expect-expect": ["error", {
451
- assertFunctionNames: config.assertFunctionNames ?? [],
452
- assertFunctionPatterns: config.assertFunctionPatterns ?? []
453
- }],
454
- "playwright/max-nested-describe": "error",
455
- "playwright/missing-playwright-await": "error",
456
- "playwright/no-conditional-expect": "error",
457
- "playwright/no-conditional-in-test": "error",
458
- "playwright/no-duplicate-hooks": "error",
459
- "playwright/no-duplicate-slow": "error",
460
- "playwright/no-element-handle": "error",
461
- "playwright/no-eval": "error",
462
- "playwright/no-focused-test": "error",
463
- "playwright/no-force-option": "error",
464
- "playwright/no-nested-step": "error",
465
- "playwright/no-networkidle": "error",
466
- "playwright/no-page-pause": "error",
467
- "playwright/no-skipped-test": "error",
468
- "playwright/no-standalone-expect": "error",
469
- "playwright/no-unsafe-references": "error",
470
- "playwright/no-unused-locators": "error",
471
- "playwright/no-useless-await": "error",
472
- "playwright/no-useless-not": "error",
473
- "playwright/no-wait-for-navigation": "error",
474
- "playwright/no-wait-for-selector": "error",
475
- "playwright/no-wait-for-timeout": "error",
476
- "playwright/prefer-hooks-in-order": "error",
477
- "playwright/prefer-hooks-on-top": "error",
478
- "playwright/prefer-locator": "error",
479
- "playwright/prefer-to-have-count": "error",
480
- "playwright/prefer-to-have-length": "error",
481
- "playwright/prefer-web-first-assertions": "error",
482
- "playwright/valid-describe-callback": "error",
483
- "playwright/valid-expect": "error",
484
- "playwright/valid-expect-in-promise": "error",
485
- "playwright/valid-test-tags": "error",
486
- "playwright/valid-title": "error"
487
- }
488
- }];
408
+ });
489
409
  //#endregion
490
410
  //#region src/configs/promise.ts
491
- const promise = () => [{
411
+ const promise = () => ({
492
412
  files: [GLOB_SRC],
493
413
  plugins: ["promise"],
494
414
  rules: {
@@ -509,123 +429,10 @@ const promise = () => [{
509
429
  "promise/spec-only": "error",
510
430
  "promise/valid-params": "error"
511
431
  }
512
- }];
513
- //#endregion
514
- //#region src/configs/react.ts
515
- const react = () => [{
516
- files: [GLOB_SRC],
517
- jsPlugins: [{
518
- name: "@eslint-react",
519
- specifier: "@eslint-react/eslint-plugin"
520
- }, {
521
- name: "react-hooks-js",
522
- specifier: "eslint-plugin-react-hooks"
523
- }],
524
- rules: {
525
- "@eslint-react/dom-no-dangerously-set-innerhtml": "error",
526
- "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": "error",
527
- "@eslint-react/dom-no-find-dom-node": "error",
528
- "@eslint-react/dom-no-flush-sync": "error",
529
- "@eslint-react/dom-no-hydrate": "error",
530
- "@eslint-react/dom-no-missing-button-type": "error",
531
- "@eslint-react/dom-no-missing-iframe-sandbox": "error",
532
- "@eslint-react/dom-no-render": "error",
533
- "@eslint-react/dom-no-render-return-value": "error",
534
- "@eslint-react/dom-no-script-url": "error",
535
- "@eslint-react/dom-no-string-style-prop": "error",
536
- "@eslint-react/dom-no-unknown-property": "error",
537
- "@eslint-react/dom-no-unsafe-iframe-sandbox": "error",
538
- "@eslint-react/dom-no-unsafe-target-blank": "error",
539
- "@eslint-react/dom-no-use-form-state": "error",
540
- "@eslint-react/dom-no-void-elements-with-children": "error",
541
- "@eslint-react/error-boundaries": "error",
542
- "@eslint-react/exhaustive-deps": "error",
543
- "@eslint-react/globals": "error",
544
- "@eslint-react/immutability": "error",
545
- "@eslint-react/jsx-no-children-prop": "error",
546
- "@eslint-react/jsx-no-children-prop-with-children": "error",
547
- "@eslint-react/jsx-no-comment-textnodes": "error",
548
- "@eslint-react/jsx-no-key-after-spread": "error",
549
- "@eslint-react/jsx-no-leaked-dollar": "error",
550
- "@eslint-react/jsx-no-leaked-semicolon": "error",
551
- "@eslint-react/jsx-no-namespace": "error",
552
- "@eslint-react/jsx-no-useless-fragment": "error",
553
- "@eslint-react/naming-convention-context-name": "error",
554
- "@eslint-react/naming-convention-id-name": "error",
555
- "@eslint-react/naming-convention-ref-name": "error",
556
- "@eslint-react/no-access-state-in-setstate": "error",
557
- "@eslint-react/no-array-index-key": "error",
558
- "@eslint-react/no-children-count": "error",
559
- "@eslint-react/no-children-for-each": "error",
560
- "@eslint-react/no-children-map": "error",
561
- "@eslint-react/no-children-only": "error",
562
- "@eslint-react/no-children-to-array": "error",
563
- "@eslint-react/no-class-component": "error",
564
- "@eslint-react/no-clone-element": "error",
565
- "@eslint-react/no-component-will-mount": "error",
566
- "@eslint-react/no-component-will-receive-props": "error",
567
- "@eslint-react/no-component-will-update": "error",
568
- "@eslint-react/no-context-provider": "error",
569
- "@eslint-react/no-create-ref": "error",
570
- "@eslint-react/no-direct-mutation-state": "error",
571
- "@eslint-react/no-duplicate-key": "error",
572
- "@eslint-react/no-forward-ref": "error",
573
- "@eslint-react/no-missing-component-display-name": "error",
574
- "@eslint-react/no-missing-context-display-name": "error",
575
- "@eslint-react/no-missing-key": "error",
576
- "@eslint-react/no-misused-capture-owner-stack": "error",
577
- "@eslint-react/no-nested-component-definitions": "error",
578
- "@eslint-react/no-nested-lazy-component-declarations": "error",
579
- "@eslint-react/no-set-state-in-component-did-mount": "error",
580
- "@eslint-react/no-set-state-in-component-did-update": "error",
581
- "@eslint-react/no-set-state-in-component-will-update": "error",
582
- "@eslint-react/no-unnecessary-use-prefix": "error",
583
- "@eslint-react/no-unsafe-component-will-mount": "error",
584
- "@eslint-react/no-unsafe-component-will-receive-props": "error",
585
- "@eslint-react/no-unsafe-component-will-update": "error",
586
- "@eslint-react/no-unstable-context-value": "error",
587
- "@eslint-react/no-unstable-default-props": "error",
588
- "@eslint-react/no-unused-class-component-members": "error",
589
- "@eslint-react/no-unused-state": "error",
590
- "@eslint-react/no-use-context": "error",
591
- "@eslint-react/purity": "error",
592
- "@eslint-react/refs": "error",
593
- "@eslint-react/rsc-function-definition": "error",
594
- "@eslint-react/rules-of-hooks": "error",
595
- "@eslint-react/set-state-in-effect": "error",
596
- "@eslint-react/set-state-in-render": "error",
597
- "@eslint-react/static-components": "off",
598
- "@eslint-react/unsupported-syntax": "error",
599
- "@eslint-react/use-memo": "error",
600
- "@eslint-react/use-state": "error",
601
- "@eslint-react/web-api-no-leaked-event-listener": "error",
602
- "@eslint-react/web-api-no-leaked-fetch": "error",
603
- "@eslint-react/web-api-no-leaked-intersection-observer": "error",
604
- "@eslint-react/web-api-no-leaked-interval": "error",
605
- "@eslint-react/web-api-no-leaked-resize-observer": "error",
606
- "@eslint-react/web-api-no-leaked-timeout": "error",
607
- "react-hooks-js/config": "error",
608
- "react-hooks-js/error-boundaries": "off",
609
- "react-hooks-js/exhaustive-deps": "off",
610
- "react-hooks-js/gating": "error",
611
- "react-hooks-js/globals": "off",
612
- "react-hooks-js/immutability": "off",
613
- "react-hooks-js/incompatible-library": "error",
614
- "react-hooks-js/preserve-manual-memoization": "error",
615
- "react-hooks-js/purity": "off",
616
- "react-hooks-js/refs": "off",
617
- "react-hooks-js/rules-of-hooks": "off",
618
- "react-hooks-js/set-state-in-effect": "off",
619
- "react-hooks-js/set-state-in-render": "off",
620
- "react-hooks-js/static-components": "off",
621
- "react-hooks-js/unsupported-syntax": "off",
622
- "react-hooks-js/use-memo": "off",
623
- "react-hooks-js/void-use-memo": "error"
624
- }
625
- }];
432
+ });
626
433
  //#endregion
627
434
  //#region src/configs/regexp.ts
628
- const regexp = () => [{
435
+ const regexp = () => ({
629
436
  files: [GLOB_SRC],
630
437
  jsPlugins: [{
631
438
  name: "regexp",
@@ -700,10 +507,10 @@ const regexp = () => [{
700
507
  "regexp/strict": "error",
701
508
  "regexp/use-ignore-case": "error"
702
509
  }
703
- }];
510
+ });
704
511
  //#endregion
705
512
  //#region src/configs/sonarjs.ts
706
- const sonarjs = () => [{
513
+ const sonarjs = () => ({
707
514
  files: [GLOB_SRC],
708
515
  jsPlugins: [{
709
516
  name: "sonarjs",
@@ -979,52 +786,20 @@ const sonarjs = () => [{
979
786
  "sonarjs/x-powered-by": "error",
980
787
  "sonarjs/xml-parser-xxe": "error"
981
788
  }
982
- }];
789
+ });
983
790
  //#endregion
984
791
  //#region src/configs/stylistic.ts
985
- const stylistic = () => [{
792
+ const stylistic = () => ({
986
793
  files: [GLOB_SRC],
987
794
  jsPlugins: [{
988
795
  name: "@stylistic",
989
796
  specifier: "@stylistic/eslint-plugin"
990
797
  }],
991
798
  rules: { "@stylistic/multiline-comment-style": ["error", "separate-lines"] }
992
- }];
993
- //#endregion
994
- //#region src/configs/tailwindcss.ts
995
- const tailwindcss = (options) => [{
996
- files: [GLOB_SRC],
997
- jsPlugins: [{
998
- name: "better-tailwindcss",
999
- specifier: "eslint-plugin-better-tailwindcss"
1000
- }],
1001
- rules: {
1002
- "better-tailwindcss/enforce-canonical-classes": ["error", {
1003
- collapse: options.canonical?.collapse ?? true,
1004
- logical: options.canonical?.logical ?? true
1005
- }],
1006
- "better-tailwindcss/enforce-consistent-class-order": ["error", {
1007
- order: options.classOrder?.order ?? "official",
1008
- componentClassOrder: options.classOrder?.componentOrder ?? "preserve",
1009
- componentClassPosition: options.classOrder?.componentPosition ?? "start",
1010
- unknownClassOrder: options.classOrder?.unknownOrder ?? "preserve",
1011
- unknownClassPosition: options.classOrder?.unknownPosition ?? "start"
1012
- }],
1013
- "better-tailwindcss/enforce-consistent-important-position": "off",
1014
- "better-tailwindcss/enforce-consistent-variable-syntax": "off",
1015
- "better-tailwindcss/enforce-consistent-variant-order": "error",
1016
- "better-tailwindcss/enforce-shorthand-classes": options.canonical?.logical ?? true ? "off" : "error",
1017
- "better-tailwindcss/no-conflicting-classes": "error",
1018
- "better-tailwindcss/no-deprecated-classes": "error",
1019
- "better-tailwindcss/no-duplicate-classes": "error",
1020
- "better-tailwindcss/no-restricted-classes": ["error", { restrict: options.restrict ?? [] }],
1021
- "better-tailwindcss/no-unknown-classes": ["error", { ignore: options.ignore ?? [] }],
1022
- "better-tailwindcss/no-unnecessary-whitespace": ["error", { allowMultiline: options.whitespace?.allowMultiline ?? true }]
1023
- }
1024
- }];
799
+ });
1025
800
  //#endregion
1026
801
  //#region src/configs/typescript.ts
1027
- const typescript = () => [{
802
+ const typescript = () => ({
1028
803
  files: [GLOB_SRC],
1029
804
  plugins: ["typescript", "eslint"],
1030
805
  rules: {
@@ -1162,17 +937,18 @@ const typescript = () => [{
1162
937
  "typescript/unified-signatures": "error",
1163
938
  "typescript/use-unknown-in-catch-callback-variable": "error"
1164
939
  }
1165
- }, {
940
+ });
941
+ const typescriptDeclarations = () => ({
1166
942
  files: ["**/*.d.ts"],
1167
943
  plugins: ["typescript"],
1168
944
  rules: {
1169
945
  "typescript/consistent-indexed-object-style": "off",
1170
946
  "typescript/consistent-type-definitions": "off"
1171
947
  }
1172
- }];
948
+ });
1173
949
  //#endregion
1174
950
  //#region src/configs/unicorn.ts
1175
- const unicorn = () => [{
951
+ const unicorn = () => ({
1176
952
  files: [GLOB_SRC],
1177
953
  plugins: ["unicorn", "eslint"],
1178
954
  rules: {
@@ -1311,76 +1087,21 @@ const unicorn = () => [{
1311
1087
  "unicorn/text-encoding-identifier-case": ["error", { withDash: true }],
1312
1088
  "unicorn/throw-new-error": "error"
1313
1089
  }
1314
- }];
1315
- //#endregion
1316
- //#region src/configs/vitest.ts
1317
- const vitest = (config) => [{
1318
- files: config.files,
1319
- plugins: ["vitest"],
1320
- rules: {
1321
- "vitest/consistent-test-it": ["error", { fn: "test" }],
1322
- "vitest/expect-expect": "error",
1323
- "vitest/no-commented-out-tests": "error",
1324
- "vitest/no-conditional-expect": "error",
1325
- "vitest/no-disabled-tests": "error",
1326
- "vitest/no-focused-tests": "error",
1327
- "vitest/no-identical-title": "error",
1328
- "vitest/no-import-node-test": "error",
1329
- "vitest/no-interpolation-in-snapshots": "error",
1330
- "vitest/no-mocks-import": "error",
1331
- "vitest/no-standalone-expect": "error",
1332
- "vitest/no-unneeded-async-expect-function": "error",
1333
- "vitest/prefer-called-exactly-once-with": "error",
1334
- "vitest/prefer-mock-return-shorthand": "error",
1335
- "vitest/require-local-test-context-for-concurrent-snapshots": "error",
1336
- "vitest/valid-describe-callback": "error",
1337
- "vitest/valid-expect": "error",
1338
- "vitest/valid-expect-in-promise": "error",
1339
- "vitest/valid-title": "error",
1340
- "vitest/warn-todo": "error"
1341
- }
1342
- }];
1090
+ });
1343
1091
  //#endregion
1344
1092
  //#region src/configs/zod.ts
1345
- const zod = () => [{
1093
+ const zod = () => ({
1346
1094
  files: [GLOB_SRC],
1347
1095
  jsPlugins: [{
1348
1096
  name: "import-zod",
1349
1097
  specifier: "eslint-plugin-import-zod"
1350
1098
  }],
1351
1099
  rules: { "import-zod/prefer-zod-namespace": "error" }
1352
- }];
1100
+ });
1353
1101
  //#endregion
1354
1102
  //#region src/base.ts
1355
- const concatArrays = (target, source) => {
1356
- if (Array.isArray(target) && Array.isArray(source)) return [...target, ...source];
1357
- };
1358
- const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1359
- const overrides = [
1360
- ...oxc(),
1361
- ...eslint(),
1362
- ...command(),
1363
- ...typescript(),
1364
- ...unicorn(),
1365
- ...promise(),
1366
- ...node(),
1367
- ...jsxA11y(),
1368
- ...imports(),
1369
- ...jsdoc(),
1370
- ...nelsonlaidev(),
1371
- ...stylistic(),
1372
- ...deMorgan(),
1373
- ...zod(),
1374
- ...regexp(),
1375
- ...sonarjs(),
1376
- ...importSort()
1377
- ];
1378
- if (userConfig.react ?? isPackageExists("react")) overrides.push(...react());
1379
- if (userConfig.nextjs ?? isPackageExists("next")) overrides.push(...nextjs());
1380
- if (userConfig.vitest) overrides.push(...vitest(userConfig.vitest));
1381
- if (userConfig.playwright) overrides.push(...playwright(userConfig.playwright));
1382
- if (userConfig.tailwindcss) overrides.push(...tailwindcss(userConfig.tailwindcss));
1383
- return mergeWith({
1103
+ const defineConfig = (config = {}) => {
1104
+ return merge({
1384
1105
  options: {
1385
1106
  typeAware: true,
1386
1107
  maxWarnings: 0,
@@ -1393,7 +1114,26 @@ const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1393
1114
  es2022: true
1394
1115
  },
1395
1116
  ignorePatterns: ["**/routeTree.gen.ts"],
1396
- overrides,
1117
+ overrides: [
1118
+ oxc(),
1119
+ eslint(),
1120
+ command(),
1121
+ typescript(),
1122
+ typescriptDeclarations(),
1123
+ unicorn(),
1124
+ promise(),
1125
+ node(),
1126
+ jsxA11y(),
1127
+ imports(),
1128
+ jsdoc(),
1129
+ nelsonlaidev(),
1130
+ stylistic(),
1131
+ deMorgan(),
1132
+ zod(),
1133
+ regexp(),
1134
+ sonarjs(),
1135
+ importSort()
1136
+ ],
1397
1137
  settings: {
1398
1138
  "jsx-a11y": { components: {
1399
1139
  Button: "button",
@@ -1402,29 +1142,280 @@ const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1402
1142
  Textarea: "textarea",
1403
1143
  Link: "a"
1404
1144
  } },
1405
- ...userConfig.tailwindcss && { "better-tailwindcss": {
1145
+ "better-tailwindcss": {
1406
1146
  detectComponentClasses: false,
1407
1147
  rootFontSize: 16
1408
- } }
1148
+ }
1409
1149
  }
1410
- }, {
1150
+ }, config);
1151
+ };
1152
+ //#endregion
1153
+ //#region src/utils.ts
1154
+ function mergeConfig(base, override) {
1155
+ const { plugins: basePlugins = [], jsPlugins: baseJsPlugins = [], ...baseConfig } = base;
1156
+ const { plugins: overridePlugins = [], jsPlugins: overrideJsPlugins, ...overrideConfig } = override;
1157
+ const config = merge.withOptions({
1158
+ allowUndefinedOverrides: false,
1159
+ mergeArrays: false
1160
+ }, baseConfig, overrideConfig);
1161
+ const plugins = [...new Set([...basePlugins, ...overridePlugins])];
1162
+ let jsPlugins = baseJsPlugins;
1163
+ if (overrideJsPlugins === null) jsPlugins = null;
1164
+ else if (overrideJsPlugins) jsPlugins = [...baseJsPlugins ?? [], ...overrideJsPlugins];
1165
+ return {
1411
1166
  ...config,
1412
- settings: {
1413
- ...config.settings,
1414
- ...userConfig.tailwindcss && { "better-tailwindcss": pick(userConfig.tailwindcss, [
1415
- "entryPoint",
1416
- "tailwindConfig",
1417
- "tsconfig",
1418
- "cwd",
1419
- "detectComponentClasses",
1420
- "rootFontSize",
1421
- "messageStyle",
1422
- "selectors"
1423
- ]) }
1167
+ plugins,
1168
+ jsPlugins
1169
+ };
1170
+ }
1171
+ //#endregion
1172
+ //#region src/configs/nextjs.ts
1173
+ const nextjs = (options = {}) => {
1174
+ return mergeConfig({
1175
+ files: [GLOB_SRC],
1176
+ plugins: ["nextjs"],
1177
+ rules: {
1178
+ "nextjs/google-font-display": "error",
1179
+ "nextjs/google-font-preconnect": "error",
1180
+ "nextjs/inline-script-id": "error",
1181
+ "nextjs/next-script-for-ga": "error",
1182
+ "nextjs/no-assign-module-variable": "error",
1183
+ "nextjs/no-async-client-component": "error",
1184
+ "nextjs/no-before-interactive-script-outside-document": "error",
1185
+ "nextjs/no-css-tags": "error",
1186
+ "nextjs/no-document-import-in-page": "error",
1187
+ "nextjs/no-duplicate-head": "error",
1188
+ "nextjs/no-head-element": "error",
1189
+ "nextjs/no-head-import-in-document": "error",
1190
+ "nextjs/no-html-link-for-pages": "error",
1191
+ "nextjs/no-img-element": "error",
1192
+ "nextjs/no-page-custom-font": "error",
1193
+ "nextjs/no-script-component-in-head": "error",
1194
+ "nextjs/no-styled-jsx-in-document": "error",
1195
+ "nextjs/no-sync-scripts": "error",
1196
+ "nextjs/no-title-in-document-head": "error",
1197
+ "nextjs/no-typos": "error",
1198
+ "nextjs/no-unwanted-polyfillio": "error"
1199
+ }
1200
+ }, options);
1201
+ };
1202
+ //#endregion
1203
+ //#region src/configs/playwright.ts
1204
+ const playwright = (options = {}) => {
1205
+ return mergeConfig({
1206
+ files: [GLOB_SRC],
1207
+ jsPlugins: [{
1208
+ name: "playwright",
1209
+ specifier: "eslint-plugin-playwright"
1210
+ }],
1211
+ rules: {
1212
+ "eslint/no-empty-pattern": "off",
1213
+ "playwright/consistent-spacing-between-blocks": "error",
1214
+ "playwright/expect-expect": "error",
1215
+ "playwright/max-nested-describe": "error",
1216
+ "playwright/missing-playwright-await": "error",
1217
+ "playwright/no-conditional-expect": "error",
1218
+ "playwright/no-conditional-in-test": "error",
1219
+ "playwright/no-duplicate-hooks": "error",
1220
+ "playwright/no-duplicate-slow": "error",
1221
+ "playwright/no-element-handle": "error",
1222
+ "playwright/no-eval": "error",
1223
+ "playwright/no-focused-test": "error",
1224
+ "playwright/no-force-option": "error",
1225
+ "playwright/no-nested-step": "error",
1226
+ "playwright/no-networkidle": "error",
1227
+ "playwright/no-page-pause": "error",
1228
+ "playwright/no-skipped-test": "error",
1229
+ "playwright/no-standalone-expect": "error",
1230
+ "playwright/no-unsafe-references": "error",
1231
+ "playwright/no-unused-locators": "error",
1232
+ "playwright/no-useless-await": "error",
1233
+ "playwright/no-useless-not": "error",
1234
+ "playwright/no-wait-for-navigation": "error",
1235
+ "playwright/no-wait-for-selector": "error",
1236
+ "playwright/no-wait-for-timeout": "error",
1237
+ "playwright/prefer-hooks-in-order": "error",
1238
+ "playwright/prefer-hooks-on-top": "error",
1239
+ "playwright/prefer-locator": "error",
1240
+ "playwright/prefer-to-have-count": "error",
1241
+ "playwright/prefer-to-have-length": "error",
1242
+ "playwright/prefer-web-first-assertions": "error",
1243
+ "playwright/valid-describe-callback": "error",
1244
+ "playwright/valid-expect": "error",
1245
+ "playwright/valid-expect-in-promise": "error",
1246
+ "playwright/valid-test-tags": "error",
1247
+ "playwright/valid-title": "error"
1248
+ }
1249
+ }, options);
1250
+ };
1251
+ //#endregion
1252
+ //#region src/configs/react.ts
1253
+ const react = (options = {}) => {
1254
+ return mergeConfig({
1255
+ files: [GLOB_SRC],
1256
+ jsPlugins: [{
1257
+ name: "@eslint-react",
1258
+ specifier: "@eslint-react/eslint-plugin"
1259
+ }, {
1260
+ name: "react-hooks-js",
1261
+ specifier: "eslint-plugin-react-hooks"
1262
+ }],
1263
+ rules: {
1264
+ "@eslint-react/dom-no-dangerously-set-innerhtml": "error",
1265
+ "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": "error",
1266
+ "@eslint-react/dom-no-find-dom-node": "error",
1267
+ "@eslint-react/dom-no-flush-sync": "error",
1268
+ "@eslint-react/dom-no-hydrate": "error",
1269
+ "@eslint-react/dom-no-missing-button-type": "error",
1270
+ "@eslint-react/dom-no-missing-iframe-sandbox": "error",
1271
+ "@eslint-react/dom-no-render": "error",
1272
+ "@eslint-react/dom-no-render-return-value": "error",
1273
+ "@eslint-react/dom-no-script-url": "error",
1274
+ "@eslint-react/dom-no-string-style-prop": "error",
1275
+ "@eslint-react/dom-no-unknown-property": "error",
1276
+ "@eslint-react/dom-no-unsafe-iframe-sandbox": "error",
1277
+ "@eslint-react/dom-no-unsafe-target-blank": "error",
1278
+ "@eslint-react/dom-no-use-form-state": "error",
1279
+ "@eslint-react/dom-no-void-elements-with-children": "error",
1280
+ "@eslint-react/error-boundaries": "error",
1281
+ "@eslint-react/exhaustive-deps": "error",
1282
+ "@eslint-react/globals": "error",
1283
+ "@eslint-react/immutability": "error",
1284
+ "@eslint-react/jsx-no-children-prop": "error",
1285
+ "@eslint-react/jsx-no-children-prop-with-children": "error",
1286
+ "@eslint-react/jsx-no-comment-textnodes": "error",
1287
+ "@eslint-react/jsx-no-key-after-spread": "error",
1288
+ "@eslint-react/jsx-no-leaked-dollar": "error",
1289
+ "@eslint-react/jsx-no-leaked-semicolon": "error",
1290
+ "@eslint-react/jsx-no-namespace": "error",
1291
+ "@eslint-react/jsx-no-useless-fragment": "error",
1292
+ "@eslint-react/naming-convention-context-name": "error",
1293
+ "@eslint-react/naming-convention-id-name": "error",
1294
+ "@eslint-react/naming-convention-ref-name": "error",
1295
+ "@eslint-react/no-access-state-in-setstate": "error",
1296
+ "@eslint-react/no-array-index-key": "error",
1297
+ "@eslint-react/no-children-count": "error",
1298
+ "@eslint-react/no-children-for-each": "error",
1299
+ "@eslint-react/no-children-map": "error",
1300
+ "@eslint-react/no-children-only": "error",
1301
+ "@eslint-react/no-children-to-array": "error",
1302
+ "@eslint-react/no-class-component": "error",
1303
+ "@eslint-react/no-clone-element": "error",
1304
+ "@eslint-react/no-component-will-mount": "error",
1305
+ "@eslint-react/no-component-will-receive-props": "error",
1306
+ "@eslint-react/no-component-will-update": "error",
1307
+ "@eslint-react/no-context-provider": "error",
1308
+ "@eslint-react/no-create-ref": "error",
1309
+ "@eslint-react/no-direct-mutation-state": "error",
1310
+ "@eslint-react/no-duplicate-key": "error",
1311
+ "@eslint-react/no-forward-ref": "error",
1312
+ "@eslint-react/no-missing-component-display-name": "error",
1313
+ "@eslint-react/no-missing-context-display-name": "error",
1314
+ "@eslint-react/no-missing-key": "error",
1315
+ "@eslint-react/no-misused-capture-owner-stack": "error",
1316
+ "@eslint-react/no-nested-component-definitions": "error",
1317
+ "@eslint-react/no-nested-lazy-component-declarations": "error",
1318
+ "@eslint-react/no-set-state-in-component-did-mount": "error",
1319
+ "@eslint-react/no-set-state-in-component-did-update": "error",
1320
+ "@eslint-react/no-set-state-in-component-will-update": "error",
1321
+ "@eslint-react/no-unnecessary-use-prefix": "error",
1322
+ "@eslint-react/no-unsafe-component-will-mount": "error",
1323
+ "@eslint-react/no-unsafe-component-will-receive-props": "error",
1324
+ "@eslint-react/no-unsafe-component-will-update": "error",
1325
+ "@eslint-react/no-unstable-context-value": "error",
1326
+ "@eslint-react/no-unstable-default-props": "error",
1327
+ "@eslint-react/no-unused-class-component-members": "error",
1328
+ "@eslint-react/no-unused-state": "error",
1329
+ "@eslint-react/no-use-context": "error",
1330
+ "@eslint-react/purity": "error",
1331
+ "@eslint-react/refs": "error",
1332
+ "@eslint-react/rsc-function-definition": "error",
1333
+ "@eslint-react/rules-of-hooks": "error",
1334
+ "@eslint-react/set-state-in-effect": "error",
1335
+ "@eslint-react/set-state-in-render": "error",
1336
+ "@eslint-react/static-components": "off",
1337
+ "@eslint-react/unsupported-syntax": "error",
1338
+ "@eslint-react/use-memo": "error",
1339
+ "@eslint-react/use-state": "error",
1340
+ "@eslint-react/web-api-no-leaked-event-listener": "error",
1341
+ "@eslint-react/web-api-no-leaked-fetch": "error",
1342
+ "@eslint-react/web-api-no-leaked-intersection-observer": "error",
1343
+ "@eslint-react/web-api-no-leaked-interval": "error",
1344
+ "@eslint-react/web-api-no-leaked-resize-observer": "error",
1345
+ "@eslint-react/web-api-no-leaked-timeout": "error",
1346
+ "react-hooks-js/config": "error",
1347
+ "react-hooks-js/error-boundaries": "off",
1348
+ "react-hooks-js/exhaustive-deps": "off",
1349
+ "react-hooks-js/gating": "error",
1350
+ "react-hooks-js/globals": "off",
1351
+ "react-hooks-js/immutability": "off",
1352
+ "react-hooks-js/incompatible-library": "error",
1353
+ "react-hooks-js/preserve-manual-memoization": "error",
1354
+ "react-hooks-js/purity": "off",
1355
+ "react-hooks-js/refs": "off",
1356
+ "react-hooks-js/rules-of-hooks": "off",
1357
+ "react-hooks-js/set-state-in-effect": "off",
1358
+ "react-hooks-js/set-state-in-render": "off",
1359
+ "react-hooks-js/static-components": "off",
1360
+ "react-hooks-js/unsupported-syntax": "off",
1361
+ "react-hooks-js/use-memo": "off",
1362
+ "react-hooks-js/void-use-memo": "error"
1363
+ }
1364
+ }, options);
1365
+ };
1366
+ //#endregion
1367
+ //#region src/configs/tailwindcss.ts
1368
+ const tailwindcss = (options = {}) => {
1369
+ return mergeConfig({
1370
+ files: [GLOB_SRC],
1371
+ jsPlugins: [{
1372
+ name: "better-tailwindcss",
1373
+ specifier: "eslint-plugin-better-tailwindcss"
1374
+ }],
1375
+ rules: {
1376
+ "better-tailwindcss/enforce-canonical-classes": "error",
1377
+ "better-tailwindcss/enforce-consistent-class-order": "error",
1378
+ "better-tailwindcss/enforce-consistent-variant-order": "error",
1379
+ "better-tailwindcss/no-conflicting-classes": "error",
1380
+ "better-tailwindcss/no-deprecated-classes": "error",
1381
+ "better-tailwindcss/no-duplicate-classes": "error",
1382
+ "better-tailwindcss/no-restricted-classes": "error",
1383
+ "better-tailwindcss/no-unknown-classes": "error",
1384
+ "better-tailwindcss/no-unnecessary-whitespace": "error"
1385
+ }
1386
+ }, options);
1387
+ };
1388
+ //#endregion
1389
+ //#region src/configs/vitest.ts
1390
+ const vitest = (options = {}) => {
1391
+ return mergeConfig({
1392
+ files: [GLOB_SRC],
1393
+ plugins: ["vitest"],
1394
+ rules: {
1395
+ "vitest/consistent-test-it": ["error", { fn: "test" }],
1396
+ "vitest/expect-expect": "error",
1397
+ "vitest/no-commented-out-tests": "error",
1398
+ "vitest/no-conditional-expect": "error",
1399
+ "vitest/no-disabled-tests": "error",
1400
+ "vitest/no-focused-tests": "error",
1401
+ "vitest/no-identical-title": "error",
1402
+ "vitest/no-import-node-test": "error",
1403
+ "vitest/no-interpolation-in-snapshots": "error",
1404
+ "vitest/no-mocks-import": "error",
1405
+ "vitest/no-standalone-expect": "error",
1406
+ "vitest/no-unneeded-async-expect-function": "error",
1407
+ "vitest/prefer-called-exactly-once-with": "error",
1408
+ "vitest/prefer-mock-return-shorthand": "error",
1409
+ "vitest/require-local-test-context-for-concurrent-snapshots": "error",
1410
+ "vitest/valid-describe-callback": "error",
1411
+ "vitest/valid-expect": "error",
1412
+ "vitest/valid-expect-in-promise": "error",
1413
+ "vitest/valid-title": "error",
1414
+ "vitest/warn-todo": "error"
1424
1415
  }
1425
- }, concatArrays);
1416
+ }, options);
1426
1417
  };
1427
1418
  //#endregion
1428
- export { GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, defineConfig };
1419
+ export { GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, defineConfig, nextjs, playwright, react, tailwindcss, vitest };
1429
1420
 
1430
1421
  //# sourceMappingURL=index.mjs.map