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