@dloizides/frontend-devtools 2.4.0 → 2.6.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +31 -0
  3. package/dist/babel/index.d.mts +19 -0
  4. package/dist/babel/index.d.ts +19 -0
  5. package/dist/babel/index.js +24 -0
  6. package/dist/babel/index.js.map +1 -0
  7. package/dist/babel/index.mjs +22 -0
  8. package/dist/babel/index.mjs.map +1 -0
  9. package/dist/eslint/index.d.mts +47 -2
  10. package/dist/eslint/index.d.ts +47 -2
  11. package/dist/eslint/index.js +756 -45
  12. package/dist/eslint/index.js.map +1 -1
  13. package/dist/eslint/index.mjs +756 -46
  14. package/dist/eslint/index.mjs.map +1 -1
  15. package/dist/jest/index.d.mts +20 -0
  16. package/dist/jest/index.d.ts +20 -0
  17. package/dist/jest/index.js +63 -0
  18. package/dist/jest/index.js.map +1 -0
  19. package/dist/jest/index.mjs +60 -0
  20. package/dist/jest/index.mjs.map +1 -0
  21. package/dist/jest/setup.d.mts +2 -0
  22. package/dist/jest/setup.d.ts +2 -0
  23. package/dist/jest/setup.js +74 -0
  24. package/dist/jest/setup.js.map +1 -0
  25. package/dist/jest/setup.mjs +72 -0
  26. package/dist/jest/setup.mjs.map +1 -0
  27. package/dist/metro/index.d.mts +24 -0
  28. package/dist/metro/index.d.ts +24 -0
  29. package/dist/metro/index.js +72 -0
  30. package/dist/metro/index.js.map +1 -0
  31. package/dist/metro/index.mjs +47 -0
  32. package/dist/metro/index.mjs.map +1 -0
  33. package/dist/test-results/index.d.mts +2 -2
  34. package/dist/test-results/index.d.ts +2 -2
  35. package/dist/test-results/jestReporter.d.mts +1 -1
  36. package/dist/test-results/jestReporter.d.ts +1 -1
  37. package/dist/test-results/vitestReporter.d.mts +1 -1
  38. package/dist/test-results/vitestReporter.d.ts +1 -1
  39. package/dist/{types-9BQtbdcF.d.mts → types-DQiTmmgP.d.mts} +1 -1
  40. package/dist/{types-9BQtbdcF.d.ts → types-DQiTmmgP.d.ts} +1 -1
  41. package/package.json +42 -2
@@ -2181,6 +2181,8 @@ var TEST_FILE = /(?:\.(?:test|spec)\.[cm]?[jt]sx?$)|(?:\/__tests__\/)/;
2181
2181
  var EXEMPT_URL_SCHEME = /^\s*(?:data|blob):/i;
2182
2182
  var ABSOLUTE_HTTP_URL = /^https?:\/\/[^/\s]+\//i;
