@sarj/eslint-plugin 15.13.1 → 15.13.3
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.cjs +387 -249
- package/dist/index.d.cts +15 -18
- package/dist/index.d.ts +15 -18
- package/dist/index.js +380 -249
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,15 +30,22 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
ADVISORY_RULES: () => ADVISORY_RULES,
|
|
34
|
+
APPLICATION_ONLY_RULES: () => APPLICATION_ONLY_RULES,
|
|
35
|
+
RECOMMENDED_RULES: () => RECOMMENDED_RULES,
|
|
36
|
+
RENAMED_RULES: () => RENAMED_RULES,
|
|
37
|
+
RETIRED_RULES: () => RETIRED_RULES,
|
|
38
|
+
RULES: () => RULES,
|
|
39
|
+
STRICT_RULES: () => STRICT_RULES,
|
|
40
|
+
advisoryRules: () => ADVISORY_RULES,
|
|
41
|
+
applicationOnlyRules: () => APPLICATION_ONLY_RULES,
|
|
35
42
|
default: () => index_default,
|
|
36
43
|
publicDocumentation: () => publicDocumentation,
|
|
37
|
-
recommendedRules: () =>
|
|
38
|
-
renamedRules: () =>
|
|
39
|
-
retiredRules: () =>
|
|
40
|
-
rules: () =>
|
|
41
|
-
strictRules: () =>
|
|
44
|
+
recommendedRules: () => RECOMMENDED_RULES,
|
|
45
|
+
renamedRules: () => RENAMED_RULES,
|
|
46
|
+
retiredRules: () => RETIRED_RULES,
|
|
47
|
+
rules: () => RULES,
|
|
48
|
+
strictRules: () => STRICT_RULES
|
|
42
49
|
});
|
|
43
50
|
module.exports = __toCommonJS(index_exports);
|
|
44
51
|
|
|
@@ -67,16 +74,16 @@ function createRule(config) {
|
|
|
67
74
|
}
|
|
68
75
|
return rule;
|
|
69
76
|
}
|
|
70
|
-
function documentationWarnings(
|
|
71
|
-
return Object.entries(
|
|
77
|
+
function documentationWarnings(rules) {
|
|
78
|
+
return Object.entries(rules).filter(([, rule]) => rule.documentation === void 0).map(([name]) => `${name}: source-owned documentation has not been migrated`).sort();
|
|
72
79
|
}
|
|
73
|
-
function publicDocumentation(
|
|
74
|
-
const missing = documentationWarnings(
|
|
80
|
+
function publicDocumentation(rules) {
|
|
81
|
+
const missing = documentationWarnings(rules);
|
|
75
82
|
if (missing.length > 0) {
|
|
76
83
|
throw new TypeError(`cannot publish an incomplete rule catalog:
|
|
77
84
|
${missing.join("\n")}`);
|
|
78
85
|
}
|
|
79
|
-
return Object.entries(
|
|
86
|
+
return Object.entries(rules).sort(([left], [right]) => left.localeCompare(right)).map(([ruleId, rule]) => {
|
|
80
87
|
const spec = rule.documentation;
|
|
81
88
|
if (spec === void 0 || spec.ruleId !== ruleId) {
|
|
82
89
|
throw new TypeError(`${ruleId}: native documentation identity mismatch`);
|
|
@@ -335,7 +342,7 @@ function isScriptFile(filename) {
|
|
|
335
342
|
}
|
|
336
343
|
|
|
337
344
|
// src/rules/enforce-file-structure.ts
|
|
338
|
-
var
|
|
345
|
+
var ENFORCE_FILE_STRUCTURE_DOCUMENTATION = {
|
|
339
346
|
summary: "Require imports before body statements and require `use server` to be the first statement.",
|
|
340
347
|
rationale: "Interleaved imports obscure module dependencies, while a displaced `use server` string is not an active directive.",
|
|
341
348
|
remediation: "Move `use server` to the first statement when present, then place imports before declarations and executable statements.",
|
|
@@ -385,7 +392,7 @@ var isUseServerDirective = (statement) => {
|
|
|
385
392
|
};
|
|
386
393
|
var enforce_file_structure_default = createRule({
|
|
387
394
|
name: "enforce-file-structure",
|
|
388
|
-
documentation:
|
|
395
|
+
documentation: ENFORCE_FILE_STRUCTURE_DOCUMENTATION,
|
|
389
396
|
meta: {
|
|
390
397
|
type: "suggestion",
|
|
391
398
|
docs: {
|
|
@@ -460,7 +467,7 @@ var OMITTED_AST_KEYS = /* @__PURE__ */ new Set([
|
|
|
460
467
|
var MIN_STATEMENTS = 3;
|
|
461
468
|
var MAX_NORMALIZED_STRING_LENGTH = 64;
|
|
462
469
|
var TEST_MODULES = /* @__PURE__ */ new Set(["@jest/globals", "@playwright/test", "bun:test", "node:test", "vitest"]);
|
|
463
|
-
var
|
|
470
|
+
var DUPLICATE_TEST_BODY_DOCUMENTATION = {
|
|
464
471
|
summary: "Disallow substantial sibling tests with the same body shape; express their differing inputs as a parameterized case table.",
|
|
465
472
|
rationale: "Copy-pasted test bodies hide the cases that differ and allow equivalent assertions to drift independently.",
|
|
466
473
|
remediation: "Move the varying inputs and expected values into a case table consumed by `test.each(...)` or `it.each(...)`.",
|
|
@@ -658,7 +665,7 @@ function isDuplicateTestFrameworkIdentifier(identifier, sourceCode) {
|
|
|
658
665
|
}
|
|
659
666
|
var duplicate_test_body_default = createRule({
|
|
660
667
|
name: "duplicate-test-body",
|
|
661
|
-
documentation:
|
|
668
|
+
documentation: DUPLICATE_TEST_BODY_DOCUMENTATION,
|
|
662
669
|
meta: {
|
|
663
670
|
type: "suggestion",
|
|
664
671
|
docs: {
|
|
@@ -692,7 +699,7 @@ var duplicate_test_body_default = createRule({
|
|
|
692
699
|
|
|
693
700
|
// src/rules/no-client-side-data-fetching.ts
|
|
694
701
|
var import_utils4 = require("@typescript-eslint/utils");
|
|
695
|
-
var
|
|
702
|
+
var NO_CLIENT_SIDE_DATA_FETCHING_DOCUMENTATION = {
|
|
696
703
|
summary: "Disallow direct data fetching inside `useEffect` or `useLayoutEffect`.",
|
|
697
704
|
rationale: "Effect-driven reads begin after rendering and can create request waterfalls, duplicate fetches, and loading-state layout shifts.",
|
|
698
705
|
remediation: "Fetch in a React Server Component or Server Action, or use a client cache such as SWR or React Query.",
|
|
@@ -819,7 +826,7 @@ function extractUrlString(node) {
|
|
|
819
826
|
}
|
|
820
827
|
var no_client_side_data_fetching_default = createRule({
|
|
821
828
|
name: "no-client-side-data-fetching",
|
|
822
|
-
documentation:
|
|
829
|
+
documentation: NO_CLIENT_SIDE_DATA_FETCHING_DOCUMENTATION,
|
|
823
830
|
meta: {
|
|
824
831
|
type: "problem",
|
|
825
832
|
docs: {
|
|
@@ -1044,7 +1051,7 @@ function headTokens(source) {
|
|
|
1044
1051
|
}
|
|
1045
1052
|
|
|
1046
1053
|
// src/rules/no-comment-cruft.ts
|
|
1047
|
-
var
|
|
1054
|
+
var NO_COMMENT_CRUFT_DOCUMENTATION = {
|
|
1048
1055
|
summary: "Flag commented-out code, section-banner comments, and leading file-header comment preambles.",
|
|
1049
1056
|
rationale: "Decorative, narrated, or dead-code comments obscure the constraints and rationale that comments should preserve.",
|
|
1050
1057
|
remediation: "Delete dead code and narration; express boundaries with named code and retain only comments that explain constraints or intent.",
|
|
@@ -1444,7 +1451,7 @@ function hasCommentedOutCode(texts, precedingProse, allowCall) {
|
|
|
1444
1451
|
}
|
|
1445
1452
|
var no_comment_cruft_default = createRule({
|
|
1446
1453
|
name: "no-comment-cruft",
|
|
1447
|
-
documentation:
|
|
1454
|
+
documentation: NO_COMMENT_CRUFT_DOCUMENTATION,
|
|
1448
1455
|
meta: {
|
|
1449
1456
|
type: "suggestion",
|
|
1450
1457
|
docs: {
|
|
@@ -1656,7 +1663,7 @@ var no_comment_cruft_default = createRule({
|
|
|
1656
1663
|
|
|
1657
1664
|
// src/rules/no-cors-wildcard-with-credentials.ts
|
|
1658
1665
|
var import_utils7 = require("@typescript-eslint/utils");
|
|
1659
|
-
var
|
|
1666
|
+
var NO_CORS_WILDCARD_WITH_CREDENTIALS_DOCUMENTATION = {
|
|
1660
1667
|
summary: "Disallow wildcard CORS origins when credentials are enabled.",
|
|
1661
1668
|
rationale: "Reflecting every origin while allowing credentials can let an untrusted site read authenticated cross-origin responses.",
|
|
1662
1669
|
remediation: "Enumerate the trusted origins that may receive credentialed responses.",
|
|
@@ -1828,7 +1835,7 @@ function enclosingScope(node) {
|
|
|
1828
1835
|
}
|
|
1829
1836
|
var no_cors_wildcard_with_credentials_default = createRule({
|
|
1830
1837
|
name: "no-cors-wildcard-with-credentials",
|
|
1831
|
-
documentation:
|
|
1838
|
+
documentation: NO_CORS_WILDCARD_WITH_CREDENTIALS_DOCUMENTATION,
|
|
1832
1839
|
meta: {
|
|
1833
1840
|
type: "problem",
|
|
1834
1841
|
docs: {
|
|
@@ -1928,7 +1935,7 @@ var no_cors_wildcard_with_credentials_default = createRule({
|
|
|
1928
1935
|
|
|
1929
1936
|
// src/rules/no-duplicate-lifecycle-refresh-listeners.ts
|
|
1930
1937
|
var import_utils8 = require("@typescript-eslint/utils");
|
|
1931
|
-
var
|
|
1938
|
+
var NO_DUPLICATE_LIFECYCLE_REFRESH_LISTENERS_DOCUMENTATION = {
|
|
1932
1939
|
summary: "Do not register one Next.js route-refresh callback for both focus and visibilitychange.",
|
|
1933
1940
|
rationale: "A browser tab activation can emit both lifecycle signals and invoke the same route-wide refresh twice.",
|
|
1934
1941
|
remediation: "Choose one lifecycle signal or route both signals through an explicitly debounced refresh policy.",
|
|
@@ -1973,7 +1980,7 @@ function enclosingFunction(sourceCode, node) {
|
|
|
1973
1980
|
}
|
|
1974
1981
|
var no_duplicate_lifecycle_refresh_listeners_default = createRule({
|
|
1975
1982
|
name: "no-duplicate-lifecycle-refresh-listeners",
|
|
1976
|
-
documentation:
|
|
1983
|
+
documentation: NO_DUPLICATE_LIFECYCLE_REFRESH_LISTENERS_DOCUMENTATION,
|
|
1977
1984
|
meta: {
|
|
1978
1985
|
type: "suggestion",
|
|
1979
1986
|
docs: { description: "Do not register one Next.js route-refresh callback for both focus and visibilitychange." },
|
|
@@ -2053,7 +2060,7 @@ var no_duplicate_lifecycle_refresh_listeners_default = createRule({
|
|
|
2053
2060
|
// src/rules/no-dangerously-allow-svg.ts
|
|
2054
2061
|
var import_utils9 = require("@typescript-eslint/utils");
|
|
2055
2062
|
var NEXT_CONFIG_RE = /(?:^|\/)next\.config\.[cm]?[jt]s$/;
|
|
2056
|
-
var
|
|
2063
|
+
var NO_DANGEROUSLY_ALLOW_SVG_DOCUMENTATION = {
|
|
2057
2064
|
summary: "Next.js image configuration enables unsanitized SVG rendering",
|
|
2058
2065
|
rationale: "SVG files can contain scripts and other active content; enabling dangerouslyAllowSVG makes the image optimizer serve that content from the application origin.",
|
|
2059
2066
|
remediation: "Keep dangerouslyAllowSVG disabled. If SVG delivery is unavoidable, use a separately reviewed asset path with restrictive Content-Disposition and Content-Security-Policy headers.",
|
|
@@ -2089,10 +2096,10 @@ function propertyName(node) {
|
|
|
2089
2096
|
}
|
|
2090
2097
|
var no_dangerously_allow_svg_default = createRule({
|
|
2091
2098
|
name: "no-dangerously-allow-svg",
|
|
2092
|
-
documentation:
|
|
2099
|
+
documentation: NO_DANGEROUSLY_ALLOW_SVG_DOCUMENTATION,
|
|
2093
2100
|
meta: {
|
|
2094
2101
|
type: "problem",
|
|
2095
|
-
docs: { description:
|
|
2102
|
+
docs: { description: NO_DANGEROUSLY_ALLOW_SVG_DOCUMENTATION.summary },
|
|
2096
2103
|
schema: [],
|
|
2097
2104
|
messages: {
|
|
2098
2105
|
noDangerouslyAllowSvg: "Do not enable dangerouslyAllowSVG. SVG can carry active content served from the application origin."
|
|
@@ -2258,7 +2265,7 @@ function createSqlListener(handler) {
|
|
|
2258
2265
|
}
|
|
2259
2266
|
|
|
2260
2267
|
// src/rules/no-dynamic-sql.ts
|
|
2261
|
-
var
|
|
2268
|
+
var NO_DYNAMIC_SQL_DOCUMENTATION = {
|
|
2262
2269
|
summary: "Disallow runtime values embedded inside quoted SQL values passed to statement-execution methods.",
|
|
2263
2270
|
rationale: "Embedding runtime values in SQL bypasses driver parameterization and can introduce injection defects or unstable query plans.",
|
|
2264
2271
|
remediation: "Use SQL placeholders and pass runtime values through the driver's binding API.",
|
|
@@ -2376,11 +2383,11 @@ function statementMethodName(node, methods) {
|
|
|
2376
2383
|
}
|
|
2377
2384
|
var no_dynamic_sql_default = createRule({
|
|
2378
2385
|
name: "no-dynamic-sql",
|
|
2379
|
-
documentation:
|
|
2386
|
+
documentation: NO_DYNAMIC_SQL_DOCUMENTATION,
|
|
2380
2387
|
meta: {
|
|
2381
2388
|
type: "problem",
|
|
2382
2389
|
docs: {
|
|
2383
|
-
description:
|
|
2390
|
+
description: NO_DYNAMIC_SQL_DOCUMENTATION.summary
|
|
2384
2391
|
},
|
|
2385
2392
|
schema: [
|
|
2386
2393
|
{
|
|
@@ -2427,7 +2434,7 @@ var no_dynamic_sql_default = createRule({
|
|
|
2427
2434
|
|
|
2428
2435
|
// src/rules/no-enum.ts
|
|
2429
2436
|
var import_utils12 = require("@typescript-eslint/utils");
|
|
2430
|
-
var
|
|
2437
|
+
var NO_ENUM_DOCUMENTATION = {
|
|
2431
2438
|
summary: "Disallow TypeScript `enum`; use string-literal unions or `as const` objects instead.",
|
|
2432
2439
|
rationale: "TypeScript enums emit runtime objects and numeric enums accept values outside their declared members, adding behavior where a type-only model is sufficient.",
|
|
2433
2440
|
remediation: "Replace the enum with a string-literal union or an `as const` object and derive its value type from that object.",
|
|
@@ -2464,7 +2471,7 @@ function matchesAnyPattern(filename, patterns) {
|
|
|
2464
2471
|
}
|
|
2465
2472
|
var no_enum_default = createRule({
|
|
2466
2473
|
name: "no-enum",
|
|
2467
|
-
documentation:
|
|
2474
|
+
documentation: NO_ENUM_DOCUMENTATION,
|
|
2468
2475
|
meta: {
|
|
2469
2476
|
type: "suggestion",
|
|
2470
2477
|
docs: {
|
|
@@ -2510,7 +2517,7 @@ var no_enum_default = createRule({
|
|
|
2510
2517
|
|
|
2511
2518
|
// src/rules/no-fat-try-blocks.ts
|
|
2512
2519
|
var import_utils13 = require("@typescript-eslint/utils");
|
|
2513
|
-
var
|
|
2520
|
+
var NO_FAT_TRY_BLOCKS_DOCUMENTATION = {
|
|
2514
2521
|
summary: "Disallow `try` blocks containing more than three top-level operations that can throw.",
|
|
2515
2522
|
rationale: "A broad `try` block obscures which operation failed and encourages one catch clause to recover from unrelated errors.",
|
|
2516
2523
|
remediation: "Keep only the operations that share one recovery policy inside the `try` block and move other work outside it.",
|
|
@@ -2899,7 +2906,7 @@ var handlerReturnsSuccessShaped = (handler) => subtreeMatches(
|
|
|
2899
2906
|
);
|
|
2900
2907
|
var no_fat_try_blocks_default = createRule({
|
|
2901
2908
|
name: "no-fat-try-blocks",
|
|
2902
|
-
documentation:
|
|
2909
|
+
documentation: NO_FAT_TRY_BLOCKS_DOCUMENTATION,
|
|
2903
2910
|
meta: {
|
|
2904
2911
|
type: "problem",
|
|
2905
2912
|
docs: {
|
|
@@ -2956,7 +2963,7 @@ var no_fat_try_blocks_default = createRule({
|
|
|
2956
2963
|
|
|
2957
2964
|
// src/rules/no-hand-rolled-sleep.ts
|
|
2958
2965
|
var import_utils14 = require("@typescript-eslint/utils");
|
|
2959
|
-
var
|
|
2966
|
+
var NO_HAND_ROLLED_SLEEP_DOCUMENTATION = {
|
|
2960
2967
|
summary: "Disallow uncancellable promisified timers and timeout arms.",
|
|
2961
2968
|
rationale: "A timer that outlives an aborted operation or a lost promise race retains work and can keep the process alive until it fires.",
|
|
2962
2969
|
remediation: "Use `node:timers/promises` with an abort signal for delays, or pass `AbortSignal.timeout(...)` to the timed operation.",
|
|
@@ -3067,7 +3074,7 @@ function isRaceArm(node) {
|
|
|
3067
3074
|
}
|
|
3068
3075
|
var no_hand_rolled_sleep_default = createRule({
|
|
3069
3076
|
name: "no-hand-rolled-sleep",
|
|
3070
|
-
documentation:
|
|
3077
|
+
documentation: NO_HAND_ROLLED_SLEEP_DOCUMENTATION,
|
|
3071
3078
|
meta: {
|
|
3072
3079
|
type: "problem",
|
|
3073
3080
|
docs: {
|
|
@@ -3164,7 +3171,7 @@ var no_hand_rolled_sleep_default = createRule({
|
|
|
3164
3171
|
|
|
3165
3172
|
// src/rules/no-hand-rolled-spinner.ts
|
|
3166
3173
|
var import_utils15 = require("@typescript-eslint/utils");
|
|
3167
|
-
var
|
|
3174
|
+
var NO_HAND_ROLLED_SPINNER_DOCUMENTATION = {
|
|
3168
3175
|
summary: "Disallow intrinsic elements styled as Tailwind border-ring spinners outside the design-system implementation.",
|
|
3169
3176
|
rationale: "One-off loading indicators duplicate a shared primitive and let accessibility and styling diverge.",
|
|
3170
3177
|
remediation: "Render the design-system Spinner component instead.",
|
|
@@ -3210,7 +3217,7 @@ function staticClassName(attribute) {
|
|
|
3210
3217
|
}
|
|
3211
3218
|
var no_hand_rolled_spinner_default = createRule({
|
|
3212
3219
|
name: "no-hand-rolled-spinner",
|
|
3213
|
-
documentation:
|
|
3220
|
+
documentation: NO_HAND_ROLLED_SPINNER_DOCUMENTATION,
|
|
3214
3221
|
meta: {
|
|
3215
3222
|
type: "suggestion",
|
|
3216
3223
|
docs: {
|
|
@@ -3248,7 +3255,7 @@ var no_hand_rolled_spinner_default = createRule({
|
|
|
3248
3255
|
|
|
3249
3256
|
// src/rules/no-insecure-random-id.ts
|
|
3250
3257
|
var import_utils16 = require("@typescript-eslint/utils");
|
|
3251
|
-
var
|
|
3258
|
+
var NO_INSECURE_RANDOM_ID_DOCUMENTATION = {
|
|
3252
3259
|
summary: "Disallow using `Math.random()` to generate identifiers, tokens, or secrets; use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.",
|
|
3253
3260
|
rationale: "Math.random is predictable and lacks the entropy required for security-sensitive values.",
|
|
3254
3261
|
remediation: "Generate the value with crypto.randomUUID or crypto.getRandomValues.",
|
|
@@ -3439,7 +3446,7 @@ function collectStaticStringParts(node, out) {
|
|
|
3439
3446
|
}
|
|
3440
3447
|
var no_insecure_random_id_default = createRule({
|
|
3441
3448
|
name: "no-insecure-random-id",
|
|
3442
|
-
documentation:
|
|
3449
|
+
documentation: NO_INSECURE_RANDOM_ID_DOCUMENTATION,
|
|
3443
3450
|
meta: {
|
|
3444
3451
|
type: "problem",
|
|
3445
3452
|
docs: {
|
|
@@ -3478,7 +3485,7 @@ var no_insecure_random_id_default = createRule({
|
|
|
3478
3485
|
|
|
3479
3486
|
// src/rules/no-json-stringify-error.ts
|
|
3480
3487
|
var import_utils17 = require("@typescript-eslint/utils");
|
|
3481
|
-
var
|
|
3488
|
+
var NO_JSON_STRINGIFY_ERROR_DOCUMENTATION = {
|
|
3482
3489
|
summary: "Disallow `JSON.stringify` on an Error value; it yields `{}` because `message`/`stack` are non-enumerable.",
|
|
3483
3490
|
rationale: "Native Error details are non-enumerable, so generic JSON serialization discards diagnostic information.",
|
|
3484
3491
|
remediation: "Serialize explicit error fields or use an error-aware serializer.",
|
|
@@ -3671,7 +3678,7 @@ function memberSuggestsError(member, scope) {
|
|
|
3671
3678
|
}
|
|
3672
3679
|
var no_json_stringify_error_default = createRule({
|
|
3673
3680
|
name: "no-json-stringify-error",
|
|
3674
|
-
documentation:
|
|
3681
|
+
documentation: NO_JSON_STRINGIFY_ERROR_DOCUMENTATION,
|
|
3675
3682
|
meta: {
|
|
3676
3683
|
type: "problem",
|
|
3677
3684
|
docs: {
|
|
@@ -3713,15 +3720,13 @@ var no_json_stringify_error_default = createRule({
|
|
|
3713
3720
|
var import_utils18 = require("@typescript-eslint/utils");
|
|
3714
3721
|
|
|
3715
3722
|
// src/rules/_zod.ts
|
|
3716
|
-
var ZOD_PREFIX_RE = /^Z[A-Z]/;
|
|
3717
|
-
var ZOD_SUFFIX_RE = /Schema$/;
|
|
3718
3723
|
var ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;
|
|
3719
3724
|
function isZodModule(source) {
|
|
3720
3725
|
return /(^|[/@-])zod([/-]|$)/.test(source);
|
|
3721
3726
|
}
|
|
3722
3727
|
|
|
3723
3728
|
// src/rules/no-impossible-zod-literal-bounds.ts
|
|
3724
|
-
var
|
|
3729
|
+
var NO_IMPOSSIBLE_ZOD_LITERAL_BOUNDS_DOCUMENTATION = {
|
|
3725
3730
|
summary: "Disallow same-chain literal Zod bounds whose accepted set is mathematically empty.",
|
|
3726
3731
|
rationale: "A schema with contradictory literal bounds rejects every input, turning validation into an unreachable contract that usually reflects a typo.",
|
|
3727
3732
|
remediation: "Choose compatible lower and upper bounds, or remove the constraint that does not express the intended domain.",
|
|
@@ -3825,7 +3830,7 @@ function isOutermostCall(node) {
|
|
|
3825
3830
|
}
|
|
3826
3831
|
var no_impossible_zod_literal_bounds_default = createRule({
|
|
3827
3832
|
name: "no-impossible-zod-literal-bounds",
|
|
3828
|
-
documentation:
|
|
3833
|
+
documentation: NO_IMPOSSIBLE_ZOD_LITERAL_BOUNDS_DOCUMENTATION,
|
|
3829
3834
|
meta: {
|
|
3830
3835
|
type: "problem",
|
|
3831
3836
|
docs: {
|
|
@@ -4104,7 +4109,7 @@ function convertibleMemberName(member) {
|
|
|
4104
4109
|
}
|
|
4105
4110
|
|
|
4106
4111
|
// src/rules/interface-contract-members-private.ts
|
|
4107
|
-
var
|
|
4112
|
+
var INTERFACE_CONTRACT_MEMBERS_PRIVATE_DOCUMENTATION = {
|
|
4108
4113
|
summary: "Require methods outside an implemented interface contract to use ECMAScript private names.",
|
|
4109
4114
|
rationale: "An implementing class should expose exactly its declared interface while keeping implementation helpers runtime-private.",
|
|
4110
4115
|
remediation: "Add the method to the interface when it is public API, or make it `#private` and remove external or inherited access.",
|
|
@@ -4183,7 +4188,7 @@ function interfaceNames(services, owner) {
|
|
|
4183
4188
|
}
|
|
4184
4189
|
var interface_contract_members_private_default = createRule({
|
|
4185
4190
|
name: "interface-contract-members-private",
|
|
4186
|
-
documentation:
|
|
4191
|
+
documentation: INTERFACE_CONTRACT_MEMBERS_PRIVATE_DOCUMENTATION,
|
|
4187
4192
|
meta: {
|
|
4188
4193
|
type: "problem",
|
|
4189
4194
|
docs: { description: "Require methods outside an implemented interface contract to use ECMAScript private names." },
|
|
@@ -4315,7 +4320,7 @@ function createLogMatcher(options = {}) {
|
|
|
4315
4320
|
}
|
|
4316
4321
|
|
|
4317
4322
|
// src/rules/no-log-only-catch.ts
|
|
4318
|
-
var
|
|
4323
|
+
var NO_LOG_ONLY_CATCH_DOCUMENTATION = {
|
|
4319
4324
|
summary: "Disallow `catch` clauses that only log (or silently do nothing) and then swallow the error; rethrow or handle it instead.",
|
|
4320
4325
|
rationale: "Swallowing an exception after logging lets execution continue as if the operation succeeded.",
|
|
4321
4326
|
remediation: "Rethrow the error, return an explicit fallback, or perform concrete recovery.",
|
|
@@ -4413,7 +4418,7 @@ function isSeedValue(node) {
|
|
|
4413
4418
|
}
|
|
4414
4419
|
var no_log_only_catch_default = createRule({
|
|
4415
4420
|
name: "no-log-only-catch",
|
|
4416
|
-
documentation:
|
|
4421
|
+
documentation: NO_LOG_ONLY_CATCH_DOCUMENTATION,
|
|
4417
4422
|
meta: {
|
|
4418
4423
|
type: "problem",
|
|
4419
4424
|
docs: {
|
|
@@ -4488,7 +4493,7 @@ var no_log_only_catch_default = createRule({
|
|
|
4488
4493
|
|
|
4489
4494
|
// src/rules/no-bare-return-from-test-catch.ts
|
|
4490
4495
|
var import_utils23 = require("@typescript-eslint/utils");
|
|
4491
|
-
var
|
|
4496
|
+
var NO_BARE_RETURN_FROM_TEST_CATCH_DOCUMENTATION = {
|
|
4492
4497
|
summary: "Disallow a bare return from a test catch block when it skips a later assertion.",
|
|
4493
4498
|
rationale: "The caught failure turns into a passing test without executing the assertion that follows it.",
|
|
4494
4499
|
remediation: "Rethrow the error, assert on it, or use the runner's explicit skip mechanism when the capability is optional.",
|
|
@@ -4572,7 +4577,7 @@ function isExplicitSkip(node, context) {
|
|
|
4572
4577
|
}
|
|
4573
4578
|
var no_bare_return_from_test_catch_default = createRule({
|
|
4574
4579
|
name: "no-bare-return-from-test-catch",
|
|
4575
|
-
documentation:
|
|
4580
|
+
documentation: NO_BARE_RETURN_FROM_TEST_CATCH_DOCUMENTATION,
|
|
4576
4581
|
meta: {
|
|
4577
4582
|
type: "problem",
|
|
4578
4583
|
docs: { description: "Disallow a bare return from a test catch block when it skips a later assertion." },
|
|
@@ -4716,7 +4721,7 @@ function typedFunction(node) {
|
|
|
4716
4721
|
}
|
|
4717
4722
|
|
|
4718
4723
|
// src/rules/no-long-comment.ts
|
|
4719
|
-
var
|
|
4724
|
+
var NO_LONG_COMMENT_DOCUMENTATION = {
|
|
4720
4725
|
summary: "Flag unusually large unstructured JSDoc blocks in implementation code.",
|
|
4721
4726
|
rationale: "Large narrative comments become stale and obscure the local facts that belong beside the code.",
|
|
4722
4727
|
remediation: "Keep only durable local constraints and express the remaining behavior in code.",
|
|
@@ -4789,7 +4794,7 @@ function wordUnits(text) {
|
|
|
4789
4794
|
}
|
|
4790
4795
|
var no_long_comment_default = createRule({
|
|
4791
4796
|
name: "no-long-comment",
|
|
4792
|
-
documentation:
|
|
4797
|
+
documentation: NO_LONG_COMMENT_DOCUMENTATION,
|
|
4793
4798
|
meta: {
|
|
4794
4799
|
type: "suggestion",
|
|
4795
4800
|
docs: { description: "Flag unusually large unstructured JSDoc blocks in implementation code." },
|
|
@@ -4816,7 +4821,7 @@ var no_long_comment_default = createRule({
|
|
|
4816
4821
|
// src/rules/no-vague-suppression-description.ts
|
|
4817
4822
|
var DIRECTIVE_WITH_DESCRIPTION_RE = /^(?:eslint-(?:disable|disable-next-line|disable-line)\b[^:\n]*?|@ts-expect-error\b)\s*(?::|--)\s*(.+?)\s*$/iu;
|
|
4818
4823
|
var VAGUE_RE = /^(?:needed|required|intentional(?:ly)?|ignore(?:d)?|false positive|type error|typescript|to satisfy (?:the )?(?:linter|typescript|type checker))\.?$/iu;
|
|
4819
|
-
var
|
|
4824
|
+
var NO_VAGUE_SUPPRESSION_DESCRIPTION_DOCUMENTATION = {
|
|
4820
4825
|
summary: "Require suppression descriptions to name the concrete mismatch or invariant instead of a generic non-reason.",
|
|
4821
4826
|
rationale: "Generic phrases satisfy require-description mechanically while leaving reviewers unable to audit the risk or remove stale debt.",
|
|
4822
4827
|
remediation: "Name the exact type/runtime mismatch, external contract, or safety invariant that makes this suppression acceptable.",
|
|
@@ -4859,7 +4864,7 @@ var noVagueSuppressionDescriptionDocumentation = {
|
|
|
4859
4864
|
};
|
|
4860
4865
|
var no_vague_suppression_description_default = createRule({
|
|
4861
4866
|
name: "no-vague-suppression-description",
|
|
4862
|
-
documentation:
|
|
4867
|
+
documentation: NO_VAGUE_SUPPRESSION_DESCRIPTION_DOCUMENTATION,
|
|
4863
4868
|
meta: {
|
|
4864
4869
|
type: "suggestion",
|
|
4865
4870
|
docs: {
|
|
@@ -4894,7 +4899,7 @@ var no_vague_suppression_description_default = createRule({
|
|
|
4894
4899
|
|
|
4895
4900
|
// src/rules/no-generic-single-export-module.ts
|
|
4896
4901
|
var import_utils26 = require("@typescript-eslint/utils");
|
|
4897
|
-
var
|
|
4902
|
+
var NO_GENERIC_SINGLE_EXPORT_MODULE_DOCUMENTATION = {
|
|
4898
4903
|
summary: "Disallow generic module stems when one runtime export already names the responsibility.",
|
|
4899
4904
|
rationale: "A generic filename hides the sole exported responsibility and makes navigation less descriptive.",
|
|
4900
4905
|
remediation: "Choose a responsibility-bearing module name or colocate the export with its domain.",
|
|
@@ -5032,7 +5037,7 @@ function memberPropertyName(node) {
|
|
|
5032
5037
|
}
|
|
5033
5038
|
var no_generic_single_export_module_default = createRule({
|
|
5034
5039
|
name: "no-generic-single-export-module",
|
|
5035
|
-
documentation:
|
|
5040
|
+
documentation: NO_GENERIC_SINGLE_EXPORT_MODULE_DOCUMENTATION,
|
|
5036
5041
|
meta: {
|
|
5037
5042
|
type: "suggestion",
|
|
5038
5043
|
docs: { description: "Disallow generic module stems when one runtime export already names the responsibility." },
|
|
@@ -5079,7 +5084,7 @@ var no_generic_single_export_module_default = createRule({
|
|
|
5079
5084
|
|
|
5080
5085
|
// src/rules/no-offset-pagination.ts
|
|
5081
5086
|
var import_utils27 = require("@typescript-eslint/utils");
|
|
5082
|
-
var
|
|
5087
|
+
var NO_OFFSET_PAGINATION_DOCUMENTATION = {
|
|
5083
5088
|
summary: "Disallow OFFSET pagination in embedded SQL; it is O(N) per page and drops or repeats rows under concurrent writes. Use a keyset cursor.",
|
|
5084
5089
|
rationale: "Offset pagination scans skipped rows and shifts page boundaries under concurrent writes.",
|
|
5085
5090
|
remediation: "Page with a stable ordered key and a cursor predicate.",
|
|
@@ -5094,7 +5099,7 @@ var OFFSET_PAGINATION = /\bOFFSET\s+(?:%s|%\(\w+\)s|\?\d*|:\w+|@\w+|\$\d+|\d+)/i
|
|
|
5094
5099
|
var OFFSET_GATE = /offset/i;
|
|
5095
5100
|
var no_offset_pagination_default = createRule({
|
|
5096
5101
|
name: "no-offset-pagination",
|
|
5097
|
-
documentation:
|
|
5102
|
+
documentation: NO_OFFSET_PAGINATION_DOCUMENTATION,
|
|
5098
5103
|
meta: {
|
|
5099
5104
|
type: "problem",
|
|
5100
5105
|
docs: {
|
|
@@ -5121,7 +5126,7 @@ var no_offset_pagination_default = createRule({
|
|
|
5121
5126
|
|
|
5122
5127
|
// src/rules/no-positional-tuple-return.ts
|
|
5123
5128
|
var import_utils28 = require("@typescript-eslint/utils");
|
|
5124
|
-
var
|
|
5129
|
+
var NO_POSITIONAL_TUPLE_RETURN_DOCUMENTATION = {
|
|
5125
5130
|
summary: "Disallow returning a multi-field tuple from a named function; return a named object so call sites cannot mismatch slots.",
|
|
5126
5131
|
rationale: "Tuple fields are identified only by position, so reordering can preserve types while changing meaning.",
|
|
5127
5132
|
remediation: "Return an object whose property names describe each value.",
|
|
@@ -5365,7 +5370,7 @@ function isExportedInterface(node, exports2) {
|
|
|
5365
5370
|
}
|
|
5366
5371
|
var no_positional_tuple_return_default = createRule({
|
|
5367
5372
|
name: "no-positional-tuple-return",
|
|
5368
|
-
documentation:
|
|
5373
|
+
documentation: NO_POSITIONAL_TUPLE_RETURN_DOCUMENTATION,
|
|
5369
5374
|
meta: {
|
|
5370
5375
|
type: "suggestion",
|
|
5371
5376
|
docs: {
|
|
@@ -5494,7 +5499,7 @@ var no_positional_tuple_return_default = createRule({
|
|
|
5494
5499
|
// src/rules/no-production-browser-source-maps.ts
|
|
5495
5500
|
var import_utils29 = require("@typescript-eslint/utils");
|
|
5496
5501
|
var NEXT_CONFIG_RE2 = /(?:^|\/)next\.config\.[cm]?[jt]s$/;
|
|
5497
|
-
var
|
|
5502
|
+
var NO_PRODUCTION_BROWSER_SOURCE_MAPS_DOCUMENTATION = {
|
|
5498
5503
|
summary: "Next.js production browser source maps expose application source",
|
|
5499
5504
|
rationale: "Next.js production browser source maps publish original client source and implementation details to every browser that can load the deployment.",
|
|
5500
5505
|
remediation: "Leave productionBrowserSourceMaps disabled and upload private source maps directly to the error-monitoring service during the build.",
|
|
@@ -5530,10 +5535,10 @@ function propertyName2(node) {
|
|
|
5530
5535
|
}
|
|
5531
5536
|
var no_production_browser_source_maps_default = createRule({
|
|
5532
5537
|
name: "no-production-browser-source-maps",
|
|
5533
|
-
documentation:
|
|
5538
|
+
documentation: NO_PRODUCTION_BROWSER_SOURCE_MAPS_DOCUMENTATION,
|
|
5534
5539
|
meta: {
|
|
5535
5540
|
type: "problem",
|
|
5536
|
-
docs: { description:
|
|
5541
|
+
docs: { description: NO_PRODUCTION_BROWSER_SOURCE_MAPS_DOCUMENTATION.summary },
|
|
5537
5542
|
schema: [],
|
|
5538
5543
|
messages: {
|
|
5539
5544
|
noProductionBrowserSourceMaps: "Do not publish production browser source maps. Upload private maps to your monitoring service instead."
|
|
@@ -5554,7 +5559,7 @@ var no_production_browser_source_maps_default = createRule({
|
|
|
5554
5559
|
|
|
5555
5560
|
// src/rules/no-raw-env.ts
|
|
5556
5561
|
var import_utils30 = require("@typescript-eslint/utils");
|
|
5557
|
-
var
|
|
5562
|
+
var NO_RAW_ENV_DOCUMENTATION = {
|
|
5558
5563
|
summary: "Disallow direct `process.env` and `import.meta.env` reads outside validated boundaries.",
|
|
5559
5564
|
rationale: "Raw environment reads are untyped and defer invalid configuration failures until use.",
|
|
5560
5565
|
remediation: "Validate environment values at startup and import the typed configuration object.",
|
|
@@ -5611,7 +5616,7 @@ function isWholeEnvSpread(node) {
|
|
|
5611
5616
|
}
|
|
5612
5617
|
var no_raw_env_default = createRule({
|
|
5613
5618
|
name: "no-raw-env",
|
|
5614
|
-
documentation:
|
|
5619
|
+
documentation: NO_RAW_ENV_DOCUMENTATION,
|
|
5615
5620
|
meta: {
|
|
5616
5621
|
type: "problem",
|
|
5617
5622
|
docs: {
|
|
@@ -5643,7 +5648,7 @@ var no_raw_env_default = createRule({
|
|
|
5643
5648
|
|
|
5644
5649
|
// src/rules/no-raw-fetch-outside-clients.ts
|
|
5645
5650
|
var import_utils31 = require("@typescript-eslint/utils");
|
|
5646
|
-
var
|
|
5651
|
+
var NO_RAW_FETCH_OUTSIDE_CLIENTS_DOCUMENTATION = {
|
|
5647
5652
|
summary: "Disallow calling the global `fetch` outside the client layer; route outbound HTTP through a client module that owns retry, timeout and status handling.",
|
|
5648
5653
|
rationale: "Scattered fetch calls bypass shared transport policy and are harder to stub and observe consistently.",
|
|
5649
5654
|
remediation: "Move the request into a client module and call that abstraction from application code.",
|
|
@@ -5775,7 +5780,7 @@ function compile(patterns) {
|
|
|
5775
5780
|
}
|
|
5776
5781
|
var no_raw_fetch_outside_clients_default = createRule({
|
|
5777
5782
|
name: "no-raw-fetch-outside-clients",
|
|
5778
|
-
documentation:
|
|
5783
|
+
documentation: NO_RAW_FETCH_OUTSIDE_CLIENTS_DOCUMENTATION,
|
|
5779
5784
|
meta: {
|
|
5780
5785
|
type: "problem",
|
|
5781
5786
|
docs: {
|
|
@@ -5905,7 +5910,7 @@ var no_raw_fetch_outside_clients_default = createRule({
|
|
|
5905
5910
|
|
|
5906
5911
|
// src/rules/no-restricted-library-load.ts
|
|
5907
5912
|
var import_utils32 = require("@typescript-eslint/utils");
|
|
5908
|
-
var
|
|
5913
|
+
var NO_RESTRICTED_LIBRARY_LOAD_DOCUMENTATION = {
|
|
5909
5914
|
summary: "Apply a configured library-replacement policy to literal dynamic imports, CommonJS loads, and TypeScript import-equals declarations.",
|
|
5910
5915
|
rationale: "Runtime module loads can bypass the replacement policy enforced for static imports.",
|
|
5911
5916
|
remediation: "Load the configured replacement library instead of the restricted module.",
|
|
@@ -5924,7 +5929,7 @@ function matchesModule(source, module2) {
|
|
|
5924
5929
|
}
|
|
5925
5930
|
var no_restricted_library_load_default = createRule({
|
|
5926
5931
|
name: "no-restricted-library-load",
|
|
5927
|
-
documentation:
|
|
5932
|
+
documentation: NO_RESTRICTED_LIBRARY_LOAD_DOCUMENTATION,
|
|
5928
5933
|
meta: {
|
|
5929
5934
|
type: "problem",
|
|
5930
5935
|
docs: {
|
|
@@ -6010,7 +6015,7 @@ var no_restricted_library_load_default = createRule({
|
|
|
6010
6015
|
|
|
6011
6016
|
// src/rules/no-router-refresh-polling.ts
|
|
6012
6017
|
var import_utils33 = require("@typescript-eslint/utils");
|
|
6013
|
-
var
|
|
6018
|
+
var NO_ROUTER_REFRESH_POLLING_DOCUMENTATION = {
|
|
6014
6019
|
summary: "Do not poll by calling a Next.js router's refresh method from a timer.",
|
|
6015
6020
|
rationale: "A route refresh refetches and rerenders the whole route on every tick instead of loading the named resource that changed.",
|
|
6016
6021
|
remediation: "Call the dedicated fetch or server action from the timer and keep the polling interval in a named constant.",
|
|
@@ -6043,7 +6048,7 @@ function isUnshadowedGlobal2(sourceCode, node) {
|
|
|
6043
6048
|
}
|
|
6044
6049
|
var no_router_refresh_polling_default = createRule({
|
|
6045
6050
|
name: "no-router-refresh-polling",
|
|
6046
|
-
documentation:
|
|
6051
|
+
documentation: NO_ROUTER_REFRESH_POLLING_DOCUMENTATION,
|
|
6047
6052
|
meta: {
|
|
6048
6053
|
type: "suggestion",
|
|
6049
6054
|
docs: { description: "Do not poll by calling a Next.js router's refresh method from a timer." },
|
|
@@ -6103,7 +6108,7 @@ var FUNCTION_TYPES4 = /* @__PURE__ */ new Set([
|
|
|
6103
6108
|
import_utils34.AST_NODE_TYPES.FunctionExpression,
|
|
6104
6109
|
import_utils34.AST_NODE_TYPES.ArrowFunctionExpression
|
|
6105
6110
|
]);
|
|
6106
|
-
var
|
|
6111
|
+
var NO_REPEATED_STRING_LITERAL_DOCUMENTATION = {
|
|
6107
6112
|
summary: "Disallow a long structured string literal repeated across functions; the copies drift when one is edited. Extract a module-level constant.",
|
|
6108
6113
|
rationale: "Independent copies of a query, route template, or identifier can diverge and silently change behavior.",
|
|
6109
6114
|
remediation: "Extract the repeated value to one module-level constant and reference it from each function.",
|
|
@@ -6140,7 +6145,7 @@ function isScaffolding(node) {
|
|
|
6140
6145
|
}
|
|
6141
6146
|
var no_repeated_string_literal_default = createRule({
|
|
6142
6147
|
name: "no-repeated-string-literal",
|
|
6143
|
-
documentation:
|
|
6148
|
+
documentation: NO_REPEATED_STRING_LITERAL_DOCUMENTATION,
|
|
6144
6149
|
meta: {
|
|
6145
6150
|
type: "suggestion",
|
|
6146
6151
|
docs: {
|
|
@@ -6258,7 +6263,7 @@ var NON_ASCII_LETTER_RE = /[^\p{ASCII}\p{N}\p{P}\p{Z}]/u;
|
|
|
6258
6263
|
var WALL_NARRATION_RE2 = /^(?:(?:\d+[.)]|(?:phase|step)\s+\d+\s*:?)\s*)?(?:add|build|call|check|compute|copy|count|create|fetch|filter|find|get|handle|load|map|merge|parse|process|read|remove|return|save|send|set|sort|store|update|validate|write)(?:s|es|d|ed|ing)?\b/i;
|
|
6259
6264
|
var WALL_CLUSTER_MAX_LINE_GAP = 8;
|
|
6260
6265
|
var WALL_CLUSTER_MIN_COMMENTS = 3;
|
|
6261
|
-
var
|
|
6266
|
+
var NO_RESTATED_COMMENT_DOCUMENTATION = {
|
|
6262
6267
|
summary: "Flag a single-line comment whose every word already appears on the statement below it.",
|
|
6263
6268
|
rationale: "A comment that only repeats code adds no context and can become stale independently.",
|
|
6264
6269
|
remediation: "Delete the comment or replace it with the reason, constraint, or consequence absent from the code.",
|
|
@@ -6284,7 +6289,7 @@ function headsSiblingRun(node) {
|
|
|
6284
6289
|
}
|
|
6285
6290
|
var no_restated_comment_default = createRule({
|
|
6286
6291
|
name: "no-restated-comment",
|
|
6287
|
-
documentation:
|
|
6292
|
+
documentation: NO_RESTATED_COMMENT_DOCUMENTATION,
|
|
6288
6293
|
meta: {
|
|
6289
6294
|
type: "suggestion",
|
|
6290
6295
|
hasSuggestions: true,
|
|
@@ -6382,7 +6387,7 @@ var no_restated_comment_default = createRule({
|
|
|
6382
6387
|
|
|
6383
6388
|
// src/rules/no-restated-jsdoc.ts
|
|
6384
6389
|
var import_utils37 = require("@typescript-eslint/utils");
|
|
6385
|
-
var
|
|
6390
|
+
var NO_RESTATED_JSDOC_DOCUMENTATION = {
|
|
6386
6391
|
summary: "Flag a JSDoc block whose description and tags only re-spell the signature they document.",
|
|
6387
6392
|
rationale: "Signature-only JSDoc duplicates type information and drifts without helping callers.",
|
|
6388
6393
|
remediation: "Delete the block or document behavior, constraints, failures, or context the signature cannot express.",
|
|
@@ -6494,7 +6499,7 @@ function tokensOf(names) {
|
|
|
6494
6499
|
}
|
|
6495
6500
|
var no_restated_jsdoc_default = createRule({
|
|
6496
6501
|
name: "no-restated-jsdoc",
|
|
6497
|
-
documentation:
|
|
6502
|
+
documentation: NO_RESTATED_JSDOC_DOCUMENTATION,
|
|
6498
6503
|
meta: {
|
|
6499
6504
|
type: "suggestion",
|
|
6500
6505
|
hasSuggestions: true,
|
|
@@ -6737,7 +6742,7 @@ function isAuthSecretName(identifier) {
|
|
|
6737
6742
|
}
|
|
6738
6743
|
|
|
6739
6744
|
// src/rules/no-secret-in-log.ts
|
|
6740
|
-
var
|
|
6745
|
+
var NO_SECRET_IN_LOG_DOCUMENTATION = {
|
|
6741
6746
|
summary: "Disallow passing a secret-named value or a raw request/response blob to a logging call; both leak to log sinks. Redact or omit.",
|
|
6742
6747
|
rationale: "Logs are widely retained and distributed, so credentials and raw bodies can become durable data leaks.",
|
|
6743
6748
|
remediation: "Omit the value or log an explicitly redacted, truncated, or derived non-sensitive field.",
|
|
@@ -6872,7 +6877,7 @@ function propertyKeyName2(prop) {
|
|
|
6872
6877
|
}
|
|
6873
6878
|
var no_secret_in_log_default = createRule({
|
|
6874
6879
|
name: "no-secret-in-log",
|
|
6875
|
-
documentation:
|
|
6880
|
+
documentation: NO_SECRET_IN_LOG_DOCUMENTATION,
|
|
6876
6881
|
meta: {
|
|
6877
6882
|
type: "problem",
|
|
6878
6883
|
docs: {
|
|
@@ -6948,7 +6953,7 @@ var no_secret_in_log_default = createRule({
|
|
|
6948
6953
|
// src/rules/no-server-env-in-client-component.ts
|
|
6949
6954
|
var import_utils39 = require("@typescript-eslint/utils");
|
|
6950
6955
|
var SERVER_ENV_MODULE_RE = /(?:^|\/)(?:server-env|server-settings)(?:\.[cm]?[jt]sx?)?$/;
|
|
6951
|
-
var
|
|
6956
|
+
var NO_SERVER_ENV_IN_CLIENT_COMPONENT_DOCUMENTATION = {
|
|
6952
6957
|
summary: "server-only environment settings imported by a client component",
|
|
6953
6958
|
rationale: "Next.js client modules run in the browser, where server-only environment values are unavailable; importing a server settings module can produce undefined configuration or bundle a secret-bearing module into the client graph.",
|
|
6954
6959
|
remediation: "Pass an explicitly public value from a Server Component, or import it from a separately validated client-settings module backed only by NEXT_PUBLIC_* values.",
|
|
@@ -6999,10 +7004,10 @@ function isTypeOnlyImport(node) {
|
|
|
6999
7004
|
}
|
|
7000
7005
|
var no_server_env_in_client_component_default = createRule({
|
|
7001
7006
|
name: "no-server-env-in-client-component",
|
|
7002
|
-
documentation:
|
|
7007
|
+
documentation: NO_SERVER_ENV_IN_CLIENT_COMPONENT_DOCUMENTATION,
|
|
7003
7008
|
meta: {
|
|
7004
7009
|
type: "problem",
|
|
7005
|
-
docs: { description:
|
|
7010
|
+
docs: { description: NO_SERVER_ENV_IN_CLIENT_COMPONENT_DOCUMENTATION.summary },
|
|
7006
7011
|
schema: [],
|
|
7007
7012
|
messages: {
|
|
7008
7013
|
noServerEnvInClientComponent: "A 'use client' module cannot import server-only settings. Pass public data from a Server Component or use a validated client-settings module."
|
|
@@ -7026,7 +7031,7 @@ var no_server_env_in_client_component_default = createRule({
|
|
|
7026
7031
|
|
|
7027
7032
|
// src/rules/no-select-star.ts
|
|
7028
7033
|
var import_utils40 = require("@typescript-eslint/utils");
|
|
7029
|
-
var
|
|
7034
|
+
var NO_SELECT_STAR_DOCUMENTATION = {
|
|
7030
7035
|
summary: "Disallow SELECT * in embedded SQL; it over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently.",
|
|
7031
7036
|
rationale: "Wildcard projections couple row shape and query cost to unrelated schema changes.",
|
|
7032
7037
|
remediation: "List every required column explicitly in the projection.",
|
|
@@ -7078,7 +7083,7 @@ function isProjectionStar(sql, pos) {
|
|
|
7078
7083
|
}
|
|
7079
7084
|
var no_select_star_default = createRule({
|
|
7080
7085
|
name: "no-select-star",
|
|
7081
|
-
documentation:
|
|
7086
|
+
documentation: NO_SELECT_STAR_DOCUMENTATION,
|
|
7082
7087
|
meta: {
|
|
7083
7088
|
type: "problem",
|
|
7084
7089
|
docs: {
|
|
@@ -7105,7 +7110,7 @@ var no_select_star_default = createRule({
|
|
|
7105
7110
|
|
|
7106
7111
|
// src/rules/no-sentinel-return-on-catch.ts
|
|
7107
7112
|
var import_utils41 = require("@typescript-eslint/utils");
|
|
7108
|
-
var
|
|
7113
|
+
var NO_SENTINEL_RETURN_ON_CATCH_DOCUMENTATION = {
|
|
7109
7114
|
summary: "Disallow swallowing a caught error by returning an empty sentinel unless the error is handled or the sentinel is part of the function contract.",
|
|
7110
7115
|
rationale: "An unreported fallback makes operational failure indistinguishable from a legitimate empty result.",
|
|
7111
7116
|
remediation: "Rethrow, report the error before returning, or model expected absence with an explicit predicate, safe-parse, or result contract.",
|
|
@@ -7477,7 +7482,7 @@ function isWithin(node, ancestor) {
|
|
|
7477
7482
|
}
|
|
7478
7483
|
var no_sentinel_return_on_catch_default = createRule({
|
|
7479
7484
|
name: "no-sentinel-return-on-catch",
|
|
7480
|
-
documentation:
|
|
7485
|
+
documentation: NO_SENTINEL_RETURN_ON_CATCH_DOCUMENTATION,
|
|
7481
7486
|
meta: {
|
|
7482
7487
|
type: "problem",
|
|
7483
7488
|
docs: {
|
|
@@ -7559,7 +7564,7 @@ var no_sentinel_return_on_catch_default = createRule({
|
|
|
7559
7564
|
|
|
7560
7565
|
// src/rules/no-silent-promise-catch.ts
|
|
7561
7566
|
var import_utils42 = require("@typescript-eslint/utils");
|
|
7562
|
-
var
|
|
7567
|
+
var NO_SILENT_PROMISE_CATCH_DOCUMENTATION = {
|
|
7563
7568
|
summary: "Disallow `.catch()` and second-argument `.then()` handlers that silently swallow a rejection; log, rethrow, or handle the error.",
|
|
7564
7569
|
rationale: "A swallowed rejection hides failures and gives callers an indistinguishable fallback value.",
|
|
7565
7570
|
remediation: "Log, rethrow, or explicitly recover from the rejection; explain intentional teardown suppression.",
|
|
@@ -7635,7 +7640,7 @@ function isSilentExpression(node) {
|
|
|
7635
7640
|
}
|
|
7636
7641
|
var no_silent_promise_catch_default = createRule({
|
|
7637
7642
|
name: "no-silent-promise-catch",
|
|
7638
|
-
documentation:
|
|
7643
|
+
documentation: NO_SILENT_PROMISE_CATCH_DOCUMENTATION,
|
|
7639
7644
|
meta: {
|
|
7640
7645
|
type: "problem",
|
|
7641
7646
|
docs: {
|
|
@@ -7708,7 +7713,7 @@ var no_silent_promise_catch_default = createRule({
|
|
|
7708
7713
|
|
|
7709
7714
|
// src/rules/no-sleep-in-test-body.ts
|
|
7710
7715
|
var import_utils43 = require("@typescript-eslint/utils");
|
|
7711
|
-
var
|
|
7716
|
+
var NO_SLEEP_IN_TEST_BODY_DOCUMENTATION = {
|
|
7712
7717
|
summary: "Disallow a fixed timed sleep directly in a test body; it flakes under CI load. Synchronize on the signal or use fake timers.",
|
|
7713
7718
|
rationale: "Wall-clock delays make test correctness depend on scheduler and machine speed.",
|
|
7714
7719
|
remediation: "Await the observable signal or advance deterministic fake timers.",
|
|
@@ -7802,7 +7807,7 @@ function testCallerName(callee) {
|
|
|
7802
7807
|
}
|
|
7803
7808
|
var no_sleep_in_test_body_default = createRule({
|
|
7804
7809
|
name: "no-sleep-in-test-body",
|
|
7805
|
-
documentation:
|
|
7810
|
+
documentation: NO_SLEEP_IN_TEST_BODY_DOCUMENTATION,
|
|
7806
7811
|
meta: {
|
|
7807
7812
|
type: "problem",
|
|
7808
7813
|
docs: {
|
|
@@ -7851,7 +7856,7 @@ var DEFAULT_METHODS2 = [
|
|
|
7851
7856
|
"getWithMetadata"
|
|
7852
7857
|
];
|
|
7853
7858
|
var MIN_ARGUMENTS = /* @__PURE__ */ new Map([["put", 2]]);
|
|
7854
|
-
var
|
|
7859
|
+
var NO_STORAGE_IN_STATELESS_MODULES_DOCUMENTATION = {
|
|
7855
7860
|
summary: "Disallow SQL or key/value access inside configured stateless modules; derive state from a system of record instead.",
|
|
7856
7861
|
rationale: "Private storage in a stateless workflow creates another source of truth that can silently diverge.",
|
|
7857
7862
|
remediation: "Read from the system of record or derive state from an artifact the workflow already produces.",
|
|
@@ -7914,7 +7919,7 @@ function identifierWords(name) {
|
|
|
7914
7919
|
}
|
|
7915
7920
|
var no_storage_in_stateless_modules_default = createRule({
|
|
7916
7921
|
name: "no-storage-in-stateless-modules",
|
|
7917
|
-
documentation:
|
|
7922
|
+
documentation: NO_STORAGE_IN_STATELESS_MODULES_DOCUMENTATION,
|
|
7918
7923
|
meta: {
|
|
7919
7924
|
type: "problem",
|
|
7920
7925
|
docs: {
|
|
@@ -7973,7 +7978,7 @@ var no_storage_in_stateless_modules_default = createRule({
|
|
|
7973
7978
|
|
|
7974
7979
|
// src/rules/no-string-concat-in-loop.ts
|
|
7975
7980
|
var import_utils45 = require("@typescript-eslint/utils");
|
|
7976
|
-
var
|
|
7981
|
+
var NO_STRING_CONCAT_IN_LOOP_DOCUMENTATION = {
|
|
7977
7982
|
summary: "Disallow O(n^2) string building via `+=` on a string variable inside a loop; push parts to an array and `join` instead.",
|
|
7978
7983
|
rationale: "Repeatedly rebuilding a growing string can copy all prior content on each iteration, making total work grow quadratically.",
|
|
7979
7984
|
remediation: "Collect each fragment in an array, then join the fragments after the loop.",
|
|
@@ -8142,7 +8147,7 @@ function isStringSeededReduce(node) {
|
|
|
8142
8147
|
}
|
|
8143
8148
|
var no_string_concat_in_loop_default = createRule({
|
|
8144
8149
|
name: "no-string-concat-in-loop",
|
|
8145
|
-
documentation:
|
|
8150
|
+
documentation: NO_STRING_CONCAT_IN_LOOP_DOCUMENTATION,
|
|
8146
8151
|
meta: {
|
|
8147
8152
|
type: "suggestion",
|
|
8148
8153
|
docs: {
|
|
@@ -8212,7 +8217,7 @@ var no_string_concat_in_loop_default = createRule({
|
|
|
8212
8217
|
|
|
8213
8218
|
// src/rules/no-tautological-expect.ts
|
|
8214
8219
|
var import_utils46 = require("@typescript-eslint/utils");
|
|
8215
|
-
var
|
|
8220
|
+
var NO_TAUTOLOGICAL_EXPECT_DOCUMENTATION = {
|
|
8216
8221
|
summary: "Disallow an assertion whose operands are all literals; its outcome is fixed before the code runs, so it can never fail.",
|
|
8217
8222
|
rationale: "An assertion determined entirely by literals does not observe the code under test and can keep passing after that code is removed.",
|
|
8218
8223
|
remediation: "Assert on a value produced by the behavior under test, or remove the assertion.",
|
|
@@ -8282,7 +8287,7 @@ function expectOperand(callee) {
|
|
|
8282
8287
|
}
|
|
8283
8288
|
var no_tautological_expect_default = createRule({
|
|
8284
8289
|
name: "no-tautological-expect",
|
|
8285
|
-
documentation:
|
|
8290
|
+
documentation: NO_TAUTOLOGICAL_EXPECT_DOCUMENTATION,
|
|
8286
8291
|
meta: {
|
|
8287
8292
|
type: "problem",
|
|
8288
8293
|
docs: {
|
|
@@ -8420,7 +8425,7 @@ function canonicalWord(word) {
|
|
|
8420
8425
|
if (word.endsWith("s") && word.length > 3) return word.slice(0, -1);
|
|
8421
8426
|
return word;
|
|
8422
8427
|
}
|
|
8423
|
-
var
|
|
8428
|
+
var NO_TYPED_DOC_SECTIONS_DOCUMENTATION = {
|
|
8424
8429
|
summary: "Reject typed-signature repetition while preserving behavior that types cannot express.",
|
|
8425
8430
|
rationale: "Parameter and return tags repeat typed signatures and can drift without adding runtime behavior or constraints.",
|
|
8426
8431
|
remediation: "Remove repeated parameter and return tags; retain documentation for behavior, failures, and external contracts.",
|
|
@@ -8449,7 +8454,7 @@ var noTypedDocSectionsDocumentation = {
|
|
|
8449
8454
|
};
|
|
8450
8455
|
var no_typed_doc_sections_default = createRule({
|
|
8451
8456
|
name: "no-typed-doc-sections",
|
|
8452
|
-
documentation:
|
|
8457
|
+
documentation: NO_TYPED_DOC_SECTIONS_DOCUMENTATION,
|
|
8453
8458
|
meta: {
|
|
8454
8459
|
type: "suggestion",
|
|
8455
8460
|
docs: { description: "Reject typed-signature repetition while preserving behavior that types cannot express." },
|
|
@@ -8474,7 +8479,7 @@ var no_typed_doc_sections_default = createRule({
|
|
|
8474
8479
|
|
|
8475
8480
|
// src/rules/no-trailing-value-narration.ts
|
|
8476
8481
|
var import_utils47 = require("@typescript-eslint/utils");
|
|
8477
|
-
var
|
|
8482
|
+
var NO_TRAILING_VALUE_NARRATION_DOCUMENTATION = {
|
|
8478
8483
|
summary: "Flag a trailing comment that repeats the line's numeric value only to name its unit.",
|
|
8479
8484
|
rationale: "A repeated value can disagree with the expression after either the code or comment changes.",
|
|
8480
8485
|
remediation: "Put the unit in the identifier and keep comments only when they explain a constraint or non-obvious conversion.",
|
|
@@ -8593,7 +8598,7 @@ function nameAlreadyCarriesUnit(code) {
|
|
|
8593
8598
|
}
|
|
8594
8599
|
var no_trailing_value_narration_default = createRule({
|
|
8595
8600
|
name: "no-trailing-value-narration",
|
|
8596
|
-
documentation:
|
|
8601
|
+
documentation: NO_TRAILING_VALUE_NARRATION_DOCUMENTATION,
|
|
8597
8602
|
meta: {
|
|
8598
8603
|
type: "suggestion",
|
|
8599
8604
|
hasSuggestions: true,
|
|
@@ -8787,7 +8792,7 @@ function bodyOf(member) {
|
|
|
8787
8792
|
}
|
|
8788
8793
|
|
|
8789
8794
|
// src/rules/no-declaration-comment-wall.ts
|
|
8790
|
-
var
|
|
8795
|
+
var NO_DECLARATION_COMMENT_WALL_DOCUMENTATION = {
|
|
8791
8796
|
summary: "Flag an enum body or class body whose member comments mostly re-spell the members' own names.",
|
|
8792
8797
|
rationale: "A dense block of repetitive member comments obscures the few comments that add information and drifts with renamed members.",
|
|
8793
8798
|
remediation: "Delete comments that restate member names and retain comments that explain constraints, lifecycle, or behavior.",
|
|
@@ -8829,7 +8834,7 @@ function named(node) {
|
|
|
8829
8834
|
}
|
|
8830
8835
|
var no_declaration_comment_wall_default = createRule({
|
|
8831
8836
|
name: "no-declaration-comment-wall",
|
|
8832
|
-
documentation:
|
|
8837
|
+
documentation: NO_DECLARATION_COMMENT_WALL_DOCUMENTATION,
|
|
8833
8838
|
meta: {
|
|
8834
8839
|
type: "suggestion",
|
|
8835
8840
|
docs: {
|
|
@@ -8929,7 +8934,7 @@ var no_declaration_comment_wall_default = createRule({
|
|
|
8929
8934
|
|
|
8930
8935
|
// src/rules/no-union-in-comment.ts
|
|
8931
8936
|
var import_utils50 = require("@typescript-eslint/utils");
|
|
8932
|
-
var
|
|
8937
|
+
var NO_UNION_IN_COMMENT_DOCUMENTATION = {
|
|
8933
8938
|
summary: "Flag a comment that lists a `string` field's allowed values instead of the type listing them.",
|
|
8934
8939
|
rationale: "A comment cannot prevent callers from supplying strings outside the listed set, and the list can drift from runtime behavior.",
|
|
8935
8940
|
remediation: "Move the allowed values into a string-literal union and remove the redundant comment.",
|
|
@@ -9044,7 +9049,7 @@ function unionLiterals(body2) {
|
|
|
9044
9049
|
}
|
|
9045
9050
|
var no_union_in_comment_default = createRule({
|
|
9046
9051
|
name: "no-union-in-comment",
|
|
9047
|
-
documentation:
|
|
9052
|
+
documentation: NO_UNION_IN_COMMENT_DOCUMENTATION,
|
|
9048
9053
|
meta: {
|
|
9049
9054
|
type: "suggestion",
|
|
9050
9055
|
docs: {
|
|
@@ -9105,7 +9110,7 @@ var no_union_in_comment_default = createRule({
|
|
|
9105
9110
|
|
|
9106
9111
|
// src/rules/no-type-member-comment-wall.ts
|
|
9107
9112
|
var import_utils51 = require("@typescript-eslint/utils");
|
|
9108
|
-
var
|
|
9113
|
+
var NO_TYPE_MEMBER_COMMENT_WALL_DOCUMENTATION = {
|
|
9109
9114
|
summary: "Flag an object type whose member comments mostly re-spell the members' own names and types.",
|
|
9110
9115
|
rationale: "Repetitive member comments add scanning cost while hiding the comments that describe facts absent from the type.",
|
|
9111
9116
|
remediation: "Delete comments that restate member names or types and keep comments that add constraints or behavior.",
|
|
@@ -9137,7 +9142,7 @@ function isNamedMember(node) {
|
|
|
9137
9142
|
}
|
|
9138
9143
|
var no_type_member_comment_wall_default = createRule({
|
|
9139
9144
|
name: "no-type-member-comment-wall",
|
|
9140
|
-
documentation:
|
|
9145
|
+
documentation: NO_TYPE_MEMBER_COMMENT_WALL_DOCUMENTATION,
|
|
9141
9146
|
meta: {
|
|
9142
9147
|
type: "suggestion",
|
|
9143
9148
|
docs: {
|
|
@@ -9230,7 +9235,7 @@ var no_type_member_comment_wall_default = createRule({
|
|
|
9230
9235
|
|
|
9231
9236
|
// src/rules/no-unnecessary-use-client.ts
|
|
9232
9237
|
var import_utils52 = require("@typescript-eslint/utils");
|
|
9233
|
-
var
|
|
9238
|
+
var NO_UNNECESSARY_USE_CLIENT_DOCUMENTATION = {
|
|
9234
9239
|
summary: "Flag `'use client'` files with no hooks or event handlers \u2014 they could be RSC.",
|
|
9235
9240
|
rationale: "An unnecessary client boundary sends the component and its transitive dependencies to the browser without using client-only behavior.",
|
|
9236
9241
|
remediation: "Remove the directive, or keep it only when the module uses a supported client-side API or boundary dependency.",
|
|
@@ -9343,7 +9348,7 @@ var isGlobalReference = (node, context) => {
|
|
|
9343
9348
|
};
|
|
9344
9349
|
var no_unnecessary_use_client_default = createRule({
|
|
9345
9350
|
name: "no-unnecessary-use-client",
|
|
9346
|
-
documentation:
|
|
9351
|
+
documentation: NO_UNNECESSARY_USE_CLIENT_DOCUMENTATION,
|
|
9347
9352
|
meta: {
|
|
9348
9353
|
type: "suggestion",
|
|
9349
9354
|
docs: {
|
|
@@ -9486,7 +9491,7 @@ var MOCK_MODULES = /* @__PURE__ */ new Set([
|
|
|
9486
9491
|
"jest-mock",
|
|
9487
9492
|
"@jest/globals"
|
|
9488
9493
|
]);
|
|
9489
|
-
var
|
|
9494
|
+
var NO_UNSAFE_MOCK_CASTING_DOCUMENTATION = {
|
|
9490
9495
|
summary: "Disallow casting to mock types like `jest.Mock` or `vi.Mock`. Use `vi.mocked()` or `jest.mocked()` instead.",
|
|
9491
9496
|
rationale: "A type assertion can claim an unmocked value is a mock and bypass checking between the original callable and the mock API.",
|
|
9492
9497
|
remediation: "Use the test framework's `mocked` helper to obtain the typed mock reference.",
|
|
@@ -9515,7 +9520,7 @@ var noUnsafeMockCastingDocumentation = {
|
|
|
9515
9520
|
};
|
|
9516
9521
|
var no_unsafe_mock_casting_default = createRule({
|
|
9517
9522
|
name: "no-unsafe-mock-casting",
|
|
9518
|
-
documentation:
|
|
9523
|
+
documentation: NO_UNSAFE_MOCK_CASTING_DOCUMENTATION,
|
|
9519
9524
|
meta: {
|
|
9520
9525
|
type: "problem",
|
|
9521
9526
|
docs: {
|
|
@@ -9583,7 +9588,7 @@ var no_unsafe_mock_casting_default = createRule({
|
|
|
9583
9588
|
// src/rules/no-zod-native-enum.ts
|
|
9584
9589
|
var import_utils54 = require("@typescript-eslint/utils");
|
|
9585
9590
|
var ts2 = __toESM(require("typescript"), 1);
|
|
9586
|
-
var
|
|
9591
|
+
var NO_ZOD_NATIVE_ENUM_DOCUMENTATION = {
|
|
9587
9592
|
summary: 'Disallow `z.nativeEnum()` (and `z.enum()` over a TypeScript enum); use `z.enum(["a", "b"])` with a string-literal union instead.',
|
|
9588
9593
|
rationale: "Wrapping a TypeScript enum preserves its emitted runtime object and duplicates the schema's value definition across two constructs.",
|
|
9589
9594
|
remediation: "Pass string literals directly to `z.enum` and derive the TypeScript type with `z.infer`.",
|
|
@@ -9681,7 +9686,7 @@ function resolvesToImportedEnum(node, services) {
|
|
|
9681
9686
|
}
|
|
9682
9687
|
var no_zod_native_enum_default = createRule({
|
|
9683
9688
|
name: "no-zod-native-enum",
|
|
9684
|
-
documentation:
|
|
9689
|
+
documentation: NO_ZOD_NATIVE_ENUM_DOCUMENTATION,
|
|
9685
9690
|
meta: {
|
|
9686
9691
|
type: "suggestion",
|
|
9687
9692
|
fixable: "code",
|
|
@@ -9805,7 +9810,7 @@ var no_zod_native_enum_default = createRule({
|
|
|
9805
9810
|
|
|
9806
9811
|
// src/rules/test-loops-over-literal-cases.ts
|
|
9807
9812
|
var import_utils55 = require("@typescript-eslint/utils");
|
|
9808
|
-
var
|
|
9813
|
+
var TEST_LOOPS_OVER_LITERAL_CASES_DOCUMENTATION = {
|
|
9809
9814
|
summary: "Disallow assertions over an inline literal case loop in a test; parameterization reports and names every case independently.",
|
|
9810
9815
|
rationale: "A loop is reported as one test, so failures hide the individual case name and may stop later cases from running.",
|
|
9811
9816
|
remediation: "Create one named parameterized test or runner-aware subtest for each literal case.",
|
|
@@ -9950,7 +9955,7 @@ var LOOP_CARRIED_CONTROL = /* @__PURE__ */ new Set([
|
|
|
9950
9955
|
]);
|
|
9951
9956
|
var test_loops_over_literal_cases_default = createRule({
|
|
9952
9957
|
name: "test-loops-over-literal-cases",
|
|
9953
|
-
documentation:
|
|
9958
|
+
documentation: TEST_LOOPS_OVER_LITERAL_CASES_DOCUMENTATION,
|
|
9954
9959
|
meta: {
|
|
9955
9960
|
type: "suggestion",
|
|
9956
9961
|
docs: {
|
|
@@ -10015,7 +10020,7 @@ var PHASE_RE = new RegExp(
|
|
|
10015
10020
|
String.raw`^[-=~*_#.\s]{0,40}(?:${PHASE_WORD})(?:\s*(?:[/&+,|]|->|and)\s*(?:${PHASE_WORD}))*[-=~*_#.\s:;!–—]{0,40}$`,
|
|
10016
10021
|
"iu"
|
|
10017
10022
|
);
|
|
10018
|
-
var
|
|
10023
|
+
var TEST_PHASE_LABEL_COMMENT_DOCUMENTATION = {
|
|
10019
10024
|
summary: "Tests must not use bare Arrange, Act, Assert, Given, When, or Then phase comments.",
|
|
10020
10025
|
rationale: "Phase labels narrate test structure without explaining behavior and often hide unclear names or oversized tests.",
|
|
10021
10026
|
remediation: "Delete the label; if the phases remain hard to follow, extract a named helper or split the test.",
|
|
@@ -10067,11 +10072,11 @@ function continuesProseRun(comments, index) {
|
|
|
10067
10072
|
}
|
|
10068
10073
|
var test_phase_label_comment_default = createRule({
|
|
10069
10074
|
name: "test-phase-label-comment",
|
|
10070
|
-
documentation:
|
|
10075
|
+
documentation: TEST_PHASE_LABEL_COMMENT_DOCUMENTATION,
|
|
10071
10076
|
meta: {
|
|
10072
10077
|
type: "suggestion",
|
|
10073
10078
|
fixable: "code",
|
|
10074
|
-
docs: { description:
|
|
10079
|
+
docs: { description: TEST_PHASE_LABEL_COMMENT_DOCUMENTATION.summary },
|
|
10075
10080
|
schema: [],
|
|
10076
10081
|
messages: { removeLabel: "Bare test phase label \u2014 delete it and let the test names and helpers carry the structure." }
|
|
10077
10082
|
},
|
|
@@ -10100,7 +10105,7 @@ var test_phase_label_comment_default = createRule({
|
|
|
10100
10105
|
|
|
10101
10106
|
// src/rules/prefer-constant-time-secret-compare.ts
|
|
10102
10107
|
var import_utils57 = require("@typescript-eslint/utils");
|
|
10103
|
-
var
|
|
10108
|
+
var PREFER_CONSTANT_TIME_SECRET_COMPARE_DOCUMENTATION = {
|
|
10104
10109
|
summary: "Disallow `===`/`!==` on a secret-like value; short-circuiting comparison leaks the secret through timing. Use a constant-time compare.",
|
|
10105
10110
|
rationale: "Ordinary equality stops at the first differing byte, allowing repeated measurements to reveal secret material.",
|
|
10106
10111
|
remediation: "Compare equal-length cryptographic digests with a constant-time comparison primitive.",
|
|
@@ -10165,7 +10170,7 @@ function secretNameOf(node) {
|
|
|
10165
10170
|
}
|
|
10166
10171
|
var prefer_constant_time_secret_compare_default = createRule({
|
|
10167
10172
|
name: "prefer-constant-time-secret-compare",
|
|
10168
|
-
documentation:
|
|
10173
|
+
documentation: PREFER_CONSTANT_TIME_SECRET_COMPARE_DOCUMENTATION,
|
|
10169
10174
|
meta: {
|
|
10170
10175
|
type: "problem",
|
|
10171
10176
|
docs: {
|
|
@@ -10311,7 +10316,7 @@ var prefer_ecmascript_private_members_default = createRule({
|
|
|
10311
10316
|
// src/rules/prefer-discriminated-union.ts
|
|
10312
10317
|
var import_utils59 = require("@typescript-eslint/utils");
|
|
10313
10318
|
var import_utils60 = require("@typescript-eslint/utils");
|
|
10314
|
-
var
|
|
10319
|
+
var PREFER_DISCRIMINATED_UNION_DOCUMENTATION = {
|
|
10315
10320
|
summary: "Flag flat result objects with a required positive boolean status and optional success/failure payloads.",
|
|
10316
10321
|
rationale: "A boolean status plus optional branch data permits contradictory and incomplete states.",
|
|
10317
10322
|
remediation: "Represent each result branch as a discriminated union member with its required payload.",
|
|
@@ -10408,7 +10413,7 @@ function inlineReturnTypeLiteral(node) {
|
|
|
10408
10413
|
}
|
|
10409
10414
|
var prefer_discriminated_union_default = createRule({
|
|
10410
10415
|
name: "prefer-discriminated-union",
|
|
10411
|
-
documentation:
|
|
10416
|
+
documentation: PREFER_DISCRIMINATED_UNION_DOCUMENTATION,
|
|
10412
10417
|
meta: {
|
|
10413
10418
|
type: "suggestion",
|
|
10414
10419
|
docs: {
|
|
@@ -10457,7 +10462,7 @@ var prefer_discriminated_union_default = createRule({
|
|
|
10457
10462
|
|
|
10458
10463
|
// src/rules/prefer-input-group-search.ts
|
|
10459
10464
|
var import_utils61 = require("@typescript-eslint/utils");
|
|
10460
|
-
var
|
|
10465
|
+
var PREFER_INPUT_GROUP_SEARCH_DOCUMENTATION = {
|
|
10461
10466
|
summary: "Require search icons and shared Input controls in the same visual wrapper to use InputGroup.",
|
|
10462
10467
|
rationale: "The shared compound control provides consistent spacing, focus behavior, and accessible composition.",
|
|
10463
10468
|
remediation: "Compose the search icon and field with InputGroup, InputGroupAddon, and InputGroupInput.",
|
|
@@ -10522,7 +10527,7 @@ function isActionIcon(search, wrapper) {
|
|
|
10522
10527
|
}
|
|
10523
10528
|
var prefer_input_group_search_default = createRule({
|
|
10524
10529
|
name: "prefer-input-group-search",
|
|
10525
|
-
documentation:
|
|
10530
|
+
documentation: PREFER_INPUT_GROUP_SEARCH_DOCUMENTATION,
|
|
10526
10531
|
meta: {
|
|
10527
10532
|
type: "suggestion",
|
|
10528
10533
|
docs: {
|
|
@@ -10599,7 +10604,7 @@ var prefer_input_group_search_default = createRule({
|
|
|
10599
10604
|
|
|
10600
10605
|
// src/rules/prefer-immutable-module-constant.ts
|
|
10601
10606
|
var import_utils62 = require("@typescript-eslint/utils");
|
|
10602
|
-
var
|
|
10607
|
+
var PREFER_IMMUTABLE_MODULE_CONSTANT_DOCUMENTATION = {
|
|
10603
10608
|
summary: "Require module-level constant collections to expose readonly state.",
|
|
10604
10609
|
rationale: "A const binding prevents reassignment but does not stop callers from mutating its array, object, Set, or Map contents.",
|
|
10605
10610
|
remediation: "Expose literals with `as const` or a readonly type, and expose Set or Map values through ReadonlySet or ReadonlyMap.",
|
|
@@ -10735,7 +10740,7 @@ function referenceMutates(identifier, isUnshadowedGlobal3) {
|
|
|
10735
10740
|
}
|
|
10736
10741
|
var prefer_immutable_module_constant_default = createRule({
|
|
10737
10742
|
name: "prefer-immutable-module-constant",
|
|
10738
|
-
documentation:
|
|
10743
|
+
documentation: PREFER_IMMUTABLE_MODULE_CONSTANT_DOCUMENTATION,
|
|
10739
10744
|
meta: {
|
|
10740
10745
|
type: "suggestion",
|
|
10741
10746
|
docs: {
|
|
@@ -10841,7 +10846,7 @@ function unwrapTransparentExport(node) {
|
|
|
10841
10846
|
|
|
10842
10847
|
// src/rules/prefer-shadcn-primitives.ts
|
|
10843
10848
|
var import_utils63 = require("@typescript-eslint/utils");
|
|
10844
|
-
var
|
|
10849
|
+
var PREFER_SHADCN_PRIMITIVES_DOCUMENTATION = {
|
|
10845
10850
|
summary: "Require visible raw JSX controls to use the corresponding shared shadcn primitive.",
|
|
10846
10851
|
rationale: "Shared primitives centralize interaction, accessibility, and visual behavior across the product.",
|
|
10847
10852
|
remediation: "Replace the raw visible control with the corresponding shared shadcn component.",
|
|
@@ -10968,7 +10973,7 @@ function replacementFor(node, element) {
|
|
|
10968
10973
|
}
|
|
10969
10974
|
var prefer_shadcn_primitives_default = createRule({
|
|
10970
10975
|
name: "prefer-shadcn-primitives",
|
|
10971
|
-
documentation:
|
|
10976
|
+
documentation: PREFER_SHADCN_PRIMITIVES_DOCUMENTATION,
|
|
10972
10977
|
meta: {
|
|
10973
10978
|
type: "suggestion",
|
|
10974
10979
|
docs: {
|
|
@@ -11025,7 +11030,7 @@ var prefer_shadcn_primitives_default = createRule({
|
|
|
11025
11030
|
|
|
11026
11031
|
// src/rules/prefer-module-level-constant.ts
|
|
11027
11032
|
var import_utils64 = require("@typescript-eslint/utils");
|
|
11028
|
-
var
|
|
11033
|
+
var PREFER_MODULE_LEVEL_CONSTANT_DOCUMENTATION = {
|
|
11029
11034
|
summary: "Hoist literal-only constant collections and regexes out of function bodies to module scope so they are allocated once.",
|
|
11030
11035
|
rationale: "Recreating immutable lookup data on every call wastes allocations and obscures its constant nature.",
|
|
11031
11036
|
remediation: "Declare immutable literal collections and non-stateful regular expressions once at module scope.",
|
|
@@ -11241,7 +11246,7 @@ function isNonRetainingBuiltinCall(node, argument) {
|
|
|
11241
11246
|
}
|
|
11242
11247
|
var prefer_module_level_constant_default = createRule({
|
|
11243
11248
|
name: "prefer-module-level-constant",
|
|
11244
|
-
documentation:
|
|
11249
|
+
documentation: PREFER_MODULE_LEVEL_CONSTANT_DOCUMENTATION,
|
|
11245
11250
|
meta: {
|
|
11246
11251
|
type: "suggestion",
|
|
11247
11252
|
docs: {
|
|
@@ -11333,7 +11338,7 @@ var prefer_module_level_constant_default = createRule({
|
|
|
11333
11338
|
|
|
11334
11339
|
// src/rules/prefer-module-level-schema.ts
|
|
11335
11340
|
var import_utils65 = require("@typescript-eslint/utils");
|
|
11336
|
-
var
|
|
11341
|
+
var PREFER_MODULE_LEVEL_SCHEMA_DOCUMENTATION = {
|
|
11337
11342
|
summary: "Declare a Zod schema at module scope when it closes over nothing in the enclosing function",
|
|
11338
11343
|
rationale: "A closed schema created inside a function is rebuilt on every call and cannot be reused or exported for inference.",
|
|
11339
11344
|
remediation: "Move the closed schema declaration to module scope and reference it from the function.",
|
|
@@ -11490,7 +11495,7 @@ function collectReferences(scope, out) {
|
|
|
11490
11495
|
}
|
|
11491
11496
|
var prefer_module_level_schema_default = createRule({
|
|
11492
11497
|
name: "prefer-module-level-schema",
|
|
11493
|
-
documentation:
|
|
11498
|
+
documentation: PREFER_MODULE_LEVEL_SCHEMA_DOCUMENTATION,
|
|
11494
11499
|
meta: {
|
|
11495
11500
|
type: "problem",
|
|
11496
11501
|
docs: {
|
|
@@ -11692,7 +11697,7 @@ var prefer_module_level_schema_default = createRule({
|
|
|
11692
11697
|
|
|
11693
11698
|
// src/rules/prefer-native-random-uuid.ts
|
|
11694
11699
|
var import_utils66 = require("@typescript-eslint/utils");
|
|
11695
|
-
var
|
|
11700
|
+
var PREFER_NATIVE_RANDOM_UUID_DOCUMENTATION = {
|
|
11696
11701
|
summary: "Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.",
|
|
11697
11702
|
rationale: "The platform implementation avoids an unnecessary dependency for standard random UUID generation.",
|
|
11698
11703
|
remediation: "Call `globalThis.crypto.randomUUID()` and remove the unused `uuid` v4 import when possible.",
|
|
@@ -11709,7 +11714,7 @@ function requireUuid(node) {
|
|
|
11709
11714
|
}
|
|
11710
11715
|
var prefer_native_random_uuid_default = createRule({
|
|
11711
11716
|
name: "prefer-native-random-uuid",
|
|
11712
|
-
documentation:
|
|
11717
|
+
documentation: PREFER_NATIVE_RANDOM_UUID_DOCUMENTATION,
|
|
11713
11718
|
meta: {
|
|
11714
11719
|
type: "suggestion",
|
|
11715
11720
|
docs: {
|
|
@@ -11791,7 +11796,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
11791
11796
|
|
|
11792
11797
|
// src/rules/prefer-non-nullable-collection.ts
|
|
11793
11798
|
var import_utils67 = require("@typescript-eslint/utils");
|
|
11794
|
-
var
|
|
11799
|
+
var PREFER_NON_NULLABLE_COLLECTION_DOCUMENTATION = {
|
|
11795
11800
|
summary: "Suggest non-null arrays only when local control flow proves the nullish state is equivalent to an empty collection.",
|
|
11796
11801
|
rationale: "A redundant nullish collection state spreads defaults and guards through consumers without carrying information.",
|
|
11797
11802
|
remediation: "Use a non-null collection type and normalize omitted input to an empty collection at the boundary.",
|
|
@@ -11939,7 +11944,7 @@ function memberIsOnlyCoalesced(context, object, property, fn) {
|
|
|
11939
11944
|
}
|
|
11940
11945
|
var prefer_non_nullable_collection_default = createRule({
|
|
11941
11946
|
name: "prefer-non-nullable-collection",
|
|
11942
|
-
documentation:
|
|
11947
|
+
documentation: PREFER_NON_NULLABLE_COLLECTION_DOCUMENTATION,
|
|
11943
11948
|
meta: {
|
|
11944
11949
|
type: "suggestion",
|
|
11945
11950
|
docs: {
|
|
@@ -12037,7 +12042,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
12037
12042
|
// src/rules/prefer-await-in-async-return.ts
|
|
12038
12043
|
var import_utils68 = require("@typescript-eslint/utils");
|
|
12039
12044
|
var ts3 = __toESM(require("typescript"), 1);
|
|
12040
|
-
var
|
|
12045
|
+
var PREFER_AWAIT_IN_ASYNC_RETURN_DOCUMENTATION = {
|
|
12041
12046
|
summary: "Prefer explicit `await` when an async function directly returns one typed Promise `.then` transform.",
|
|
12042
12047
|
rationale: "Mixing a directly returned Promise callback into otherwise async control flow makes sequencing and failures harder to read.",
|
|
12043
12048
|
remediation: "Await the Promise, then return the transformed value with ordinary async statements.",
|
|
@@ -12124,7 +12129,7 @@ function isProvenPromiseLike(node, services) {
|
|
|
12124
12129
|
}
|
|
12125
12130
|
var prefer_await_in_async_return_default = createRule({
|
|
12126
12131
|
name: "prefer-await-in-async-return",
|
|
12127
|
-
documentation:
|
|
12132
|
+
documentation: PREFER_AWAIT_IN_ASYNC_RETURN_DOCUMENTATION,
|
|
12128
12133
|
meta: {
|
|
12129
12134
|
type: "suggestion",
|
|
12130
12135
|
docs: {
|
|
@@ -12183,7 +12188,7 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
12183
12188
|
|
|
12184
12189
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
12185
12190
|
var import_utils69 = require("@typescript-eslint/utils");
|
|
12186
|
-
var
|
|
12191
|
+
var PREFER_SCHEMA_FOR_API_PAYLOAD_DOCUMENTATION = {
|
|
12187
12192
|
summary: "Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access.",
|
|
12188
12193
|
rationale: "External JSON is untrusted at runtime even when its expected TypeScript shape is known statically.",
|
|
12189
12194
|
remediation: "Parse the payload through a schema or establish a recognized runtime validation guard before reading fields.",
|
|
@@ -12498,7 +12503,7 @@ var unvalidatedVariableRef = (node, scope, tracked) => {
|
|
|
12498
12503
|
};
|
|
12499
12504
|
var prefer_schema_for_api_payload_default = createRule({
|
|
12500
12505
|
name: "prefer-schema-for-api-payload",
|
|
12501
|
-
documentation:
|
|
12506
|
+
documentation: PREFER_SCHEMA_FOR_API_PAYLOAD_DOCUMENTATION,
|
|
12502
12507
|
meta: {
|
|
12503
12508
|
type: "problem",
|
|
12504
12509
|
docs: {
|
|
@@ -12708,7 +12713,7 @@ var tailwindBase = (token) => token.replace(/^(?:[a-z0-9-]+:)+/i, "").replace(/^
|
|
|
12708
12713
|
var classTokens = (value) => value.split(/\s+/).filter(Boolean);
|
|
12709
12714
|
|
|
12710
12715
|
// src/rules/prefer-semantic-colors.ts
|
|
12711
|
-
var
|
|
12716
|
+
var PREFER_SEMANTIC_COLORS_DOCUMENTATION = {
|
|
12712
12717
|
summary: "Enforce semantic color tokens over raw Tailwind palette classes, arbitrary color values, and inline color literals.",
|
|
12713
12718
|
rationale: "Semantic tokens keep themes and product meaning consistent while raw colors couple components to a palette value.",
|
|
12714
12719
|
remediation: "Replace raw palette and literal colors with the closest semantic design-system token or CSS variable.",
|
|
@@ -12787,9 +12792,9 @@ var WORKSPACE_ROOT_FILES = [
|
|
|
12787
12792
|
];
|
|
12788
12793
|
var DEFAULT_WORKSPACE_GLOBS = ["packages/*", "apps/*"];
|
|
12789
12794
|
var MAX_WORKSPACE_PACKAGES = 512;
|
|
12790
|
-
var
|
|
12791
|
-
var
|
|
12792
|
-
var
|
|
12795
|
+
var ANCESTRY_CACHE = /* @__PURE__ */ new Map();
|
|
12796
|
+
var WORKSPACE_SCAN_CACHE = /* @__PURE__ */ new Map();
|
|
12797
|
+
var WORKSPACE_ROOT_CACHE = /* @__PURE__ */ new Map();
|
|
12793
12798
|
var SVG_DEFS_CONTAINERS = /* @__PURE__ */ new Set([
|
|
12794
12799
|
"mask",
|
|
12795
12800
|
"clipPath",
|
|
@@ -12905,7 +12910,7 @@ var hasMarkerAtOrAbove = (startDir) => {
|
|
|
12905
12910
|
const visited = [];
|
|
12906
12911
|
let answer;
|
|
12907
12912
|
for (; ; ) {
|
|
12908
|
-
const cached =
|
|
12913
|
+
const cached = ANCESTRY_CACHE.get(dir);
|
|
12909
12914
|
if (cached !== void 0) {
|
|
12910
12915
|
answer = cached;
|
|
12911
12916
|
break;
|
|
@@ -12922,7 +12927,7 @@ var hasMarkerAtOrAbove = (startDir) => {
|
|
|
12922
12927
|
}
|
|
12923
12928
|
dir = parent;
|
|
12924
12929
|
}
|
|
12925
|
-
for (const seen of visited)
|
|
12930
|
+
for (const seen of visited) ANCESTRY_CACHE.set(seen, answer);
|
|
12926
12931
|
return answer;
|
|
12927
12932
|
};
|
|
12928
12933
|
var findWorkspaceRoot = (startDir) => {
|
|
@@ -12931,7 +12936,7 @@ var findWorkspaceRoot = (startDir) => {
|
|
|
12931
12936
|
const visited = [];
|
|
12932
12937
|
let answer;
|
|
12933
12938
|
for (; ; ) {
|
|
12934
|
-
const cached =
|
|
12939
|
+
const cached = WORKSPACE_ROOT_CACHE.get(dir);
|
|
12935
12940
|
if (cached !== void 0) {
|
|
12936
12941
|
answer = cached;
|
|
12937
12942
|
break;
|
|
@@ -12948,11 +12953,11 @@ var findWorkspaceRoot = (startDir) => {
|
|
|
12948
12953
|
}
|
|
12949
12954
|
dir = parent;
|
|
12950
12955
|
}
|
|
12951
|
-
for (const seen of visited)
|
|
12956
|
+
for (const seen of visited) WORKSPACE_ROOT_CACHE.set(seen, answer);
|
|
12952
12957
|
return answer;
|
|
12953
12958
|
};
|
|
12954
12959
|
var workspaceHasMarker = (root) => {
|
|
12955
|
-
const cached =
|
|
12960
|
+
const cached = WORKSPACE_SCAN_CACHE.get(root);
|
|
12956
12961
|
if (cached !== void 0) return cached;
|
|
12957
12962
|
const globs = readWorkspaceGlobs(root);
|
|
12958
12963
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -12970,7 +12975,7 @@ var workspaceHasMarker = (root) => {
|
|
|
12970
12975
|
break;
|
|
12971
12976
|
}
|
|
12972
12977
|
}
|
|
12973
|
-
|
|
12978
|
+
WORKSPACE_SCAN_CACHE.set(root, found);
|
|
12974
12979
|
return found;
|
|
12975
12980
|
};
|
|
12976
12981
|
var expandWorkspaceGlob = (root, glob) => {
|
|
@@ -12994,7 +12999,7 @@ var staticallyImportsEmailOrPdfRenderer = (program) => program.body.some((statem
|
|
|
12994
12999
|
});
|
|
12995
13000
|
var prefer_semantic_colors_default = createRule({
|
|
12996
13001
|
name: "prefer-semantic-colors",
|
|
12997
|
-
documentation:
|
|
13002
|
+
documentation: PREFER_SEMANTIC_COLORS_DOCUMENTATION,
|
|
12998
13003
|
meta: {
|
|
12999
13004
|
type: "suggestion",
|
|
13000
13005
|
docs: {
|
|
@@ -13133,7 +13138,7 @@ var prefer_semantic_colors_default = createRule({
|
|
|
13133
13138
|
|
|
13134
13139
|
// src/rules/prefer-server-actions.ts
|
|
13135
13140
|
var import_utils71 = require("@typescript-eslint/utils");
|
|
13136
|
-
var
|
|
13141
|
+
var PREFER_SERVER_ACTIONS_DOCUMENTATION = {
|
|
13137
13142
|
summary: "Prefer Next.js Server Actions over /api/* mutations.",
|
|
13138
13143
|
rationale: "Server Actions preserve typed application calls and avoid an internal JSON request-response boundary.",
|
|
13139
13144
|
remediation: "Move the mutation into a Server Action and invoke that action from the React client.",
|
|
@@ -13242,7 +13247,7 @@ function getPropertyNode(objNode, propName2) {
|
|
|
13242
13247
|
}
|
|
13243
13248
|
var prefer_server_actions_default = createRule({
|
|
13244
13249
|
name: "prefer-server-actions",
|
|
13245
|
-
documentation:
|
|
13250
|
+
documentation: PREFER_SERVER_ACTIONS_DOCUMENTATION,
|
|
13246
13251
|
meta: {
|
|
13247
13252
|
type: "suggestion",
|
|
13248
13253
|
docs: {
|
|
@@ -13332,7 +13337,7 @@ var COLLECTION_PROPERTIES = /* @__PURE__ */ new Set(["length", "size"]);
|
|
|
13332
13337
|
var LITERAL_KEY_HAZARDS = /* @__PURE__ */ new Set(["__proto__"]);
|
|
13333
13338
|
var NUMERIC_SIGNS2 = /* @__PURE__ */ new Set(["-", "+"]);
|
|
13334
13339
|
var MIN_RUN_LENGTH = 2;
|
|
13335
|
-
var
|
|
13340
|
+
var PREFER_WHOLE_OBJECT_ASSERTION_DOCUMENTATION = {
|
|
13336
13341
|
summary: "Collapse consecutive assertions on one object into a whole-object assertion so related mismatches are reported together.",
|
|
13337
13342
|
rationale: "One whole-object assertion presents related expectations together and produces a complete structural diff.",
|
|
13338
13343
|
remediation: "Replace consecutive member assertions with one `toMatchObject` assertion.",
|
|
@@ -13391,7 +13396,7 @@ function propertyAccess(node) {
|
|
|
13391
13396
|
}
|
|
13392
13397
|
var prefer_whole_object_assertion_default = createRule({
|
|
13393
13398
|
name: "prefer-whole-object-assertion",
|
|
13394
|
-
documentation:
|
|
13399
|
+
documentation: PREFER_WHOLE_OBJECT_ASSERTION_DOCUMENTATION,
|
|
13395
13400
|
meta: {
|
|
13396
13401
|
type: "suggestion",
|
|
13397
13402
|
docs: {
|
|
@@ -13599,7 +13604,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
13599
13604
|
|
|
13600
13605
|
// src/rules/repeated-static-call-cases.ts
|
|
13601
13606
|
var import_utils73 = require("@typescript-eslint/utils");
|
|
13602
|
-
var
|
|
13607
|
+
var REPEATED_STATIC_CALL_CASES_DOCUMENTATION = {
|
|
13603
13608
|
summary: "Report three or more consecutive literal call assertions that should be independently named test cases.",
|
|
13604
13609
|
rationale: "Copy-pasted cases obscure the input table and stop later cases from being reported after the first failure.",
|
|
13605
13610
|
remediation: "Replace the repeated assertions with a named `test.each` or `it.each` table.",
|
|
@@ -13714,7 +13719,7 @@ function expectCallFromMatcher(node) {
|
|
|
13714
13719
|
}
|
|
13715
13720
|
var repeated_static_call_cases_default = createRule({
|
|
13716
13721
|
name: "repeated-static-call-cases",
|
|
13717
|
-
documentation:
|
|
13722
|
+
documentation: REPEATED_STATIC_CALL_CASES_DOCUMENTATION,
|
|
13718
13723
|
meta: {
|
|
13719
13724
|
type: "suggestion",
|
|
13720
13725
|
docs: { description: "Report three or more consecutive literal call assertions that should be independently named test cases." },
|
|
@@ -13782,7 +13787,7 @@ var repeated_static_call_cases_default = createRule({
|
|
|
13782
13787
|
|
|
13783
13788
|
// src/rules/prefer-zod-infer.ts
|
|
13784
13789
|
var import_utils74 = require("@typescript-eslint/utils");
|
|
13785
|
-
var
|
|
13790
|
+
var PREFER_ZOD_INFER_DOCUMENTATION = {
|
|
13786
13791
|
summary: "Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.",
|
|
13787
13792
|
rationale: "A derived type stays synchronized when the runtime schema changes.",
|
|
13788
13793
|
remediation: "Replace the hand-written twin with `z.infer<typeof Schema>`.",
|
|
@@ -14075,7 +14080,7 @@ function endsWithTokens(candidate2, suffix) {
|
|
|
14075
14080
|
}
|
|
14076
14081
|
var prefer_zod_infer_default = createRule({
|
|
14077
14082
|
name: "prefer-zod-infer",
|
|
14078
|
-
documentation:
|
|
14083
|
+
documentation: PREFER_ZOD_INFER_DOCUMENTATION,
|
|
14079
14084
|
meta: {
|
|
14080
14085
|
type: "problem",
|
|
14081
14086
|
docs: {
|
|
@@ -14505,7 +14510,7 @@ var prefer_zod_infer_default = createRule({
|
|
|
14505
14510
|
// src/rules/require-assert-never.ts
|
|
14506
14511
|
var import_utils75 = require("@typescript-eslint/utils");
|
|
14507
14512
|
var import_typescript = __toESM(require("typescript"), 1);
|
|
14508
|
-
var
|
|
14513
|
+
var REQUIRE_ASSERT_NEVER_DOCUMENTATION = {
|
|
14509
14514
|
summary: "Require an empty switch default to call `assertNever` so discriminated unions remain exhaustive at compile time.",
|
|
14510
14515
|
rationale: "An empty default silently accepts new union members instead of making the compiler identify the missing case.",
|
|
14511
14516
|
remediation: "Call `assertNever` with the discriminant in the exhaustive switch default.",
|
|
@@ -14580,7 +14585,7 @@ function finiteTypeKey(type, checker) {
|
|
|
14580
14585
|
}
|
|
14581
14586
|
var require_assert_never_default = createRule({
|
|
14582
14587
|
name: "require-assert-never",
|
|
14583
|
-
documentation:
|
|
14588
|
+
documentation: REQUIRE_ASSERT_NEVER_DOCUMENTATION,
|
|
14584
14589
|
meta: {
|
|
14585
14590
|
type: "problem",
|
|
14586
14591
|
docs: {
|
|
@@ -14623,7 +14628,7 @@ var require_assert_never_default = createRule({
|
|
|
14623
14628
|
|
|
14624
14629
|
// src/rules/require-fetch-timeout.ts
|
|
14625
14630
|
var import_utils76 = require("@typescript-eslint/utils");
|
|
14626
|
-
var
|
|
14631
|
+
var REQUIRE_FETCH_TIMEOUT_DOCUMENTATION = {
|
|
14627
14632
|
summary: "Require an abort `signal` (e.g. `AbortSignal.timeout(ms)`) on global `fetch()` calls so stalled upstreams cannot hang the caller forever.",
|
|
14628
14633
|
rationale: "An unbounded request can occupy work indefinitely when an upstream stalls.",
|
|
14629
14634
|
remediation: "Pass an abort signal, such as `AbortSignal.timeout(ms)`, in the fetch init.",
|
|
@@ -14669,7 +14674,7 @@ function isInlineUrl(node, resolvesToGlobal) {
|
|
|
14669
14674
|
}
|
|
14670
14675
|
var require_fetch_timeout_default = createRule({
|
|
14671
14676
|
name: "require-fetch-timeout",
|
|
14672
|
-
documentation:
|
|
14677
|
+
documentation: REQUIRE_FETCH_TIMEOUT_DOCUMENTATION,
|
|
14673
14678
|
meta: {
|
|
14674
14679
|
type: "problem",
|
|
14675
14680
|
docs: {
|
|
@@ -14751,7 +14756,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
14751
14756
|
|
|
14752
14757
|
// src/rules/require-port-for-service.ts
|
|
14753
14758
|
var import_utils77 = require("@typescript-eslint/utils");
|
|
14754
|
-
var
|
|
14759
|
+
var REQUIRE_PORT_FOR_SERVICE_DOCUMENTATION = {
|
|
14755
14760
|
summary: "Advise when an exported service with injected collaborators has public methods not covered by its declared ports.",
|
|
14756
14761
|
rationale: "A declared port keeps consumers coupled to the service capability instead of its concrete implementation.",
|
|
14757
14762
|
remediation: "Declare and implement an interface covering the service's public methods.",
|
|
@@ -15231,7 +15236,7 @@ function hasServicePort(node, methods, classes, interfaces) {
|
|
|
15231
15236
|
}
|
|
15232
15237
|
var require_port_for_service_default = createRule({
|
|
15233
15238
|
name: "require-port-for-service",
|
|
15234
|
-
documentation:
|
|
15239
|
+
documentation: REQUIRE_PORT_FOR_SERVICE_DOCUMENTATION,
|
|
15235
15240
|
meta: {
|
|
15236
15241
|
type: "suggestion",
|
|
15237
15242
|
docs: {
|
|
@@ -15296,7 +15301,7 @@ var require_port_for_service_default = createRule({
|
|
|
15296
15301
|
|
|
15297
15302
|
// src/rules/require-static-next-matcher.ts
|
|
15298
15303
|
var import_utils78 = require("@typescript-eslint/utils");
|
|
15299
|
-
var
|
|
15304
|
+
var REQUIRE_STATIC_NEXT_MATCHER_DOCUMENTATION = {
|
|
15300
15305
|
summary: "Require Next.js middleware and proxy matcher configuration to contain only build-time literals.",
|
|
15301
15306
|
rationale: "Next.js must statically analyze matcher values at build time; computed values are ignored.",
|
|
15302
15307
|
remediation: "Write matcher strings, arrays, and object fields as literals in the exported config.",
|
|
@@ -15340,7 +15345,7 @@ function propertyName4(property) {
|
|
|
15340
15345
|
}
|
|
15341
15346
|
var require_static_next_matcher_default = createRule({
|
|
15342
15347
|
name: "require-static-next-matcher",
|
|
15343
|
-
documentation:
|
|
15348
|
+
documentation: REQUIRE_STATIC_NEXT_MATCHER_DOCUMENTATION,
|
|
15344
15349
|
meta: {
|
|
15345
15350
|
type: "problem",
|
|
15346
15351
|
docs: {
|
|
@@ -15385,7 +15390,7 @@ var require_static_next_matcher_default = createRule({
|
|
|
15385
15390
|
|
|
15386
15391
|
// src/rules/require-use-form-default-values.ts
|
|
15387
15392
|
var import_utils79 = require("@typescript-eslint/utils");
|
|
15388
|
-
var
|
|
15393
|
+
var REQUIRE_USE_FORM_DEFAULT_VALUES_DOCUMENTATION = {
|
|
15389
15394
|
summary: "react-hook-form useForm call without defaultValues",
|
|
15390
15395
|
rationale: "Without an explicit initial value, fields can change from uncontrolled to controlled as data arrives, reset behavior becomes ambiguous, and the form's initial shape no longer documents the values users can edit.",
|
|
15391
15396
|
remediation: "Pass an object with a defaultValues property to useForm; use empty strings, nulls, or schema-appropriate values deliberately for every controlled field.",
|
|
@@ -15421,10 +15426,10 @@ function hasDefaultValues(options) {
|
|
|
15421
15426
|
}
|
|
15422
15427
|
var require_use_form_default_values_default = createRule({
|
|
15423
15428
|
name: "require-use-form-default-values",
|
|
15424
|
-
documentation:
|
|
15429
|
+
documentation: REQUIRE_USE_FORM_DEFAULT_VALUES_DOCUMENTATION,
|
|
15425
15430
|
meta: {
|
|
15426
15431
|
type: "problem",
|
|
15427
|
-
docs: { description:
|
|
15432
|
+
docs: { description: REQUIRE_USE_FORM_DEFAULT_VALUES_DOCUMENTATION.summary },
|
|
15428
15433
|
schema: [],
|
|
15429
15434
|
messages: {
|
|
15430
15435
|
requireUseFormDefaultValues: "Pass explicit defaultValues to useForm so fields have a stable initial shape and reset behavior."
|
|
@@ -15456,7 +15461,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
15456
15461
|
// src/rules/require-use-server-in-actions-file.ts
|
|
15457
15462
|
var import_utils80 = require("@typescript-eslint/utils");
|
|
15458
15463
|
var ACTION_MODULE_RE = /(?:^|\/)app\/.*\/(?:actions|[^/]+-actions)\.[cm]?[jt]s$/u;
|
|
15459
|
-
var
|
|
15464
|
+
var REQUIRE_USE_SERVER_IN_ACTIONS_FILE_DOCUMENTATION = {
|
|
15460
15465
|
summary: "route action module missing the use server directive",
|
|
15461
15466
|
rationale: "An exported async function is not callable as a Server Action merely because its file is named actions.ts. Without the module directive, a client import can fail or pull server-only implementation details across the client boundary.",
|
|
15462
15467
|
remediation: "Put 'use server' at the start of the route action module.",
|
|
@@ -15494,10 +15499,10 @@ function isExportedAsyncFunction(node) {
|
|
|
15494
15499
|
}
|
|
15495
15500
|
var require_use_server_in_actions_file_default = createRule({
|
|
15496
15501
|
name: "require-use-server-in-actions-file",
|
|
15497
|
-
documentation:
|
|
15502
|
+
documentation: REQUIRE_USE_SERVER_IN_ACTIONS_FILE_DOCUMENTATION,
|
|
15498
15503
|
meta: {
|
|
15499
15504
|
type: "problem",
|
|
15500
|
-
docs: { description:
|
|
15505
|
+
docs: { description: REQUIRE_USE_SERVER_IN_ACTIONS_FILE_DOCUMENTATION.summary },
|
|
15501
15506
|
schema: [],
|
|
15502
15507
|
messages: {
|
|
15503
15508
|
requireUseServerInActionsFile: "This route action module exports an async function but is missing a leading 'use server' directive."
|
|
@@ -15521,7 +15526,7 @@ var require_use_server_in_actions_file_default = createRule({
|
|
|
15521
15526
|
|
|
15522
15527
|
// src/rules/require-zod-form-validation.ts
|
|
15523
15528
|
var import_utils81 = require("@typescript-eslint/utils");
|
|
15524
|
-
var
|
|
15529
|
+
var REQUIRE_ZOD_FORM_VALIDATION_DOCUMENTATION = {
|
|
15525
15530
|
summary: "Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.",
|
|
15526
15531
|
rationale: "FormData values are untrusted strings or files and need runtime validation before use.",
|
|
15527
15532
|
remediation: "Read the value inside a Zod schema's `parse` or `safeParse` input.",
|
|
@@ -15570,7 +15575,7 @@ var isFormDataMethodCall = (node) => {
|
|
|
15570
15575
|
};
|
|
15571
15576
|
var require_zod_form_validation_default = createRule({
|
|
15572
15577
|
name: "require-zod-form-validation",
|
|
15573
|
-
documentation:
|
|
15578
|
+
documentation: REQUIRE_ZOD_FORM_VALIDATION_DOCUMENTATION,
|
|
15574
15579
|
meta: {
|
|
15575
15580
|
type: "problem",
|
|
15576
15581
|
docs: {
|
|
@@ -15821,7 +15826,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
15821
15826
|
|
|
15822
15827
|
// src/rules/store-insert-requires-on-conflict.ts
|
|
15823
15828
|
var import_utils82 = require("@typescript-eslint/utils");
|
|
15824
|
-
var
|
|
15829
|
+
var STORE_INSERT_REQUIRES_ON_CONFLICT_DOCUMENTATION = {
|
|
15825
15830
|
summary: "Require embedded inserts in explicitly replayable callables to carry conflict handling.",
|
|
15826
15831
|
rationale: "A callable named as an enqueue, seed, migration, schedule, ensure, or upsert promises replay safety.",
|
|
15827
15832
|
remediation: "Add an appropriate `ON CONFLICT` action or supported replay-safe insert form.",
|
|
@@ -15854,7 +15859,7 @@ function owningCallableName(node) {
|
|
|
15854
15859
|
var INSERT_GATE = /insert/i;
|
|
15855
15860
|
var store_insert_requires_on_conflict_default = createRule({
|
|
15856
15861
|
name: "store-insert-requires-on-conflict",
|
|
15857
|
-
documentation:
|
|
15862
|
+
documentation: STORE_INSERT_REQUIRES_ON_CONFLICT_DOCUMENTATION,
|
|
15858
15863
|
meta: {
|
|
15859
15864
|
type: "problem",
|
|
15860
15865
|
docs: {
|
|
@@ -15885,7 +15890,7 @@ var store_insert_requires_on_conflict_default = createRule({
|
|
|
15885
15890
|
|
|
15886
15891
|
// src/rules/stepdown.ts
|
|
15887
15892
|
var import_utils83 = require("@typescript-eslint/utils");
|
|
15888
|
-
var
|
|
15893
|
+
var STEPDOWN_DOCUMENTATION = {
|
|
15889
15894
|
summary: "Place a private helper below its sole direct same-scope caller.",
|
|
15890
15895
|
rationale: "Caller-first ordering lets a reader follow the main flow before descending into implementation details.",
|
|
15891
15896
|
remediation: "Move the private helper below its sole caller.",
|
|
@@ -16304,7 +16309,7 @@ function isClassRuntimeBarrier(member) {
|
|
|
16304
16309
|
}
|
|
16305
16310
|
var stepdown_default = createRule({
|
|
16306
16311
|
name: "stepdown",
|
|
16307
|
-
documentation:
|
|
16312
|
+
documentation: STEPDOWN_DOCUMENTATION,
|
|
16308
16313
|
meta: {
|
|
16309
16314
|
type: "suggestion",
|
|
16310
16315
|
docs: { description: "Place a private helper below its sole direct same-scope caller." },
|
|
@@ -16376,7 +16381,7 @@ var EXPECT_MATCHERS = /* @__PURE__ */ new Set([
|
|
|
16376
16381
|
]);
|
|
16377
16382
|
var EXPECT_MODIFIERS2 = /* @__PURE__ */ new Set(["not", "rejects", "resolves"]);
|
|
16378
16383
|
var ASSERT_MATCHERS = /* @__PURE__ */ new Set(["deepEqual", "doesNotMatch", "equal", "match", "notDeepEqual", "notEqual", "notStrictEqual", "ok", "strictEqual"]);
|
|
16379
|
-
var
|
|
16384
|
+
var SOURCE_COUPLED_TEST_DOCUMENTATION = {
|
|
16380
16385
|
summary: "Disallow raw repository source text as a test oracle; parse or execute the artifact instead.",
|
|
16381
16386
|
rationale: "Substring and regex checks can pass on comments or unreachable configuration and fail after behavior-preserving formatting changes.",
|
|
16382
16387
|
remediation: "Parse the artifact, execute its validator, or assert on another runtime contract.",
|
|
@@ -16634,13 +16639,13 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
16634
16639
|
}
|
|
16635
16640
|
var source_coupled_test_default = createSourceCoupledRule(
|
|
16636
16641
|
"source-coupled-test",
|
|
16637
|
-
|
|
16642
|
+
SOURCE_COUPLED_TEST_DOCUMENTATION,
|
|
16638
16643
|
GENERAL_SOURCE_SUFFIX_RE
|
|
16639
16644
|
);
|
|
16640
16645
|
|
|
16641
16646
|
// src/rules/iac-source-coupled-test.ts
|
|
16642
16647
|
var IAC_SOURCE_SUFFIX_RE = /(?:\.tf\.json|\.tftest\.(?:hcl|json)|\.(?:hcl|tf|tfvars))$/iu;
|
|
16643
|
-
var
|
|
16648
|
+
var IAC_SOURCE_COUPLED_TEST_DOCUMENTATION = {
|
|
16644
16649
|
summary: "Disallow raw IaC source text as a test oracle; inspect a rendered plan, provider state, or runtime behavior.",
|
|
16645
16650
|
rationale: "Substring and regex checks can pass on comments, formatting, or unreachable Terraform configuration while clients fail silently.",
|
|
16646
16651
|
remediation: "Parse rendered plan JSON, query the provider, or exercise the deployed runtime contract.",
|
|
@@ -16672,28 +16677,30 @@ var iacSourceCoupledTestDocumentation = {
|
|
|
16672
16677
|
};
|
|
16673
16678
|
var iac_source_coupled_test_default = createSourceCoupledRule(
|
|
16674
16679
|
"iac-source-coupled-test",
|
|
16675
|
-
|
|
16680
|
+
IAC_SOURCE_COUPLED_TEST_DOCUMENTATION,
|
|
16676
16681
|
IAC_SOURCE_SUFFIX_RE
|
|
16677
16682
|
);
|
|
16678
16683
|
|
|
16679
|
-
// src/rules/zod-
|
|
16684
|
+
// src/rules/require-pascal-case-zod-schema-name.ts
|
|
16680
16685
|
var import_utils85 = require("@typescript-eslint/utils");
|
|
16681
|
-
var
|
|
16682
|
-
summary: "
|
|
16683
|
-
rationale: "A
|
|
16684
|
-
remediation: "Rename the
|
|
16686
|
+
var REQUIRE_PASCAL_CASE_ZOD_SCHEMA_NAME_DOCUMENTATION = {
|
|
16687
|
+
summary: "Require confirmed module-level Zod schema contracts to use PascalCase with a `Schema` suffix.",
|
|
16688
|
+
rationale: "A reusable Zod schema is a runtime type contract. PascalCase mirrors that role; SCREAMING_SNAKE_CASE should remain reserved for scalar values and lookup tables.",
|
|
16689
|
+
remediation: "Rename the binding to PascalCase ending in `Schema` (for example, `MutationRouteBaseSchema`).",
|
|
16685
16690
|
category: "style",
|
|
16691
|
+
aliases: ["zod-naming-convention"],
|
|
16692
|
+
autofix: "none",
|
|
16693
|
+
limitations: [
|
|
16694
|
+
"Only module-level bindings proven from a Zod import or a same-file proven schema are checked.",
|
|
16695
|
+
"Tests, benchmarks, generated files, imported schemas, re-export aliases, and arbitrary wrapper-factory results are excluded.",
|
|
16696
|
+
"Cross-file and exported renames are not safely file-local, so the rule has no autofix."
|
|
16697
|
+
],
|
|
16686
16698
|
examples: [
|
|
16687
|
-
{ id: "
|
|
16688
|
-
{ id: "
|
|
16699
|
+
{ id: "runtime-type-schema-name", title: "Name a reusable schema like a runtime type contract", outcome: "no-match", files: [{ path: "src/user.ts", source: "import { z } from 'zod';\nexport const UserSchema = z.object({ id: z.string() });" }], focusPath: "src/user.ts", expectedCount: 0, public: true },
|
|
16700
|
+
{ id: "screaming-schema-name", title: "Do not name a schema like a scalar constant", outcome: "match", files: [{ path: "src/user.ts", source: "import { z } from 'zod';\nexport const USER_SCHEMA = z.object({ id: z.string() });" }], focusPath: "src/user.ts", expectedCount: 1, public: true }
|
|
16689
16701
|
]
|
|
16690
16702
|
};
|
|
16691
|
-
var
|
|
16692
|
-
prefix: { test: ZOD_PREFIX_RE, messageId: "zPrefix" },
|
|
16693
|
-
suffix: { test: ZOD_SUFFIX_RE, messageId: "schemaSuffix" },
|
|
16694
|
-
either: { test: ZOD_SCHEMA_NAME_RE, messageId: "zodSchemaName" }
|
|
16695
|
-
};
|
|
16696
|
-
var CONTAINS_SCHEMA_RE = /schema/i;
|
|
16703
|
+
var PASCAL_SCHEMA_NAME_RE = /^[A-Z][A-Za-z0-9]*Schema$/;
|
|
16697
16704
|
var BENCHMARK_PATH_RE = /(^|[\\/])(?:benchmarks?|bench)[\\/]/;
|
|
16698
16705
|
var NON_SCHEMA_TERMINALS = /* @__PURE__ */ new Set([
|
|
16699
16706
|
"parse",
|
|
@@ -16718,6 +16725,95 @@ var NON_SCHEMA_TERMINALS = /* @__PURE__ */ new Set([
|
|
|
16718
16725
|
"prettifyError",
|
|
16719
16726
|
"treeifyError"
|
|
16720
16727
|
]);
|
|
16728
|
+
var ZOD_SCHEMA_FACTORIES = /* @__PURE__ */ new Set([
|
|
16729
|
+
"any",
|
|
16730
|
+
"array",
|
|
16731
|
+
"base64",
|
|
16732
|
+
"base64url",
|
|
16733
|
+
"bigint",
|
|
16734
|
+
"boolean",
|
|
16735
|
+
"cidrv4",
|
|
16736
|
+
"cidrv6",
|
|
16737
|
+
"codec",
|
|
16738
|
+
"custom",
|
|
16739
|
+
"date",
|
|
16740
|
+
"discriminatedUnion",
|
|
16741
|
+
"email",
|
|
16742
|
+
"emoji",
|
|
16743
|
+
"enum",
|
|
16744
|
+
"file",
|
|
16745
|
+
"function",
|
|
16746
|
+
"hash",
|
|
16747
|
+
"hex",
|
|
16748
|
+
"hostname",
|
|
16749
|
+
"instanceof",
|
|
16750
|
+
"intersection",
|
|
16751
|
+
"ipv4",
|
|
16752
|
+
"ipv6",
|
|
16753
|
+
"json",
|
|
16754
|
+
"jwt",
|
|
16755
|
+
"lazy",
|
|
16756
|
+
"literal",
|
|
16757
|
+
"looseObject",
|
|
16758
|
+
"map",
|
|
16759
|
+
"nan",
|
|
16760
|
+
"nativeEnum",
|
|
16761
|
+
"never",
|
|
16762
|
+
"null",
|
|
16763
|
+
"nullable",
|
|
16764
|
+
"nullish",
|
|
16765
|
+
"number",
|
|
16766
|
+
"object",
|
|
16767
|
+
"optional",
|
|
16768
|
+
"partialRecord",
|
|
16769
|
+
"preprocess",
|
|
16770
|
+
"promise",
|
|
16771
|
+
"record",
|
|
16772
|
+
"set",
|
|
16773
|
+
"strictObject",
|
|
16774
|
+
"string",
|
|
16775
|
+
"stringbool",
|
|
16776
|
+
"symbol",
|
|
16777
|
+
"templateLiteral",
|
|
16778
|
+
"tuple",
|
|
16779
|
+
"undefined",
|
|
16780
|
+
"union",
|
|
16781
|
+
"unknown",
|
|
16782
|
+
"url",
|
|
16783
|
+
"uuid",
|
|
16784
|
+
"void"
|
|
16785
|
+
]);
|
|
16786
|
+
var ZOD_FACTORY_NAMESPACES = /* @__PURE__ */ new Set(["coerce", "iso"]);
|
|
16787
|
+
var SCHEMA_RETURNING_METHODS = /* @__PURE__ */ new Set([
|
|
16788
|
+
"and",
|
|
16789
|
+
"array",
|
|
16790
|
+
"brand",
|
|
16791
|
+
"catch",
|
|
16792
|
+
"check",
|
|
16793
|
+
"clone",
|
|
16794
|
+
"default",
|
|
16795
|
+
"describe",
|
|
16796
|
+
"extend",
|
|
16797
|
+
"keyof",
|
|
16798
|
+
"meta",
|
|
16799
|
+
"nullable",
|
|
16800
|
+
"nullish",
|
|
16801
|
+
"omit",
|
|
16802
|
+
"optional",
|
|
16803
|
+
"or",
|
|
16804
|
+
"overwrite",
|
|
16805
|
+
"partial",
|
|
16806
|
+
"pick",
|
|
16807
|
+
"pipe",
|
|
16808
|
+
"prefault",
|
|
16809
|
+
"readonly",
|
|
16810
|
+
"refine",
|
|
16811
|
+
"register",
|
|
16812
|
+
"required",
|
|
16813
|
+
"safeExtend",
|
|
16814
|
+
"superRefine",
|
|
16815
|
+
"transform"
|
|
16816
|
+
]);
|
|
16721
16817
|
var terminalMethodName = (callee) => !callee.computed && callee.property.type === import_utils85.AST_NODE_TYPES.Identifier ? callee.property.name : null;
|
|
16722
16818
|
var calleeChainRoot = (node) => {
|
|
16723
16819
|
let current = node;
|
|
@@ -16736,38 +16832,55 @@ var calleeChainRoot = (node) => {
|
|
|
16736
16832
|
return null;
|
|
16737
16833
|
}
|
|
16738
16834
|
};
|
|
16739
|
-
var
|
|
16740
|
-
|
|
16741
|
-
|
|
16835
|
+
var chainMemberNames = (node) => {
|
|
16836
|
+
const names = [];
|
|
16837
|
+
let current = node;
|
|
16838
|
+
for (; ; ) {
|
|
16839
|
+
if (current.type === import_utils85.AST_NODE_TYPES.MemberExpression) {
|
|
16840
|
+
if (current.computed || current.property.type !== import_utils85.AST_NODE_TYPES.Identifier) return [];
|
|
16841
|
+
names.push(current.property.name);
|
|
16842
|
+
current = current.object;
|
|
16843
|
+
continue;
|
|
16844
|
+
}
|
|
16845
|
+
if (current.type === import_utils85.AST_NODE_TYPES.CallExpression) {
|
|
16846
|
+
current = current.callee;
|
|
16847
|
+
continue;
|
|
16848
|
+
}
|
|
16849
|
+
break;
|
|
16850
|
+
}
|
|
16851
|
+
names.reverse();
|
|
16852
|
+
return names;
|
|
16853
|
+
};
|
|
16854
|
+
var unwrapExpression4 = (node) => {
|
|
16855
|
+
let current = node;
|
|
16856
|
+
while (current.type === import_utils85.AST_NODE_TYPES.TSAsExpression || current.type === import_utils85.AST_NODE_TYPES.TSSatisfiesExpression || current.type === import_utils85.AST_NODE_TYPES.TSNonNullExpression || current.type === import_utils85.AST_NODE_TYPES.TSTypeAssertion) {
|
|
16857
|
+
current = current.expression;
|
|
16858
|
+
}
|
|
16859
|
+
return current;
|
|
16860
|
+
};
|
|
16861
|
+
var isModuleDeclarator = (node) => {
|
|
16862
|
+
const declaration = node.parent;
|
|
16863
|
+
if (declaration.type !== import_utils85.AST_NODE_TYPES.VariableDeclaration) return false;
|
|
16864
|
+
const owner = declaration.parent;
|
|
16865
|
+
return owner.type === import_utils85.AST_NODE_TYPES.Program || owner.type === import_utils85.AST_NODE_TYPES.ExportNamedDeclaration && owner.parent.type === import_utils85.AST_NODE_TYPES.Program;
|
|
16866
|
+
};
|
|
16867
|
+
var require_pascal_case_zod_schema_name_default = createRule({
|
|
16868
|
+
name: "require-pascal-case-zod-schema-name",
|
|
16869
|
+
documentation: REQUIRE_PASCAL_CASE_ZOD_SCHEMA_NAME_DOCUMENTATION,
|
|
16742
16870
|
meta: {
|
|
16743
16871
|
type: "suggestion",
|
|
16744
16872
|
docs: {
|
|
16745
|
-
description: "
|
|
16873
|
+
description: "Require confirmed module-level Zod schema contracts to use PascalCase with a `Schema` suffix."
|
|
16746
16874
|
},
|
|
16747
|
-
schema: [
|
|
16748
|
-
{
|
|
16749
|
-
type: "object",
|
|
16750
|
-
additionalProperties: false,
|
|
16751
|
-
properties: {
|
|
16752
|
-
convention: {
|
|
16753
|
-
type: "string",
|
|
16754
|
-
enum: ["prefix", "suffix", "either"]
|
|
16755
|
-
}
|
|
16756
|
-
}
|
|
16757
|
-
}
|
|
16758
|
-
],
|
|
16875
|
+
schema: [],
|
|
16759
16876
|
messages: {
|
|
16760
|
-
|
|
16761
|
-
schemaSuffix: "Zod schema names should end with Schema (e.g. `userSchema`)",
|
|
16762
|
-
zodSchemaName: "Zod schema names should start with Z (`ZUser`) or end with Schema (`userSchema`)"
|
|
16877
|
+
requirePascalSchema: "Zod schema contracts must use PascalCase ending in Schema (for example, `MutationRouteBaseSchema`); reserve SCREAMING_SNAKE_CASE for scalar/table constants."
|
|
16763
16878
|
}
|
|
16764
16879
|
},
|
|
16765
|
-
defaultOptions: [
|
|
16766
|
-
create(context
|
|
16767
|
-
const convention = optionsArg?.convention ?? "either";
|
|
16768
|
-
const { test, messageId } = CONVENTIONS[convention];
|
|
16769
|
-
const acceptsSchemaWord = convention !== "prefix";
|
|
16880
|
+
defaultOptions: [],
|
|
16881
|
+
create(context) {
|
|
16770
16882
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
16883
|
+
const schemaBindings = /* @__PURE__ */ new Set();
|
|
16771
16884
|
function resolvedBinding(identifier) {
|
|
16772
16885
|
return import_utils85.ASTUtils.findVariable(
|
|
16773
16886
|
context.sourceCode.getScope(identifier),
|
|
@@ -16784,6 +16897,26 @@ var zod_naming_convention_default = createRule({
|
|
|
16784
16897
|
const binding = resolvedBinding(root);
|
|
16785
16898
|
return binding !== null && zodBindings.has(binding);
|
|
16786
16899
|
}
|
|
16900
|
+
function isSchemaBinding(identifier) {
|
|
16901
|
+
const binding = resolvedBinding(identifier);
|
|
16902
|
+
return binding !== null && schemaBindings.has(binding);
|
|
16903
|
+
}
|
|
16904
|
+
function isConfirmedSchema(expression) {
|
|
16905
|
+
const init = unwrapExpression4(expression);
|
|
16906
|
+
if (init.type === import_utils85.AST_NODE_TYPES.Identifier) return isSchemaBinding(init);
|
|
16907
|
+
if (init.type !== import_utils85.AST_NODE_TYPES.CallExpression || init.callee.type !== import_utils85.AST_NODE_TYPES.MemberExpression) {
|
|
16908
|
+
return false;
|
|
16909
|
+
}
|
|
16910
|
+
const terminal = terminalMethodName(init.callee);
|
|
16911
|
+
if (terminal === null || NON_SCHEMA_TERMINALS.has(terminal)) return false;
|
|
16912
|
+
const names = chainMemberNames(init.callee);
|
|
16913
|
+
if (names.length === 0) return false;
|
|
16914
|
+
if (isZodChain(init.callee)) {
|
|
16915
|
+
return ZOD_SCHEMA_FACTORIES.has(names[0] ?? "") || ZOD_FACTORY_NAMESPACES.has(names[0] ?? "") && ZOD_SCHEMA_FACTORIES.has(names[1] ?? "");
|
|
16916
|
+
}
|
|
16917
|
+
const root = calleeChainRoot(init.callee);
|
|
16918
|
+
return root !== null && isSchemaBinding(root) && SCHEMA_RETURNING_METHODS.has(terminal);
|
|
16919
|
+
}
|
|
16787
16920
|
if (isTestFile(context.filename) || BENCHMARK_PATH_RE.test(context.filename.replaceAll("\\", "/")) || isGeneratedFile(context.filename, context.sourceCode.text)) {
|
|
16788
16921
|
return {};
|
|
16789
16922
|
}
|
|
@@ -16797,20 +16930,17 @@ var zod_naming_convention_default = createRule({
|
|
|
16797
16930
|
}
|
|
16798
16931
|
},
|
|
16799
16932
|
VariableDeclarator(node) {
|
|
16933
|
+
if (!isModuleDeclarator(node)) return;
|
|
16800
16934
|
const init = node.init;
|
|
16801
16935
|
if (init === null || init === void 0) return;
|
|
16802
|
-
if (init.type !== import_utils85.AST_NODE_TYPES.CallExpression) return;
|
|
16803
|
-
const callee = init.callee;
|
|
16804
|
-
if (callee.type !== import_utils85.AST_NODE_TYPES.MemberExpression) return;
|
|
16805
|
-
if (!isZodChain(callee)) return;
|
|
16806
|
-
const terminal = terminalMethodName(callee);
|
|
16807
|
-
if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;
|
|
16808
16936
|
if (node.id.type !== import_utils85.AST_NODE_TYPES.Identifier) return;
|
|
16809
|
-
if (
|
|
16810
|
-
|
|
16937
|
+
if (!isConfirmedSchema(init)) return;
|
|
16938
|
+
const binding = resolvedBinding(node.id);
|
|
16939
|
+
if (binding !== null) schemaBindings.add(binding);
|
|
16940
|
+
if (PASCAL_SCHEMA_NAME_RE.test(node.id.name)) return;
|
|
16811
16941
|
context.report({
|
|
16812
16942
|
node: node.id,
|
|
16813
|
-
messageId
|
|
16943
|
+
messageId: "requirePascalSchema"
|
|
16814
16944
|
});
|
|
16815
16945
|
}
|
|
16816
16946
|
};
|
|
@@ -16818,15 +16948,16 @@ var zod_naming_convention_default = createRule({
|
|
|
16818
16948
|
});
|
|
16819
16949
|
|
|
16820
16950
|
// src/rules/_renames.ts
|
|
16821
|
-
var
|
|
16951
|
+
var RENAMED_RULES = {
|
|
16822
16952
|
"jsdoc-restates-signature": "no-restated-jsdoc",
|
|
16953
|
+
"zod-naming-convention": "require-pascal-case-zod-schema-name",
|
|
16823
16954
|
"require-interface-for-injected-service": "require-port-for-service",
|
|
16824
16955
|
"strict-test-assertions": "prefer-whole-object-assertion",
|
|
16825
16956
|
"trailing-value-narration": "no-trailing-value-narration"
|
|
16826
16957
|
};
|
|
16827
16958
|
|
|
16828
16959
|
// src/rules/_retired.ts
|
|
16829
|
-
var
|
|
16960
|
+
var RETIRED_RULES = {
|
|
16830
16961
|
"ban-loose-type-guards-in-tests": {
|
|
16831
16962
|
removedIn: "5.0.0",
|
|
16832
16963
|
reason: "Delete the config entry and suppressions; there is no replacement."
|
|
@@ -16898,7 +17029,7 @@ var retiredRules = {
|
|
|
16898
17029
|
};
|
|
16899
17030
|
|
|
16900
17031
|
// src/index.ts
|
|
16901
|
-
var
|
|
17032
|
+
var RULES = {
|
|
16902
17033
|
"iac-source-coupled-test": iac_source_coupled_test_default,
|
|
16903
17034
|
"duplicate-test-body": duplicate_test_body_default,
|
|
16904
17035
|
"enforce-file-structure": enforce_file_structure_default,
|
|
@@ -16977,19 +17108,19 @@ var rules = {
|
|
|
16977
17108
|
"store-insert-requires-on-conflict": store_insert_requires_on_conflict_default,
|
|
16978
17109
|
"stepdown": stepdown_default,
|
|
16979
17110
|
"source-coupled-test": source_coupled_test_default,
|
|
16980
|
-
"zod-
|
|
17111
|
+
"require-pascal-case-zod-schema-name": require_pascal_case_zod_schema_name_default
|
|
16981
17112
|
};
|
|
16982
17113
|
var meta = {
|
|
16983
17114
|
name: "@sarj/eslint-plugin",
|
|
16984
|
-
version: "15.13.
|
|
17115
|
+
version: "15.13.3"
|
|
16985
17116
|
};
|
|
16986
|
-
var
|
|
17117
|
+
var APPLICATION_ONLY_RULES = [
|
|
16987
17118
|
"no-restricted-library-load",
|
|
16988
17119
|
"prefer-native-random-uuid",
|
|
16989
17120
|
"prefer-shadcn-primitives"
|
|
16990
17121
|
];
|
|
16991
|
-
var
|
|
16992
|
-
var
|
|
17122
|
+
var ADVISORY_RULES = ["@sarj/require-pascal-case-zod-schema-name"];
|
|
17123
|
+
var RECOMMENDED_RULES = {
|
|
16993
17124
|
"@sarj/interface-contract-members-private": "error",
|
|
16994
17125
|
"@sarj/iac-source-coupled-test": "error",
|
|
16995
17126
|
"@sarj/duplicate-test-body": "error",
|
|
@@ -17061,9 +17192,9 @@ var recommendedRules = {
|
|
|
17061
17192
|
"@sarj/stepdown": "error",
|
|
17062
17193
|
"@sarj/source-coupled-test": "error",
|
|
17063
17194
|
"@sarj/test-phase-label-comment": "error",
|
|
17064
|
-
"@sarj/zod-
|
|
17195
|
+
"@sarj/require-pascal-case-zod-schema-name": "warn"
|
|
17065
17196
|
};
|
|
17066
|
-
var
|
|
17197
|
+
var STRICT_RULES = {
|
|
17067
17198
|
"@sarj/interface-contract-members-private": "error",
|
|
17068
17199
|
"@sarj/iac-source-coupled-test": "error",
|
|
17069
17200
|
"@sarj/duplicate-test-body": "error",
|
|
@@ -17139,30 +17270,37 @@ var strictRules = {
|
|
|
17139
17270
|
"@sarj/stepdown": "error",
|
|
17140
17271
|
"@sarj/source-coupled-test": "error",
|
|
17141
17272
|
"@sarj/test-phase-label-comment": "error",
|
|
17142
|
-
"@sarj/zod-
|
|
17273
|
+
"@sarj/require-pascal-case-zod-schema-name": "warn"
|
|
17143
17274
|
};
|
|
17144
|
-
var
|
|
17275
|
+
var PLUGIN = {
|
|
17145
17276
|
meta,
|
|
17146
|
-
rules,
|
|
17147
|
-
retiredRules,
|
|
17277
|
+
rules: RULES,
|
|
17278
|
+
retiredRules: RETIRED_RULES,
|
|
17148
17279
|
get configs() {
|
|
17149
17280
|
return {
|
|
17150
17281
|
recommended: {
|
|
17151
17282
|
name: "@sarj/recommended",
|
|
17152
|
-
plugins: { "@sarj":
|
|
17153
|
-
rules:
|
|
17283
|
+
plugins: { "@sarj": PLUGIN },
|
|
17284
|
+
rules: RECOMMENDED_RULES
|
|
17154
17285
|
},
|
|
17155
17286
|
strict: {
|
|
17156
17287
|
name: "@sarj/strict",
|
|
17157
|
-
plugins: { "@sarj":
|
|
17158
|
-
rules:
|
|
17288
|
+
plugins: { "@sarj": PLUGIN },
|
|
17289
|
+
rules: STRICT_RULES
|
|
17159
17290
|
}
|
|
17160
17291
|
};
|
|
17161
17292
|
}
|
|
17162
17293
|
};
|
|
17163
|
-
var index_default =
|
|
17294
|
+
var index_default = PLUGIN;
|
|
17164
17295
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17165
17296
|
0 && (module.exports = {
|
|
17297
|
+
ADVISORY_RULES,
|
|
17298
|
+
APPLICATION_ONLY_RULES,
|
|
17299
|
+
RECOMMENDED_RULES,
|
|
17300
|
+
RENAMED_RULES,
|
|
17301
|
+
RETIRED_RULES,
|
|
17302
|
+
RULES,
|
|
17303
|
+
STRICT_RULES,
|
|
17166
17304
|
advisoryRules,
|
|
17167
17305
|
applicationOnlyRules,
|
|
17168
17306
|
publicDocumentation,
|