2183
2183
  var ABSOLUTE_HTTP_LITERAL = /^https?:\/\/[^/\s]+(?:[/?#]|$)/i;
2184
+ var URL_HOST = /^https?:\/\/([^/\s?#:@]+)/i;
2185
+ var WILDCARD_PREFIX = "*.";
2184
2186
  var URL_OBJECTS = /* @__PURE__ */ new Set(["URL", "webkitURL"]);
2185
2187
  var GLOBAL_OBJECTS = /* @__PURE__ */ new Set(["window", "globalThis", "self"]);
2186
2188
  var AXIOS_MODULE = "axios";
@@ -2217,6 +2219,19 @@ function isThirdPartyLiteralUrl(node) {
2217
2219
  const head = node.quasis[0].value.cooked ?? "";
2218
2220
  return node.expressions.length === 0 ? ABSOLUTE_HTTP_LITERAL.test(head) : ABSOLUTE_HTTP_URL.test(head);
2219
2221
  }
2222
+ function literalUrlHost(node) {
2223
+ const match = URL_HOST.exec(leadingText(node));
2224
+ return match === null ? "" : match[1].toLowerCase();
2225
+ }
2226
+ function hostMatches(host, pattern) {
2227
+ const wanted = pattern.toLowerCase();
2228
+ if (!wanted.startsWith(WILDCARD_PREFIX)) return host === wanted;
2229
+ return host.endsWith(wanted.slice(1));
2230
+ }
2231
+ function isBackendHostUrl(node, backendHosts) {
2232
+ const host = literalUrlHost(node);
2233
+ return host !== "" && backendHosts.some((pattern) => hostMatches(host, pattern));
2234
+ }
2220
2235
  function unwrapExpression(node) {
2221
2236
  let current = node;
2222
2237
  while (current !== void 0 && current !== null && ["TSAsExpression", "TSNonNullExpression", "TSTypeAssertion", "TSSatisfiesExpression"].includes(current.type))
@@ -2268,9 +2283,10 @@ function scopeOf(context, node) {
2268
2283
  const sourceCode = context.sourceCode ?? context.getSourceCode();
2269
2284
  return typeof sourceCode.getScope === "function" ? sourceCode.getScope(node) : context.getScope();
2270
2285
  }
2271
- function isExemptFetchTarget(context, node) {
2286
+ function isExemptFetchTarget(context, node, backendHosts) {
2272
2287
  const target = node.arguments[0];
2273
- if (isDataOrBlobUrl(target) || isThirdPartyLiteralUrl(target)) return true;
2288
+ if (isDataOrBlobUrl(target)) return true;
2289
+ if (isThirdPartyLiteralUrl(target)) return !isBackendHostUrl(target, backendHosts);
2274
2290
  return isLocalObjectUrl(target, scopeOf(context, node));
2275
2291
  }
2276
2292
  function isAxiosSource(node) {
@@ -2293,7 +2309,8 @@ var noRawBackendFetchRule = {
2293
2309
  {
2294
2310
  type: "object",
2295
2311
  properties: {
2296
- allow: { type: "array", items: { type: "string" } }
2312
+ allow: { type: "array", items: { type: "string" } },
2313
+ backendHosts: { type: "array", items: { type: "string" } }
2297
2314
  },
2298
2315
  additionalProperties: false
2299
2316
  }
@@ -2306,6 +2323,7 @@ var noRawBackendFetchRule = {
2306
2323
  create(context) {
2307
2324
  const options = context.options[0] ?? {};
2308
2325
  const allow = Array.isArray(options.allow) ? options.allow : [];
2326
+ const backendHosts = Array.isArray(options.backendHosts) ? options.backendHosts : [];
2309
2327
  const filename = context.filename ?? context.getFilename();
2310
2328
  if (isExemptFile(filename, allow)) return {};
2311
2329
  const sourceCode = context.sourceCode ?? context.getSourceCode();
@@ -2313,7 +2331,7 @@ var noRawBackendFetchRule = {
2313
2331
  return {
2314
2332
  CallExpression(node) {
2315
2333
  if (isFetchCallee(node.callee)) {
2316
- if (!isExemptFetchTarget(context, node)) context.report({ node, messageId: "rawFetch" });
2334
+ if (!isExemptFetchTarget(context, node, backendHosts)) context.report({ node, messageId: "rawFetch" });
2317
2335
  return;
2318
2336
  }
2319
2337
  const isRequire = node.callee.type === "Identifier" && node.callee.name === "require";
@@ -3361,47 +3379,6 @@ function oneRulePlugin(name, rule7) {
3361
3379
  rules: { [name]: rule7 }
3362
3380
  };
3363
3381
  }
3364
- var OFF_LEVELS = ["off", 0];
3365
- function pluginOf(mod) {
3366
- const candidate = mod;
3367
- const inner = candidate.default;
3368
- return inner?.rules !== void 0 ? inner : candidate;
3369
- }
3370
- function rulesOf(config) {
3371
- const blocks = Array.isArray(config) ? config : [config ?? {}];
3372
- return Object.assign({}, ...blocks.map((block) => block.rules ?? {}));
3373
- }
3374
- function toWarn(entry) {
3375
- const level = Array.isArray(entry) ? entry[0] : entry;
3376
- if (OFF_LEVELS.includes(level)) {
3377
- return entry;
3378
- }
3379
- return Array.isArray(entry) ? ["warn", ...entry.slice(1)] : "warn";
3380
- }
3381
- function warnAll(rules2) {
3382
- return Object.fromEntries(Object.entries(rules2).map(([name, entry]) => [name, toWarn(entry)]));
3383
- }
3384
- var tanstackQuery = pluginOf(tanstackQueryPlugin);
3385
- var effect = pluginOf(effectPlugin);
3386
- var boundaries = pluginOf(boundariesPlugin);
3387
- var sonarjs = pluginOf(sonarjsPlugin);
3388
- var HOUSE_PATTERN_RULE_NAMES = ["query-key-factory"];
3389
- var patternPacksConfig = {
3390
- plugins: {
3391
- "@tanstack/query": tanstackQuery,
3392
- "react-you-might-not-need-an-effect": effect,
3393
- boundaries,
3394
- sonarjs,
3395
- "@dloizides": plugin
3396
- },
3397
- rules: warnAll({
3398
- ...rulesOf(tanstackQuery.configs?.["flat/recommended"]),
3399
- ...rulesOf(effect.configs?.recommended),
3400
- ...rulesOf(boundaries.configs?.recommended),
3401
- ...rulesOf(sonarjs.configs?.recommended),
3402
- "@dloizides/query-key-factory": "warn"
3403
- })
3404
- };
3405
3382
 
3406
3383
  // src/eslint/configs.ts
3407
3384
  var DOC_COMMENT_MAX_LINES = 3;
@@ -3464,7 +3441,740 @@ var composeConfig = {
3464
3441
  "@dloizides/max-component-props": "error"
3465
3442
  }
3466
3443
  };
3444
+ var OFF_LEVELS = ["off", 0];
3445
+ function pluginOf(mod) {
3446
+ const candidate = mod;
3447
+ const inner = candidate.default;
3448
+ return inner?.rules !== void 0 ? inner : candidate;
3449
+ }
3450
+ function rulesOf(config) {
3451
+ const blocks = Array.isArray(config) ? config : [config ?? {}];
3452
+ return Object.assign({}, ...blocks.map((block) => block.rules ?? {}));
3453
+ }
3454
+ function toWarn(entry) {
3455
+ const level = Array.isArray(entry) ? entry[0] : entry;
3456
+ if (OFF_LEVELS.includes(level)) {
3457
+ return entry;
3458
+ }
3459
+ return Array.isArray(entry) ? ["warn", ...entry.slice(1)] : "warn";
3460
+ }
3461
+ function warnAll(rules2) {
3462
+ return Object.fromEntries(Object.entries(rules2).map(([name, entry]) => [name, toWarn(entry)]));
3463
+ }
3464
+ var tanstackQuery = pluginOf(tanstackQueryPlugin);
3465
+ var effect = pluginOf(effectPlugin);
3466
+ var boundaries = pluginOf(boundariesPlugin);
3467
+ var sonarjs = pluginOf(sonarjsPlugin);
3468
+ var HOUSE_PATTERN_RULE_NAMES = ["query-key-factory"];
3469
+ var patternPacksConfig = {
3470
+ plugins: {
3471
+ "@tanstack/query": tanstackQuery,
3472
+ "react-you-might-not-need-an-effect": effect,
3473
+ boundaries,
3474
+ sonarjs,
3475
+ "@dloizides": plugin
3476
+ },
3477
+ rules: warnAll({
3478
+ ...rulesOf(tanstackQuery.configs?.["flat/recommended"]),
3479
+ ...rulesOf(effect.configs?.recommended),
3480
+ ...rulesOf(boundaries.configs?.recommended),
3481
+ ...rulesOf(sonarjs.configs?.recommended),
3482
+ "@dloizides/query-key-factory": "warn"
3483
+ })
3484
+ };
3485
+
3486
+ // src/eslint/base/defaults.ts
3487
+ var BASE_IGNORES = [
3488
+ "node_modules/**",
3489
+ ".expo/**",
3490
+ "dist/**",
3491
+ "**/dist/**",
3492
+ "build/**",
3493
+ "android/**",
3494
+ "ios/**",
3495
+ "**/*.d.ts",
3496
+ "public/**",
3497
+ "*.config.js",
3498
+ "*.config.mjs",
3499
+ "babel.config.js",
3500
+ "metro.config.js",
3501
+ "lighthouserc.js",
3502
+ "scripts/**",
3503
+ "src/generated/**",
3504
+ "src/server/autoGeneratedHooks/**",
3505
+ "src/server/endpoints.ts"
3506
+ ];
3507
+ var DEFAULT_STABLE_HOOK_IGNORE_PATTERNS = [
3508
+ "^useIdentityService",
3509
+ "^useQuestionerWeb",
3510
+ "^useOnlineMenu",
3511
+ "^useNotification"
3512
+ ];
3513
+ var DEFAULT_ROUTE_PRELOAD = {
3514
+ file: "src/config/routePreloader.ts",
3515
+ routeDir: "app/(protected)",
3516
+ excludeFiles: ["_layout.tsx"],
3517
+ excludeDirs: ["__tests__"],
3518
+ rootIndexIsRedirect: true
3519
+ };
3520
+ var DEFAULT_BOUNDARY_ELEMENTS = [
3521
+ { type: "feature", pattern: "src/features/*", mode: "folder", capture: ["name"] },
3522
+ { type: "module", pattern: "src/modules/*", mode: "folder", capture: ["name"] },
3523
+ {
3524
+ type: "shared",
3525
+ pattern: ["src/shared/*", "src/components/*", "src/hooks/*", "src/utils/*", "src/lib/*", "src/theme/*", "src/types/*"],
3526
+ mode: "folder",
3527
+ capture: ["name"]
3528
+ },
3529
+ {
3530
+ type: "platform",
3531
+ pattern: ["src/auth/*", "src/bootstrap/*", "src/config/*", "src/localization/*", "src/navigation/*", "src/pwa/*", "src/server/*", "src/store/*"],
3532
+ mode: "folder",
3533
+ capture: ["name"]
3534
+ }
3535
+ ];
3536
+ var TS_FILES = ["**/*.ts", "**/*.tsx"];
3537
+ var SRC_FILES = ["src/**/*.ts", "src/**/*.tsx"];
3538
+ var TEST_FILES = ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**"];
3539
+ var LOCALE_FILES = ["src/localization/locales/**/*.json"];
3540
+ var DEFAULT_NAV_PREFIX_FILES = ["packages/*/src/index.ts"];
3541
+
3542
+ // src/eslint/base/globals.ts
3543
+ function readonlyGlobals(names) {
3544
+ return Object.fromEntries(names.map((name) => [name, "readonly"]));
3545
+ }
3546
+ var REACT_NATIVE_GLOBALS = readonlyGlobals([
3547
+ "__DEV__",
3548
+ "FormData",
3549
+ "Headers",
3550
+ "Request",
3551
+ "Response",
3552
+ "AbortController",
3553
+ "Blob",
3554
+ "File",
3555
+ "FileReader",
3556
+ "URL",
3557
+ "URLSearchParams",
3558
+ "WebSocket",
3559
+ "console",
3560
+ "setTimeout",
3561
+ "setInterval",
3562
+ "clearTimeout",
3563
+ "clearInterval",
3564
+ "setImmediate",
3565
+ "clearImmediate",
3566
+ "requestAnimationFrame",
3567
+ "cancelAnimationFrame",
3568
+ "alert",
3569
+ "process",
3570
+ "global",
3571
+ "window",
3572
+ "document",
3573
+ "navigator",
3574
+ "localStorage",
3575
+ "sessionStorage",
3576
+ "XMLHttpRequest",
3577
+ "module",
3578
+ "require",
3579
+ "exports"
3580
+ ]);
3581
+ var TEST_GLOBALS = readonlyGlobals([
3582
+ "describe",
3583
+ "it",
3584
+ "test",
3585
+ "expect",
3586
+ "jest",
3587
+ "beforeAll",
3588
+ "beforeEach",
3589
+ "afterAll",
3590
+ "afterEach"
3591
+ ]);
3592
+ var JEST_SETUP_GLOBALS = readonlyGlobals(["jest", "global", "console"]);
3593
+
3594
+ // src/eslint/base/i18nRules.ts
3595
+ var I18N_LITERAL_STRING_RULES = {
3596
+ "i18next/no-literal-string": ["error", {
3597
+ markupOnly: true,
3598
+ ignoreAttribute: [
3599
+ "className",
3600
+ "style",
3601
+ "id",
3602
+ "key",
3603
+ "ref",
3604
+ "type",
3605
+ "name",
3606
+ "value",
3607
+ "defaultValue",
3608
+ "href",
3609
+ "src",
3610
+ "as",
3611
+ "to",
3612
+ "from",
3613
+ "mode",
3614
+ "variant",
3615
+ "size",
3616
+ "color",
3617
+ "testID",
3618
+ "accessibilityRole",
3619
+ "accessibilityState",
3620
+ "aria-hidden",
3621
+ "aria-live",
3622
+ "aria-current",
3623
+ "aria-expanded",
3624
+ "aria-selected",
3625
+ "aria-checked",
3626
+ "d",
3627
+ "viewBox",
3628
+ "fill",
3629
+ "stroke",
3630
+ "strokeWidth",
3631
+ "strokeLinecap",
3632
+ "strokeLinejoin",
3633
+ "xmlns",
3634
+ "role",
3635
+ "tabIndex",
3636
+ "htmlFor",
3637
+ "autoComplete",
3638
+ "autoFocus",
3639
+ "autoCapitalize",
3640
+ "keyboardType",
3641
+ "returnKeyType",
3642
+ "secureTextEntry",
3643
+ "multiline",
3644
+ "numberOfLines",
3645
+ "resizeMode",
3646
+ "contentFit",
3647
+ "pointerEvents"
3648
+ ],
3649
+ ignoreCallee: [
3650
+ "require",
3651
+ "Error",
3652
+ "URL",
3653
+ "console.*",
3654
+ "cn",
3655
+ "navigate",
3656
+ "useRoute",
3657
+ "useNavigation",
3658
+ "StyleSheet.create",
3659
+ "Dimensions.get"
3660
+ ],
3661
+ ignoreProperty: [
3662
+ "className",
3663
+ "style",
3664
+ "testID",
3665
+ "id",
3666
+ "key",
3667
+ "type",
3668
+ "name",
3669
+ "variant",
3670
+ "mode",
3671
+ "path",
3672
+ "uri",
3673
+ "source",
3674
+ "fontFamily",
3675
+ "fontWeight",
3676
+ "textAlign",
3677
+ "display",
3678
+ "flex",
3679
+ "flexDirection",
3680
+ "alignItems",
3681
+ "justifyContent"
3682
+ ],
3683
+ ignore: ["^[A-Z_]+$", "^#[0-9a-fA-F]+$", "^rgba?\\(", "^M\\d"]
3684
+ }]
3685
+ };
3686
+ var RULES_OFF_IN_TESTS = [
3687
+ "max-lines",
3688
+ "max-nested-callbacks",
3689
+ "smart-max-lines/smart-max-lines",
3690
+ "no-magic-numbers",
3691
+ "no-script-url",
3692
+ "no-console",
3693
+ "no-null-check/no-null-check",
3694
+ "prefer-const-enum/prefer-const-enum",
3695
+ "enum-file-isolation/enum-file-isolation",
3696
+ "react/jsx-no-literals",
3697
+ "i18next/no-literal-string",
3698
+ "react-compiler/react-compiler",
3699
+ "require-stable-hook-args/require-stable-hook-args",
3700
+ "enforce-module-structure/enforce-module-structure",
3701
+ "enforce-function-style/enforce-function-style",
3702
+ "no-restricted-imports",
3703
+ "no-product-imports-in-shared/no-product-imports-in-shared",
3704
+ "no-duplicate-shared-patterns/no-duplicate-shared-patterns"
3705
+ ];
3706
+ var TEST_FILE_RULES = {
3707
+ "@typescript-eslint/no-explicit-any": "warn",
3708
+ "@typescript-eslint/no-non-null-assertion": "off",
3709
+ "@typescript-eslint/no-unsafe-argument": "off",
3710
+ "@typescript-eslint/no-unsafe-assignment": "off",
3711
+ "@typescript-eslint/no-unsafe-call": "off",
3712
+ "@typescript-eslint/no-unsafe-member-access": "off",
3713
+ "@typescript-eslint/no-unsafe-return": "off",
3714
+ "@typescript-eslint/require-await": "off",
3715
+ "@typescript-eslint/consistent-type-assertions": ["error", {
3716
+ assertionStyle: "as",
3717
+ objectLiteralTypeAssertions: "allow-as-parameter"
3718
+ }],
3719
+ ...Object.fromEntries(RULES_OFF_IN_TESTS.map((name) => [name, "off"]))
3720
+ };
3721
+
3722
+ // src/eslint/base/importRules.ts
3723
+ var IMPORT_ORDER = ["error", {
3724
+ "groups": ["builtin", "external", "internal", ["parent", "sibling"], "index", "object", "type"],
3725
+ "pathGroups": [
3726
+ { pattern: "react", group: "builtin", position: "before" },
3727
+ { pattern: "react-native", group: "builtin", position: "before" },
3728
+ { pattern: "expo**", group: "external", position: "before" },
3729
+ { pattern: "@/**", group: "internal", position: "before" }
3730
+ ],
3731
+ "pathGroupsExcludedImportTypes": ["react", "react-native"],
3732
+ "newlines-between": "always",
3733
+ "alphabetize": { order: "asc", caseInsensitive: true }
3734
+ }];
3735
+ var IMPORT_RULES = {
3736
+ "import/first": "error",
3737
+ "import/no-duplicates": "error",
3738
+ "import/no-self-import": "error",
3739
+ "import/no-cycle": "error",
3740
+ "import/no-useless-path-segments": "error",
3741
+ "import/newline-after-import": "error",
3742
+ "import/no-mutable-exports": "error",
3743
+ "import/no-default-export": "off",
3744
+ "import/order": IMPORT_ORDER,
3745
+ "unused-imports/no-unused-imports": "error",
3746
+ "unused-imports/no-unused-vars": "off"
3747
+ };
3748
+ var HOUSE_RULES = {
3749
+ "max-lines": ["error", { max: 200, skipBlankLines: true, skipComments: true }],
3750
+ "smart-max-lines/smart-max-lines": ["error", {
3751
+ componentMax: 200,
3752
+ functionMax: 50,
3753
+ skipBlankLines: true,
3754
+ skipComments: true
3755
+ }],
3756
+ "no-null-check/no-null-check": "error",
3757
+ "prefer-const-enum/prefer-const-enum": "warn",
3758
+ "enum-file-isolation/enum-file-isolation": "warn",
3759
+ "no-barrel-companion-file/no-barrel-companion-file": "error",
3760
+ "no-optional-undefined/no-optional-undefined": "error",
3761
+ "no-generated-models-barrel-value-import/no-generated-models-barrel-value-import": "error",
3762
+ "enforce-module-structure/enforce-module-structure": ["error", { fileThreshold: 4 }],
3763
+ "enforce-test-colocation/enforce-test-colocation": "error",
3764
+ "enforce-function-style/enforce-function-style": ["warn", { checkStyle: true, checkOrdering: true }],
3765
+ "no-product-imports-in-shared/no-product-imports-in-shared": "warn",
3766
+ "no-duplicate-shared-patterns/no-duplicate-shared-patterns": "warn",
3767
+ "no-restricted-imports": ["error", {
3768
+ paths: [{
3769
+ name: "react-i18next",
3770
+ importNames: ["useTranslation"],
3771
+ message: "Use FM() from localization/helpers instead of t() from useTranslation(). FM() has no fallback strings \u2014 missing keys are immediately visible."
3772
+ }]
3773
+ }]
3774
+ };
3775
+
3776
+ // src/eslint/base/qualityRules.ts
3777
+ var ERROR_RULE_NAMES = [
3778
+ "no-debugger",
3779
+ "no-alert",
3780
+ "no-eval",
3781
+ "no-implied-eval",
3782
+ "no-new-func",
3783
+ "no-script-url",
3784
+ "no-void",
3785
+ "no-with",
3786
+ "no-proto",
3787
+ "no-extend-native",
3788
+ "no-iterator",
3789
+ "no-labels",
3790
+ "no-lone-blocks",
3791
+ "no-multi-str",
3792
+ "no-new-wrappers",
3793
+ "no-octal-escape",
3794
+ "no-self-compare",
3795
+ "no-sequences",
3796
+ "no-throw-literal",
3797
+ "no-unmodified-loop-condition",
3798
+ "no-unused-expressions",
3799
+ "no-useless-call",
3800
+ "no-useless-concat",
3801
+ "no-useless-return",
3802
+ "prefer-promise-reject-errors",
3803
+ "radix",
3804
+ "yoda"
3805
+ ];
3806
+ var ERROR_RULE_NAMES_AFTER_CURLY = [
3807
+ "default-case",
3808
+ "default-case-last",
3809
+ "grouped-accessor-pairs",
3810
+ "no-constructor-return",
3811
+ "no-else-return"
3812
+ ];
3813
+ var ERROR_RULE_NAMES_AFTER_EMPTY_FUNCTION = [
3814
+ "no-extra-bind",
3815
+ "no-floating-decimal",
3816
+ "no-implicit-coercion",
3817
+ "no-multi-spaces"
3818
+ ];
3819
+ var ERROR_RULE_NAMES_AFTER_PARAM_REASSIGN = [
3820
+ "no-return-assign",
3821
+ "prefer-const",
3822
+ "prefer-template",
3823
+ "object-shorthand",
3824
+ "no-var",
3825
+ "no-nested-ternary",
3826
+ "no-unneeded-ternary"
3827
+ ];
3828
+ var TOO_MANY_CONDITIONS = "Condition has more than 2 expressions. Extract to a named variable (e.g., const shouldUpdate = a && b && c)";
3829
+ var TOO_MANY_TERNARY_CONDITIONS = "Ternary condition has more than 2 expressions. Extract to a named variable";
3830
+ var TOO_MANY_WHILE_CONDITIONS = "While condition has more than 2 expressions. Extract to a named variable";
3831
+ function asErrors(names) {
3832
+ return Object.fromEntries(names.map((name) => [name, "error"]));
3833
+ }
3834
+ function nestedLogical(parent, message) {
3835
+ return ["left", "right"].map((side) => ({
3836
+ selector: `${parent} > LogicalExpression[${side}.type="LogicalExpression"]`,
3837
+ message
3838
+ }));
3839
+ }
3840
+ var QUALITY_RULES = {
3841
+ "no-console": ["error", { allow: ["warn", "error"] }],
3842
+ ...asErrors(ERROR_RULE_NAMES),
3843
+ "eqeqeq": ["error", "always"],
3844
+ "curly": ["error", "multi"],
3845
+ ...asErrors(ERROR_RULE_NAMES_AFTER_CURLY),
3846
+ "no-empty-function": ["error", { allow: ["arrowFunctions"] }],
3847
+ ...asErrors(ERROR_RULE_NAMES_AFTER_EMPTY_FUNCTION),
3848
+ "no-param-reassign": ["error", { props: true }],
3849
+ ...asErrors(ERROR_RULE_NAMES_AFTER_PARAM_REASSIGN),
3850
+ "spaced-comment": ["error", "always"],
3851
+ "max-depth": ["error", 4],
3852
+ "max-nested-callbacks": ["error", 3],
3853
+ "max-params": ["error", 4],
3854
+ "complexity": ["warn", 15],
3855
+ "no-magic-numbers": ["error", {
3856
+ ignore: [0, 1, -1, 2, 100],
3857
+ ignoreArrayIndexes: true,
3858
+ ignoreDefaultValues: true,
3859
+ enforceConst: true,
3860
+ ignoreClassFieldInitialValues: true,
3861
+ ignoreEnums: true
3862
+ }],
3863
+ "no-restricted-syntax": [
3864
+ "error",
3865
+ {
3866
+ selector: "TSEnumDeclaration:not([const])",
3867
+ message: "Use const enum instead of enum. String literal union types should also use const enum."
3868
+ },
3869
+ ...nestedLogical("IfStatement", TOO_MANY_CONDITIONS),
3870
+ ...nestedLogical("ConditionalExpression", TOO_MANY_TERNARY_CONDITIONS),
3871
+ ...nestedLogical("WhileStatement", TOO_MANY_WHILE_CONDITIONS)
3872
+ ]
3873
+ };
3874
+
3875
+ // src/eslint/base/reactRules.ts
3876
+ var JSX_ALLOWED_STRINGS = [
3877
+ "/",
3878
+ "-",
3879
+ ">",
3880
+ "<",
3881
+ "|",
3882
+ ":",
3883
+ ".",
3884
+ ",",
3885
+ "+",
3886
+ "=",
3887
+ "(",
3888
+ ")",
3889
+ "*",
3890
+ "%",
3891
+ "$",
3892
+ "#",
3893
+ "&",
3894
+ "@",
3895
+ "~",
3896
+ "^",
3897
+ "!",
3898
+ "?",
3899
+ ";",
3900
+ "\u2192",
3901
+ "\u2715"
3902
+ ];
3903
+ var A11Y_RULE_NAMES = [
3904
+ "has-accessibility-hint",
3905
+ "has-accessibility-props",
3906
+ "has-valid-accessibility-actions",
3907
+ "has-valid-accessibility-role",
3908
+ "has-valid-accessibility-state",
3909
+ "has-valid-accessibility-states",
3910
+ "has-valid-accessibility-component-type",
3911
+ "has-valid-accessibility-traits",
3912
+ "has-valid-accessibility-value",
3913
+ "no-nested-touchables",
3914
+ "has-valid-accessibility-descriptors",
3915
+ "has-valid-accessibility-ignores-invert-colors",
3916
+ "has-valid-accessibility-live-region",
3917
+ "has-valid-important-for-accessibility"
3918
+ ];
3919
+ var REACT_RULES = {
3920
+ "react/jsx-uses-react": "off",
3921
+ "react/react-in-jsx-scope": "off",
3922
+ "react/prop-types": "off",
3923
+ "react/display-name": "error",
3924
+ "react/jsx-key": ["error", { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true }],
3925
+ "react/jsx-no-duplicate-props": "error",
3926
+ "react/jsx-no-undef": "error",
3927
+ "react/jsx-pascal-case": "error",
3928
+ "react/jsx-uses-vars": "error",
3929
+ "react/no-children-prop": "error",
3930
+ "react/no-danger-with-children": "error",
3931
+ "react/no-deprecated": "error",
3932
+ "react/no-direct-mutation-state": "error",
3933
+ "react/no-find-dom-node": "error",
3934
+ "react/no-is-mounted": "error",
3935
+ "react/no-render-return-value": "error",
3936
+ "react/no-string-refs": "error",
3937
+ "react/no-unescaped-entities": "error",
3938
+ "react/no-unknown-property": "error",
3939
+ "react/no-unsafe": ["error", { checkAliases: true }],
3940
+ "react/self-closing-comp": "error",
3941
+ "react/jsx-boolean-value": ["error", "never"],
3942
+ "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
3943
+ "react/jsx-fragments": ["error", "syntax"],
3944
+ "react/jsx-no-useless-fragment": "error",
3945
+ "react/jsx-sort-props": ["error", {
3946
+ callbacksLast: true,
3947
+ shorthandFirst: true,
3948
+ ignoreCase: true,
3949
+ reservedFirst: true
3950
+ }],
3951
+ "react/function-component-definition": ["error", {
3952
+ namedComponents: "arrow-function",
3953
+ unnamedComponents: "arrow-function"
3954
+ }],
3955
+ "react/hook-use-state": "error",
3956
+ "react/no-unstable-nested-components": ["error", { allowAsProps: true }],
3957
+ "react/no-array-index-key": "error",
3958
+ "react/jsx-no-leaked-render": "error",
3959
+ "react/jsx-no-literals": ["error", {
3960
+ noStrings: true,
3961
+ allowedStrings: JSX_ALLOWED_STRINGS,
3962
+ ignoreProps: true,
3963
+ noAttributeStrings: false
3964
+ }],
3965
+ "react-hooks/rules-of-hooks": "error",
3966
+ "react-hooks/exhaustive-deps": "error",
3967
+ "react-compiler/react-compiler": "warn"
3968
+ };
3969
+ function stableHookArgsRule(ignoreHookPatterns) {
3970
+ return {
3971
+ "require-stable-hook-args/require-stable-hook-args": ["warn", { ignoreHookPatterns: [...ignoreHookPatterns] }]
3972
+ };
3973
+ }
3974
+ var REACT_NATIVE_RULES = {
3975
+ "react-native/no-unused-styles": "error",
3976
+ "react-native/split-platform-components": "error",
3977
+ "react-native/no-inline-styles": "error",
3978
+ "react-native/no-color-literals": "error",
3979
+ "react-native/no-raw-text": ["error", { skip: ["Text", "Button"] }],
3980
+ "react-native/no-single-element-style-arrays": "error",
3981
+ ...Object.fromEntries(A11Y_RULE_NAMES.map((name) => [`react-native-a11y/${name}`, "error"]))
3982
+ };
3983
+
3984
+ // src/eslint/base/typescriptRules.ts
3985
+ var NAMING_CONVENTION = [
3986
+ "error",
3987
+ { selector: "default", format: ["camelCase"], leadingUnderscore: "allow" },
3988
+ { selector: "variable", format: ["camelCase", "UPPER_CASE", "PascalCase"], leadingUnderscore: "allow" },
3989
+ { selector: "parameter", format: ["camelCase"], leadingUnderscore: "allow" },
3990
+ { selector: "typeLike", format: ["PascalCase"] },
3991
+ { selector: "enumMember", format: ["PascalCase", "UPPER_CASE"] },
3992
+ { selector: "function", format: ["camelCase", "PascalCase"] },
3993
+ { selector: "objectLiteralProperty", format: null },
3994
+ { selector: "typeProperty", format: null },
3995
+ { selector: "objectLiteralMethod", format: ["camelCase", "PascalCase"] },
3996
+ { selector: "import", format: ["camelCase", "PascalCase"] }
3997
+ ];
3998
+ var TYPESCRIPT_RULES = {
3999
+ "no-undef": "off",
4000
+ "@typescript-eslint/no-explicit-any": "error",
4001
+ "@typescript-eslint/no-unsafe-argument": "error",
4002
+ "@typescript-eslint/no-unsafe-assignment": "error",
4003
+ "@typescript-eslint/no-unsafe-call": "error",
4004
+ "@typescript-eslint/no-unsafe-member-access": "error",
4005
+ "@typescript-eslint/no-unsafe-return": "error",
4006
+ "@typescript-eslint/no-unsafe-enum-comparison": "error",
4007
+ "@typescript-eslint/strict-boolean-expressions": ["error", {
4008
+ allowString: false,
4009
+ allowNumber: false,
4010
+ allowNullableObject: true,
4011
+ allowNullableBoolean: false,
4012
+ allowNullableString: false,
4013
+ allowNullableNumber: false,
4014
+ allowAny: false
4015
+ }],
4016
+ "@typescript-eslint/no-unnecessary-condition": "error",
4017
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
4018
+ "@typescript-eslint/no-non-null-assertion": "error",
4019
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
4020
+ "@typescript-eslint/prefer-optional-chain": "error",
4021
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
4022
+ "@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "never" }],
4023
+ "@typescript-eslint/explicit-function-return-type": ["error", {
4024
+ allowExpressions: true,
4025
+ allowTypedFunctionExpressions: true,
4026
+ allowHigherOrderFunctions: true,
4027
+ allowDirectConstAssertionInArrowFunctions: true,
4028
+ allowConciseArrowFunctionExpressionsStartingWithVoid: true
4029
+ }],
4030
+ "@typescript-eslint/explicit-module-boundary-types": "error",
4031
+ "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
4032
+ "@typescript-eslint/no-floating-promises": "error",
4033
+ "@typescript-eslint/promise-function-async": "error",
4034
+ "@typescript-eslint/require-await": "error",
4035
+ "@typescript-eslint/await-thenable": "error",
4036
+ "@typescript-eslint/no-for-in-array": "error",
4037
+ "@typescript-eslint/no-unused-vars": ["error", {
4038
+ argsIgnorePattern: "^_",
4039
+ varsIgnorePattern: "^_",
4040
+ caughtErrorsIgnorePattern: "^_"
4041
+ }],
4042
+ "@typescript-eslint/no-shadow": "error",
4043
+ "@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: true, variables: true }],
4044
+ "@typescript-eslint/no-redeclare": "error",
4045
+ "@typescript-eslint/no-duplicate-enum-values": "error",
4046
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
4047
+ "@typescript-eslint/no-redundant-type-constituents": "error",
4048
+ "@typescript-eslint/no-meaningless-void-operator": "error",
4049
+ "@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
4050
+ "@typescript-eslint/no-invalid-void-type": "error",
4051
+ "@typescript-eslint/unified-signatures": "error",
4052
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
4053
+ "@typescript-eslint/prefer-includes": "error",
4054
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
4055
+ "@typescript-eslint/prefer-find": "error",
4056
+ "@typescript-eslint/prefer-as-const": "error",
4057
+ "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
4058
+ "@typescript-eslint/consistent-type-imports": ["error", {
4059
+ prefer: "type-imports",
4060
+ fixStyle: "inline-type-imports",
4061
+ disallowTypeAnnotations: true
4062
+ }],
4063
+ "@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
4064
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
4065
+ "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
4066
+ "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
4067
+ "@typescript-eslint/method-signature-style": ["error", "property"],
4068
+ "@typescript-eslint/naming-convention": NAMING_CONVENTION,
4069
+ "no-unused-vars": "off",
4070
+ "no-shadow": "off",
4071
+ "no-use-before-define": "off",
4072
+ "no-redeclare": "off",
4073
+ "require-await": "off",
4074
+ "no-return-await": "off"
4075
+ };
4076
+
4077
+ // src/eslint/base/createBaseConfig.ts
4078
+ var HOUSE_PLUGINS = legacyPlugins;
4079
+ function typescriptBlock(deps, options) {
4080
+ const { plugins } = deps;
4081
+ return {
4082
+ files: TS_FILES,
4083
+ languageOptions: {
4084
+ parser: deps.tsParser,
4085
+ parserOptions: {
4086
+ ecmaVersion: "latest",
4087
+ sourceType: "module",
4088
+ ecmaFeatures: { jsx: true },
4089
+ project: options.tsconfigProject ?? "./tsconfig.json"
4090
+ },
4091
+ globals: REACT_NATIVE_GLOBALS
4092
+ },
4093
+ plugins: {
4094
+ "@typescript-eslint": plugins.typescript,
4095
+ "react": plugins.react,
4096
+ "react-hooks": plugins.reactHooks,
4097
+ "react-native": plugins.reactNative,
4098
+ "react-native-a11y": plugins.reactNativeA11y,
4099
+ "import": plugins.import,
4100
+ "unused-imports": plugins.unusedImports,
4101
+ "react-compiler": plugins.reactCompiler,
4102
+ ...HOUSE_PLUGINS
4103
+ },
4104
+ settings: {
4105
+ "react": { version: "detect" },
4106
+ "import/resolver": { typescript: { alwaysTryTypes: true } }
4107
+ },
4108
+ rules: {
4109
+ ...TYPESCRIPT_RULES,
4110
+ ...REACT_RULES,
4111
+ ...stableHookArgsRule(options.stableHookIgnorePatterns ?? DEFAULT_STABLE_HOOK_IGNORE_PATTERNS),
4112
+ ...REACT_NATIVE_RULES,
4113
+ ...IMPORT_RULES,
4114
+ ...HOUSE_RULES,
4115
+ ...QUALITY_RULES
4116
+ }
4117
+ };
4118
+ }
4119
+ function routePreloadBlocks(routePreload) {
4120
+ if (routePreload === false) {
4121
+ return [];
4122
+ }
4123
+ const { file, ...ruleOptions } = routePreload;
4124
+ return [{
4125
+ files: [file],
4126
+ plugins: HOUSE_PLUGINS,
4127
+ rules: { "enforce-route-preload/enforce-route-preload": ["error", ruleOptions] }
4128
+ }];
4129
+ }
4130
+ function navPrefixBlocks(files) {
4131
+ if (files === false) {
4132
+ return [];
4133
+ }
4134
+ return [{ files, plugins: HOUSE_PLUGINS, rules: { "no-duplicate-nav-prefix/no-duplicate-nav-prefix": "error" } }];
4135
+ }
4136
+ function i18nBlocks(deps) {
4137
+ return [
4138
+ { files: TS_FILES, plugins: { i18next: deps.plugins.i18next }, rules: I18N_LITERAL_STRING_RULES },
4139
+ { files: TEST_FILES, languageOptions: { globals: TEST_GLOBALS }, rules: TEST_FILE_RULES }
4140
+ ];
4141
+ }
4142
+ function sourceRuleBlocks(deps, options) {
4143
+ return [
4144
+ { files: options.loggerFiles ?? ["src/utils/logger.ts"], rules: { "no-console": "off" } },
4145
+ {
4146
+ files: LOCALE_FILES,
4147
+ languageOptions: { parser: deps.jsoncParser },
4148
+ plugins: HOUSE_PLUGINS,
4149
+ rules: { "i18n-interpolation/i18n-interpolation": "error" }
4150
+ },
4151
+ {
4152
+ files: SRC_FILES,
4153
+ ignores: ["src/**/__tests__/**", "src/**/*.test.*"],
4154
+ plugins: HOUSE_PLUGINS,
4155
+ rules: { "i18n-param-names/i18n-param-names": "error" }
4156
+ },
4157
+ ...routePreloadBlocks(options.routePreload ?? DEFAULT_ROUTE_PRELOAD),
4158
+ ...navPrefixBlocks(options.navPrefixFiles ?? DEFAULT_NAV_PREFIX_FILES)
4159
+ ];
4160
+ }
4161
+ function createBaseConfig(deps, options = {}) {
4162
+ return [
4163
+ { ignores: [...BASE_IGNORES, ...options.extraIgnores ?? []] },
4164
+ { files: ["jest.setup.js"], languageOptions: { globals: JEST_SETUP_GLOBALS } },
4165
+ deps.jsRecommended,
4166
+ typescriptBlock(deps, options),
4167
+ ...i18nBlocks(deps),
4168
+ ...sourceRuleBlocks(deps, options),
4169
+ commentsConfig,
4170
+ apiConfig,
4171
+ { files: SRC_FILES, ...patternPacksConfig },
4172
+ { files: SRC_FILES, settings: { "boundaries/elements": options.boundaryElements ?? DEFAULT_BOUNDARY_ELEMENTS } },
4173
+ deps.prettierConfig,
4174
+ { files: TS_FILES, rules: { curly: ["error", "multi"] } }
4175
+ ];
4176
+ }
3467
4177
 
3468
- export { API_RULE_NAMES, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, FOCUS_RULE_NAMES, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, apiConfig, commentsConfig, composeConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
4178
+ export { API_RULE_NAMES, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, FOCUS_RULE_NAMES, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, apiConfig, commentsConfig, composeConfig, createBaseConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
3469
4179
  //# sourceMappingURL=index.mjs.map
3470
4180
  //# sourceMappingURL=index.mjs.map