@sarj/eslint-plugin 9.10.0 → 9.12.1
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/README.md +15 -0
- package/dist/index.cjs +475 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +470 -333
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/rules/enforce-file-structure.ts","../src/rules/_docs.ts","../src/rules/_paths.ts","../src/rules/no-async-callback-in-wait-for.ts","../src/rules/no-client-side-data-fetching.ts","../src/rules/no-comment-cruft.ts","../src/rules/_comments.ts","../src/rules/no-conditional-in-test.ts","../src/rules/no-cors-wildcard-with-credentials.ts","../src/rules/no-dynamic-sql.ts","../src/rules/_sql.ts","../src/rules/no-enum.ts","../src/rules/no-fat-try-blocks.ts","../src/rules/no-hand-rolled-sleep.ts","../src/rules/no-hand-rolled-spinner.ts","../src/rules/no-insecure-random-id.ts","../src/rules/no-json-stringify-error.ts","../src/rules/no-log-only-catch.ts","../src/rules/_logging.ts","../src/rules/_prose-budget.ts","../src/rules/no-long-comment.ts","../src/rules/no-offset-pagination.ts","../src/rules/no-positional-tuple-return.ts","../src/rules/no-raw-env.ts","../src/rules/no-raw-fetch-outside-clients.ts","../src/rules/no-restricted-library-load.ts","../src/rules/no-repeated-string-literal.ts","../src/rules/no-restated-comment.ts","../src/rules/no-restated-jsdoc.ts","../src/rules/no-secret-in-log.ts","../src/rules/_secret-names.ts","../src/rules/no-select-star.ts","../src/rules/no-sentinel-return-on-catch.ts","../src/rules/no-silent-promise-catch.ts","../src/rules/no-sleep-in-test-body.ts","../src/rules/no-storage-in-stateless-modules.ts","../src/rules/no-string-concat-in-loop.ts","../src/rules/no-tautological-expect.ts","../src/rules/no-typed-doc-sections.ts","../src/rules/no-trailing-value-narration.ts","../src/rules/no-declaration-comment-wall.ts","../src/rules/_comment-wall.ts","../src/rules/no-union-in-comment.ts","../src/rules/no-type-member-comment-wall.ts","../src/rules/no-unnecessary-use-client.ts","../src/rules/no-unsafe-mock-casting.ts","../src/rules/no-zod-native-enum.ts","../src/rules/prefer-constant-time-secret-compare.ts","../src/rules/prefer-discriminated-union.ts","../src/rules/prefer-input-group-search.ts","../src/rules/prefer-module-level-constant.ts","../src/rules/prefer-module-level-schema.ts","../src/rules/_zod.ts","../src/rules/prefer-native-random-uuid.ts","../src/rules/prefer-non-nullable-collection.ts","../src/rules/prefer-schema-for-api-payload.ts","../src/rules/prefer-semantic-colors.ts","../src/rules/_tailwind.ts","../src/rules/prefer-server-actions.ts","../src/rules/prefer-single-sentence-comment.ts","../src/rules/prefer-string-literal-union.ts","../src/rules/prefer-whole-object-assertion.ts","../src/rules/prefer-zod-enum.ts","../src/rules/prefer-zod-infer.ts","../src/rules/require-assert-never.ts","../src/rules/require-fetch-timeout.ts","../src/rules/require-interface-for-injected-service.ts","../src/rules/require-static-next-matcher.ts","../src/rules/require-zod-form-validation.ts","../src/rules/store-insert-requires-on-conflict.ts","../src/rules/zod-naming-convention.ts","../src/rules/_renames.ts","../src/rules/_retired.ts"],"sourcesContent":["/**\n * @fileoverview index — the plugin's rule registry and its two presets; the historical rename map lives in `rules/_renames.ts`.\n */\n\nimport enforceFileStructure from \"./rules/enforce-file-structure.js\";\nimport noAsyncCallbackInWaitFor from \"./rules/no-async-callback-in-wait-for.js\";\nimport noClientSideDataFetching from \"./rules/no-client-side-data-fetching.js\";\nimport noCommentCruft from \"./rules/no-comment-cruft.js\";\nimport noConditionalInTest from \"./rules/no-conditional-in-test.js\";\nimport noCorsWildcardWithCredentials from \"./rules/no-cors-wildcard-with-credentials.js\";\nimport noDynamicSql from \"./rules/no-dynamic-sql.js\";\nimport noEnum from \"./rules/no-enum.js\";\nimport noFatTryBlocks from \"./rules/no-fat-try-blocks.js\";\nimport noHandRolledSleep from \"./rules/no-hand-rolled-sleep.js\";\nimport noHandRolledSpinner from \"./rules/no-hand-rolled-spinner.js\";\nimport noInsecureRandomId from \"./rules/no-insecure-random-id.js\";\nimport noJsonStringifyError from \"./rules/no-json-stringify-error.js\";\nimport noLogOnlyCatch from \"./rules/no-log-only-catch.js\";\nimport noLongComment from \"./rules/no-long-comment.js\";\nimport noOffsetPagination from \"./rules/no-offset-pagination.js\";\nimport noPositionalTupleReturn from \"./rules/no-positional-tuple-return.js\";\nimport noRawEnv from \"./rules/no-raw-env.js\";\nimport noRawFetchOutsideClients from \"./rules/no-raw-fetch-outside-clients.js\";\nimport noRestrictedLibraryLoad from \"./rules/no-restricted-library-load.js\";\nimport noRepeatedStringLiteral from \"./rules/no-repeated-string-literal.js\";\nimport noRestatedComment from \"./rules/no-restated-comment.js\";\nimport noRestatedJsdoc from \"./rules/no-restated-jsdoc.js\";\nimport noSecretInLog from \"./rules/no-secret-in-log.js\";\nimport noSelectStar from \"./rules/no-select-star.js\";\nimport noSentinelReturnOnCatch from \"./rules/no-sentinel-return-on-catch.js\";\nimport noSilentPromiseCatch from \"./rules/no-silent-promise-catch.js\";\nimport noSleepInTestBody from \"./rules/no-sleep-in-test-body.js\";\nimport noStorageInStatelessModules from \"./rules/no-storage-in-stateless-modules.js\";\nimport noStringConcatInLoop from \"./rules/no-string-concat-in-loop.js\";\nimport noTautologicalExpect from \"./rules/no-tautological-expect.js\";\nimport noTypedDocSections from \"./rules/no-typed-doc-sections.js\";\nimport noTrailingValueNarration from \"./rules/no-trailing-value-narration.js\";\nimport noDeclarationCommentWall from \"./rules/no-declaration-comment-wall.js\";\nimport noUnionInComment from \"./rules/no-union-in-comment.js\";\nimport noTypeMemberCommentWall from \"./rules/no-type-member-comment-wall.js\";\nimport noUnnecessaryUseClient from \"./rules/no-unnecessary-use-client.js\";\nimport noUnsafeMockCasting from \"./rules/no-unsafe-mock-casting.js\";\nimport noZodNativeEnum from \"./rules/no-zod-native-enum.js\";\nimport preferConstantTimeSecretCompare from \"./rules/prefer-constant-time-secret-compare.js\";\nimport preferDiscriminatedUnion from \"./rules/prefer-discriminated-union.js\";\nimport preferInputGroupSearch from \"./rules/prefer-input-group-search.js\";\nimport preferModuleLevelConstant from \"./rules/prefer-module-level-constant.js\";\nimport preferModuleLevelSchema from \"./rules/prefer-module-level-schema.js\";\nimport preferNativeRandomUuid from \"./rules/prefer-native-random-uuid.js\";\nimport preferNonNullableCollection from \"./rules/prefer-non-nullable-collection.js\";\nimport preferSchemaForApiPayload from \"./rules/prefer-schema-for-api-payload.js\";\nimport preferSemanticColors from \"./rules/prefer-semantic-colors.js\";\nimport preferServerActions from \"./rules/prefer-server-actions.js\";\nimport preferSingleSentenceComment from \"./rules/prefer-single-sentence-comment.js\";\nimport preferStringLiteralUnion from \"./rules/prefer-string-literal-union.js\";\nimport preferWholeObjectAssertion from \"./rules/prefer-whole-object-assertion.js\";\nimport preferZodEnum from \"./rules/prefer-zod-enum.js\";\nimport preferZodInfer from \"./rules/prefer-zod-infer.js\";\nimport requireAssertNever from \"./rules/require-assert-never.js\";\nimport requireFetchTimeout from \"./rules/require-fetch-timeout.js\";\nimport requireInterfaceForInjectedService from \"./rules/require-interface-for-injected-service.js\";\nimport requireStaticNextMatcher from \"./rules/require-static-next-matcher.js\";\nimport requireZodFormValidation from \"./rules/require-zod-form-validation.js\";\nimport storeInsertRequiresOnConflict from \"./rules/store-insert-requires-on-conflict.js\";\nimport zodNamingConvention from \"./rules/zod-naming-convention.js\";\nimport { renamedRules } from \"./rules/_renames.js\";\nimport { retiredRules } from \"./rules/_retired.js\";\n\nconst rules = {\n\"enforce-file-structure\": enforceFileStructure,\n \"no-async-callback-in-wait-for\": noAsyncCallbackInWaitFor,\n \"no-client-side-data-fetching\": noClientSideDataFetching,\n \"no-comment-cruft\": noCommentCruft,\n \"no-conditional-in-test\": noConditionalInTest,\n \"no-cors-wildcard-with-credentials\": noCorsWildcardWithCredentials,\n \"no-dynamic-sql\": noDynamicSql,\n \"no-enum\": noEnum,\n \"no-fat-try-blocks\": noFatTryBlocks,\n \"no-hand-rolled-sleep\": noHandRolledSleep,\n \"no-hand-rolled-spinner\": noHandRolledSpinner,\n \"no-insecure-random-id\": noInsecureRandomId,\n \"no-json-stringify-error\": noJsonStringifyError,\n \"no-log-only-catch\": noLogOnlyCatch,\n \"no-long-comment\": noLongComment,\n \"no-offset-pagination\": noOffsetPagination,\n \"no-positional-tuple-return\": noPositionalTupleReturn,\n \"no-raw-env\": noRawEnv,\n \"no-raw-fetch-outside-clients\": noRawFetchOutsideClients,\n \"no-restricted-library-load\": noRestrictedLibraryLoad,\n \"no-repeated-string-literal\": noRepeatedStringLiteral,\n \"no-restated-comment\": noRestatedComment,\n \"no-restated-jsdoc\": noRestatedJsdoc,\n \"no-secret-in-log\": noSecretInLog,\n \"no-select-star\": noSelectStar,\n \"no-sentinel-return-on-catch\": noSentinelReturnOnCatch,\n \"no-silent-promise-catch\": noSilentPromiseCatch,\n \"no-sleep-in-test-body\": noSleepInTestBody,\n \"no-storage-in-stateless-modules\": noStorageInStatelessModules,\n \"no-string-concat-in-loop\": noStringConcatInLoop,\n \"no-tautological-expect\": noTautologicalExpect,\n \"no-typed-doc-sections\": noTypedDocSections,\n \"no-trailing-value-narration\": noTrailingValueNarration,\n \"no-declaration-comment-wall\": noDeclarationCommentWall,\n \"no-union-in-comment\": noUnionInComment,\n \"no-type-member-comment-wall\": noTypeMemberCommentWall,\n \"no-unnecessary-use-client\": noUnnecessaryUseClient,\n \"no-unsafe-mock-casting\": noUnsafeMockCasting,\n \"no-zod-native-enum\": noZodNativeEnum,\n \"prefer-constant-time-secret-compare\": preferConstantTimeSecretCompare,\n \"prefer-discriminated-union\": preferDiscriminatedUnion,\n \"prefer-input-group-search\": preferInputGroupSearch,\n \"prefer-module-level-constant\": preferModuleLevelConstant,\n \"prefer-module-level-schema\": preferModuleLevelSchema,\n \"prefer-native-random-uuid\": preferNativeRandomUuid,\n \"prefer-non-nullable-collection\": preferNonNullableCollection,\n \"prefer-schema-for-api-payload\": preferSchemaForApiPayload,\n \"prefer-semantic-colors\": preferSemanticColors,\n \"prefer-server-actions\": preferServerActions,\n \"prefer-single-sentence-comment\": preferSingleSentenceComment,\n \"prefer-string-literal-union\": preferStringLiteralUnion,\n \"prefer-whole-object-assertion\": preferWholeObjectAssertion,\n \"prefer-zod-enum\": preferZodEnum,\n \"prefer-zod-infer\": preferZodInfer,\n \"require-assert-never\": requireAssertNever,\n \"require-fetch-timeout\": requireFetchTimeout,\n \"require-interface-for-injected-service\": requireInterfaceForInjectedService,\n \"require-static-next-matcher\": requireStaticNextMatcher,\n \"require-zod-form-validation\": requireZodFormValidation,\n \"store-insert-requires-on-conflict\": storeInsertRequiresOnConflict,\n \"zod-naming-convention\": zodNamingConvention,\n};\n\nconst meta = {\n name: \"@sarj/eslint-plugin\",\n version: \"9.10.0\",\n} as const;\n\n/** Rules registered for application-profile configs but intentionally absent from general presets. */\nconst applicationOnlyRules = [\n \"no-restricted-library-load\",\n \"prefer-native-random-uuid\",\n] as const;\n\nconst recommendedRules = {\n\"@sarj/enforce-file-structure\": \"warn\",\n \"@sarj/no-async-callback-in-wait-for\": \"warn\",\n \"@sarj/no-client-side-data-fetching\": \"warn\",\n \"@sarj/no-comment-cruft\": \"warn\",\n \"@sarj/no-conditional-in-test\": \"warn\",\n \"@sarj/no-cors-wildcard-with-credentials\": \"warn\",\n \"@sarj/no-dynamic-sql\": \"warn\",\n \"@sarj/no-fat-try-blocks\": \"warn\",\n \"@sarj/no-hand-rolled-sleep\": \"warn\",\n \"@sarj/no-hand-rolled-spinner\": \"error\",\n \"@sarj/no-insecure-random-id\": \"warn\",\n \"@sarj/no-json-stringify-error\": \"warn\",\n \"@sarj/no-log-only-catch\": \"warn\",\n \"@sarj/no-long-comment\": \"warn\",\n \"@sarj/no-offset-pagination\": \"warn\",\n \"@sarj/no-positional-tuple-return\": \"warn\",\n \"@sarj/no-repeated-string-literal\": \"warn\",\n \"@sarj/no-restated-comment\": \"warn\",\n \"@sarj/no-restated-jsdoc\": \"warn\",\n \"@sarj/no-secret-in-log\": \"warn\",\n \"@sarj/no-select-star\": \"warn\",\n \"@sarj/no-sentinel-return-on-catch\": \"warn\",\n \"@sarj/no-silent-promise-catch\": \"warn\",\n \"@sarj/no-sleep-in-test-body\": \"warn\",\n \"@sarj/no-string-concat-in-loop\": \"warn\",\n \"@sarj/no-tautological-expect\": \"warn\",\n \"@sarj/no-typed-doc-sections\": \"warn\",\n \"@sarj/no-trailing-value-narration\": \"warn\",\n \"@sarj/no-declaration-comment-wall\": \"warn\",\n \"@sarj/no-union-in-comment\": \"warn\",\n \"@sarj/no-type-member-comment-wall\": \"warn\",\n \"@sarj/no-unnecessary-use-client\": \"warn\",\n \"@sarj/no-unsafe-mock-casting\": \"warn\",\n \"@sarj/no-zod-native-enum\": \"warn\",\n \"@sarj/prefer-constant-time-secret-compare\": \"error\",\n \"@sarj/prefer-discriminated-union\": \"warn\",\n \"@sarj/prefer-input-group-search\": \"error\",\n \"@sarj/prefer-module-level-constant\": \"warn\",\n \"@sarj/prefer-module-level-schema\": \"warn\",\n \"@sarj/prefer-non-nullable-collection\": \"warn\",\n \"@sarj/prefer-schema-for-api-payload\": \"warn\",\n \"@sarj/prefer-semantic-colors\": [\"warn\", { requireSemanticTokens: true }],\n \"@sarj/prefer-server-actions\": \"warn\",\n \"@sarj/prefer-single-sentence-comment\": \"warn\",\n \"@sarj/prefer-string-literal-union\": \"warn\",\n \"@sarj/prefer-whole-object-assertion\": \"warn\",\n \"@sarj/prefer-zod-enum\": \"warn\",\n \"@sarj/prefer-zod-infer\": \"warn\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-fetch-timeout\": \"warn\",\n \"@sarj/require-interface-for-injected-service\": \"warn\",\n \"@sarj/require-static-next-matcher\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/store-insert-requires-on-conflict\": \"warn\",\n \"@sarj/zod-naming-convention\": \"warn\",\n} as const;\n\nconst strictRules = {\n\"@sarj/enforce-file-structure\": \"error\",\n \"@sarj/no-async-callback-in-wait-for\": \"error\",\n \"@sarj/no-client-side-data-fetching\": \"error\",\n \"@sarj/no-comment-cruft\": \"error\",\n \"@sarj/no-conditional-in-test\": \"error\",\n \"@sarj/no-cors-wildcard-with-credentials\": \"error\",\n \"@sarj/no-dynamic-sql\": \"error\",\n \"@sarj/no-enum\": \"error\",\n \"@sarj/no-fat-try-blocks\": \"error\",\n \"@sarj/no-hand-rolled-sleep\": \"error\",\n \"@sarj/no-hand-rolled-spinner\": \"error\",\n \"@sarj/no-insecure-random-id\": \"error\",\n \"@sarj/no-json-stringify-error\": \"error\",\n \"@sarj/no-log-only-catch\": \"error\",\n \"@sarj/no-long-comment\": \"error\",\n \"@sarj/no-offset-pagination\": \"error\",\n \"@sarj/no-positional-tuple-return\": \"error\",\n \"@sarj/no-raw-env\": \"error\",\n \"@sarj/no-raw-fetch-outside-clients\": \"error\",\n \"@sarj/no-repeated-string-literal\": \"error\",\n \"@sarj/no-restated-comment\": \"error\",\n \"@sarj/no-restated-jsdoc\": \"error\",\n \"@sarj/no-secret-in-log\": \"error\",\n \"@sarj/no-select-star\": \"error\",\n \"@sarj/no-sentinel-return-on-catch\": \"error\",\n \"@sarj/no-silent-promise-catch\": \"error\",\n \"@sarj/no-sleep-in-test-body\": \"error\",\n \"@sarj/no-storage-in-stateless-modules\": \"error\",\n \"@sarj/no-string-concat-in-loop\": \"error\",\n \"@sarj/no-tautological-expect\": \"error\",\n \"@sarj/no-typed-doc-sections\": \"error\",\n \"@sarj/no-trailing-value-narration\": \"error\",\n \"@sarj/no-declaration-comment-wall\": \"error\",\n \"@sarj/no-union-in-comment\": \"error\",\n \"@sarj/no-type-member-comment-wall\": \"error\",\n \"@sarj/no-unnecessary-use-client\": \"error\",\n \"@sarj/no-unsafe-mock-casting\": \"error\",\n \"@sarj/no-zod-native-enum\": \"error\",\n \"@sarj/prefer-constant-time-secret-compare\": \"error\",\n \"@sarj/prefer-discriminated-union\": \"error\",\n \"@sarj/prefer-input-group-search\": \"error\",\n \"@sarj/prefer-module-level-constant\": \"error\",\n \"@sarj/prefer-module-level-schema\": \"error\",\n \"@sarj/prefer-non-nullable-collection\": \"error\",\n \"@sarj/prefer-schema-for-api-payload\": \"error\",\n \"@sarj/prefer-semantic-colors\": [\"error\", { requireSemanticTokens: true }],\n \"@sarj/prefer-server-actions\": \"error\",\n \"@sarj/prefer-single-sentence-comment\": \"warn\",\n \"@sarj/prefer-string-literal-union\": \"error\",\n \"@sarj/prefer-whole-object-assertion\": \"error\",\n \"@sarj/prefer-zod-enum\": \"error\",\n \"@sarj/prefer-zod-infer\": \"error\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-fetch-timeout\": \"error\",\n \"@sarj/require-interface-for-injected-service\": \"error\",\n \"@sarj/require-static-next-matcher\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/store-insert-requires-on-conflict\": \"error\",\n \"@sarj/zod-naming-convention\": \"error\",\n} as const;\n\ntype FlatPreset = {\n readonly name: string;\n readonly plugins: Record<string, unknown>;\n readonly rules: Record<string, unknown>;\n};\n\n/**\n * The presets, as FLAT config objects — `plugins` is the object form, so both go\n * straight into an `eslint.config.mjs` array with no spread. Neither sets\n * `files` or a parser, so they compose with whatever a repo already has.\n */\nconst plugin = {\n meta,\n rules,\n // Withdrawn names travel WITH the plugin so a consumer's migration script and\n // this repo's gates read one map, not two. See src/rules/_retired.ts.\n retiredRules,\n configs: {\n recommended: {} as FlatPreset,\n strict: {} as FlatPreset,\n },\n};\n\nplugin.configs.recommended = {\n name: \"@sarj/recommended\",\n plugins: { \"@sarj\": plugin },\n rules: recommendedRules,\n};\n\nplugin.configs.strict = {\n name: \"@sarj/strict\",\n plugins: { \"@sarj\": plugin },\n rules: strictRules,\n};\n\nexport default plugin;\nexport { type RetiredRule, retiredRules } from \"./rules/_retired.js\";\nexport { applicationOnlyRules, recommendedRules, renamedRules, rules, strictRules };\n","/**\n * @fileoverview enforce-file-structure — imports come first, then step-down order; a `use server` directive that is not the first statement is inert.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/enforce-file-structure.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"importsFirst\" | \"useServerDirective\";\ntype Options = readonly [];\n\ntype StatementKind = \"import\" | \"reexport\" | \"body\";\n\n/** Classify declarations by what they introduce; re-exports are neutral. */\nconst classifyStatement = (\n statement: TSESTree.ProgramStatement,\n): StatementKind => {\n switch (statement.type) {\n case AST_NODE_TYPES.ImportDeclaration:\n return \"import\";\n case AST_NODE_TYPES.ExportAllDeclaration:\n return \"reexport\";\n case AST_NODE_TYPES.ExportNamedDeclaration:\n // Only `export <declaration>` introduces a body statement.\n return statement.declaration === null ? \"reexport\" : \"body\";\n default:\n return \"body\";\n }\n};\n\nconst isStringDirective = (statement: TSESTree.ProgramStatement): boolean =>\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n statement.expression.type === AST_NODE_TYPES.Literal &&\n typeof statement.expression.value === \"string\" &&\n statement.expression.value.startsWith(\"use \");\n\nconst isUseServerDirective = (\n statement: TSESTree.ProgramStatement,\n): boolean => {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) return false;\n const expr = statement.expression;\n if (expr.type !== AST_NODE_TYPES.Literal) return false;\n return expr.value === \"use server\";\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"enforce-file-structure\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require `import` statements to come first, then allow step-down ordering (public API first, private helpers below) for the rest of the file. Exported statements are classified by WHAT they export — an exported interface is a declaration, an exported function is a function — so a public exported function followed by a private helper, or an exported interface among declarations, is allowed. Re-exports (`export { … } from`, `export *`, `export { … }`) are a neutral group, so generated namespace barrels pass. When a module contains a `use server` directive, it must be the first statement in the file.\",\n },\n schema: [],\n messages: {\n importsFirst:\n \"File structure violation: import statements must come before other declarations\",\n useServerDirective:\n \"A 'use server' directive must be the first statement in the file\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n return {\n Program(node: TSESTree.Program): void {\n const body = node.body;\n\n const misplacedUseServer = body.find(\n (statement, index) => index > 0 && isUseServerDirective(statement),\n );\n if (misplacedUseServer !== undefined) {\n context.report({\n node: misplacedUseServer,\n messageId: \"useServerDirective\",\n });\n }\n\n let seenBody = false;\n let inMisplacedRun = false;\n\n for (const statement of body) {\n if (isStringDirective(statement)) continue;\n\n switch (classifyStatement(statement)) {\n case \"reexport\":\n continue;\n case \"body\":\n seenBody = true;\n inMisplacedRun = false;\n continue;\n case \"import\":\n if (seenBody && !inMisplacedRun) {\n inMisplacedRun = true;\n context.report({\n node: statement,\n messageId: \"importsFirst\",\n });\n }\n continue;\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _docs — a rule links directly to executable examples derived from its name.\n *\n */\n\nimport { ESLintUtils } from \"@typescript-eslint/utils\";\n\nexport const REPO_BLOB = \"https://github.com/sarj-ai/standards/blob/main\";\nexport const TESTS_DIR = \"packages/typescript/tests/rules\";\n\nexport const examplesPath = (name: string): string =>\n `${TESTS_DIR}/${name}.test.ts`;\n\nexport const examplesUrl = (name: string): string =>\n `${REPO_BLOB}/${examplesPath(name)}`;\n\nexport const createRule = ESLintUtils.RuleCreator(examplesUrl);\n","/**\n * @fileoverview _paths — shared file-kind predicates, so \"is this a test / script / generated file?\" is answered in exactly one place.\n *\n * A path joins a shared default only if its NAME makes a claim true for every rule; anything one rule needs alone is a named gate that rule opts into.\n *\n */\n\nconst SCRIPT_FILE_RE = /([\\\\/]scripts[\\\\/])|(\\.mjs$)/;\n\nconst STORY_FILE_RE = /\\.stories\\.[cm]?[jt]sx?$/i;\n// `storyTree` includes Storybook's suffixed directories. It stays opt-in because\n// some repositories keep production components under `stories/`.\nconst STORY_TREE_RE = /(^|\\/)stories(?:[_-][^/]*)?\\//i;\n\n// These directory names explicitly identify upstream-owned code, so every rule\n// may safely ignore them.\nconst GENERATED_FILE_RE =\n /([\\\\/](?:generated|openapi-gen|graphql[\\\\/]types|vendor|vendored|third[-_]?party)[\\\\/])|(\\.gen\\.[cm]?[jt]sx?$)|(\\.generated\\.[cm]?[jt]sx?$)|(\\.d\\.[cm]?ts$)|(\\.types\\.[cm]?ts$)/;\n// `externalTree` stays opt-in because `external/` often contains first-party\n// integration code.\nconst EXTERNAL_TREE_RE = /[\\\\/]external[\\\\/]/;\n\n// A banner must claim that the file itself is generated. This avoids treating\n// prose about generated values or warnings as generated-file declarations.\nconst GENERATED_MARKER_RE =\n /(?:@generated\\b|this file (?:is|was|has been)[\\w\\s,'-]{0,40}?generated|auto-?generated file\\b|generated (?:with|by)|generated (?:graphql )?types|do not edit(?: directly| manually)?|do not (?:modify|change) this file)/i;\n\nconst TEST_BASENAME_RE = /[.\\-_](test|spec|e2e)\\.[cm]?[jt]sx?$/;\nconst TEST_INTEGRATION_BASENAME_RE = /\\.integration\\.[cm]?[jt]sx?$/;\n// Double-underscore fixture directories are alternate spellings of `fixtures/`.\nconst TEST_DIR_RE = /(^|\\/)(tests?|__tests__|__mocks__|fixtures|__fixtures__|__testfixtures__|e2e|integration)\\//;\n// Singular `fixture/` stays opt-in because it can contain production seeders.\nconst FIXTURE_TREE_RE = /(^|\\/)fixture\\//;\n\n/** Extra path gates that `isGeneratedFile` honours on request. */\nexport type GeneratedPathGate = \"externalTree\";\n\n/** Extra path gates `isTestFile` honours on request. */\nexport type TestPathGate = \"fixtureTree\";\n\n/** Extra path gates `isStoryFile` honours on request. */\nexport type StoryPathGate = \"storyTree\";\n\n/**\n * True for a test file: a `*.test.*` / `*.spec.*` basename, the `-test` /\n * `_test` suffix forms of the same, or anything under a `test/` / `tests/` /\n * `__tests__/` / `__mocks__/` / `fixtures/` / `__fixtures__/` /\n * `__testfixtures__/` / `e2e/` / `integration/` directory.\n *\n * Pass `[\"fixtureTree\"]` to also exempt the singular `fixture/`.\n */\nexport function isTestFile(filename: string, gates: readonly TestPathGate[] = []): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n const base = normalized.slice(normalized.lastIndexOf(\"/\") + 1);\n if (TEST_BASENAME_RE.test(base) || TEST_INTEGRATION_BASENAME_RE.test(base)) {\n return true;\n }\n if (TEST_DIR_RE.test(normalized)) {\n return true;\n }\n return gates.includes(\"fixtureTree\") && FIXTURE_TREE_RE.test(normalized);\n}\n\n/**\n * True for a `*.stories.*` file. Pass `[\"storyTree\"]` to also match anything\n * inside a `stories/` tree.\n */\nexport function isStoryFile(filename: string, gates: readonly StoryPathGate[] = []): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n if (STORY_FILE_RE.test(normalized)) {\n return true;\n }\n return gates.includes(\"storyTree\") && STORY_TREE_RE.test(normalized);\n}\n\n/**\n * True for a file whose text an upstream owns: generator output or a vendored\n * copy by path, or any file whose own header declares it generated.\n *\n * The banner arm is universal; the path arm defaults to generator output and\n * vendored trees, while `[\"externalTree\"]` adds `external/`.\n */\nexport function isGeneratedFile(\n filename: string,\n sourceText = \"\",\n gates: readonly GeneratedPathGate[] = [],\n): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n if (GENERATED_FILE_RE.test(normalized)) {\n return true;\n }\n if (gates.includes(\"externalTree\") && EXTERNAL_TREE_RE.test(normalized)) {\n return true;\n }\n return GENERATED_MARKER_RE.test(sourceText.slice(0, 2048));\n}\n\n/**\n * True for one-off tooling files: anything under a `scripts/` directory or a\n * `*.mjs` file. Dev scripts run interactively and die with the terminal, so\n * production-hardening rules (e.g. fetch timeouts) do not apply there.\n */\nexport function isScriptFile(filename: string): boolean {\n return SCRIPT_FILE_RE.test(filename);\n}\n","/**\n * @fileoverview no-async-callback-in-wait-for — an async `waitFor` callback swallows its own rejection, so the assertion inside it can never fail the test.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-async-callback-in-wait-for.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noAsyncCallbackInWaitFor\";\ntype Options = readonly [];\n\n/** Match bare and non-computed member calls; the receiver does not change the polling contract. */\nconst isWaitForCallee = (callee: TSESTree.CallExpression[\"callee\"]): boolean => {\n if (callee.type === AST_NODE_TYPES.Identifier) return callee.name === \"waitFor\";\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"waitFor\"\n );\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"no-async-callback-in-wait-for\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow async callbacks in `waitFor` to prevent swallowed promise rejections.\",\n },\n schema: [],\n messages: {\n noAsyncCallbackInWaitFor:\n \"The callback to `waitFor` should not be async. It expects synchronous assertions and runs the callback repeatedly.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n return {\n CallExpression(node: TSESTree.CallExpression) {\n if (!isWaitForCallee(node.callee)) return;\n const callback = node.arguments[0];\n if (\n callback &&\n (callback.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n callback.type === AST_NODE_TYPES.FunctionExpression) &&\n callback.async\n ) {\n context.report({\n node: callback,\n messageId: \"noAsyncCallbackInWaitFor\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-client-side-data-fetching — fetching in `useEffect` is a render -> effect -> fetch -> re-render waterfall with no server cache.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-client-side-data-fetching.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"noClientFetch\";\ntype Options = readonly [];\n\nconst FETCH_LIBS: ReadonlySet<string> = new Set([\"axios\", \"ky\", \"superagent\"]);\n\n// Real HTTP verbs only. Explicitly excludes `create`, `defaults`,\n// `interceptors`, `isAxiosError`, etc.\nconst HTTP_METHOD_NAMES: ReadonlySet<string> = new Set([\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"request\",\n \"head\",\n \"options\",\n]);\n\n// Matched against whole path SEGMENTS (split on `/` and `.`), never as raw\n// substrings — otherwise `/api/login` (\"log\"), `/blog` (\"log\"), `/api/events`\n// (\"event\"), `/catalog` (\"log\"), and `/api/shipping` (\"ping\") would be wrongly\n// exempted.\nconst ANALYTICS_SEGMENTS: ReadonlySet<string> = new Set([\n \"analytics\",\n \"telemetry\",\n \"track\",\n \"log\",\n \"ping\",\n \"beacon\",\n \"metrics\",\n \"event\",\n]);\n\nfunction isEffectHookCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n // useEffect(...) / useLayoutEffect(...)\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"useEffect\" || callee.name === \"useLayoutEffect\";\n }\n\n // React.useEffect(...) / React.useLayoutEffect(...)\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"React\" &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return (\n callee.property.name === \"useEffect\" ||\n callee.property.name === \"useLayoutEffect\"\n );\n }\n\n return false;\n}\n\n/**\n * Reads the `method` property of an options object passed to `fetch` / `axios`.\n * Returns the uppercased method name, or `null` if not statically determinable.\n */\nfunction readMethodProperty(\n optionsArg: TSESTree.Node | undefined,\n): string | null {\n if (!optionsArg || optionsArg.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n for (const prop of optionsArg.properties) {\n if (prop.type !== AST_NODE_TYPES.Property) continue;\n if (prop.computed) continue;\n const key = prop.key;\n const matchesMethodKey =\n (key.type === AST_NODE_TYPES.Identifier && key.name === \"method\") ||\n (key.type === AST_NODE_TYPES.Literal && key.value === \"method\");\n if (!matchesMethodKey) continue;\n if (\n prop.value.type === AST_NODE_TYPES.Literal &&\n typeof prop.value.value === \"string\"\n ) {\n return prop.value.value.toUpperCase();\n }\n return null;\n }\n return null;\n}\n\nfunction isFetchCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n callee.name === \"fetch\"\n ) {\n const method = readMethodProperty(node.arguments[1]);\n if (method !== null && method !== \"GET\") {\n return false;\n }\n return true;\n }\n\n // axios.get(...), ky.post(...), superagent.delete(...), ...\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n FETCH_LIBS.has(callee.object.name) &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n // Only flag actual HTTP method calls — NOT `axios.create`, `axios.defaults`,\n // `axios.interceptors`, `axios.isAxiosError`, etc.\n return HTTP_METHOD_NAMES.has(callee.property.name);\n }\n\n // axios(config) / ky(config) — treat as request unless method is explicitly non-GET.\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n (callee.name === \"axios\" || callee.name === \"ky\")\n ) {\n const firstArg = node.arguments[0];\n const secondArg = node.arguments[1];\n let configArg: TSESTree.Node | undefined;\n if (firstArg?.type === AST_NODE_TYPES.ObjectExpression) {\n configArg = firstArg;\n } else if (secondArg?.type === AST_NODE_TYPES.ObjectExpression) {\n configArg = secondArg;\n }\n const method = readMethodProperty(configArg);\n if (method !== null && method !== \"GET\") {\n return false;\n }\n return true;\n }\n\n return false;\n}\n\nfunction extractUrlString(node: TSESTree.CallExpression): string {\n const firstArg = node.arguments[0];\n if (!firstArg) return \"\";\n\n if (\n firstArg.type === AST_NODE_TYPES.Literal &&\n typeof firstArg.value === \"string\"\n ) {\n return firstArg.value;\n }\n if (firstArg.type === AST_NODE_TYPES.TemplateLiteral) {\n return firstArg.quasis.map((q) => q.value.cooked).join(\"\");\n }\n if (firstArg.type === AST_NODE_TYPES.Identifier) {\n return firstArg.name;\n }\n return \"\";\n}\n\nfunction isAnalyticsCall(node: TSESTree.CallExpression): boolean {\n const url = extractUrlString(node).toLowerCase();\n if (url === \"\") return false;\n // Split into path segments and file-extension parts; exempt only when a\n // WHOLE segment is a known analytics keyword.\n return url\n .split(/[/.]/)\n .some((segment) => ANALYTICS_SEGMENTS.has(segment));\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-client-side-data-fetching\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow data fetching inside `useEffect` / `useLayoutEffect`; prefer React Server Components, Server Actions, or a client-side cache (SWR / React Query).\",\n },\n schema: [],\n messages: {\n noClientFetch:\n \"Avoid direct data fetching inside useEffect / useLayoutEffect. This causes waterfalls and layout shifts. Prefer React Server Components, Server Actions, or client-side caching libraries like SWR or React Query.\",\n },\n },\n defaultOptions: [],\n create(context) {\n let effectDepth = 0;\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (isEffectHookCall(node)) {\n effectDepth += 1;\n return;\n }\n if (effectDepth === 0) return;\n if (!isFetchCall(node)) return;\n if (isAnalyticsCall(node)) return;\n context.report({ node, messageId: \"noClientFetch\" });\n },\n \"CallExpression:exit\"(node: TSESTree.CallExpression): void {\n if (isEffectHookCall(node)) {\n effectDepth -= 1;\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-comment-cruft — commented-out code, section banners and file-header preambles are volume the reader pays for and nothing maintains.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-comment-cruft.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport {\n codeTokens,\n contentTokens,\n hasExternalReference,\n isProtected,\n restates,\n restatableStatementBelow,\n restatesStatementHead,\n} from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds =\n | \"commentedOutCode\"\n | \"sectionBanner\"\n | \"fileHeaderPreamble\"\n | \"commentWall\"\n | \"redundantNarration\"\n | \"untrackedTodo\";\ntype Options = readonly [];\n\nconst LEADING_PREAMBLE_MIN = 4;\nconst WALL_MIN_STATEMENTS = 4;\nconst WALL_MIN_COMMENTS = 3;\nconst WALL_MIN_COMMENTED_RATIO = 0.6;\nconst WALL_MIN_WEAK_RATIO = 0.75;\nconst WALL_MAX_WORDS = 18;\nconst WALL_MAX_NOVEL_WORDS = 2;\nconst WALL_NARRATION_RE =\n /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|now|finally|lastly|add|append|assign|await|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|define|delete|extract|fetch|filter|find|format|generate|get|handle|initialize|insert|iterate|join|load|log|loop|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|d|ed|ing)?\\b/i;\nconst WALL_STEP_PREFIX_RE = /^(?:\\d+[.)]|(?:phase|step)\\s+\\d+\\s*:)\\s*/i;\n\n// Require punctuation after step adverbs so ordinary prose does not match.\nconst STEP_NARRATION_RE =\n /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|after(?:wards| that)?|finally|lastly|now)\\s*[,:]\\s*\\S/i;\n\n// These phrases name debt; `isBareDeferral` handles content-free `for now` notes.\nconst META_COMMENTARY_RE =\n /\\b(?:keeping (?:it|this) simple|could be (?:refactored|improved|cleaned up|simplified)|refactor(?:ed|ing)? (?:later|this)|not sure (?:if|whether|why|how)|quick[- ](?:and[- ]dirty|fix)|(?:a |bit of a )?hacky|is a hack|temporary (?:solution|workaround|fix|hack)|revisit (?:this|later|below)|clean (?:this|it) up|not ideal|placeholder for now)\\b/i;\n\nconst FOR_NOW_RE = /\\bfor now\\b/i;\n\n// Stopwords do not identify what is deferred.\nconst DEFERRAL_STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"an\", \"and\", \"are\", \"as\", \"at\", \"be\", \"but\", \"by\", \"can\", \"could\", \"do\",\n \"does\", \"for\", \"from\", \"had\", \"has\", \"have\", \"here\", \"i\", \"in\", \"is\", \"it\",\n \"its\", \"just\", \"may\", \"might\", \"no\", \"not\", \"now\", \"of\", \"on\", \"only\", \"our\",\n \"shall\", \"should\", \"so\", \"still\", \"that\", \"the\", \"then\", \"there\", \"this\",\n \"to\", \"us\", \"was\", \"we\", \"were\", \"will\", \"with\", \"would\", \"you\", \"your\",\n]);\n\n/** Most content words a `for now` comment may carry and still be pure deferral. */\nconst DEFERRAL_MAX_CONTENT_WORDS = 2;\n\n/** Match `for now` only when at most two content words identify the deferral. */\nfunction isBareDeferral(text: string): boolean {\n if (!FOR_NOW_RE.test(text)) return false;\n const rest = text.replace(FOR_NOW_RE, \" \");\n const content = (rest.match(/[A-Za-z][\\w']*/g) ?? []).filter(\n (word) => !DEFERRAL_STOPWORDS.has(word.toLowerCase()),\n );\n return content.length <= DEFERRAL_MAX_CONTENT_WORDS;\n}\n\n// Suppression and tool directives are instructions, not prose.\nconst DIRECTIVE_RE =\n /^(eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier-ignore|prettier\\b|biome-|c8\\b|v8\\b|istanbul\\b|@type\\b|@vite|webpack|<reference|<amd|global\\b|noinspection|hack\\b|xxx\\b)/i;\n\nconst LICENSE_RE =\n /copyright|licen[cs]ed?|spdx|permission is hereby granted|all rights reserved/i;\n\n// Multiple explanatory list items form a walkthrough, not a content-free preamble.\nconst ENUMERATED_ITEM_RE = /^(?:\\d+[.):]|[-*•])\\s+\\S/;\nconst ENUMERATED_ITEM_MIN_WORDS = 3;\nconst ENUMERATED_PREAMBLE_MIN_ITEMS = 2;\n\nconst BANNER_FULL_RE = /^[\\s\\-=*#~_+.]{4,}$/;\nconst BANNER_RUN_RE = /={4,}|-{4,}|#{4,}|\\*{4,}|~{4,}|[\\u2500-\\u257f]{4,}/;\n\nconst REGION_MARKER_RE = /^#?(?:end)?region\\b(.*)$/i;\nconst REGION_TITLE_RE = /^[\\s:\\-\\u2013\\u2014]*\\w[\\w \\-/&+]*$/;\nconst REGION_TITLE_MAX_WORDS = 5;\n\nfunction isRegionMarker(text: string): boolean {\n const match = REGION_MARKER_RE.exec(text);\n if (match === null) return false;\n const title = (match[1] ?? \"\").trim();\n if (title.length === 0) return true;\n if (!REGION_TITLE_RE.test(title)) return false;\n return title.split(/\\s+/).length <= REGION_TITLE_MAX_WORDS;\n}\n\nconst SECTION_LABEL_WORDS: ReadonlySet<string> = new Set([\n \"actions\", \"components\", \"config\", \"configuration\", \"constant\", \"constants\",\n \"enums\", \"exports\", \"fixtures\", \"getters\", \"globals\", \"handler\", \"handlers\",\n \"helper\", \"helpers\", \"hook\", \"hooks\", \"imports\", \"interfaces\", \"main\",\n \"mocks\", \"models\", \"mutations\", \"props\", \"queries\", \"reducers\", \"routes\",\n \"schemas\", \"selectors\", \"setters\", \"setup\", \"state\", \"styles\", \"teardown\",\n \"type\", \"types\", \"util\", \"utilities\", \"utils\",\n]);\nconst SECTION_LABEL_RE = /^([A-Za-z]+)\\s*:?\\s*$/;\n\nfunction isSectionLabel(text: string): boolean {\n const match = SECTION_LABEL_RE.exec(text);\n return match !== null && SECTION_LABEL_WORDS.has((match[1] ?? \"\").toLowerCase());\n}\n\n// Match two-to-four shouted words; preserve acronyms and numbered standards.\nconst SHOUTED_LABEL_RE = /^[A-Z]{2,}(?:[ -][A-Z]{2,}){1,3}$/;\n\nconst HELPER_OPENER_RE = /^(?:a\\s+)?helper\\s+(?:function|method|component|hook|class|type|util(?:ity)?)\\b/i;\n\n// Match walkthrough `let's`, but preserve third-person `lets` explanations.\nconst LETS_RE =\n /^let'?s\\s+(?:not\\s+|just\\s+|now\\s+|first\\s+)?(?:add|append|assign|await|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|decrement|define|delete|extract|fetch|filter|find|format|generate|get|handle|increment|init|initialise|initialize|insert|iterate|join|load|log|loop|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|ed|ing)?\\b/i;\n\n// Flag an isolated numbered step; preserve walkthrough runs and JSX labels.\nconst ENUMERATION_RE = /^(?:\\d+[.)]\\s+\\S|(?:phase|step)\\s+\\d+\\b)/i;\n\n// Dummy translational comments: ultra-short comments that just restate the code.\n// Corroborated against the statement below by `restatesWholeStatement` — the\n// lexical match alone is NOT evidence. See that function.\nconst DUMMY_TRANSLATION_RE = /^(?:increment|return|returns|get|gets|set\\b(?! up\\b)|sets\\b(?! up\\b)|function to|method to)\\b/i;\n\nconst DIAGRAM_ARROW_RE = /[-=~]{2,}>|<[-=~]{2,}/;\n\nconst CODE_KEYWORD_RE =\n /^(import |export |const |let |var |function\\b|class |interface |type \\w|enum |return\\b|throw |await |async |if\\s*\\(|for\\s*\\(|while\\s*\\(|switch\\s*\\(|new |console\\.)/;\nconst CODE_TAIL_RE = /[;{}()]\\s*$|=>\\s*$|,\\s*$/;\n// Require an identifier LHS and code tail so prose equations do not match.\nconst ASSIGN_RE = /^[A-Za-z_$][\\w.$[\\]]*\\s*(?:=(?![=>])|\\+=|-=|\\*=)\\s*\\S.*[;)}\\]]\\s*$/;\nconst CALL_RE = /^[A-Za-z_$][\\w.$]*\\([^)]*\\)\\s*;?\\s*$/;\n\n// Placeholders that only appear in grammar productions / desugaring examples,\n// never in real code: `%sent%`, `[opt]`, a standalone `<FunctionBody>`, `…` / `...`.\nconst PSEUDOCODE_RE = /%\\w+%|\\[opt\\]|(?:^|\\s)<[A-Za-z]\\w*>|…|\\.\\.\\./;\n\n// A triple-slash `///` directive keeps its third `/` after ESLint strips the\n// leading `//`, so strip 1–2 leading slashes (not exactly two) for `<reference`.\nfunction stripCommentMarker(line: string): string {\n return line.replace(/^\\s*\\/{1,2}/, \"\").replace(/^\\s*\\*+/, \"\").trim();\n}\n\nfunction isDirective(text: string): boolean {\n return DIRECTIVE_RE.test(text.trim());\n}\n\nfunction isBanner(text: string): boolean {\n const t = text.trim();\n if (!t) return false;\n if (BANNER_FULL_RE.test(t) || isRegionMarker(t)) return true;\n return BANNER_RUN_RE.test(t) && !DIAGRAM_ARROW_RE.test(t);\n}\n\n/**\n * `allowCall` is false where a bare statement cannot legally appear — inside an\n * interface body or a type literal. See `TYPE_MEMBER_CONTAINERS`.\n */\nfunction looksLikeCode(text: string, allowCall = true): boolean {\n const t = text.trim();\n if (!t) return false;\n if (CODE_KEYWORD_RE.test(t) && CODE_TAIL_RE.test(t)) return true;\n if (ASSIGN_RE.test(t)) return true;\n return allowCall && CALL_RE.test(t);\n}\n\nfunction hasPseudocode(text: string): boolean {\n return PSEUDOCODE_RE.test(text);\n}\n\n/** An explanatory item of a numbered/bulleted walkthrough. */\nfunction isEnumeratedProseItem(text: string): boolean {\n const t = text.trim();\n return ENUMERATED_ITEM_RE.test(t) && t.split(/\\s+/).length >= ENUMERATED_ITEM_MIN_WORDS;\n}\n\n// A prose lead-in preceding a code-shaped line marks that line as an\n// illustration (`// For example:`, a grammar production `FunctionExpression:`),\n// not commented-out code.\nfunction isProse(text: string): boolean {\n const t = text.trim();\n if (!t) return false;\n if (t.endsWith(\":\")) return true;\n if (\n /[.!?]$/.test(t) &&\n /\\s/.test(t) &&\n /[a-z]/.test(t) &&\n !looksLikeCode(t) &&\n t.split(/\\s+/).length >= 3\n ) {\n return true;\n }\n return false;\n}\n\nconst JUSTIFICATION_RE =\n /\\b(?:because|since|until|due to|so that|so we|so it|so the|otherwise|which is why|in order to|to avoid|to work around|to prevent|backwards? compat(?:ibility)?|for compatibility)\\b/i;\n\n/** Apply total corroboration to the whole statement, including call arguments. */\nfunction restatesWholeStatement(body: string, statement: string | null): boolean {\n return statement !== null && restatesStatementHead(body, statement.replaceAll(\"(\", \" \"));\n}\n\n/**\n * Whether a single-line comment merely narrates the code rather than explaining\n * the *why*. Three deterministic shapes: step narration (\"First, …\"), self-\n * admitted meta-commentary (\"keeping it simple\"), and a restatement of the very\n * next line (`// increment the counter` above `counter += 1`).\n */\nfunction isRedundantNarration(\n body: string,\n statementBelow: string | null,\n standalone: boolean,\n isolatedEnumeration: boolean,\n nested: boolean,\n): boolean {\n const t = body.trim();\n if (!t || looksLikeCode(t) || hasPseudocode(t)) return false;\n if (standalone) {\n const justified = JUSTIFICATION_RE.test(t);\n if (STEP_NARRATION_RE.test(t) && !justified) return true;\n if (META_COMMENTARY_RE.test(t) && !justified) return true;\n if (isBareDeferral(t) && !justified) return true;\n if (HELPER_OPENER_RE.test(t) || LETS_RE.test(t)) return true;\n\n const words = t.split(/\\s+/);\n if (words.length > 1 && words.length <= 4 && DUMMY_TRANSLATION_RE.test(t) && !/[():=]/.test(t)) {\n const lowerT = t.toLowerCase();\n const rationaleWords = [\"when\", \"because\", \"if\", \"so that\", \"due to\", \"for\", \"instead of\", \"to prevent\", \"to avoid\", \"only\"];\n if (!rationaleWords.some((w) => lowerT.includes(w)) && restatesWholeStatement(t, statementBelow)) {\n return true;\n }\n }\n\n if (!nested && isSectionLabel(t)) return true;\n if (isolatedEnumeration && ENUMERATION_RE.test(t)) return true;\n }\n return restatesStatementHead(t, statementBelow);\n}\n\n// Outside these containers, a short label groups expression elements.\nconst STATEMENT_CONTAINERS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.Program,\n AST_NODE_TYPES.BlockStatement,\n AST_NODE_TYPES.ClassBody,\n AST_NODE_TYPES.StaticBlock,\n AST_NODE_TYPES.SwitchCase,\n AST_NODE_TYPES.TSModuleBlock,\n AST_NODE_TYPES.TSInterfaceBody,\n]);\n\ninterface CommentWall {\n readonly leader: TSESTree.Comment;\n readonly members: ReadonlySet<TSESTree.Comment>;\n}\n\ninterface WallAttachment {\n readonly container: TSESTree.Node;\n readonly index: number;\n readonly statement: string;\n}\n\nfunction directStatements(container: TSESTree.Node): readonly TSESTree.Node[] {\n switch (container.type) {\n case AST_NODE_TYPES.Program:\n case AST_NODE_TYPES.BlockStatement:\n case AST_NODE_TYPES.ClassBody:\n case AST_NODE_TYPES.StaticBlock:\n case AST_NODE_TYPES.TSModuleBlock:\n return container.body;\n case AST_NODE_TYPES.SwitchCase:\n return container.consequent;\n case AST_NODE_TYPES.TSInterfaceBody:\n return container.body;\n default:\n return [];\n }\n}\n\nconst WALL_STATEMENTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ExpressionStatement,\n AST_NODE_TYPES.ReturnStatement,\n AST_NODE_TYPES.ThrowStatement,\n AST_NODE_TYPES.VariableDeclaration,\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.ForStatement,\n AST_NODE_TYPES.ForOfStatement,\n AST_NODE_TYPES.ForInStatement,\n AST_NODE_TYPES.WhileStatement,\n AST_NODE_TYPES.DoWhileStatement,\n AST_NODE_TYPES.SwitchStatement,\n AST_NODE_TYPES.TryStatement,\n]);\n\nfunction statementAttachmentBelow(\n comment: TSESTree.Comment,\n sourceCode: Readonly<{\n getNodeByRangeIndex(index: number): TSESTree.Node | null;\n getTokenAfter(\n node: TSESTree.Comment,\n options: { includeComments: boolean },\n ): TSESTree.Token | null;\n getText(node: TSESTree.Node): string;\n }>,\n): WallAttachment | null {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (\n token === null ||\n token.loc.start.line !== comment.loc.end.line + 1 ||\n token.loc.start.column !== comment.loc.start.column\n ) {\n return null;\n }\n for (\n let node: TSESTree.Node | null | undefined = sourceCode.getNodeByRangeIndex(token.range[0]);\n node?.parent != null;\n node = node.parent\n ) {\n if (!STATEMENT_CONTAINERS.has(node.parent.type) || !WALL_STATEMENTS.has(node.type)) {\n continue;\n }\n const siblings = directStatements(node.parent);\n const index = siblings.indexOf(node);\n return index < 0\n ? null\n : { container: node.parent, index, statement: sourceCode.getText(node) };\n }\n return null;\n}\n\nfunction isWeakWalkthroughComment(body: string, statement: string): boolean {\n const normalized = body.replace(WALL_STEP_PREFIX_RE, \"\");\n if (\n normalized.length === 0 ||\n normalized.endsWith(\"?\") ||\n normalized.split(/\\s+/).length > WALL_MAX_WORDS ||\n isDirective(normalized) ||\n isProtected(normalized) ||\n !WALL_NARRATION_RE.test(normalized)\n ) {\n return false;\n }\n const words = contentTokens(normalized);\n const described = words.slice(1);\n if (described.length === 0) return false;\n const code = codeTokens(statement);\n const matched = described.filter((word) => restates([word], code)).length;\n return (\n matched / described.length >= 0.5 &&\n described.length - matched <= WALL_MAX_NOVEL_WORDS\n );\n}\n\n/** Type-member containers cannot contain bare call statements. */\nconst TYPE_MEMBER_CONTAINERS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.TSInterfaceBody,\n AST_NODE_TYPES.TSTypeLiteral,\n]);\n\n/** Preserve an entire contiguous comment run when any line cites a reference. */\nfunction runCitesAReference(comments: readonly TSESTree.Comment[], index: number): boolean {\n for (let i = index; i >= 0; i--) {\n if (i < index && !areAdjacentLineComments(comments[i], comments[i + 1])) break;\n if (hasExternalReference(stripCommentMarker(comments[i]?.value ?? \"\"))) return true;\n }\n for (let i = index + 1; i < comments.length; i++) {\n if (!areAdjacentLineComments(comments[i - 1], comments[i])) break;\n if (hasExternalReference(stripCommentMarker(comments[i]?.value ?? \"\"))) return true;\n }\n return false;\n}\n\n/** True when `a` and `b` are `//` comments on consecutive lines. */\nfunction areAdjacentLineComments(\n a: TSESTree.Comment | undefined,\n b: TSESTree.Comment | undefined,\n): boolean {\n return (\n a !== undefined &&\n b !== undefined &&\n a.type === \"Line\" &&\n b.type === \"Line\" &&\n b.loc.start.line === a.loc.end.line + 1\n );\n}\n\n/**\n * True when the comment at `index` is one line of a contiguous `//` block rather\n * than a lone annotation.\n */\nfunction isInsideCommentRun(comments: readonly TSESTree.Comment[], index: number): boolean {\n const comment = comments[index];\n return (\n areAdjacentLineComments(comments[index - 1], comment) ||\n areAdjacentLineComments(comment, comments[index + 1])\n );\n}\n\n/** How far back the illustration lead-in scan walks within one `//` block. */\nconst LEAD_IN_SCAN_LIMIT = 24;\n\nfunction hasIllustrationLeadInAbove(\n comments: readonly TSESTree.Comment[],\n index: number,\n): boolean {\n for (let i = index - 1; i >= 0 && index - i <= LEAD_IN_SCAN_LIMIT; i--) {\n if (!areAdjacentLineComments(comments[i], comments[i + 1])) return false;\n const body = stripCommentMarker(comments[i]?.value ?? \"\");\n if (body.length > 0 && body.endsWith(\":\")) return true;\n }\n return false;\n}\n\nfunction hasCommentedOutCode(\n texts: readonly string[],\n precedingProse: boolean,\n allowCall: boolean,\n): boolean {\n for (let i = 0; i < texts.length; i++) {\n const line = texts[i];\n if (line === undefined || !looksLikeCode(line, allowCall) || hasPseudocode(line)) {\n continue;\n }\n const prev = i > 0 ? texts[i - 1] : undefined;\n if (prev !== undefined ? isProse(prev) : precedingProse) continue;\n return true;\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-comment-cruft\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag commented-out code, section-banner comments, and leading file-header comment preambles.\",\n },\n schema: [],\n messages: {\n commentedOutCode:\n \"Commented-out code — delete it; git history remembers.\",\n sectionBanner:\n \"Section-banner / region comment — structure code with functions, not ASCII rules.\",\n fileHeaderPreamble:\n \"File-header comment preamble — use a brief doc comment for the why, not a block of `//` lines.\",\n commentWall:\n \"Statement comment wall ({{count}} narrated steps) — delete the walkthrough and name the operations in code; keep only constraints or rationale.\",\n redundantNarration:\n \"Comment narrates the code — delete it or say *why*, not *what*. Code is self-documenting.\",\n untrackedTodo:\n \"Untracked TODO/FIXME marker — add an issue ticket or context link.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const sourceCode = context.sourceCode;\n\n function isStandalone(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, {\n includeComments: false,\n });\n return !before || before.loc.end.line < comment.loc.start.line;\n }\n\n function isJsDoc(comment: TSESTree.Comment): boolean {\n return comment.type === \"Block\" && /^\\*/.test(comment.value);\n }\n\n function findCommentWalls(comments: readonly TSESTree.Comment[]): CommentWall[] {\n const attached = new Map<\n TSESTree.Node,\n Array<{ comment: TSESTree.Comment; index: number; weak: boolean }>\n >();\n for (const comment of comments) {\n if (comment.type !== \"Line\" || !isStandalone(comment)) continue;\n const attachment = statementAttachmentBelow(comment, sourceCode);\n if (attachment === null) continue;\n const body = stripCommentMarker(comment.value);\n const entries = attached.get(attachment.container) ?? [];\n entries.push({\n comment,\n index: attachment.index,\n weak: isWeakWalkthroughComment(body, attachment.statement),\n });\n attached.set(attachment.container, entries);\n }\n\n const walls: CommentWall[] = [];\n for (const entries of attached.values()) {\n const sorted = entries.toSorted((left, right) => left.index - right.index);\n const clusters: Array<typeof sorted> = [];\n for (const entry of sorted) {\n const cluster = clusters.at(-1);\n if (cluster !== undefined && entry.index <= (cluster.at(-1)?.index ?? 0) + 2) {\n cluster.push(entry);\n } else {\n clusters.push([entry]);\n }\n }\n for (const cluster of clusters) {\n const firstIndex = cluster[0]?.index;\n const lastIndex = cluster.at(-1)?.index;\n if (firstIndex === undefined || lastIndex === undefined) continue;\n const span = lastIndex - firstIndex + 1;\n const weak = cluster.filter((entry) => entry.weak).map((entry) => entry.comment);\n if (\n span < WALL_MIN_STATEMENTS ||\n weak.length < WALL_MIN_COMMENTS ||\n cluster.length / span < WALL_MIN_COMMENTED_RATIO ||\n weak.length / cluster.length < WALL_MIN_WEAK_RATIO\n ) {\n continue;\n }\n const leader = weak[0];\n if (leader !== undefined) walls.push({ leader, members: new Set(weak) });\n }\n }\n return walls;\n }\n\n /** True when every content line of a JSDoc block is a banner or a section title. */\n function isSectionJsDoc(comment: TSESTree.Comment): boolean {\n const texts = comment.value\n .split(\"\\n\")\n .map(stripCommentMarker)\n .filter((line) => line.length > 0 && !isDirective(line));\n return (\n texts.length > 0 &&\n texts.every(\n (text) =>\n !isProtected(text) &&\n (isBanner(text) ||\n isSectionLabel(text) ||\n SHOUTED_LABEL_RE.test(text.replace(/[.:]$/, \"\"))),\n )\n );\n }\n\n function reportLeadingPreamble(\n comments: readonly TSESTree.Comment[],\n firstCodeLine: number,\n ): void {\n const leading: TSESTree.Comment[] = [];\n let prevLine: number | null = null;\n for (const comment of comments) {\n if (comment.type !== \"Line\") break;\n if (comment.loc.start.line >= firstCodeLine) break;\n if (!isStandalone(comment)) break;\n const body = stripCommentMarker(comment.value);\n if (isDirective(body) || body.startsWith(\"!\")) continue;\n if (prevLine !== null && comment.loc.start.line !== prevLine + 1) break;\n leading.push(comment);\n prevLine = comment.loc.start.line;\n }\n const first = leading[0];\n if (first === undefined || leading.length < LEADING_PREAMBLE_MIN) return;\n const bodies = leading.map((c) => stripCommentMarker(c.value));\n if (bodies.some((body) => LICENSE_RE.test(body))) return;\n // A preamble carrying at least one prose sentence is documentation — the\n // \"why\" the rule wants — regardless of which comment syntax carries it.\n if (bodies.some((body) => isProse(body))) return;\n if (bodies.filter(isEnumeratedProseItem).length >= ENUMERATED_PREAMBLE_MIN_ITEMS) {\n return;\n }\n context.report({ node: first, messageId: \"fileHeaderPreamble\" });\n }\n\n return {\n Program(): void {\n const comments = sourceCode.getAllComments();\n const walls = findCommentWalls(comments);\n const wallByLeader = new Map(walls.map((wall) => [wall.leader, wall]));\n const wallMembers = new Set(walls.flatMap((wall) => [...wall.members]));\n const firstCodeLine =\n sourceCode.ast.tokens[0]?.loc.start.line ?? Number.MAX_SAFE_INTEGER;\n const enumerated = comments.filter(\n (c) => c.type === \"Line\" && ENUMERATION_RE.test(stripCommentMarker(c.value)),\n );\n\n for (let i = 0; i < comments.length; i++) {\n const comment = comments[i];\n if (comment === undefined) continue;\n const wall = wallByLeader.get(comment);\n if (wall !== undefined) {\n context.report({\n node: comment,\n messageId: \"commentWall\",\n data: { count: String(wall.members.size) },\n });\n continue;\n }\n if (wallMembers.has(comment)) continue;\n if (isJsDoc(comment)) {\n // JSDoc is preserved unless its entire body is a section signpost.\n if (isStandalone(comment) && isSectionJsDoc(comment)) {\n context.report({ node: comment, messageId: \"sectionBanner\" });\n }\n continue;\n }\n if (!isStandalone(comment)) continue;\n if (LICENSE_RE.test(comment.value)) continue;\n const texts = comment.value\n .split(\"\\n\")\n .map(stripCommentMarker)\n .filter((l) => l.length > 0 && !isDirective(l));\n\n const firstText = texts[0];\n if (firstText !== undefined && /^(?:todo|fixme)\\b/i.test(firstText)) {\n if (!runCitesAReference(comments, i)) {\n context.report({\n node: comment,\n messageId: \"untrackedTodo\",\n });\n }\n continue;\n }\n\n if (texts.some(isBanner)) {\n context.report({ node: comment, messageId: \"sectionBanner\" });\n continue;\n }\n const prev = comments[i - 1];\n const precedingProse =\n prev !== undefined &&\n prev.type === \"Line\" &&\n prev.loc.end.line === comment.loc.start.line - 1 &&\n isProse(stripCommentMarker(prev.value));\n const container = sourceCode.getNodeByRangeIndex(comment.range[0]);\n const inTypeMembers = container !== null && TYPE_MEMBER_CONTAINERS.has(container.type);\n if (\n hasCommentedOutCode(texts, precedingProse, !inTypeMembers) &&\n !hasIllustrationLeadInAbove(comments, i)\n ) {\n context.report({ node: comment, messageId: \"commentedOutCode\" });\n continue;\n }\n // Narration only for single-line comments (a multi-line block is\n // usually a real doc).\n if (comment.type === \"Line\" && texts.length === 1) {\n const body = texts[0];\n const statement = restatableStatementBelow(comment, sourceCode);\n const standalone = !isInsideCommentRun(comments, i);\n const nested = container !== null && !STATEMENT_CONTAINERS.has(container.type);\n if (\n body !== undefined &&\n !runCitesAReference(comments, i) &&\n isRedundantNarration(body, statement, standalone, enumerated.length === 1, nested)\n ) {\n context.report({ node: comment, messageId: \"redundantNarration\" });\n }\n }\n }\n\n reportLeadingPreamble(comments, firstCodeLine);\n },\n };\n },\n});\n","/**\n * @fileoverview _comments — shared comment analysis for the comment-hygiene rules, kept signal-for-signal identical to Python's `_comments.py`.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\n// S1 — external reference: URL, ticket key, RFC/PEP/CVE, bare issue number, or\n// an email/handle domain. Ticket keys allow letters after the first digit\n// (`PLATFORM-1YC`) and exclude the encoding acronyms sharing the shape.\nconst REF_RE =\n /https?:\\/\\/|\\bRFC[- ]?\\d+|\\bPEP[- ]?\\d+|\\bCVE-\\d{4}|\\b(?!UTF-|SHA-|ISO-|AES-|CRC-|MD-|PCM-|EOF-|API-|BASE-)[A-Z][A-Z0-9]{1,9}-\\d[A-Z0-9]{0,5}\\b|(?<![&\\w])#\\d{2,6}\\b|@[a-z][\\w.-]*\\.(?:us|com|ai|io|net|org|dev)\\b/;\n\n// S2 — version pin or comparison.\nconst VERSION_RE =\n /(?:>=|<=|==|<|>)\\s*v?\\d+\\.\\d+|\\bv\\d+\\.\\d+|\\b(?:since|until|as of)\\s+(?:v?\\d+\\.\\d+|Python\\s*\\d)/i;\n\n// S3 — a number carrying a unit, or an HTTP status code.\nconst UNITS_RE =\n /[~<>]?\\d+(?:\\.\\d+)?\\s?(?:ms|s\\b|sec\\b|seconds?\\b|min\\b|minutes?\\b|hours?\\b|days?\\b|KB|MB|MiB|GiB|kHz|Hz|bytes?\\b|bit\\b|-bit\\b|%|px\\b|rps\\b|qps\\b)|\\b[1-5]xx\\b|\\b(?:301|302|304|307|308|400|401|403|404|405|409|410|412|422|425|429|500|501|502|503|504)\\b/;\n\n// S4 — a causal connective tying behaviour to a consequence.\nconst CAUSAL_RE =\n /\\b(?:because|otherwise|so that|or else|would (?:break|fail|race|deadlock|leak|clobber|loop|crash|page|stall)|breaks?\\b|so we don'?t|to avoid\\b|caused\\b|causes\\b|gets? clobbered|keeps? (?:us|it|them) from|doesn'?t\\b.{0,24}\\b(?:page|fire|break|leak|loop)|eat into|would otherwise|trade-?offs?\\b)\\b/i;\n\n// S5 — negation of the obvious, or a flagged deliberate deviation.\nconst NEGATION_RE =\n /\\b(?:must not|must never|do(?:es)? not\\b|don'?t\\b.{0,30}\\b(?:leak|log|cache|retry|block|steal|wipe)|never\\b|deliberately|intentionally|counterintuitiv|NOT\\b)|(?<!based )\\bon purpose\\b|\\(not\\s|\\binstead of\\b|\\brather than\\b/;\n\n// S6 — upstream/vendor quirk, workaround provenance, or an external contract.\nconst UPSTREAM_RE =\n /\\b(?:upstream|workaround|quirk|backport|vendored|regression|fixed upstream|requires?\\b|convention\\b|rate.?limit|deprecat|opts? in(?:to)?\\b|raises?\\b.{0,60}\\b(?:when|if|unless)\\b)/i;\n\n// S7 — concurrency, ordering, or invariant vocabulary.\nconst INVARIANT_RE =\n /\\b(?:invariant|idempotent|race\\b|deadlock|re-?entran|atomic|thread-?safe|signal-?safe|lexicographic(?:al(?:ly)?)?|monotonic|must (?:run|be|happen|come|stay|hit|converge|configure)|before any\\b|lost the (?:claim )?race)\\b/i;\n\n// S8 — security reasoning.\nconst SECURITY_RE =\n /\\b(?:timing attack|constant-?time|replay|PII\\b|redact|secret|injection|spoof|fail-?closed|fail-?open|auth bypass|early-?exit timing)\\b/i;\n\nconst VENDOR_RE =\n /\\b(?:GitHub|Slack|Twilio|LiveKit|Kamailio|Groq|OpenAI|Anthropic|Cloudflare|FastAPI|Starlette|Sentry|Zoho|Salla|Ashby|Linear|BigQuery|Postgres|Neon|Drizzle|Vertex|Gemini|Firestore|Stripe|Next\\.js|React Compiler|pydantic|ruff|loguru|Lexical|Farasa|Orpheus|Whisper|schemathesis)(?:'s\\b|\\s+(?:requires?|returns?|expects?|allows?|rejects?|accepts?|sends?|caps?|limits?|wraps?|silently|outputs?|stores?|treats?|doesn'?t|does not|won'?t|can'?t|only|models)\\b)/;\n\nconst PROTECTED_SIGNALS: readonly RegExp[] = [\n REF_RE,\n VERSION_RE,\n UNITS_RE,\n CAUSAL_RE,\n NEGATION_RE,\n UPSTREAM_RE,\n INVARIANT_RE,\n SECURITY_RE,\n VENDOR_RE,\n];\n\n/**\n * True when a comment carries any of the nine protected-class signals.\n *\n * EXEMPTION FLOOR ONLY — a false result is not evidence the comment is worthless.\n */\nexport function isProtected(body: string): boolean {\n return PROTECTED_SIGNALS.some((signal) => signal.test(body));\n}\n\n/**\n * True when a comment cites a ticket, URL, RFC/PEP/CVE or issue number (signal\n * S1 alone). Naming where a decision is recorded is the one thing code cannot\n * do, and it separates an owned scoping note from an unowned admission.\n */\nexport function hasExternalReference(body: string): boolean {\n return REF_RE.test(body);\n}\n\n/**\n * Words that say nothing about *which* code a comment describes. Kept in step\n * with `_comments.py`: shrinking the list costs recall, growing it costs\n * precision by discounting a genuinely novel word.\n */\nexport const STOPWORDS: ReadonlySet<string> = new Set(\n `a an the this that these those it its their his her our your my\n is are was were be been being am do does did done doing has have had having\n will would shall should can could may might must\n and or but nor so yet not no none\n to of for in on at by with from into onto out up down over under about\n as if then than when where which who whom whose what how why while\n we you they i he she them him us me\n also just only even still already again there here\n all any each every some\n via per etc eg ie vs\n need needs needed want wants make makes making let lets\n please note see above below`.split(/\\s+/),\n);\n\nconst CAMEL_PART_RE = /[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|\\d+/g;\nconst WORD_RE = /[A-Za-z_$][\\w$]*|\\d+/g;\n\n/** Split `snake_case` / `camelCase` / `SCREAMING_CASE` into lowercase parts. */\nexport function splitIdentifier(token: string): string[] {\n const parts: string[] = [];\n for (const chunk of token.split(/[_$]/)) {\n for (const match of chunk.match(CAMEL_PART_RE) ?? []) {\n parts.push(match.toLowerCase());\n }\n }\n return parts;\n}\n\n/**\n * Fold the common English inflections so `updates` / `updating` match `update`.\n *\n * The trailing-`e` strip is what makes the fold *symmetric*: without it\n * `creates` / `creating` reduce to `creat` while `create` stays `create`, and\n * the two never match — the shape that most often made a restatement look\n * novel. Deliberately crude otherwise; every extra conflation is a chance to\n * call a novel word a restatement.\n */\nexport function stem(word: string): string {\n let base = word;\n for (const suffix of [\"ing\", \"ied\", \"ies\", \"ers\", \"er\", \"ed\", \"es\", \"s\"]) {\n if (word.endsWith(suffix) && word.length - suffix.length >= 3) {\n base = word.slice(0, word.length - suffix.length);\n if (suffix === \"ied\" || suffix === \"ies\") return `${base}y`;\n break;\n }\n }\n return base.endsWith(\"e\") && base.length - 1 >= 3 ? base.slice(0, -1) : base;\n}\n\n/** Split prose into lowercase content words, dropping stopwords. */\nexport function contentTokens(text: string): string[] {\n const tokens: string[] = [];\n for (const match of text.match(WORD_RE) ?? []) {\n tokens.push(...splitIdentifier(match));\n }\n return tokens.filter((token) => !STOPWORDS.has(token));\n}\n\n/** Every identifier part appearing in a slice of source. */\nexport function codeTokens(text: string): Set<string> {\n const tokens = new Set<string>();\n for (const match of text.match(WORD_RE) ?? []) {\n for (const part of splitIdentifier(match)) tokens.add(part);\n }\n return tokens;\n}\n\n/** True when every content token of a comment already appears in the code. */\nexport function restates(commentTokens: readonly string[], code: ReadonlySet<string>): boolean {\n const stems = new Set<string>();\n for (const token of code) stems.add(stem(token));\n return commentTokens.every((token) => code.has(token) || stems.has(stem(token)));\n}\n\nconst NARRATION_MAX_WORDS = 6;\nconst NARRATION_MIN_CONTENT = 1;\nconst TOKEN_PLURAL_MIN = 4;\n\n// Statements that compute something a comment could be restating. A block, a\n// class/function/type declaration, an `if`, a `for` — anything whose body the\n// comment could be labelling instead — is deliberately absent.\nconst RESTATABLE_STATEMENTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ExpressionStatement,\n AST_NODE_TYPES.ReturnStatement,\n AST_NODE_TYPES.ThrowStatement,\n AST_NODE_TYPES.VariableDeclaration,\n]);\n\n// Verbs that describe the mechanics of the next statement. A comment opening\n// with anything else (a noun, \"because\", \"we\", a ticket id) is not narration.\nconst NARRATION_VERB_RE =\n /^(?:add|append|assign|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|decrement|define|delete|extract|fetch|filter|find|format|generate|get|handle|increment|init|initialise|initialize|insert|iterate|join|load|log|loop|make|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|d|ed|ing)?$/i;\n\n// Words that carry no information about *which* code the comment describes, so\n// they are not required to appear in the line below.\nconst NARRATION_STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"all\", \"an\", \"and\", \"any\", \"are\", \"as\", \"at\", \"back\", \"be\", \"both\", \"by\",\n \"each\", \"for\", \"from\", \"here\", \"if\", \"in\", \"into\", \"is\", \"it\", \"its\", \"just\",\n \"new\", \"of\", \"on\", \"one\", \"onto\", \"or\", \"our\", \"out\", \"over\", \"so\", \"that\",\n \"the\", \"then\", \"this\", \"to\", \"up\", \"us\", \"we\", \"when\", \"with\",\n]);\n\n/** Lowercase, with a single plural `s` folded away so `users` matches `user`. */\nexport function normalizeToken(word: string): string {\n const lower = word.toLowerCase();\n return lower.length > TOKEN_PLURAL_MIN && lower.endsWith(\"s\") && !lower.endsWith(\"ss\")\n ? lower.slice(0, -1)\n : lower;\n}\n\n/** Every identifier in a slice of source, plus its parts, with plurals folded. */\nfunction headTokens(source: string): ReadonlySet<string> {\n const tokens = new Set<string>();\n for (const identifier of source.match(/[A-Za-z_$][\\w$]*/g) ?? []) {\n tokens.add(normalizeToken(identifier));\n for (const part of identifier.split(/[_$]+|(?<=[a-z0-9])(?=[A-Z])/)) {\n if (part.length > 0) tokens.add(normalizeToken(part));\n }\n }\n return tokens;\n}\n\n/** The slice of ESLint's `SourceCode` these shapes read. */\nexport interface StatementReader {\n getTokenAfter: (\n node: TSESTree.Comment,\n options: { includeComments: boolean },\n ) => TSESTree.Token | null;\n getNodeByRangeIndex: (index: number) => TSESTree.Node | null;\n getText: (node: TSESTree.Node) => string;\n}\n\n/** A declaration with nothing but a zero/empty seed computes nothing to restate. */\nfunction isTrivialInitializer(node: TSESTree.VariableDeclaration): boolean {\n return node.declarations.every((declarator) => {\n const init = declarator.init;\n if (init == null || init.type === AST_NODE_TYPES.Literal) return true;\n return (\n (init.type === AST_NODE_TYPES.ArrayExpression && init.elements.length === 0) ||\n (init.type === AST_NODE_TYPES.ObjectExpression && init.properties.length === 0)\n );\n });\n}\n\n/**\n * The source of the single-line statement a comment sits directly above, or null\n * when what follows is a block, a declaration, a type member or anything else\n * the comment could be *labelling* rather than restating.\n */\nexport function restatableStatementBelow(comment: TSESTree.Comment, sourceCode: StatementReader): string | null {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) return null;\n for (\n let node: TSESTree.Node | undefined | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n if (!RESTATABLE_STATEMENTS.has(node.type)) continue;\n if (node.loc.start.line !== token.loc.start.line || node.loc.end.line !== node.loc.start.line) {\n return null;\n }\n if (node.type === AST_NODE_TYPES.VariableDeclaration && isTrivialInitializer(node)) {\n return null;\n }\n return sourceCode.getText(node);\n }\n return null;\n}\n\n/**\n * True when a short verb-led comment adds nothing to the statement beneath it:\n * every content word after the opening verb already appears in that statement's\n * head — its assignment target or its callee.\n *\n * Corroboration is TOTAL: one unmatched word means the comment carries\n * something the code does not, so it stays. Only the head counts — everything\n * up to the first `(` — so the comment must restate what the statement\n * *computes*, not something it merely passes as an argument.\n */\nexport function restatesStatementHead(body: string, statement: string | null): boolean {\n if (statement === null) return false;\n const words = body.match(/[A-Za-z][\\w$]*/g) ?? [];\n const opener = words[0];\n if (opener === undefined || words.length > NARRATION_MAX_WORDS) return false;\n if (!NARRATION_VERB_RE.test(opener)) return false;\n const content = words\n .slice(1)\n .map(normalizeToken)\n .filter((word) => !NARRATION_STOPWORDS.has(word));\n if (content.length < NARRATION_MIN_CONTENT) return false;\n const head = statement.split(\"(\")[0] ?? statement;\n const code = headTokens(head);\n return content.every((word) => code.has(word));\n}\n","/**\n * @fileoverview no-conditional-in-test — a conditional in a test body can route around the assertion, so the test passes without asserting.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-conditional-in-test.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noConditionalInTest\";\ntype Options = readonly [];\n\nconst TEST_CALLERS: ReadonlySet<string> = new Set([\"it\", \"test\"]);\n\n/** Members whose callbacks define suites or lifecycle work rather than tests. */\nconst NON_TEST_MEMBERS: ReadonlySet<string> = new Set([\n \"afterAll\",\n \"afterEach\",\n \"beforeAll\",\n \"beforeEach\",\n \"describe\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** Roots of assertion calls: `expect(x)`, `assert.ok(x)`, `expectTypeOf<T>()`. */\nconst ASSERTION_ROOTS: ReadonlySet<string> = new Set([\n \"expect\",\n \"expectTypeOf\",\n \"assert\",\n \"assertType\",\n]);\n\n/** Assertions that exist only in the type system and are erased at run time. */\nconst TYPE_ASSERTION_ROOTS: ReadonlySet<string> = new Set([\n \"expectTypeOf\",\n \"assertType\",\n]);\n\nfunction nearestEnclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n }\n return null;\n}\n\n/** The base callee name of a call, unwrapping `.only` / `.skip` / `.each` chains. */\nfunction testCallerName(callee: TSESTree.Node): string | null {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name;\n }\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n return testCallerName(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return testCallerName(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return testCallerName(callee.tag);\n }\n return null;\n}\n\n/** Return whether any member in a chained callee identifies suite or lifecycle work. */\nfunction hasNonTestMember(callee: TSESTree.Node): boolean {\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n if (\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n NON_TEST_MEMBERS.has(callee.property.name)\n ) {\n return true;\n }\n return hasNonTestMember(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return hasNonTestMember(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return hasNonTestMember(callee.tag);\n }\n return false;\n}\n\n/** True when `fn` is the callback argument of an `it` or `test` call. */\nfunction isTestBody(fn: TSESTree.Node): boolean {\n const call = fn.parent;\n if (\n call?.type !== AST_NODE_TYPES.CallExpression ||\n !call.arguments.some((argument) => argument === fn)\n ) {\n return false;\n }\n if (hasNonTestMember(call.callee)) {\n return false;\n }\n const name = testCallerName(call.callee);\n return name !== null && TEST_CALLERS.has(name);\n}\n\n/** Walk `node`'s subtree until `predicate` matches. */\nfunction subtreeMatches(\n node: TSESTree.Node,\n predicate: (current: TSESTree.Node) => boolean,\n descendIntoFunctions = true,\n): boolean {\n let found = false;\n const visit = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (predicate(current)) {\n found = true;\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n if (\n !descendIntoFunctions &&\n FUNCTION_TYPES.has(current.type) &&\n key === \"body\"\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (\n typeof child === \"object\" &&\n child !== null &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n } else if (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n ) {\n visit(value as TSESTree.Node);\n }\n if (found) {\n return;\n }\n }\n };\n visit(node);\n return found;\n}\n\n/** The leftmost identifier a reference chain is rooted at: `!r.a.b` -> `r`. */\nfunction rootIdentifier(node: TSESTree.Node): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Identifier:\n return node.name;\n case AST_NODE_TYPES.MemberExpression:\n return rootIdentifier(node.object);\n case AST_NODE_TYPES.UnaryExpression:\n return rootIdentifier(node.argument);\n case AST_NODE_TYPES.AwaitExpression:\n return rootIdentifier(node.argument);\n case AST_NODE_TYPES.ChainExpression:\n case AST_NODE_TYPES.TSNonNullExpression:\n case AST_NODE_TYPES.TSAsExpression:\n return rootIdentifier(node.expression);\n case AST_NODE_TYPES.BinaryExpression:\n case AST_NODE_TYPES.LogicalExpression:\n return rootIdentifier(node.left);\n case AST_NODE_TYPES.CallExpression:\n return rootIdentifier(node.callee);\n default:\n return null;\n }\n}\n\n/** The identifier a call is rooted at: `expect(x).not.toBe(y)` -> `expect`. */\nfunction calleeRootName(call: TSESTree.CallExpression): string | null {\n let current: TSESTree.Node = call.callee;\n for (;;) {\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name;\n }\n if (current.type === AST_NODE_TYPES.MemberExpression) {\n current = current.object;\n continue;\n }\n if (current.type === AST_NODE_TYPES.CallExpression) {\n current = current.callee;\n continue;\n }\n if (\n current.type === AST_NODE_TYPES.ChainExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n continue;\n }\n return null;\n }\n}\n\nconst isAssertionCall = (node: TSESTree.Node): boolean =>\n node.type === AST_NODE_TYPES.CallExpression &&\n ASSERTION_ROOTS.has(calleeRootName(node) ?? \"\");\n\nconst isTypeAssertionCall = (node: TSESTree.Node): boolean =>\n node.type === AST_NODE_TYPES.CallExpression &&\n TYPE_ASSERTION_ROOTS.has(calleeRootName(node) ?? \"\");\n\nconst containsAssertion = (node: TSESTree.Node): boolean =>\n subtreeMatches(node, isAssertionCall);\n\n/** `test.skip(...)`, `this.skip()`, `ctx.skip()` — an explicit test escape. */\nconst containsSkipCall = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (current) =>\n current.type === AST_NODE_TYPES.CallExpression &&\n current.callee.type === AST_NODE_TYPES.MemberExpression &&\n !current.callee.computed &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n current.callee.property.name === \"skip\",\n );\n\n/**\n * `return` / `continue` / `break` in the branch's own scope — the ways a branch\n * can cut the rest of the test short. A `return` inside a nested callback does\n * not leave the test, so the walk stops at function boundaries.\n */\nconst containsEscape = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (current) =>\n current.type === AST_NODE_TYPES.ReturnStatement ||\n current.type === AST_NODE_TYPES.ContinueStatement ||\n current.type === AST_NODE_TYPES.BreakStatement,\n false,\n );\n\n/** The statements of a branch, whether or not it is wrapped in a block. */\nfunction branchStatements(\n branch: TSESTree.Statement,\n): readonly TSESTree.Statement[] {\n return branch.type === AST_NODE_TYPES.BlockStatement ? branch.body : [branch];\n}\n\n/** The statement immediately before `node` among its siblings, if any. */\nfunction previousSibling(node: TSESTree.Statement): TSESTree.Node | null {\n const parent = node.parent;\n let siblings: readonly TSESTree.Node[] | null = null;\n if (\n parent.type === AST_NODE_TYPES.BlockStatement ||\n parent.type === AST_NODE_TYPES.Program ||\n parent.type === AST_NODE_TYPES.StaticBlock\n ) {\n siblings = parent.body;\n } else if (parent.type === AST_NODE_TYPES.SwitchCase) {\n siblings = parent.consequent;\n }\n if (siblings === null) {\n return null;\n }\n const index = siblings.indexOf(node);\n return index > 0 ? (siblings[index - 1] ?? null) : null;\n}\n\n/**\n * Guard 1 — a narrowing `if` pinned by the assertion directly above it. The\n * preceding statement must assert on the same value the `if` narrows, so the\n * branch's direction is already established by a check that can fail.\n */\nfunction isPinnedNarrowingGuard(node: TSESTree.IfStatement): boolean {\n const testRoot = rootIdentifier(node.test);\n if (testRoot === null) {\n return false;\n }\n const previous = previousSibling(node);\n if (previous === null || previous.type !== AST_NODE_TYPES.ExpressionStatement) {\n return false;\n }\n let matched = false;\n subtreeMatches(previous, (current) => {\n if (\n current.type !== AST_NODE_TYPES.CallExpression ||\n current.callee.type !== AST_NODE_TYPES.Identifier ||\n current.callee.name !== \"expect\"\n ) {\n return false;\n }\n const subject = current.arguments[0];\n if (subject === undefined) {\n return false;\n }\n if (rootIdentifier(subject) === testRoot) {\n matched = true;\n return true;\n }\n return false;\n });\n return matched;\n}\n\n/** Guard 2 — the branch is an assertion spelled as a throw; the test stops here. */\nfunction isThrowingGuard(node: TSESTree.IfStatement): boolean {\n if (node.alternate !== null) {\n return false;\n }\n const statements = branchStatements(node.consequent);\n return (\n statements.length === 1 &&\n statements[0]?.type === AST_NODE_TYPES.ThrowStatement\n );\n}\n\n/** Every statement in `branch` is a bare type-level assertion call. */\nfunction isTypeAssertionBranch(branch: TSESTree.Statement): boolean {\n const statements = branchStatements(branch);\n return (\n statements.length > 0 &&\n statements.every(\n (statement) =>\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n isTypeAssertionCall(statement.expression),\n )\n );\n}\n\n/** Guard 4 — narrowing around assertions that are erased at run time. */\nfunction isTypeLevelNarrowing(node: TSESTree.IfStatement): boolean {\n return (\n isTypeAssertionBranch(node.consequent) &&\n (node.alternate === null || isTypeAssertionBranch(node.alternate))\n );\n}\n\n/** A branch that asserts nothing and cannot cut the test short. */\nconst isInertBranch = (branch: TSESTree.Statement): boolean =>\n !containsAssertion(branch) &&\n !containsEscape(branch) &&\n !containsSkipCall(branch);\n\n/**\n * Does the branch only REWRITE state — assign, update, delete, declare?\n *\n * Guard 5 is named \"state normalization\", and \"no assertion and no escape\" is a\n * strictly weaker test than that name implies: a branch full of ACTIONS asserts\n * nothing and escapes nothing either, and it is precisely the branch that makes\n * one test take two paths through the UI.\n */\nfunction isNormalizationStatement(statement: TSESTree.Statement): boolean {\n if (statement.type === AST_NODE_TYPES.VariableDeclaration) {\n return true;\n }\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.every(isNormalizationStatement);\n }\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n return false;\n }\n const { expression } = statement;\n return (\n expression.type === AST_NODE_TYPES.AssignmentExpression ||\n expression.type === AST_NODE_TYPES.UpdateExpression ||\n (expression.type === AST_NODE_TYPES.UnaryExpression &&\n expression.operator === \"delete\")\n );\n}\n\n/**\n * Guard 5 — state normalization. The branch has no assertion to skip, no way\n * out of the test, and does nothing but rewrite state. Deliberately narrow: a\n * branch that returns, breaks, continues, calls `.skip(`, or DOES something is\n * exactly the defect this rule exists for and is NOT exempt.\n */\nfunction isInertNormalization(node: TSESTree.IfStatement): boolean {\n const branches = [node.consequent, node.alternate].filter(\n (branch): branch is TSESTree.Statement => branch !== null,\n );\n return branches.every(\n (branch) => isInertBranch(branch) && isNormalizationStatement(branch),\n );\n}\n\n/**\n * State normalization: a branch with no assertion to skip and no way out of the\n * test cannot hide anything. Deliberately narrow — a branch that returns,\n * breaks, continues or calls `.skip(` is the shape the rule exists for.\n */\nfunction isExemptIfStatement(node: TSESTree.IfStatement): boolean {\n return (\n isPinnedNarrowingGuard(node) ||\n isThrowingGuard(node) ||\n isTypeLevelNarrowing(node) ||\n isInertNormalization(node)\n );\n}\n\n/**\n * Guard 3 — `??` never reports (it is a default, never control flow over an\n * assertion), and `&&` / `||` report only in the shape that can actually skip an\n * assertion: a bare `a && expect(a).toBe(1);` statement.\n */\nfunction isShortCircuitedAssertion(node: TSESTree.LogicalExpression): boolean {\n return (\n node.operator !== \"??\" &&\n node.parent.type === AST_NODE_TYPES.ExpressionStatement &&\n containsAssertion(node.right)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-conditional-in-test\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow conditional logic (if, switch, ternary) in test bodies, which can hide missing assertions or test multiple code paths.\",\n },\n schema: [],\n messages: {\n noConditionalInTest:\n \"Avoid using conditional logic in tests. It can obscure intent and hide unexecuted assertions. Split the test instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n const report = (node: TSESTree.Node): void => {\n const enclosing = nearestEnclosingFunction(node);\n if (enclosing === null || !isTestBody(enclosing)) {\n return;\n }\n context.report({ node, messageId: \"noConditionalInTest\" });\n };\n return {\n IfStatement(node: TSESTree.IfStatement): void {\n if (isExemptIfStatement(node)) {\n return;\n }\n report(node);\n },\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n report(node);\n },\n ConditionalExpression(node: TSESTree.ConditionalExpression): void {\n report(node);\n },\n LogicalExpression(node: TSESTree.LogicalExpression): void {\n if (!isShortCircuitedAssertion(node)) {\n return;\n }\n report(node);\n },\n };\n },\n});\n","/**\n * @fileoverview no-cors-wildcard-with-credentials — `Access-Control-Allow-Origin: *` together with credentials lets any site read authenticated responses.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-cors-wildcard-with-credentials.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"corsWildcardWithCredentials\";\ntype Options = readonly [];\n\nconst ACAO_HEADER = \"access-control-allow-origin\";\nconst ACAC_HEADER = \"access-control-allow-credentials\";\nconst HEADER_SET_METHODS = new Set([\"setheader\", \"set\", \"append\"]);\n\n/**\n * True only for the boolean literal `true` (not `1`, not a truthy expression).\n */\nfunction isTrueLiteral(node: TSESTree.Node): boolean {\n return node.type === \"Literal\" && node.value === true;\n}\n\n/**\n * True if `node` is a string literal whose value equals `\"true\"`\n * (case-insensitive), or the boolean literal `true`. Header values are strings,\n * but some frameworks coerce a boolean, so both are accepted.\n */\nfunction isCredentialsTrueValue(node: TSESTree.Node): boolean {\n if (node.type === \"Literal\") {\n if (node.value === true) {\n return true;\n }\n if (typeof node.value === \"string\") {\n return node.value.trim().toLowerCase() === \"true\";\n }\n }\n return false;\n}\n\nfunction isStarLiteral(node: TSESTree.Node): boolean {\n return node.type === \"Literal\" && node.value === \"*\";\n}\n\n/**\n * True if a `\"*\"` string literal appears anywhere in `node`'s subtree. Walking\n * the whole subtree catches `\"*\"`, `[\"*\"]`, and the `flag ? origins : \"*\"`\n * conditional branch. A dynamic `origin: someVar` has no `\"*\"` literal, so it\n * does not fire.\n */\nfunction subtreeContainsStarLiteral(node: TSESTree.Node): boolean {\n if (isStarLiteral(node)) {\n return true;\n }\n for (const key of Object.keys(node)) {\n if (key === \"parent\" || key === \"loc\" || key === \"range\") {\n continue;\n }\n const value = (node as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child) && subtreeContainsStarLiteral(child)) {\n return true;\n }\n }\n } else if (isNode(value) && subtreeContainsStarLiteral(value)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/**\n * Returns the (non-computed) string name of a property key, or `undefined`.\n */\nfunction propertyKeyName(prop: TSESTree.Property): string | undefined {\n if (prop.computed) {\n return undefined;\n }\n const key = prop.key;\n if (key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n}\n\n/**\n * Extracts the callee's terminal identifier name for a call/new expression\n * (`cors` for `cors(...)` and `app.cors(...)`, `Cors` for `new Cors(...)`).\n */\nfunction calleeName(\n node: TSESTree.CallExpression | TSESTree.NewExpression,\n): string | undefined {\n const callee = node.callee;\n if (callee.type === \"Identifier\") {\n return callee.name;\n }\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\"\n ) {\n return callee.property.name;\n }\n return undefined;\n}\n\n/**\n * Detects the `cors({ origin: \"*\", credentials: true })` shape. Returns true\n * when the callee is `cors` / `Cors` and the first ObjectExpression argument\n * has `credentials: true` AND an `origin` whose subtree contains `\"*\"`.\n */\nfunction isCorsWildcardCredentialsCall(\n node: TSESTree.CallExpression | TSESTree.NewExpression,\n): boolean {\n const name = calleeName(node);\n if (name === undefined || name.toLowerCase() !== \"cors\") {\n return false;\n }\n const options = node.arguments.find(\n (arg): arg is TSESTree.ObjectExpression => arg.type === \"ObjectExpression\",\n );\n if (options === undefined) {\n return false;\n }\n let hasCredentials = false;\n let hasWildcardOrigin = false;\n for (const prop of options.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n const key = propertyKeyName(prop);\n if (key === \"credentials\" && isTrueLiteral(prop.value)) {\n hasCredentials = true;\n } else if (key === \"origin\" && subtreeContainsStarLiteral(prop.value)) {\n hasWildcardOrigin = true;\n }\n }\n return hasCredentials && hasWildcardOrigin;\n}\n\n/**\n * True if the ObjectExpression is a header map setting BOTH\n * `Access-Control-Allow-Origin: \"*\"` and\n * `Access-Control-Allow-Credentials: \"true\"` (case-insensitive keys).\n */\nfunction isWildcardCredentialsHeaderObject(\n node: TSESTree.ObjectExpression,\n): boolean {\n let wildcardOrigin = false;\n let credentialsTrue = false;\n for (const prop of node.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n const key = propertyKeyName(prop);\n if (key === undefined) {\n continue;\n }\n const header = key.toLowerCase();\n if (header === ACAO_HEADER && isStarLiteral(prop.value)) {\n wildcardOrigin = true;\n } else if (header === ACAC_HEADER && isCredentialsTrueValue(prop.value)) {\n credentialsTrue = true;\n }\n }\n return wildcardOrigin && credentialsTrue;\n}\n\ntype HeaderSetKind = \"origin\" | \"credentials\";\n\n/**\n * Classifies a `x.setHeader(name, value)` / `x.set(name, value)` /\n * `x.append(name, value)` call as an ACAO-wildcard set, an ACAC-true set, or\n * neither.\n */\nfunction classifyHeaderSetCall(\n node: TSESTree.CallExpression,\n): HeaderSetKind | undefined {\n const callee = node.callee;\n if (\n callee.type !== \"MemberExpression\" ||\n callee.computed ||\n callee.property.type !== \"Identifier\" ||\n !HEADER_SET_METHODS.has(callee.property.name.toLowerCase())\n ) {\n return undefined;\n }\n const [nameArg, valueArg] = node.arguments;\n if (\n nameArg === undefined ||\n valueArg === undefined ||\n nameArg.type !== \"Literal\" ||\n typeof nameArg.value !== \"string\"\n ) {\n return undefined;\n }\n const header = nameArg.value.toLowerCase();\n if (header === ACAO_HEADER && isStarLiteral(valueArg)) {\n return \"origin\";\n }\n if (header === ACAC_HEADER && isCredentialsTrueValue(valueArg)) {\n return \"credentials\";\n }\n return undefined;\n}\n\n/**\n * Nearest enclosing function node, or `undefined` for module scope. Used to\n * group split `setHeader`/`set` header assignments so a wildcard origin and a\n * credentials=true set only pair up when they live in the same scope.\n */\nfunction enclosingScope(node: TSESTree.Node): TSESTree.Node | undefined {\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (\n current.type === \"FunctionDeclaration\" ||\n current.type === \"FunctionExpression\" ||\n current.type === \"ArrowFunctionExpression\"\n ) {\n return current;\n }\n current = current.parent;\n }\n return undefined;\n}\n\ninterface ScopeHeaderSets {\n originNodes: TSESTree.CallExpression[];\n credentialsNodes: TSESTree.CallExpression[];\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-cors-wildcard-with-credentials\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n 'Disallow CORS that reflects any Origin (`\"*\"`) while allowing credentials; any site could then read authenticated responses. Enumerate explicit trusted origins instead.',\n },\n schema: [],\n messages: {\n corsWildcardWithCredentials:\n 'CORS reflects any Origin (`\"*\"`) while allowing credentials — any site can read authenticated responses. Enumerate explicit trusted origins instead of using `\"*\"` with credentials.',\n },\n },\n defaultOptions: [],\n create(context) {\n const scopeHeaderSets = new Map<TSESTree.Node | \"module\", ScopeHeaderSets>();\n\n function recordHeaderSet(\n node: TSESTree.CallExpression,\n kind: HeaderSetKind,\n ): void {\n const key = enclosingScope(node) ?? \"module\";\n let entry = scopeHeaderSets.get(key);\n if (entry === undefined) {\n entry = { originNodes: [], credentialsNodes: [] };\n scopeHeaderSets.set(key, entry);\n }\n if (kind === \"origin\") {\n entry.originNodes.push(node);\n } else {\n entry.credentialsNodes.push(node);\n }\n }\n\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (isCorsWildcardCredentialsCall(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (isCorsWildcardCredentialsCall(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n return;\n }\n const kind = classifyHeaderSetCall(node);\n if (kind !== undefined) {\n recordHeaderSet(node, kind);\n }\n },\n ObjectExpression(node: TSESTree.ObjectExpression): void {\n if (isWildcardCredentialsHeaderObject(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n }\n },\n \"Program:exit\"(): void {\n for (const { originNodes, credentialsNodes } of scopeHeaderSets.values()) {\n if (originNodes.length > 0 && credentialsNodes.length > 0) {\n for (const node of originNodes) {\n context.report({\n node,\n messageId: \"corsWildcardWithCredentials\",\n });\n }\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-dynamic-sql — a runtime value interpolated into statement text is SQL injection, and it defeats the prepared-statement cache.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-dynamic-sql.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { stripSqlNoise } from \"./_sql.js\";\n\ntype MessageIds = \"dynamicSql\";\n\nexport interface RuleOptions {\n /** Statement-taking method names to inspect. Replaces the defaults. */\n readonly methods?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\nconst DEFAULT_METHODS: readonly string[] = [\"prepare\", \"exec\", \"query\"];\n\n/** A module-level constant fragment: `CANDIDATE_COLS`, `TABLE_NAME`. */\nconst CONSTANT_CASE_RE = /^[A-Z][A-Z0-9_]*$/;\n\n/**\n * True when an interpolated expression is a compile-time SQL fragment rather\n * than runtime data: a CONSTANT_CASE identifier, a member access whose final\n * property is CONSTANT_CASE (`TABLES.USERS`), or a string literal.\n */\nfunction isStaticFragment(expression: TSESTree.Expression): boolean {\n if (expression.type === AST_NODE_TYPES.Identifier) {\n return CONSTANT_CASE_RE.test(expression.name);\n }\n if (\n expression.type === AST_NODE_TYPES.MemberExpression &&\n !expression.computed &&\n expression.property.type === AST_NODE_TYPES.Identifier\n ) {\n return CONSTANT_CASE_RE.test(expression.property.name);\n }\n if (expression.type === AST_NODE_TYPES.Literal) {\n return typeof expression.value === \"string\";\n }\n return false;\n}\n\n/** The interpolated runtime expressions in a template literal. */\nfunction runtimeInterpolations(\n template: TSESTree.TemplateLiteral,\n): TSESTree.Expression[] {\n return template.expressions.filter(\n (expression) => !isStaticFragment(expression),\n );\n}\n\n/**\n * Flatten a `+` chain into its operands. `\"a\" + b + \"c\"` yields three nodes so\n * each can be judged independently.\n */\nfunction concatOperands(node: TSESTree.Expression): TSESTree.Expression[] {\n if (node.type === AST_NODE_TYPES.BinaryExpression && node.operator === \"+\") {\n return [...concatOperands(node.left), ...concatOperands(node.right)];\n }\n return [node];\n}\n\n/**\n * The runtime operands of a string-concatenation chain, or an empty array when\n * the node is not a concatenation that mixes a literal with a runtime value.\n * Requiring at least one string literal is what distinguishes statement\n * building from ordinary arithmetic.\n */\nfunction runtimeConcatOperands(node: TSESTree.Node): TSESTree.Expression[] {\n if (node.type !== AST_NODE_TYPES.BinaryExpression || node.operator !== \"+\") {\n return [];\n }\n const operands = concatOperands(node);\n const hasStringLiteral = operands.some(\n (operand) =>\n operand.type === AST_NODE_TYPES.Literal &&\n typeof operand.value === \"string\",\n );\n if (!hasStringLiteral) {\n return [];\n }\n return operands.filter(\n (operand) =>\n operand.type !== AST_NODE_TYPES.Literal && !isStaticFragment(operand),\n );\n}\n\n/**\n * A SQL data/DDL statement keyword. `exec` and `query` are generic method names\n * — `child_process.exec` shares them — so the statement text itself has to prove\n * it is SQL before an interpolation into it can be an injection.\n */\nconst SQL_STATEMENT_RE =\n /\\b(?:select\\s|insert\\s+into\\b|insert\\s+or\\b|update\\s+\\w|delete\\s+from\\b|replace\\s+into\\b|merge\\s+into\\b|upsert\\s+into\\b|create\\s+(?:temp(?:orary)?\\s+)?(?:table|index|view|trigger|schema|database)\\b|alter\\s+table\\b|drop\\s+(?:table|index|view|trigger)\\b|truncate\\s+table\\b|pragma\\s+\\w|with\\s+\\w+\\s+as\\s*\\(|from\\s+\\w+\\s+where\\b)/i;\n\n/** The marker a non-static operand contributes to the reconstructed statement text. */\nconst RUNTIME_MARKER = \" ? \";\n\n/**\n * The statically known text of a statement argument, with every runtime operand\n * replaced by a placeholder. Enough to answer \"is this SQL?\" for both the\n * template-literal and the `+`-concatenation shape.\n */\nfunction staticStatementText(node: TSESTree.Node): string {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n return node.quasis.map((quasi) => quasi.value.cooked ?? quasi.value.raw).join(RUNTIME_MARKER);\n }\n if (node.type === AST_NODE_TYPES.Literal) {\n return typeof node.value === \"string\" ? node.value : RUNTIME_MARKER;\n }\n if (node.type === AST_NODE_TYPES.BinaryExpression && node.operator === \"+\") {\n return staticStatementText(node.left) + staticStatementText(node.right);\n }\n return RUNTIME_MARKER;\n}\n\n/** True when the statement argument reads as SQL rather than as a shell command line. */\nfunction looksLikeSql(node: TSESTree.Node): boolean {\n return SQL_STATEMENT_RE.test(stripSqlNoise(staticStatementText(node)));\n}\n\n/** The inspected method name of `receiver.method(...)`, or null. */\nfunction statementMethodName(\n node: TSESTree.CallExpression,\n methods: ReadonlySet<string>,\n): string | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const name = callee.property.name;\n return methods.has(name) ? name : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-dynamic-sql\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow interpolating or concatenating a runtime value into a SQL statement passed to `prepare`/`exec`/`query`; use a placeholder and bind the value.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n methods: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Statement-taking method names to inspect. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n dynamicSql:\n \"Runtime value built into a SQL statement passed to `{{method}}()`. Use a `?` placeholder and pass the value through `.bind(...)` so the driver parameterises it.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const methods = new Set(options?.methods ?? DEFAULT_METHODS);\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const method = statementMethodName(node, methods);\n if (method === null) {\n return;\n }\n\n const statement = node.arguments[0];\n if (statement === undefined || !looksLikeSql(statement)) {\n return;\n }\n\n const offenders =\n statement.type === AST_NODE_TYPES.TemplateLiteral\n ? runtimeInterpolations(statement)\n : runtimeConcatOperands(statement);\n\n for (const offender of offenders) {\n context.report({\n node: offender,\n messageId: \"dynamicSql\",\n data: { method },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _sql — shared extraction of statically-resolvable SQL strings, with literal values and comments neutralised before any keyword scan.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\n/** Mask SQL values and comments without changing text or line lengths. */\nexport function stripSqlNoise(text: string): string {\n const out = [...text];\n const n = text.length;\n let i = 0;\n while (i < n) {\n const ch = text[i];\n if (ch === \"'\" || ch === '\"') {\n out[i] = \" \";\n i += 1;\n while (i < n) {\n const c = text[i];\n if (c === ch) {\n if (i + 1 < n && text[i + 1] === ch) {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n continue;\n }\n out[i] = \" \";\n i += 1;\n break;\n }\n if (c !== \"\\n\") {\n out[i] = \" \";\n }\n i += 1;\n }\n continue;\n }\n if (ch === \"-\" && text[i + 1] === \"-\") {\n while (i < n && text[i] !== \"\\n\") {\n out[i] = \" \";\n i += 1;\n }\n continue;\n }\n if (ch === \"/\" && text[i + 1] === \"*\") {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) {\n if (text[i] !== \"\\n\") {\n out[i] = \" \";\n }\n i += 1;\n }\n if (i < n) {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n }\n continue;\n }\n i += 1;\n }\n return out.join(\"\");\n}\n\n/** The parameter marker a `${...}` substitution is replaced with before scanning. */\nconst SUBSTITUTION_MARKER = \"?\";\n\n/** Reconstruct static SQL literals, templates, concatenations, and fragment arrays. */\nexport function sqlTextOf(node: TSESTree.Node): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return typeof node.value === \"string\" ? node.value : null;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.quasis.map((q) => q.value.cooked ?? q.value.raw).join(SUBSTITUTION_MARKER);\n case AST_NODE_TYPES.TaggedTemplateExpression:\n return sqlTextOf(node.quasi);\n case AST_NODE_TYPES.BinaryExpression: {\n if (node.operator !== \"+\") {\n return null;\n }\n const left = sqlTextOf(node.left);\n const right = sqlTextOf(node.right);\n return left !== null && right !== null ? left + right : null;\n }\n case AST_NODE_TYPES.ArrayExpression: {\n const parts: string[] = [];\n for (const element of node.elements) {\n if (element === null) {\n return null;\n }\n const part = sqlTextOf(element);\n if (part === null) {\n return null;\n }\n parts.push(part);\n }\n return parts.length > 0 ? parts.join(\" \") : null;\n }\n default:\n return null;\n }\n}\n\n/** Return whether an array's fragments are consumed together by `.join(...)`. */\nfunction isJoinedFragmentArray(node: TSESTree.ArrayExpression): boolean {\n const parent = node.parent;\n return (\n parent?.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === node &&\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n parent.property.name === \"join\" &&\n parent.parent?.type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** Every string-bearing descendant that a composite node has already absorbed. */\nfunction markConsumed(node: TSESTree.Node, consumed: WeakSet<TSESTree.Node>): void {\n consumed.add(node);\n for (const key of Object.keys(node)) {\n if (key === \"parent\") {\n continue;\n }\n const value = (node as unknown as Record<string, unknown>)[key];\n for (const child of Array.isArray(value) ? value : [value]) {\n if (child !== null && typeof child === \"object\" && \"type\" in child) {\n markConsumed(child as TSESTree.Node, consumed);\n }\n }\n }\n}\n\n/** Hand each whole, statically resolvable SQL statement to `handler` once. */\nexport function createSqlListener(\n handler: (sql: string, node: TSESTree.Node) => void,\n): TSESLint.RuleListener {\n const consumed = new WeakSet<TSESTree.Node>();\n\n const visit = (node: TSESTree.Node): void => {\n if (consumed.has(node)) {\n return;\n }\n const text = sqlTextOf(node);\n if (text === null) {\n return;\n }\n markConsumed(node, consumed);\n handler(stripSqlNoise(text), node);\n };\n\n return {\n BinaryExpression: (node: TSESTree.BinaryExpression): void => {\n visit(node);\n },\n ArrayExpression: (node: TSESTree.ArrayExpression): void => {\n if (isJoinedFragmentArray(node)) {\n visit(node);\n }\n },\n TemplateLiteral: (node: TSESTree.TemplateLiteral): void => {\n visit(node);\n },\n Literal: (node: TSESTree.Literal): void => {\n visit(node);\n },\n };\n}\n","/**\n * @fileoverview no-enum — a TypeScript `enum` emits runtime code, defaults to numbers, and does not tree-shake.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-enum.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noEnum\";\ntype Options = readonly [\n {\n ignoreFiles?: readonly string[];\n }?,\n];\n\nfunction matchesAnyPattern(\n filename: string,\n patterns: readonly string[],\n): boolean {\n for (const pattern of patterns) {\n // Convert minimatch-ish globs to regex: ** -> .*, * -> [^/\\\\]*\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-enum\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow TypeScript `enum`; use string-literal unions or `as const` objects instead.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreFiles: {\n type: \"array\",\n description:\n \"Additional generated-file globs to ignore; shared generated paths and header markers are always ignored.\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n noEnum:\n 'Enums are discouraged. Use a string-literal union (e.g. `type Status = \"active\" | \"inactive\"`) or an `as const` object instead.',\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const options = optionsArg ?? {};\n const ignoreFiles = options.ignoreFiles ?? [];\n const filename = context.filename;\n const sourceText = context.sourceCode.getText();\n\n // `ignoreFiles` adds repository-specific paths to shared generated-file detection.\n const isIgnoredByOption =\n ignoreFiles.length > 0 && matchesAnyPattern(filename, ignoreFiles);\n\n if (isIgnoredByOption || isGeneratedFile(filename, sourceText)) {\n return {};\n }\n\n return {\n TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void {\n context.report({\n node,\n messageId: \"noEnum\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-fat-try-blocks — a `try` holding more than three throwing statements catches failures its handler was never written for.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-fat-try-blocks.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"fatTryBlock\";\ntype Options = readonly [];\n\nconst MAX_TRY_BODY_STATEMENTS = 3;\n\nconst NESTED_FUNCTION_TYPES = new Set<AST_NODE_TYPES>([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** Pure method names must not overlap common I/O-client methods such as `get`, `set`, or `find`. */\nconst PURE_METHODS = new Set<string>([\n \"map\", \"filter\", \"forEach\", \"reduce\", \"reduceRight\", \"findIndex\",\n \"findLast\", \"findLastIndex\", \"some\", \"every\", \"push\", \"pop\", \"shift\",\n \"unshift\", \"slice\", \"splice\", \"concat\", \"flat\", \"flatMap\", \"join\", \"reverse\",\n \"sort\", \"fill\", \"includes\", \"indexOf\", \"lastIndexOf\", \"at\", \"toString\",\n \"toLocaleString\", \"valueOf\", \"charAt\", \"charCodeAt\", \"codePointAt\", \"split\",\n \"padStart\", \"padEnd\", \"repeat\", \"trim\", \"trimStart\", \"trimEnd\", \"toUpperCase\",\n \"toLowerCase\", \"toFixed\", \"toPrecision\", \"startsWith\", \"endsWith\",\n]);\n\n/** Non-throwing global namespaces called as `X.method(...)`. */\nconst PURE_NAMESPACES = new Set<string>([\n \"Object\", \"Array\", \"Math\", \"JSON\", \"Number\", \"String\", \"Boolean\", \"console\",\n]);\n\n/** Namespace exceptions that commonly throw; `JSON.stringify` remains a deliberate recall tradeoff. */\nconst IMPURE_NAMESPACE_METHODS = new Set<string>([\"JSON.parse\"]);\n\n/** Constructors that do not throw on construction. */\nconst PURE_CONSTRUCTORS = new Set<string>([\n \"Map\", \"Set\", \"WeakMap\", \"WeakSet\", \"Date\", \"Error\", \"TypeError\",\n \"RangeError\", \"Array\", \"Object\", \"Headers\", \"URLSearchParams\", \"FormData\",\n \"TextEncoder\", \"TextDecoder\", \"Blob\", \"ReadableStream\", \"WritableStream\",\n \"TransformStream\", \"Response\", \"AbortController\",\n]);\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/** A call whose value is a known pure, non-throwing helper. */\nfunction isPureCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) {\n return false;\n }\n const property = callee.property;\n if (property.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (\n callee.object.type === AST_NODE_TYPES.Identifier &&\n PURE_NAMESPACES.has(callee.object.name)\n ) {\n return !IMPURE_NAMESPACE_METHODS.has(`${callee.object.name}.${property.name}`);\n }\n return PURE_METHODS.has(property.name);\n}\n\nfunction isPureNew(node: TSESTree.NewExpression): boolean {\n return (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n PURE_CONSTRUCTORS.has(node.callee.name)\n );\n}\n\n/**\n * Walk `stmt`'s subtree until `predicate` matches a node. By default the walk\n * stays in the same scope (it does not descend into nested function/arrow\n * bodies); pass `descendIntoFunctions` to visit those too.\n */\nfunction subtreeMatches(\n stmt: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n descendIntoFunctions = false,\n): boolean {\n let found = false;\n\n const visit = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (predicate(current)) {\n found = true;\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n if (\n !descendIntoFunctions &&\n NESTED_FUNCTION_TYPES.has(current.type) &&\n key === \"body\"\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n visit(child);\n }\n }\n } else if (isNode(value)) {\n visit(value);\n }\n if (found) {\n return;\n }\n }\n };\n\n visit(stmt);\n return found;\n}\n\nconst hasAwait = (node: TSESTree.Node): boolean =>\n subtreeMatches(node, (n) => n.type === AST_NODE_TYPES.AwaitExpression);\n\nconst hasThrowingCallOrNew = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (n) =>\n (n.type === AST_NODE_TYPES.CallExpression && !isPureCall(n)) ||\n (n.type === AST_NODE_TYPES.NewExpression && !isPureNew(n)),\n );\n\n/** Unwrap `await` / optional-chain / non-null wrappers to the core expression. */\nfunction unwrap(expr: TSESTree.Expression): TSESTree.Expression {\n let current = expr;\n while (\n current.type === AST_NODE_TYPES.ChainExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n }\n return current;\n}\n\n/** A bare fire-and-forget call statement — `toast(\"done\");`, `logEvent(...);`. */\nfunction isBareCallStatement(stmt: TSESTree.Statement): boolean {\n return (\n stmt.type === AST_NODE_TYPES.ExpressionStatement &&\n unwrap(stmt.expression).type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** `await` and used calls count; bare calls do not, including inside blocks and branches. */\nfunction canThrow(stmt: TSESTree.Statement): boolean {\n if (hasAwait(stmt)) {\n return true;\n }\n if (isBareCallStatement(stmt)) {\n return false;\n }\n if (stmt.type === AST_NODE_TYPES.BlockStatement) {\n return stmt.body.some(canThrow);\n }\n if (stmt.type === AST_NODE_TYPES.IfStatement) {\n return (\n hasThrowingCallOrNew(stmt.test) ||\n canThrow(stmt.consequent) ||\n (stmt.alternate !== null && canThrow(stmt.alternate))\n );\n }\n return hasThrowingCallOrNew(stmt);\n}\n\n/**\n * Conservative: is the `catch` handler guaranteed to re-throw? True when a\n * handler is present and its body's last statement is a `throw`.\n */\nfunction handlerRethrows(handler: TSESTree.CatchClause | null): boolean {\n if (handler === null) {\n return false;\n }\n const body = handler.body.body;\n const last = body[body.length - 1];\n return last !== undefined && last.type === AST_NODE_TYPES.ThrowStatement;\n}\n\n/** Statements that hand control straight through to their own parent. */\nconst PASS_THROUGH_PARENTS = new Set<AST_NODE_TYPES>([\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.TryStatement,\n AST_NODE_TYPES.CatchClause,\n AST_NODE_TYPES.LabeledStatement,\n]);\n\n/** A terminal node is last through every enclosing block up to its function, without a loop or switch. */\nfunction isTerminalInFunction(node: TSESTree.Node): boolean {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | undefined = current.parent;\n\n while (parent !== undefined) {\n if (parent.type === AST_NODE_TYPES.BlockStatement) {\n if (parent.body[parent.body.length - 1] !== current) {\n return false;\n }\n } else if (parent.type === AST_NODE_TYPES.Program) {\n return parent.body[parent.body.length - 1] === current;\n } else if (NESTED_FUNCTION_TYPES.has(parent.type)) {\n return true;\n } else if (!PASS_THROUGH_PARENTS.has(parent.type)) {\n return false;\n }\n current = parent;\n parent = current.parent;\n }\n return false;\n}\n\n/** `await f()` unwrapped to `f()`; everything else unwrapped as usual. */\nfunction unwrapAwait(expr: TSESTree.Expression): TSESTree.Expression {\n const inner = unwrap(expr);\n return inner.type === AST_NODE_TYPES.AwaitExpression\n ? unwrap(inner.argument)\n : inner;\n}\n\n/** A propagating handler ends with `return`, `throw`, or a bare call. */\nfunction handlerEndsByHandingOff(handler: TSESTree.CatchClause): boolean {\n const body = handler.body.body;\n const last = body[body.length - 1];\n if (last === undefined) {\n return false;\n }\n if (\n last.type === AST_NODE_TYPES.ReturnStatement ||\n last.type === AST_NODE_TYPES.ThrowStatement\n ) {\n return true;\n }\n return (\n last.type === AST_NODE_TYPES.ExpressionStatement &&\n unwrapAwait(last.expression).type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** Collect identifiers bound by a catch pattern, excluding type annotations. */\nfunction collectBindingNames(\n pattern: TSESTree.Node,\n names: Set<string>,\n): void {\n if (pattern.type === AST_NODE_TYPES.Identifier) {\n names.add(pattern.name);\n return;\n }\n if (pattern.type === AST_NODE_TYPES.ObjectPattern) {\n for (const property of pattern.properties) {\n collectBindingNames(\n property.type === AST_NODE_TYPES.RestElement\n ? property.argument\n : property.value,\n names,\n );\n }\n return;\n }\n if (pattern.type === AST_NODE_TYPES.ArrayPattern) {\n for (const element of pattern.elements) {\n if (element !== null) {\n collectBindingNames(element, names);\n }\n }\n return;\n }\n if (\n pattern.type === AST_NODE_TYPES.AssignmentPattern ||\n pattern.type === AST_NODE_TYPES.RestElement\n ) {\n collectBindingNames(\n pattern.type === AST_NODE_TYPES.AssignmentPattern\n ? pattern.left\n : pattern.argument,\n names,\n );\n }\n}\n\nfunction caughtBindingNames(handler: TSESTree.CatchClause): ReadonlySet<string> {\n const names = new Set<string>();\n if (handler.param !== null) {\n collectBindingNames(handler.param, names);\n }\n return names;\n}\n\n/** A member property / object key spelled `x` is not a reference to `x`. */\nfunction isPropertyName(node: TSESTree.Identifier): boolean {\n const parent = node.parent;\n if (parent.type === AST_NODE_TYPES.MemberExpression) {\n return parent.property === node && !parent.computed;\n }\n if (parent.type === AST_NODE_TYPES.Property) {\n return parent.key === node && !parent.computed;\n }\n return false;\n}\n\n/** A boundary must reference its caught error, including through nested callbacks. */\nfunction handlerMentionsCaughtBinding(handler: TSESTree.CatchClause): boolean {\n const names = caughtBindingNames(handler);\n if (names.size === 0) {\n return false;\n }\n return subtreeMatches(\n handler.body,\n (n) =>\n n.type === AST_NODE_TYPES.Identifier &&\n names.has(n.name) &&\n !isPropertyName(n),\n true,\n );\n}\n\n/** `null`, `undefined`, `false`, `void 0`, `[]`, `{}` — a success-shaped value. */\nfunction isSuccessShapedValue(expr: TSESTree.Expression): boolean {\n let current: TSESTree.Expression = expr;\n while (\n current.type === AST_NODE_TYPES.TSAsExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n }\n if (current.type === AST_NODE_TYPES.Literal) {\n return current.value === null || current.value === false;\n }\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name === \"undefined\";\n }\n if (current.type === AST_NODE_TYPES.UnaryExpression) {\n return current.operator === \"void\";\n }\n if (current.type === AST_NODE_TYPES.ArrayExpression) {\n return current.elements.length === 0;\n }\n if (current.type === AST_NODE_TYPES.ObjectExpression) {\n return current.properties.length === 0;\n }\n return false;\n}\n\n/** Empty or false results hide which operation failed and are not error propagation. */\nconst handlerReturnsSuccessShaped = (handler: TSESTree.CatchClause): boolean =>\n subtreeMatches(\n handler.body,\n (n) =>\n n.type === AST_NODE_TYPES.ReturnStatement &&\n n.argument !== null &&\n isSuccessShapedValue(n.argument),\n );\n\n/** Exempt terminal boundaries that propagate the caught error without fabricating success. */\nfunction isTerminalErrorBoundary(node: TSESTree.TryStatement): boolean {\n const handler = node.handler;\n return (\n handler !== null &&\n isTerminalInFunction(node) &&\n handlerEndsByHandingOff(handler) &&\n handlerMentionsCaughtBinding(handler) &&\n !handlerReturnsSuccessShaped(handler)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-fat-try-blocks\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `try` blocks with more than three top-level statements that can throw — isolate the throwing statement and move non-throwing work outside.\",\n },\n schema: [],\n messages: {\n fatTryBlock:\n \"This `try` block has {{count}} statements that can throw (max {{max}}). Isolate the throwing statement(s); move non-throwing work outside the `try`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const sourceCode = context.sourceCode;\n\n return {\n TryStatement(node: TSESTree.TryStatement): void {\n if (node.finalizer !== null) {\n return;\n }\n if (handlerRethrows(node.handler)) {\n return;\n }\n if (isTerminalErrorBoundary(node)) {\n return;\n }\n\n const count = node.block.body.filter(canThrow).length;\n if (count <= MAX_TRY_BODY_STATEMENTS) {\n return;\n }\n\n const tryKeyword = sourceCode.getFirstToken(node);\n context.report({\n node: tryKeyword ?? node,\n messageId: \"fatTryBlock\",\n data: { count, max: MAX_TRY_BODY_STATEMENTS },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-hand-rolled-sleep — a hand-rolled promisified timer cannot be cancelled; the stdlib form takes an `AbortSignal`.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-hand-rolled-sleep.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"handRolledSleep\" | \"handRolledTimeoutRace\";\ntype Options = readonly [\n {\n allowIn?: readonly string[];\n checkClientModules?: boolean;\n }?,\n];\n\nconst GLOBAL_OBJECTS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n \"global\",\n]);\n\nconst CLIENT_ONLY_MODULES =\n /^(react|react-dom|react-native|svelte|vue|preact|solid-js)(\\/|$)|^next\\/(navigation|router|link|image)$/;\n\nconst RACE_METHODS: ReadonlySet<string> = new Set([\"race\", \"any\"]);\n\n/** Match configured paths where `**` spans separators and `*` does not. */\nfunction matchesAnyPattern(filename: string, patterns: readonly string[]): boolean {\n for (const pattern of patterns) {\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isSetTimeoutCallee(callee: TSESTree.Node): boolean {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"setTimeout\";\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"setTimeout\" &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n GLOBAL_OBJECTS.has(callee.object.name)\n );\n}\n\nfunction soleCall(fn: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression):\n | TSESTree.CallExpression\n | null {\n if (fn.body.type !== AST_NODE_TYPES.BlockStatement) {\n return fn.body.type === AST_NODE_TYPES.CallExpression ? fn.body : null;\n }\n if (fn.body.body.length !== 1) {\n return null;\n }\n const [only] = fn.body.body;\n if (only?.type !== AST_NODE_TYPES.ExpressionStatement) {\n return null;\n }\n return only.expression.type === AST_NODE_TYPES.CallExpression ? only.expression : null;\n}\n\nfunction isTimedDelay(delay: TSESTree.Node | undefined): boolean {\n if (delay === undefined) {\n return false;\n }\n if (delay.type === AST_NODE_TYPES.Literal && typeof delay.value === \"number\") {\n return delay.value !== 0;\n }\n return true;\n}\n\nfunction settlesWithoutValue(callback: TSESTree.Node, name: string): boolean {\n if (callback.type === AST_NODE_TYPES.Identifier) {\n return callback.name === name;\n }\n if (\n callback.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n callback.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const call = soleCall(callback);\n return (\n call !== null &&\n call.arguments.length === 0 &&\n call.callee.type === AST_NODE_TYPES.Identifier &&\n call.callee.name === name\n );\n}\n\nfunction rejectsInCallback(callback: TSESTree.Node, name: string): boolean {\n if (callback.type === AST_NODE_TYPES.Identifier) {\n return callback.name === name;\n }\n if (\n callback.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n callback.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const call = soleCall(callback);\n return (\n call !== null &&\n call.callee.type === AST_NODE_TYPES.Identifier &&\n call.callee.name === name\n );\n}\n\nfunction parameterName(\n fn: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n index: number,\n): string | null {\n const parameter = fn.params[index];\n return parameter?.type === AST_NODE_TYPES.Identifier ? parameter.name : null;\n}\n\nfunction isRaceArm(node: TSESTree.NewExpression): boolean {\n const array = node.parent;\n if (array?.type !== AST_NODE_TYPES.ArrayExpression) {\n return false;\n }\n const call = array.parent;\n return (\n call?.type === AST_NODE_TYPES.CallExpression &&\n call.arguments[0] === array &&\n call.callee.type === AST_NODE_TYPES.MemberExpression &&\n !call.callee.computed &&\n call.callee.object.type === AST_NODE_TYPES.Identifier &&\n call.callee.object.name === \"Promise\" &&\n call.callee.property.type === AST_NODE_TYPES.Identifier &&\n RACE_METHODS.has(call.callee.property.name)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-hand-rolled-sleep\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow hand-rolled promisified timers (`new Promise((r) => setTimeout(r, ms))`) and hand-rolled `Promise.race` timeout arms; the stdlib forms are cancellable, these are not.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n allowIn: {\n description:\n \"Glob patterns for modules exempt from the rule (e.g. a single sanctioned `sleep` utility). Matched against the ABSOLUTE file path, so anchor with a `**/` prefix (e.g. `**/lib/sleep.ts`).\",\n type: \"array\",\n items: { type: \"string\" },\n },\n checkClientModules: {\n description:\n \"Also report the sleep form in browser/React Native modules. Off by default: those bundles cannot import `node:timers/promises` and the web platform has no equivalent, so the fix is impossible to follow. Turn on only where every file can resolve `node:` builtins.\",\n type: \"boolean\",\n },\n },\n },\n ],\n messages: {\n handRolledSleep:\n \"Hand-rolled sleep: `new Promise((resolve) => setTimeout(resolve, ms))` cannot be cancelled, so an aborted request or a lost race still waits out the full delay. Use `import { setTimeout as sleep } from \\\"node:timers/promises\\\"` and pass `{ signal }`.\",\n handRolledTimeoutRace:\n \"Hand-rolled timeout arm: when the other promise wins, this timer is never cleared and keeps the event loop alive until it fires. Use `AbortSignal.timeout(ms)` and pass the signal to the operation.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const { filename, sourceCode } = context;\n if (\n isTestFile(filename) ||\n isScriptFile(filename) ||\n isGeneratedFile(filename, sourceCode.getText())\n ) {\n return {};\n }\n\n const allowIn = optionsArg?.allowIn ?? [];\n if (allowIn.length > 0 && matchesAnyPattern(filename, allowIn)) {\n return {};\n }\n\n const checkClientModules = optionsArg?.checkClientModules ?? false;\n\n function isClientModule(): boolean {\n if (/\\.[cm]?[jt]sx$/.test(filename)) {\n return true;\n }\n const program = sourceCode.ast;\n for (const statement of program.body) {\n if (\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n statement.expression.type === AST_NODE_TYPES.Literal &&\n statement.expression.value === \"use client\"\n ) {\n return true;\n }\n if (\n statement.type === AST_NODE_TYPES.ImportDeclaration &&\n typeof statement.source.value === \"string\" &&\n CLIENT_ONLY_MODULES.test(statement.source.value)\n ) {\n return true;\n }\n }\n return false;\n }\n\n let clientModule: boolean | null = null;\n const reportsSleepHere = (): boolean => {\n if (checkClientModules) {\n return true;\n }\n clientModule ??= isClientModule();\n return !clientModule;\n };\n\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (node.callee.type !== AST_NODE_TYPES.Identifier || node.callee.name !== \"Promise\") {\n return;\n }\n const executor = node.arguments[0];\n if (\n executor?.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n executor?.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return;\n }\n const call = soleCall(executor);\n if (call === null || !isSetTimeoutCallee(call.callee)) {\n return;\n }\n const [callback, delay] = call.arguments;\n if (callback === undefined || !isTimedDelay(delay)) {\n return;\n }\n\n const resolveName = parameterName(executor, 0);\n if (resolveName !== null && settlesWithoutValue(callback, resolveName)) {\n if (reportsSleepHere()) {\n context.report({ node, messageId: \"handRolledSleep\" });\n }\n return;\n }\n\n const rejectName = parameterName(executor, 1);\n if (\n rejectName !== null &&\n isRaceArm(node) &&\n rejectsInCallback(callback, rejectName)\n ) {\n context.report({ node, messageId: \"handRolledTimeoutRace\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-hand-rolled-spinner — border-ring loading indicators should use the design-system spinner.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-hand-rolled-spinner.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"handRolledSpinner\";\ntype Options = readonly [];\n\nconst DESIGN_SYSTEM_PATH = /(?:^|[/\\\\])components[/\\\\]ui[/\\\\]/u;\nconst BORDER_WIDTH = /^border(?:-[0-9]+)?$/u;\nconst TRANSPARENT_EDGE = /^border-[trbl]-transparent$/u;\n\nfunction staticClassName(attribute: TSESTree.JSXAttribute): string | null {\n const value = attribute.value;\n if (value?.type === AST_NODE_TYPES.Literal && typeof value.value === \"string\") {\n return value.value;\n }\n if (\n value?.type === AST_NODE_TYPES.JSXExpressionContainer &&\n value.expression.type === AST_NODE_TYPES.Literal &&\n typeof value.expression.value === \"string\"\n ) {\n return value.expression.value;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-hand-rolled-spinner\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow intrinsic elements styled as Tailwind border-ring spinners outside the design-system implementation.\",\n },\n schema: [],\n messages: {\n handRolledSpinner:\n \"Use the design-system Spinner component instead of rebuilding a border-ring spinner with utility classes.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (DESIGN_SYSTEM_PATH.test(context.filename)) {\n return {};\n }\n\n return {\n JSXOpeningElement(node): void {\n if (\n node.name.type !== AST_NODE_TYPES.JSXIdentifier ||\n (node.name.name !== \"div\" && node.name.name !== \"span\")\n ) {\n return;\n }\n const classNameAttribute = node.attributes.find(\n (attribute): attribute is TSESTree.JSXAttribute =>\n attribute.type === AST_NODE_TYPES.JSXAttribute &&\n attribute.name.type === AST_NODE_TYPES.JSXIdentifier &&\n attribute.name.name === \"className\",\n );\n if (classNameAttribute === undefined) return;\n const className = staticClassName(classNameAttribute);\n if (className === null) return;\n const classes = className.split(/\\s+/u);\n if (\n classes.includes(\"animate-spin\") &&\n classes.includes(\"rounded-full\") &&\n classes.some((token) => BORDER_WIDTH.test(token)) &&\n classes.some((token) => TRANSPARENT_EDGE.test(token))\n ) {\n context.report({ node, messageId: \"handRolledSpinner\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-insecure-random-id — `Math.random()` is predictable, so an id, token or key built from it is guessable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-insecure-random-id.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"insecureRandomId\";\ntype Options = readonly [];\n\nconst STRONG_SECURITY_PATTERN =\n /token|secret|csrf|password|passwd|apikey|api[-_]?key|nonce|salt|uuid|authid/i;\n\nconst NON_SECURITY_ID_PATTERN =\n /temp|tmp|cache|correlation|request|req|trace|execution|dev|hmr|mock|test|perf|marker/i;\n\n/** Matches a static string fragment that reads as a path or DOM-id context. */\nconst PATH_OR_DOM_MARKER = /[\\\\/#]|\\.[A-Za-z0-9]/;\n\n/**\n * Returns true if `node` is a `Math.random()` CallExpression.\n */\nfunction isMathRandomCall(node: TSESTree.Node): node is TSESTree.CallExpression {\n if (node.type !== \"CallExpression\") {\n return false;\n }\n const callee = node.callee;\n if (callee.type !== \"MemberExpression\" || callee.computed) {\n return false;\n }\n const { object, property } = callee;\n return (\n object.type === \"Identifier\" &&\n object.name === \"Math\" &&\n property.type === \"Identifier\" &&\n property.name === \"random\"\n );\n}\n\n/**\n * Climbs the member/call chain in which `node` is the object/callee end, and\n * returns the outermost value node of that chain. For\n * `Math.random().toString(36).slice(2)` this returns the `.slice(2)` call —\n * i.e. the value that actually gets assigned/concatenated.\n */\nfunction climbValueChain(node: TSESTree.Node): TSESTree.Node {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (\n parent.type === \"MemberExpression\" &&\n parent.object === current &&\n !parent.computed\n ) {\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"CallExpression\" && parent.callee === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n return current;\n}\n\n/**\n * Returns true if `node` (a `Math.random()` call) is the base of a member\n * chain that calls `.toString(36)` somewhere above it, e.g.\n * `Math.random().toString(36)` or `Math.random().toString(36).slice(2)`.\n */\nfunction isPartOfToString36Chain(node: TSESTree.Node): boolean {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (\n parent.type === \"MemberExpression\" &&\n parent.object === current &&\n !parent.computed &&\n parent.property.type === \"Identifier\" &&\n parent.property.name === \"toString\"\n ) {\n const grandparent = parent.parent;\n if (\n grandparent &&\n grandparent.type === \"CallExpression\" &&\n grandparent.callee === parent\n ) {\n const firstArg = grandparent.arguments[0];\n if (firstArg && firstArg.type === \"Literal\" && firstArg.value === 36) {\n return true;\n }\n }\n }\n\n if (parent.type === \"MemberExpression\" && parent.object === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"CallExpression\" && parent.callee === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n return false;\n}\n\n/** Finds the nearest binding or property name without leaving its value. */\nfunction findEnclosingName(node: TSESTree.Node): string | undefined {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (parent.type === \"VariableDeclarator\" && parent.init === current) {\n if (parent.id.type === \"Identifier\") {\n return parent.id.name;\n }\n return undefined;\n }\n\n if (parent.type === \"Property\" && parent.value === current) {\n const key = parent.key;\n if (!parent.computed && key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n }\n\n if (parent.type === \"PropertyDefinition\" && parent.value === current) {\n const key = parent.key;\n if (!parent.computed && key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n }\n\n if (\n parent.type === \"FunctionDeclaration\" ||\n parent.type === \"FunctionExpression\" ||\n parent.type === \"ArrowFunctionExpression\" ||\n parent.type === \"BlockStatement\" ||\n parent.type === \"ReturnStatement\" ||\n parent.type === \"ExpressionStatement\"\n ) {\n return undefined;\n }\n\n current = parent;\n parent = current.parent;\n }\n\n return undefined;\n}\n\n/**\n * Collects the static string fragments of a `+` concatenation / template\n * literal subtree into `out`.\n */\nfunction collectStaticStringParts(\n node: TSESTree.Node,\n out: string[],\n): void {\n if (node.type === \"Literal\" && typeof node.value === \"string\") {\n out.push(node.value);\n return;\n }\n if (node.type === \"TemplateLiteral\") {\n for (const quasi of node.quasis) {\n out.push(quasi.value.cooked ?? quasi.value.raw);\n }\n return;\n }\n if (node.type === \"BinaryExpression\" && node.operator === \"+\") {\n collectStaticStringParts(node.left, out);\n collectStaticStringParts(node.right, out);\n }\n}\n\n/**\n * Returns true if the random value is concatenated into a string whose static\n * parts read as a filename/path/DOM id (contain a slash, backslash, `#`, or a\n * `.ext`-style fragment).\n */\nfunction isConcatenatedIntoPathOrDomId(node: TSESTree.Node): boolean {\n const valueNode = climbValueChain(node);\n\n let current: TSESTree.Node = valueNode;\n let parent = current.parent;\n let top: TSESTree.Node | undefined;\n\n while (parent) {\n if (\n parent.type === \"BinaryExpression\" &&\n parent.operator === \"+\" &&\n (parent.left === current || parent.right === current)\n ) {\n top = parent;\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"TemplateLiteral\") {\n top = parent;\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n if (!top) {\n return false;\n }\n\n const parts: string[] = [];\n collectStaticStringParts(top, parts);\n return parts.some((part) => PATH_OR_DOM_MARKER.test(part));\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-insecure-random-id\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow using `Math.random()` to generate identifiers, tokens, or secrets; use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.\",\n },\n schema: [],\n messages: {\n insecureRandomId:\n \"`Math.random()` is not cryptographically secure and is predictable; do not use it to generate IDs, tokens, or secrets. Use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isMathRandomCall(node)) {\n return;\n }\n\n const name = findEnclosingName(node);\n\n // Security signals take precedence over non-security signals.\n if (name !== undefined && STRONG_SECURITY_PATTERN.test(name)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n return;\n }\n\n // Ignore ephemeral and correlation identifiers.\n if (name !== undefined && NON_SECURITY_ID_PATTERN.test(name)) {\n return;\n }\n\n // Ignore filename, path, and DOM-id fragments.\n if (isConcatenatedIntoPathOrDomId(node)) {\n return;\n }\n\n // The classic insecure random-id idiom.\n if (isPartOfToString36Chain(node)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-json-stringify-error — `JSON.stringify` on an Error yields `{}` — `message` and `stack` are non-enumerable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-json-stringify-error.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { Scope, SourceCode } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"noJsonStringifyError\";\ntype Options = readonly [];\n\nconst ERROR_NAME_PATTERN = /^(e|err|error|ex|exc)$/i;\n\n/** Property names whose value is itself an error object (unsafe to stringify). */\nconst ERROR_PROP_PATTERN = /^(cause|lastError|error|err|exception|originalError|innerError)$/i;\n\n/** Property names whose value is a plain string — the recommended escape hatch. */\nconst SAFE_STRING_PROPS: ReadonlySet<string> = new Set([\"message\", \"stack\", \"name\"]);\n\n/**\n * Accessors that hold an error's *data* payload rather than a nested error.\n * These are ordinary enumerable JSON, so `JSON.stringify` on them is correct —\n * react-router's `ErrorResponse.data`, zod's `ZodError.issues`, an HTTP client's\n * `.status` / `.response.body`.\n */\nconst PAYLOAD_PROPS: ReadonlySet<string> = new Set([\n \"data\",\n \"status\",\n \"statuscode\",\n \"statustext\",\n \"code\",\n \"issues\",\n \"details\",\n \"body\",\n \"payload\",\n \"response\",\n \"info\",\n \"meta\",\n \"metadata\",\n \"context\",\n]);\n\n/**\n * Walk up the scope chain looking for a `catch` clause whose binding matches\n * `name`. We rely on the scope analysis provided by the parser rather than\n * type information, keeping the rule type-free.\n */\nfunction isCatchBinding(scope: Scope.Scope, name: string): boolean {\n let current: Scope.Scope | null = scope;\n while (current) {\n const variable = current.set.get(name);\n if (variable) {\n for (const def of variable.defs) {\n if (def.type === \"CatchClause\") {\n return true;\n }\n }\n }\n current = current.upper;\n }\n return false;\n}\n\n/**\n * True if a member-expression argument (`err.cause`, `this.lastError`) denotes an\n * Error value: an error-suggesting property name, or an error-suggesting base whose\n * property is not a known string accessor (`.message` / `.stack` / `.name`).\n */\nfunction memberSuggestsError(\n member: TSESTree.MemberExpression,\n scope: Scope.Scope,\n): boolean {\n const propName =\n !member.computed && member.property.type === \"Identifier\" ? member.property.name : null;\n\n if (propName !== null && ERROR_PROP_PATTERN.test(propName)) {\n return true;\n }\n\n const base = member.object;\n const baseSuggestsError =\n base.type === \"Identifier\" &&\n (ERROR_NAME_PATTERN.test(base.name) || isCatchBinding(scope, base.name));\n if (baseSuggestsError) {\n if (propName === null) {\n return true;\n }\n const lowered = propName.toLowerCase();\n return !SAFE_STRING_PROPS.has(lowered) && !PAYLOAD_PROPS.has(lowered);\n }\n\n return false;\n}\n\nfunction instanceofErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n if (\n test.type === \"BinaryExpression\" &&\n test.operator === \"instanceof\" &&\n test.right.type === \"Identifier\" &&\n test.right.name === \"Error\"\n ) {\n return test.left;\n }\n return null;\n}\n\n/** Names of a user-defined type-guard predicate: `isErrorLike`, `isError`, `hasErrorShape`. */\nconst TYPE_GUARD_PATTERN = /^(is|has)[A-Z]/;\n\n/** The narrowed subject `x` of a user-defined type-guard call `isFoo(x)`, or null. */\nfunction typeGuardSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n const arg = test.type === \"CallExpression\" ? test.arguments[0] : undefined;\n if (\n test.type === \"CallExpression\" &&\n test.callee.type === \"Identifier\" &&\n TYPE_GUARD_PATTERN.test(test.callee.name) &&\n test.arguments.length === 1 &&\n arg !== undefined &&\n arg.type !== \"SpreadElement\"\n ) {\n return arg;\n }\n return null;\n}\n\n/**\n * The subject `x` of a positive error-narrowing test — `x instanceof Error` or a\n * user-defined guard `isErrorLike(x)`. In both, the value IS the error in the\n * truthy branch, so `JSON.stringify(x)` belongs in the falsy (alternate) branch.\n */\nfunction positiveErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n return instanceofErrorSubject(test) ?? typeGuardSubject(test);\n}\n\n/** The subject `x` of a negated error-narrowing test — `!(x instanceof Error)` / `!isErrorLike(x)`. */\nfunction negatedInstanceofErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n if (test.type === \"UnaryExpression\" && test.operator === \"!\") {\n return positiveErrorSubject(test.argument);\n }\n return null;\n}\n\n/** Whether a branch statement unconditionally exits (its last statement returns/throws). */\nfunction branchTerminates(branch: TSESTree.Statement): boolean {\n const body = branch.type === \"BlockStatement\" ? branch.body : [branch];\n const last = body[body.length - 1];\n return (\n last !== undefined &&\n (last.type === \"ReturnStatement\" || last.type === \"ThrowStatement\")\n );\n}\n\n/**\n * True if an earlier guard `if (isErrorLike(arg)) return …` (or `instanceof Error`)\n * in an enclosing block narrows `argExpr` away from the error case before `node`,\n * so by the time `JSON.stringify(arg)` runs the value is the non-Error fallback.\n */\nfunction isNarrowedByEarlyReturn(\n node: TSESTree.Node,\n argExpr: TSESTree.Expression,\n sourceCode: Readonly<SourceCode>,\n): boolean {\n const argText = sourceCode.getText(argExpr);\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (current.type === \"BlockStatement\" || current.type === \"Program\") {\n for (const stmt of current.body) {\n if (stmt.range[0] >= node.range[0]) {\n break;\n }\n if (\n stmt.type === \"IfStatement\" &&\n stmt.alternate === null &&\n branchTerminates(stmt.consequent)\n ) {\n const subject = positiveErrorSubject(stmt.test);\n if (subject && sourceCode.getText(subject) === argText) {\n return true;\n }\n }\n }\n }\n current = current.parent;\n }\n return false;\n}\n\nfunction nodeWithin(node: TSESTree.Node, container: TSESTree.Node | null): boolean {\n return (\n container !== null &&\n node.range[0] >= container.range[0] &&\n node.range[1] <= container.range[1]\n );\n}\n\n/**\n * True if `node` sits in the NON-error branch of an `argExpr instanceof Error`\n * guard — the branch where `argExpr` is provably not an Error, so stringifying it\n * is the correct fallback. Handles both the ternary and `if`/`else` shapes,\n * including the negated `!(x instanceof Error)` form.\n */\nfunction isGuardedByInstanceofError(\n node: TSESTree.Node,\n argExpr: TSESTree.Expression,\n sourceCode: Readonly<SourceCode>,\n): boolean {\n const argText = sourceCode.getText(argExpr);\n const sameSubject = (subject: TSESTree.Expression): boolean =>\n sourceCode.getText(subject) === argText;\n\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (current.type === \"ConditionalExpression\") {\n const subject = positiveErrorSubject(current.test);\n if (subject && sameSubject(subject) && nodeWithin(node, current.alternate)) {\n return true;\n }\n const negated = negatedInstanceofErrorSubject(current.test);\n if (negated && sameSubject(negated) && nodeWithin(node, current.consequent)) {\n return true;\n }\n } else if (current.type === \"IfStatement\") {\n const subject = positiveErrorSubject(current.test);\n if (subject && sameSubject(subject) && nodeWithin(node, current.alternate)) {\n return true;\n }\n const negated = negatedInstanceofErrorSubject(current.test);\n if (negated && sameSubject(negated) && nodeWithin(node, current.consequent)) {\n return true;\n }\n }\n current = current.parent;\n }\n return false;\n}\n\nfunction isJsonStringify(callee: TSESTree.Expression): boolean {\n return (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.object.type === \"Identifier\" &&\n callee.object.name === \"JSON\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === \"stringify\"\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-json-stringify-error\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `JSON.stringify` on an Error value; it yields `{}` because `message`/`stack` are non-enumerable.\",\n },\n schema: [],\n messages: {\n noJsonStringifyError:\n \"`JSON.stringify` on an Error yields `{}` because `message`/`stack` are non-enumerable. Log `err.message` / `err.stack`, or use a proper error serializer.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isJsonStringify(node.callee)) {\n return;\n }\n\n const firstArg = node.arguments[0];\n if (!firstArg) {\n return;\n }\n\n const scope = context.sourceCode.getScope(firstArg);\n\n let suggestsError: boolean;\n if (firstArg.type === \"Identifier\") {\n suggestsError =\n ERROR_NAME_PATTERN.test(firstArg.name) || isCatchBinding(scope, firstArg.name);\n } else if (firstArg.type === \"MemberExpression\") {\n suggestsError = memberSuggestsError(firstArg, scope);\n } else {\n return;\n }\n\n if (!suggestsError) {\n return;\n }\n\n if (\n isGuardedByInstanceofError(node, firstArg, context.sourceCode) ||\n isNarrowedByEarlyReturn(node, firstArg, context.sourceCode)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: \"noJsonStringifyError\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-log-only-catch — a catch that only logs keeps the program running broken, with a log line as the only signal.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-log-only-catch.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noLogOnlyCatch\" | \"emptyCatch\";\ntype Options = readonly [LoggingOptions?];\n\n// A micro-benchmark harness swallows the throw it is timing; `_paths` owns the\n// test-file question but does not yet know this segment, so it is local.\nconst BENCHMARK_DIR_RE = /(?:^|[\\\\/])benchmarks?[\\\\/]/;\n\n// Loop and branch bodies a lone try can be the whole content of. Reaching one\n// level up through these is what finds the rationale comment that real code\n// writes above the guard rather than inside the catch.\nconst SINGLE_STATEMENT_HOSTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.DoWhileStatement,\n AST_NODE_TYPES.ForInStatement,\n AST_NODE_TYPES.ForOfStatement,\n AST_NODE_TYPES.ForStatement,\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.WhileStatement,\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n]);\n\n/** The statement list a node sits directly in, plus its index in that list. */\nfunction statementSlot(\n node: TSESTree.Node,\n): { readonly list: readonly TSESTree.Node[]; readonly index: number } | null {\n const parent = node.parent;\n if (parent === undefined) return null;\n let list: readonly TSESTree.Node[];\n switch (parent.type) {\n case AST_NODE_TYPES.BlockStatement:\n case AST_NODE_TYPES.Program:\n case AST_NODE_TYPES.StaticBlock:\n list = parent.body;\n break;\n case AST_NODE_TYPES.SwitchCase:\n list = parent.consequent;\n break;\n default:\n return null;\n }\n const index = list.indexOf(node);\n return index === -1 ? null : { list, index };\n}\n\nfunction hasFollowingStatement(node: TSESTree.Node): boolean {\n for (\n let current: TSESTree.Node | undefined = node;\n current !== undefined && !FUNCTION_TYPES.has(current.type);\n current = current.parent\n ) {\n const slot = statementSlot(current);\n if (slot !== null && slot.index < slot.list.length - 1) return true;\n }\n return false;\n}\n\n/**\n * Class 1 — the try ends in a `return` and something follows the try, so the\n * catch's only job is to let control fall through to that fallback.\n */\nfunction fallbackFollowsTry(tryStatement: TSESTree.TryStatement): boolean {\n const body = tryStatement.block.body;\n const last = body.at(-1);\n return last?.type === AST_NODE_TYPES.ReturnStatement && hasFollowingStatement(tryStatement);\n}\n\n/** An explicit fallback seed: a literal, `undefined`, or an empty array/object. */\nfunction isSeedValue(node: TSESTree.Expression): boolean {\n const inner = node.type === AST_NODE_TYPES.TSAsExpression ? node.expression : node;\n switch (inner.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.Identifier:\n return inner.name === \"undefined\";\n case AST_NODE_TYPES.UnaryExpression:\n return inner.argument.type === AST_NODE_TYPES.Literal;\n case AST_NODE_TYPES.ArrayExpression:\n return inner.elements.length === 0;\n case AST_NODE_TYPES.ObjectExpression:\n return inner.properties.length === 0;\n default:\n return false;\n }\n}\n\n/**\n * Class 2 — `let x = <seed>;` immediately above the try, written inside it, read\n * after it. The seed IS the recovery value, so an empty catch is the whole\n * handler and there is nothing left for a comment to add.\n */\nfunction seededFallbackHandled(\n tryStatement: TSESTree.TryStatement,\n scope: TSESLint.Scope.Scope,\n): boolean {\n const slot = statementSlot(tryStatement);\n if (slot === null || slot.index === 0) return false;\n const previous = slot.list[slot.index - 1];\n if (previous?.type !== AST_NODE_TYPES.VariableDeclaration || previous.kind === \"const\") {\n return false;\n }\n const declarator = previous.declarations[0];\n if (previous.declarations.length !== 1 || declarator === undefined) return false;\n if (declarator.id.type !== AST_NODE_TYPES.Identifier) return false;\n if (declarator.init == null || !isSeedValue(declarator.init)) return false;\n\n const variable = ASTUtils.findVariable(scope, declarator.id.name);\n if (variable === null) return false;\n const [tryStart, tryEnd] = tryStatement.block.range;\n let writtenInTry = false;\n let readAfter = false;\n for (const reference of variable.references) {\n const [start] = reference.identifier.range;\n if (reference.isWrite() && start >= tryStart && start < tryEnd) writtenInTry = true;\n if (reference.isRead() && start >= tryStatement.range[1]) readAfter = true;\n }\n return writtenInTry && readAfter;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-log-only-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `catch` clauses that only log (or silently do nothing) and then swallow the error; rethrow or handle it instead.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noLogOnlyCatch:\n \"Logging then swallowing the error hides failures. Rethrow the error or handle it for real.\",\n emptyCatch:\n \"Empty catch silently swallows the error. Rethrow it, handle it, or add a comment explaining why it is safe to ignore.\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n const matcher = createLogMatcher(loggingOptions);\n const filename = context.filename;\n const sourceCode = context.sourceCode;\n\n /** True when a statement is exactly a bare logging call, e.g. `console.error(err);`. */\n function isLoggingCallStatement(statement: TSESTree.Statement): boolean {\n if (statement.type !== \"ExpressionStatement\") {\n return false;\n }\n return matcher.isLoggingCall(statement.expression);\n }\n\n /** True when a `//`/`/* *\\/` run ends on the line directly above `node`. */\n function hasCommentDirectlyAbove(node: TSESTree.Node): boolean {\n const above = sourceCode.getCommentsBefore(node).at(-1);\n return above !== undefined && above.loc.end.line === node.loc.start.line - 1;\n }\n\n /**\n * Class 3 — a rationale written next to the braces instead of inside them.\n */\n function hasAdjacentRationale(node: TSESTree.CatchClause): boolean {\n const tryStatement = node.parent;\n if (hasCommentDirectlyAbove(tryStatement) || hasCommentDirectlyAbove(node)) return true;\n const block = tryStatement.parent;\n if (\n block?.type !== AST_NODE_TYPES.BlockStatement ||\n block.body.length !== 1 ||\n block.parent === undefined ||\n !SINGLE_STATEMENT_HOSTS.has(block.parent.type)\n ) {\n return false;\n }\n return hasCommentDirectlyAbove(block.parent);\n }\n\n if (isTestFile(filename) || BENCHMARK_DIR_RE.test(filename.replaceAll(\"\\\\\", \"/\"))) {\n return {};\n }\n\n return {\n CatchClause(node: TSESTree.CatchClause): void {\n const statements = node.body.body;\n\n // A comment inside the block documents an intentional ignore — for a\n // silent swallow and for a log-and-continue alike.\n const isDocumented =\n sourceCode.getCommentsInside(node.body).length > 0 || hasAdjacentRationale(node);\n\n if (statements.length === 0) {\n if (isDocumented) {\n return;\n }\n // The recovery can live outside the catch, where no comment can\n // describe it better than the code already does.\n if (\n fallbackFollowsTry(node.parent) ||\n seededFallbackHandled(node.parent, sourceCode.getScope(node))\n ) {\n return;\n }\n context.report({ node, messageId: \"emptyCatch\" });\n return;\n }\n\n if (isDocumented) {\n return;\n }\n\n const everyStatementIsLogging = statements.every((statement) =>\n isLoggingCallStatement(statement),\n );\n\n if (everyStatementIsLogging) {\n context.report({ node, messageId: \"noLogOnlyCatch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _logging — shared recognition of logging / error-reporting calls, so the catch rules and the secret rule cannot disagree.\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nexport const LOG_METHODS: ReadonlySet<string> = new Set([\n \"debug\",\n \"info\",\n \"warn\",\n \"warning\",\n \"error\",\n \"exception\",\n \"critical\",\n \"trace\",\n \"log\",\n \"fatal\",\n \"success\",\n]);\n\nexport const LOGGER_NAMES: ReadonlySet<string> = new Set([\n \"logger\",\n \"log\",\n \"logging\",\n \"loguru\",\n \"console\",\n \"_logger\",\n \"_log\",\n]);\n\n/** Factory methods that RETURN a logger (`logging.getLogger(name).info(...)`). */\nexport const LOGGER_FACTORIES: ReadonlySet<string> = new Set([\n \"getlogger\",\n \"get_logger\",\n]);\n\n/** Reporting names stay broad because consumers also require the caught binding. */\nexport const REPORT_NAME_RE = /error|report|capture|log|trace|warn/i;\n\n/** Shared `loggerNames` / `logFunctions` option shape. */\nexport interface LoggingOptions {\n readonly loggerNames?: readonly string[];\n readonly logFunctions?: readonly string[];\n}\n\n/** Shared schema properties keep logging options consistent across consumers. */\nexport const LOGGING_OPTION_PROPERTIES = {\n loggerNames: { type: \"array\", items: { type: \"string\" } },\n logFunctions: { type: \"array\", items: { type: \"string\" } },\n} as const;\n\n/** The static callee name of a call (free function or method), or null. */\nexport function calleeName(callee: TSESTree.Node): string | null {\n if (callee.type === \"Identifier\") {\n return callee.name;\n }\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\"\n ) {\n return callee.property.name;\n }\n return null;\n}\n\nexport interface LogMatcher {\n /** Is `expr` a logger receiver (bare name, member chain, or factory call)? */\n isLoggerReceiver(expr: TSESTree.Expression | TSESTree.PrivateIdentifier): boolean;\n /** Is `expr` a project-declared free logging function call (`logEvent(...)`)? */\n isLogFunctionCall(expr: TSESTree.Node): boolean;\n /** Is `expr` a logging call of either shape? */\n isLoggingCall(expr: TSESTree.Node): boolean;\n}\n\n/** Builds a matcher with the project's declared receivers and functions. */\nexport function createLogMatcher(options: LoggingOptions = {}): LogMatcher {\n const loggerNames: ReadonlySet<string> = new Set([\n ...LOGGER_NAMES,\n ...(options.loggerNames ?? []).map((name) => name.toLowerCase()),\n ]);\n const logFunctions: ReadonlySet<string> = new Set(options.logFunctions ?? []);\n\n function isLoggerReceiver(\n expr: TSESTree.Expression | TSESTree.PrivateIdentifier,\n ): boolean {\n switch (expr.type) {\n case \"Identifier\":\n return loggerNames.has(expr.name.toLowerCase());\n case \"MemberExpression\": {\n const { property, object } = expr;\n if (!expr.computed && property.type === \"Identifier\") {\n const lowered = property.name.toLowerCase();\n if (loggerNames.has(lowered) || LOGGER_FACTORIES.has(lowered)) {\n return true;\n }\n }\n return isLoggerReceiver(object);\n }\n case \"CallExpression\": {\n const callee = expr.callee;\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\" &&\n LOGGER_FACTORIES.has(callee.property.name.toLowerCase())\n ) {\n return true;\n }\n if (callee.type !== \"Super\") {\n return isLoggerReceiver(callee);\n }\n return false;\n }\n default:\n return false;\n }\n }\n\n function isLogFunctionCall(expr: TSESTree.Node): boolean {\n if (expr.type !== \"CallExpression\" || logFunctions.size === 0) {\n return false;\n }\n const name = calleeName(expr.callee);\n return name !== null && logFunctions.has(name);\n }\n\n function isLoggingCall(expr: TSESTree.Node): boolean {\n if (expr.type !== \"CallExpression\") {\n return false;\n }\n if (isLogFunctionCall(expr)) {\n return true;\n }\n const callee = expr.callee;\n if (\n callee.type !== \"MemberExpression\" ||\n callee.computed ||\n callee.property.type !== \"Identifier\"\n ) {\n return false;\n }\n if (!LOG_METHODS.has(callee.property.name.toLowerCase())) {\n return false;\n }\n return isLoggerReceiver(callee.object);\n }\n\n return { isLoggerReceiver, isLogFunctionCall, isLoggingCall };\n}\n","/**\n * @fileoverview _prose-budget — shared extraction and sentence counting for comment-budget rules.\n */\n\nimport { AST_NODE_TYPES, type TSESTree, type TSESLint } from \"@typescript-eslint/utils\";\n\nimport { isGeneratedFile, isStoryFile } from \"./_paths.js\";\n\nconst DIRECTIVE_RE = /^(?:!|eslint\\b|eslint-|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|@vite|webpack|@jsx|@jest-environment|@vitest-environment|#__|todo\\b|fixme\\b|hack\\b)/i;\nconst LICENSE_RE = /\\b(?:copyright|spdx-license-identifier|licensed under)\\b/i;\nconst TYPED_TAG_RE = /@(arg|argument|param|return|returns|yield|yields)\\b/i;\nconst VALUE_TAG_RE = /@(example|deprecated|see|remarks|throws|internal|public|alpha|beta|since|template|fileoverview)\\b/i;\nconst BOUNDARY_RE = /(?<=[.!?])[\"'`)\\]]*\\s+(?=[A-Z0-9`])/;\nconst BULLET_RE = /^\\s*(?:[-*+] |\\d+[.)] )/;\n\nexport interface ProseGroup {\n readonly comment: TSESTree.Comment;\n readonly text: string;\n readonly hasTypedTags: boolean;\n}\n\nfunction body(comment: TSESTree.Comment): string {\n return comment.value\n .replace(/^\\*/, \"\")\n .split(\"\\n\")\n .map((line) => line.replace(/^\\s*\\*?\\s?/, \"\"))\n .join(\"\\n\")\n .trim();\n}\n\nfunction eligible(text: string, includeValueTags: boolean): boolean {\n return text.length > 0 && !DIRECTIVE_RE.test(text) && !LICENSE_RE.test(text) && (includeValueTags || !VALUE_TAG_RE.test(text));\n}\n\nexport function sentenceUnits(text: string): number {\n const cleaned = text\n .replace(/https?:\\/\\/\\S+/g, \"URL\")\n .replace(/`[^`\\n]+`/g, \"CODE\")\n .replace(/\\b\\d+\\.\\d+\\b/g, \"NUMBER\")\n .replace(/\\b(?:e\\.g\\.|i\\.e\\.|vs\\.|etc\\.)/gi, \"ABBREVIATION\");\n let units = 0;\n const prose: string[] = [];\n for (const raw of cleaned.split(\"\\n\")) {\n const line = raw.trim();\n if (line.length === 0 || /^[A-Za-z][A-Za-z ]+:$/.test(line)) continue;\n if (BULLET_RE.test(line)) units += 1;\n else prose.push(line);\n }\n if (prose.length > 0) units += prose.join(\" \").split(BOUNDARY_RE).length;\n return units;\n}\n\nexport function proseGroups(\n filename: string,\n sourceCode: Readonly<TSESLint.SourceCode>,\n includeValueTags = false,\n): ProseGroup[] {\n if (isGeneratedFile(filename, sourceCode.text) || isStoryFile(filename)) return [];\n const groups: ProseGroup[] = [];\n let run: TSESTree.Comment[] = [];\n const flush = (): void => {\n if (run.length === 0) return;\n const text = run.map(body).join(\"\\n\");\n if (eligible(text, includeValueTags)) groups.push({ comment: run[0]!, text, hasTypedTags: TYPED_TAG_RE.test(text) });\n run = [];\n };\n for (const comment of sourceCode.getAllComments()) {\n const text = body(comment);\n if (comment.type === \"Block\") {\n flush();\n if (eligible(text, includeValueTags)) groups.push({ comment, text, hasTypedTags: TYPED_TAG_RE.test(text) });\n continue;\n }\n const ownLine = sourceCode.lines[comment.loc.start.line - 1]?.slice(0, comment.loc.start.column).trim() === \"\";\n if (!ownLine || !eligible(text, includeValueTags)) {\n flush();\n continue;\n }\n const previous = run.at(-1);\n if (previous !== undefined && (comment.loc.start.line !== previous.loc.end.line + 1 || comment.loc.start.column !== previous.loc.start.column)) flush();\n run.push(comment);\n }\n flush();\n return groups;\n}\n\nfunction annotatedParameter(parameter: TSESTree.Parameter): boolean {\n if (parameter.type === AST_NODE_TYPES.TSParameterProperty) return annotatedParameter(parameter.parameter);\n const target = parameter.type === AST_NODE_TYPES.AssignmentPattern ? parameter.left : parameter;\n return \"typeAnnotation\" in target && target.typeAnnotation != null;\n}\n\nfunction typedFunction(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n return node.declaration != null && typedFunction(node.declaration);\n case AST_NODE_TYPES.FunctionDeclaration:\n case AST_NODE_TYPES.TSDeclareFunction:\n return node.returnType != null && node.params.every(annotatedParameter);\n case AST_NODE_TYPES.VariableDeclaration: {\n const init = node.declarations[0]?.init;\n return init != null &&\n (init.type === AST_NODE_TYPES.ArrowFunctionExpression || init.type === AST_NODE_TYPES.FunctionExpression) &&\n init.returnType != null && init.params.every(annotatedParameter);\n }\n case AST_NODE_TYPES.MethodDefinition:\n return node.value.returnType != null && node.value.params.every(annotatedParameter);\n case AST_NODE_TYPES.TSMethodSignature:\n return node.returnType != null && node.params.every(annotatedParameter);\n default:\n return false;\n }\n}\n\nexport function documentsTypedFunction(\n sourceCode: Readonly<TSESLint.SourceCode>,\n comment: TSESTree.Comment,\n): boolean {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) return false;\n let node: TSESTree.Node | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n while (node != null && node.type !== AST_NODE_TYPES.Program) {\n if (typedFunction(node)) return true;\n node = node.parent ?? null;\n }\n return false;\n}\n","/**\n * @fileoverview no-long-comment — three or more sentences exceed the in-code prose budget.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-long-comment.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { proseGroups, sentenceUnits } from \"./_prose-budget.js\";\n\ntype MessageIds = \"tooLong\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"no-long-comment\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Limit in-code prose to two sentences.\" },\n schema: [],\n messages: {\n tooLong: \"Comment exceeds two sentences — keep one local fact and clarify the code itself.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode)) {\n if (!group.hasTypedTags && sentenceUnits(group.text) >= 3) {\n context.report({ node: group.comment, messageId: \"tooLong\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-offset-pagination — `OFFSET m` scans and discards m rows per page and shifts under concurrent writes, so rows repeat or vanish.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-offset-pagination.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"noOffsetPagination\";\ntype Options = readonly [];\n\n/** Match pagination across the parameter styles supported by the TS, Python, and SQL rules. */\nconst OFFSET_PAGINATION = /\\bOFFSET\\s+(?:%s|%\\(\\w+\\)s|\\?\\d*|:\\w+|@\\w+|\\$\\d+|\\d+)/i;\n\n/** Cheap substring gate; noise-stripping can only ever remove keywords, never add them. */\nconst OFFSET_GATE = /offset/i;\n\nexport default createRule<Options, MessageIds>({\n name: \"no-offset-pagination\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow OFFSET pagination in embedded SQL; it is O(N) per page and drops or repeats rows under concurrent writes. Use a keyset cursor.\",\n },\n schema: [],\n messages: {\n noOffsetPagination:\n \"OFFSET pagination scans and discards every skipped row (O(N) per page) and shifts under concurrent inserts, so rows get repeated or missed. Use a keyset cursor: `WHERE id > ? ORDER BY id LIMIT ?`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !OFFSET_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!OFFSET_PAGINATION.test(sql)) {\n return;\n }\n context.report({ node, messageId: \"noOffsetPagination\" });\n });\n },\n});\n","/**\n * @fileoverview no-positional-tuple-return — a positional tuple crossing a module boundary names its fields only at the call site, so call sites disagree.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-positional-tuple-return.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"noPositionalTupleReturn\";\ntype Options = readonly [];\n\nconst MIN_ELEMENTS = 2;\n\n/** The pair length an accessor/mutator tuple has. */\nconst ACCESSOR_PAIR_LENGTH = 2;\n\n/** Type wrappers whose single type argument is the value actually returned. */\nconst AWAITABLE_TYPES: ReadonlySet<string> = new Set([\"Promise\", \"PromiseLike\", \"Awaited\"]);\n\n/** The tuple type a return annotation resolves to, unwrapping `Promise<...>`. */\nfunction tupleReturnType(node: TSESTree.TypeNode): TSESTree.TSTupleType | null {\n if (node.type === AST_NODE_TYPES.TSTupleType) {\n return node;\n }\n if (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.Identifier &&\n AWAITABLE_TYPES.has(node.typeName.name)\n ) {\n const argument = node.typeArguments?.params[0];\n return argument === undefined ? null : tupleReturnType(argument);\n }\n return null;\n}\n\n/** Source text with all whitespace runs collapsed, for structural comparison. */\nfunction normalizedText(sourceCode: { getText: (node: TSESTree.Node) => string }, node: TSESTree.Node): string {\n return sourceCode.getText(node).replaceAll(/\\s+/g, \" \").trim();\n}\n\n/**\n * True when the tuple is one of the permitted shapes: variadic, labeled, tagged\n * by a leading literal type, or structurally homogeneous.\n */\nfunction isPermittedTuple(\n tuple: TSESTree.TSTupleType,\n sourceCode: { getText: (node: TSESTree.Node) => string },\n): boolean {\n const elements = tuple.elementTypes;\n if (elements.length < MIN_ELEMENTS) {\n return true;\n }\n if (elements.some((element) => element.type === AST_NODE_TYPES.TSRestType)) {\n return true;\n }\n if (elements.some((element) => element.type === AST_NODE_TYPES.TSNamedTupleMember)) {\n return true;\n }\n if (elements[0]?.type === AST_NODE_TYPES.TSLiteralType) {\n return true;\n }\n if (\n elements.length === ACCESSOR_PAIR_LENGTH &&\n elements.some((element) => element.type === AST_NODE_TYPES.TSFunctionType)\n ) {\n return true;\n }\n const texts = new Set(elements.map((element) => normalizedText(sourceCode, element)));\n return texts.size === 1;\n}\n\n/** The declared name of a function-ish node, or null for an anonymous one. */\nfunction functionName(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.FunctionDeclaration) {\n return node.id?.name ?? null;\n }\n const parent = node.parent;\n if (parent?.type === AST_NODE_TYPES.VariableDeclarator && parent.id.type === AST_NODE_TYPES.Identifier) {\n return parent.id.name;\n }\n if (\n (parent?.type === AST_NODE_TYPES.MethodDefinition ||\n parent?.type === AST_NODE_TYPES.PropertyDefinition ||\n parent?.type === AST_NODE_TYPES.Property) &&\n parent.key.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.key.name;\n }\n return null;\n}\n\n/**\n * True when an ancestor statement carries the `export` keyword inline —\n * `export function f`, `export const f =`, `export default function f`.\n */\nfunction isInlineExported(node: TSESTree.Node): boolean {\n for (let current: TSESTree.Node | undefined | null = node; current != null; current = current.parent) {\n const parent = current.parent;\n if (\n parent?.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n parent?.type === AST_NODE_TYPES.ExportDefaultDeclaration\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The module-scope binding the function lives under — `split` for a top-level\n * `function split`, `Repo` for a method of a top-level `class Repo`. That is the\n * name an `export { … }` specifier elsewhere in the file would refer to. Null\n * when the function is not anchored to a named top-level declaration.\n */\nfunction moduleScopeBindingName(node: TSESTree.Node): string | null {\n let current: TSESTree.Node = node;\n let child: TSESTree.Node = node;\n while (current.parent != null && current.parent.type !== AST_NODE_TYPES.Program) {\n child = current;\n current = current.parent;\n }\n if (current.parent?.type !== AST_NODE_TYPES.Program) {\n return null;\n }\n if (\n current.type === AST_NODE_TYPES.FunctionDeclaration ||\n current.type === AST_NODE_TYPES.ClassDeclaration\n ) {\n return current.id?.name ?? null;\n }\n if (current.type === AST_NODE_TYPES.VariableDeclaration) {\n if (child.type !== AST_NODE_TYPES.VariableDeclarator || child.id.type !== AST_NODE_TYPES.Identifier) {\n return null;\n }\n return child.id.name;\n }\n return null;\n}\n\n/**\n * Local names this module puts on its public surface through a *detached* export\n * statement: `export { split }`, `export { split as s }`, `export default split`,\n * `export = split`. A re-export (`export { x } from \"./other\"`) names a binding\n * owned by another module, and a type-only export (`export type { x }`) does not\n * expose the value, so neither counts.\n */\nfunction specifierExportedNames(program: TSESTree.Program): ReadonlySet<string> {\n const names = new Set<string>();\n for (const statement of program.body) {\n if (\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration &&\n statement.declaration == null &&\n statement.source == null &&\n statement.exportKind !== \"type\"\n ) {\n for (const specifier of statement.specifiers) {\n if (specifier.exportKind !== \"type\" && specifier.local.type === AST_NODE_TYPES.Identifier) {\n names.add(specifier.local.name);\n }\n }\n continue;\n }\n if (\n statement.type === AST_NODE_TYPES.ExportDefaultDeclaration &&\n statement.declaration.type === AST_NODE_TYPES.Identifier\n ) {\n names.add(statement.declaration.name);\n continue;\n }\n if (\n statement.type === AST_NODE_TYPES.TSExportAssignment &&\n statement.expression.type === AST_NODE_TYPES.Identifier\n ) {\n names.add(statement.expression.name);\n }\n }\n return names;\n}\n\n/**\n * True when the function is reachable from outside the module — the boundary the\n * rule is about. Either the declaration is exported inline, or its module-scope\n * binding is exported later through an export specifier.\n */\nfunction isExported(node: TSESTree.Node, specifierExports: ReadonlySet<string>): boolean {\n if (isInlineExported(node)) {\n return true;\n }\n if (specifierExports.size === 0) {\n return false;\n }\n const binding = moduleScopeBindingName(node);\n return binding !== null && specifierExports.has(binding);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-positional-tuple-return\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow returning a positional tuple of distinct fields from an exported function; return a named object so call sites cannot mismatch slots.\",\n },\n schema: [],\n messages: {\n noPositionalTupleReturn:\n \"Exported `{{name}}` returns a positional {{count}}-tuple, so every call site re-invents the field names and can disagree. Return a named object (or label the tuple members) instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const specifierExports = specifierExportedNames(context.sourceCode.ast);\n const check = (\n node:\n | TSESTree.FunctionDeclaration\n | TSESTree.FunctionExpression\n | TSESTree.ArrowFunctionExpression,\n ): void => {\n const annotation = node.returnType?.typeAnnotation;\n if (annotation === undefined) {\n return;\n }\n const tuple = tupleReturnType(annotation);\n if (tuple === null || isPermittedTuple(tuple, context.sourceCode)) {\n return;\n }\n const name = functionName(node);\n if (name === null || name.startsWith(\"_\") || /^use[A-Z]/.test(name)) {\n return;\n }\n if (!isExported(node, specifierExports)) {\n return;\n }\n context.report({\n node: tuple,\n messageId: \"noPositionalTupleReturn\",\n data: { name, count: String(tuple.elementTypes.length) },\n });\n };\n return {\n FunctionDeclaration: check,\n FunctionExpression: check,\n ArrowFunctionExpression: check,\n };\n },\n});\n","/**\n * @fileoverview no-raw-env — a raw `process.env` read is untyped and unvalidated, so a missing variable surfaces as `undefined` in business logic.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-raw-env.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noRawEnv\";\ntype Options = readonly [];\n\n/** Build / test / tooling config: `vite.config.ts`, `vitest.config.mts`, `playwright.config.ts`. */\nconst CONFIG_FILE_RE = /(^|[\\\\/])[\\w.-]+\\.config\\.[cm]?[jt]sx?$/;\n\n/** Exempt only boundary-named modules that contain a validation marker. */\nconst ENV_BOUNDARY_FILE_RE =\n /(^|[\\\\/])(?:env|client-env|server-env|client-settings|server-settings)\\.[cm]?[jt]sx?$/;\n\nconst ENV_VALIDATION_MARKER_RE =\n /\\bcreateEnv\\s*\\(|\\bz\\.object\\s*\\(|\\.(?:safeParse|parse)\\s*\\(/;\n\nfunction isValidatedEnvBoundary(filename: string, sourceText: string): boolean {\n return (\n ENV_BOUNDARY_FILE_RE.test(filename.replaceAll(\"\\\\\", \"/\")) &&\n ENV_VALIDATION_MARKER_RE.test(sourceText)\n );\n}\n\n/** True for the `process.env` member node (dotted or as the base of `process.env[key]`). */\nfunction isProcessEnv(node: TSESTree.MemberExpression): boolean {\n return (\n !node.computed &&\n node.object.type === \"Identifier\" &&\n node.object.name === \"process\" &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\"\n );\n}\n\n/** True for the `import.meta.env` member node (dotted or as the base of `import.meta.env[key]`). */\nfunction isImportMetaEnv(node: TSESTree.MemberExpression): boolean {\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\" &&\n node.object.type === \"MetaProperty\" &&\n node.object.meta.name === \"import\" &&\n node.object.property.name === \"meta\"\n );\n}\n\n// Build-time constants that bundlers (webpack/Vite) statically replace — there is\n// no runtime env value to route through the validated layer, so they are exempt.\nconst BUILD_TIME_CONSTANTS: ReadonlySet<string> = new Set([\n \"NODE_ENV\",\n \"MODE\",\n \"DEV\",\n \"PROD\",\n \"SSR\",\n]);\n\nconst PLATFORM_MARKERS: ReadonlySet<string> = new Set([\n \"NEXT_RUNTIME\",\n \"VERCEL\",\n \"VERCEL_ENV\",\n \"CI\",\n]);\n\n/** Match named bundler constants and host-owned platform markers. */\nfunction isExemptVariableAccess(node: TSESTree.MemberExpression): boolean {\n const parent = node.parent;\n return (\n parent.type === \"MemberExpression\" &&\n parent.object === node &&\n !parent.computed &&\n parent.property.type === \"Identifier\" &&\n (BUILD_TIME_CONSTANTS.has(parent.property.name) ||\n PLATFORM_MARKERS.has(parent.property.name))\n );\n}\n\n/** Match assignment and deletion targets, which do not read configuration. */\nfunction isWriteTarget(node: TSESTree.MemberExpression): boolean {\n const access = node.parent.type === \"MemberExpression\" && node.parent.object === node ? node.parent : node;\n const parent = access.parent;\n if (parent.type === \"AssignmentExpression\") {\n return parent.left === access;\n }\n if (parent.type === \"UnaryExpression\") {\n return parent.operator === \"delete\";\n }\n return false;\n}\n\n/** Match whole-environment pass-through such as `{ ...process.env }`. */\nfunction isWholeEnvSpread(node: TSESTree.MemberExpression): boolean {\n const parent = node.parent;\n return parent.type === \"SpreadElement\" && parent.argument === node;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-raw-env\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow direct `process.env` and `import.meta.env` reads outside validated boundaries.\",\n },\n schema: [],\n messages: {\n noRawEnv:\n \"Do not read raw environment values directly. Import the validated env module so values are typed and checked at startup.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (\n isTestFile(filename) ||\n isScriptFile(filename) ||\n CONFIG_FILE_RE.test(filename.replaceAll(\"\\\\\", \"/\")) ||\n isValidatedEnvBoundary(filename, context.sourceCode.text)\n ) {\n return {};\n }\n return {\n MemberExpression(node: TSESTree.MemberExpression): void {\n if (\n (isProcessEnv(node) || isImportMetaEnv(node)) &&\n !isExemptVariableAccess(node) &&\n !isWriteTarget(node) &&\n !isWholeEnvSpread(node)\n ) {\n context.report({\n node,\n messageId: \"noRawEnv\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-raw-fetch-outside-clients — a bare `fetch` outside the client layer opts out of retry, timeout and status handling, and cannot be stubbed.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-raw-fetch-outside-clients.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"rawFetch\";\n\nexport interface RuleOptions {\n /** Regular-expression sources matched against the filename. */\n readonly allow?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\n/** Client-layer paths that may own outbound HTTP; test files are exempt separately. */\nconst DEFAULT_ALLOW: readonly string[] = [\n \"[\\\\\\\\/]clients?[\\\\\\\\/]\",\n \"-client\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]http-client\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]api[\\\\\\\\/]\",\n \"[\\\\\\\\/]api\\\\.[cm]?[jt]sx?$\",\n \"[-.]api\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]services?[\\\\\\\\/]\",\n \"[\\\\\\\\/](connectors|providers|integrations|adapters|fetchers)[\\\\\\\\/]\",\n \"[\\\\\\\\/]notifications[\\\\\\\\/]\",\n \"[Ss]ervice\\\\.[cm]?[jt]sx?$\",\n \"-(service|connector|adapter|sdk|fetcher)\\\\.[cm]?[jt]sx?$\",\n];\n\n/** Additional non-production trees that may call `fetch` directly. */\nconst NON_PRODUCTION_TREE_RE =\n /[\\\\/](playwright|cypress|__testfixtures__)[\\\\/]/;\n\n/** Receivers on which `.fetch()` is the global, not some cache/query API. */\nconst GLOBAL_RECEIVERS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n]);\n\nconst PRESIGNED_URL_NAME_RE = /(?:pre-?signed|signed|upload|download)Url$/i;\n\nfunction isGlobalFetchCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n if (callee.type === \"Identifier\") {\n return callee.name === \"fetch\";\n }\n\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === \"fetch\" &&\n callee.object.type === \"Identifier\"\n ) {\n return GLOBAL_RECEIVERS.has(callee.object.name);\n }\n\n return false;\n}\n\nfunction identifierLikeName(node: TSESTree.Node): string | null {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n if (\n node.type === \"MemberExpression\" &&\n !node.computed &&\n node.property.type === \"Identifier\"\n ) {\n return node.property.name;\n }\n return null;\n}\n\n/** True for a lone `fetch(new URL(...))` / `fetch(new Request(...))`. */\nfunction isConstructedArgumentHandoff(node: TSESTree.CallExpression): boolean {\n const [first] = node.arguments;\n return (\n node.arguments.length === 1 &&\n first !== undefined &&\n first.type === AST_NODE_TYPES.NewExpression\n );\n}\n\nfunction isPresignedUrlTransfer(node: TSESTree.CallExpression): boolean {\n const first = node.arguments[0];\n if (first === undefined) {\n return false;\n }\n const name = identifierLikeName(first);\n return name !== null && PRESIGNED_URL_NAME_RE.test(name);\n}\n\n/** Compile valid allow patterns; malformed entries fail closed. */\nfunction compile(patterns: readonly string[]): RegExp[] {\n const compiled: RegExp[] = [];\n for (const pattern of patterns) {\n try {\n compiled.push(new RegExp(pattern));\n } catch {\n // Skip the malformed entry; the remaining patterns still apply.\n }\n }\n return compiled;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-raw-fetch-outside-clients\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow calling the global `fetch` outside the client layer; route outbound HTTP through a client module that owns retry, timeout and status handling.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n allow: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Regular-expression sources matched against the filename. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n rawFetch:\n \"Raw `fetch()` outside a client module. Route the call through a client (e.g. `clients/*-client.ts`) so it inherits retry, timeout and status handling and stays stubbable in tests.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const filename = context.filename;\n\n if (isTestFile(filename) || NON_PRODUCTION_TREE_RE.test(filename)) {\n return {};\n }\n\n const patterns = options?.allow ?? DEFAULT_ALLOW;\n const allowed = compile(patterns);\n\n if (allowed.some((re) => re.test(filename))) {\n return {};\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (isPresignedUrlTransfer(node) || isConstructedArgumentHandoff(node)) {\n return;\n }\n if (isGlobalFetchCall(node)) {\n context.report({ node, messageId: \"rawFetch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restricted-library-load — literal runtime module loads must obey the same library policy as static imports.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restricted-library-load.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\nexport interface RestrictedLibrary {\n readonly id: string;\n readonly module: string;\n readonly replacement: string;\n readonly note?: string;\n}\n\ntype MessageIds = \"restrictedLibraryLoad\";\ntype Options = readonly [\n {\n libraries: readonly RestrictedLibrary[];\n },\n];\n\nfunction literalModule(node: TSESTree.Node | undefined): string | null {\n return node?.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\"\n ? node.value\n : null;\n}\n\nfunction matchesModule(source: string, module: string): boolean {\n return source === module || source.startsWith(`${module}/`);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restricted-library-load\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Apply a configured library-replacement policy to literal dynamic imports, CommonJS loads, and TypeScript import-equals declarations.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"libraries\"],\n properties: {\n libraries: {\n type: \"array\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"module\", \"replacement\"],\n properties: {\n id: { type: \"string\", minLength: 1 },\n module: { type: \"string\", minLength: 1 },\n replacement: { type: \"string\", minLength: 1 },\n note: { type: \"string\", minLength: 1 },\n },\n },\n },\n },\n },\n ],\n messages: {\n restrictedLibraryLoad:\n \"{{id}}: Replace runtime loading of {{module}} with {{replacement}}.{{note}}\",\n },\n },\n defaultOptions: [{ libraries: [] }],\n create(context, [options]) {\n const restrictions = options.libraries;\n\n function report(node: TSESTree.Node, source: string): void {\n const restriction = restrictions.find((entry) =>\n matchesModule(source, entry.module),\n );\n if (restriction === undefined) return;\n context.report({\n node,\n messageId: \"restrictedLibraryLoad\",\n data: {\n id: restriction.id,\n module: restriction.module,\n replacement: restriction.replacement,\n note: restriction.note === undefined ? \"\" : ` ${restriction.note}`,\n },\n });\n }\n\n function isUnshadowedRequire(node: TSESTree.Identifier): boolean {\n const variable = ASTUtils.findVariable(\n context.sourceCode.getScope(node),\n node.name,\n );\n return variable === null || variable.defs.length === 0;\n }\n\n return {\n ImportExpression(node: TSESTree.ImportExpression): void {\n const source = literalModule(node.source);\n if (source !== null) report(node.source, source);\n },\n CallExpression(node: TSESTree.CallExpression): void {\n let requireIdentifier: TSESTree.Identifier | null = null;\n if (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\"\n ) {\n requireIdentifier = node.callee;\n } else if (\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n node.callee.object.name === \"require\" &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n node.callee.property.name === \"resolve\"\n ) {\n requireIdentifier = node.callee.object;\n }\n if (requireIdentifier === null || !isUnshadowedRequire(requireIdentifier)) return;\n const source = literalModule(node.arguments[0]);\n if (source !== null) report(node.arguments[0] as TSESTree.Node, source);\n },\n TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void {\n if (node.moduleReference.type !== AST_NODE_TYPES.TSExternalModuleReference) return;\n const source = literalModule(node.moduleReference.expression);\n if (source !== null) report(node.moduleReference.expression, source);\n },\n };\n },\n});\n","/**\n * @fileoverview no-repeated-string-literal — the same structured literal in two functions drifts the moment one copy is edited.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-repeated-string-literal.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noRepeatedStringLiteral\";\ntype Options = readonly [];\n\nconst MIN_LENGTH = 40;\nconst MIN_DISTINCT_SCOPES = 2;\nconst PREVIEW_LENGTH = 40;\n\n/** Case-sensitive on purpose: uppercase keywords mean SQL, lowercase means prose. */\nconst SQL_KEYWORD_RE =\n /\\b(SELECT|INSERT|UPDATE|DELETE|FROM|WHERE|JOIN|VALUES|ON CONFLICT|RETURNING|GROUP BY|ORDER BY)\\b/;\nconst IDENTIFIER_RE = /^[a-z_][a-z0-9_.]*$/;\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** True when the literal carries structure that rules out coincidental equality. */\nfunction isStructured(value: string): boolean {\n return value.includes(\"\\n\") || SQL_KEYWORD_RE.test(value) || IDENTIFIER_RE.test(value);\n}\n\nfunction preview(value: string): string {\n const oneLine = value.replaceAll(\"\\n\", \" \").trim();\n return oneLine.length <= PREVIEW_LENGTH ? oneLine : `${oneLine.slice(0, PREVIEW_LENGTH)}...`;\n}\n\n/** The enclosing function node, or null when the literal sits at module/class scope. */\nfunction enclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n }\n return null;\n}\n\n/**\n * True when the literal is scaffolding rather than a reusable value: an\n * import/`require` source (repeating a module path is the point) or a JSX\n * attribute value (styling strings, handled by the styling rules).\n */\nfunction isScaffolding(node: TSESTree.Node): boolean {\n const parent = node.parent;\n if (parent === undefined) {\n return true;\n }\n const isRequireSource =\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee.type === AST_NODE_TYPES.Identifier &&\n parent.callee.name === \"require\";\n return (\n parent.type === AST_NODE_TYPES.ImportDeclaration ||\n parent.type === AST_NODE_TYPES.ImportExpression ||\n parent.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n parent.type === AST_NODE_TYPES.ExportAllDeclaration ||\n parent.type === AST_NODE_TYPES.TSImportType ||\n parent.type === AST_NODE_TYPES.JSXAttribute ||\n parent.type === AST_NODE_TYPES.TSLiteralType ||\n isRequireSource\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-repeated-string-literal\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow a long structured string literal repeated across functions; the copies drift when one is edited. Extract a module-level constant.\",\n },\n schema: [],\n messages: {\n noRepeatedStringLiteral:\n 'Structured string literal \"{{preview}}\" is repeated across functions (first use on line {{line}}) — extract a module-level constant so the copies cannot drift.',\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n const occurrences = new Map<string, TSESTree.Node[]>();\n const scopes = new WeakMap<TSESTree.Node, TSESTree.Node | null>();\n\n const record = (value: string, node: TSESTree.Node): void => {\n if (value.length < MIN_LENGTH || !isStructured(value) || isScaffolding(node)) {\n return;\n }\n const existing = occurrences.get(value);\n if (existing === undefined) {\n occurrences.set(value, [node]);\n } else {\n existing.push(node);\n }\n scopes.set(node, enclosingFunction(node));\n };\n\n return {\n Literal(node: TSESTree.Literal): void {\n if (typeof node.value === \"string\") {\n record(node.value, node);\n }\n },\n TemplateLiteral(node: TSESTree.TemplateLiteral): void {\n // A tagged template (`js`…``, `css`…``, `sql`…``) is a call, not a\n // string value — the tag, not this rule, decides what the text means.\n if (node.parent.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return;\n }\n const [only] = node.quasis;\n if (node.expressions.length === 0 && only !== undefined) {\n record(only.value.cooked ?? only.value.raw, node);\n }\n },\n \"Program:exit\": (): void => {\n for (const [value, nodes] of occurrences) {\n const distinctScopes = new Set(\n nodes.map((node) => scopes.get(node)).filter((scope) => scope != null),\n );\n if (distinctScopes.size < MIN_DISTINCT_SCOPES) {\n continue;\n }\n const [first, ...repeats] = nodes;\n if (first === undefined) {\n continue;\n }\n for (const node of repeats) {\n context.report({\n node,\n messageId: \"noRepeatedStringLiteral\",\n data: { preview: preview(value), line: String(first.loc.start.line) },\n });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restated-comment — a comment whose every content word is already on the line below can only go out of date silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restated-comment.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n codeTokens,\n contentTokens,\n isProtected,\n restatableStatementBelow,\n restates,\n restatesStatementHead,\n} from \"./_comments.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"restatesLineBelow\";\ntype Options = readonly [];\n\nconst MAX_WORDS = 8;\nconst MIN_CONTENT_TOKENS = 2;\n\nconst DIRECTIVE_RE =\n /^(eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier-ignore|prettier\\b|biome-|c8\\b|v8\\b|istanbul\\b|@type\\b|@vite|webpack|<reference|<amd|global\\b|noinspection|todo\\b|fixme\\b|hack\\b|xxx\\b)/i;\n\n// Commented-out code and section banners belong to `no-comment-cruft`.\nconst CODEY_RE = /^[\\w.$[\\]'\"]+\\s*[:=]\\s*\\S|^[\\w.$]+\\s*\\(|^(?:return|throw|await|import|export|const|let|var)\\b.*[=()[\\]{}]/;\nconst BANNERISH_RE = /[=\\-─-╿*#~_.]{3,}|^[A-Z0-9 _:-]+$/;\n\nconst MODALITY_RE = /\\b(?:can|could|should|shall|may|might|must|will|would|cannot)\\b/i;\nconst LEAD_IN_RE = /:$/;\nconst EMPHASIS_RE = /\\*\\w[^*]*\\*|`[^`]+`/;\nconst NEGATION_WORD_RE = /\\b(?:no|not|never|neither|nor|without|none|non)\\b/i;\n\nconst ACTION_STMT_RE = /[\\w.$\\])]\\s*\\(|^\\s*(?:return|throw|await|yield)\\b/;\n\nconst NON_ASCII_LETTER_RE = /[^\\p{ASCII}\\p{N}\\p{P}\\p{Z}]/u;\nconst WALL_NARRATION_RE =\n /^(?:(?:\\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;\nconst WALL_CLUSTER_MAX_LINE_GAP = 8;\nconst WALL_CLUSTER_MIN_COMMENTS = 3;\n\n/** True when `a` and `b` are `//` comments on consecutive lines. */\nfunction areAdjacentLineComments(\n a: TSESTree.Comment | undefined,\n b: TSESTree.Comment | undefined,\n): boolean {\n return (\n a !== undefined &&\n b !== undefined &&\n a.type === \"Line\" &&\n b.type === \"Line\" &&\n b.loc.start.line === a.loc.end.line + 1\n );\n}\n\n/**\n * True when the statement below the comment heads a run of siblings of the same\n * kind — `// register secrets` over eight `registerSecret(…)` calls. The label\n * provides the grouping, and deleting it loses that.\n */\nfunction headsSiblingRun(node: TSESTree.Node): boolean {\n const parent = node.parent;\n if (parent === undefined) return false;\n const body: readonly TSESTree.Node[] | undefined =\n \"body\" in parent && Array.isArray(parent.body)\n ? parent.body\n : undefined;\n if (body === undefined) return false;\n const index = body.indexOf(node);\n const next = index >= 0 ? body[index + 1] : undefined;\n return next !== undefined && next.type === node.type;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restated-comment\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a single-line comment whose every word already appears on the statement below it.\",\n },\n schema: [],\n messages: {\n restatesLineBelow:\n \"Comment restates the statement below it — delete it, or replace it with the *why*; the code already carries the *what*.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n const lines = sourceCode.lines;\n\n function isStandalone(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n return !before || before.loc.end.line < comment.loc.start.line;\n }\n\n function labelsASiblingRun(comment: TSESTree.Comment): boolean {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null) return false;\n for (\n let node: TSESTree.Node | undefined | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n if (headsSiblingRun(node)) return true;\n }\n return false;\n }\n\n return {\n Program(): void {\n const comments = sourceCode.getAllComments();\n const wallMembers = new Set<TSESTree.Comment>();\n let cluster: TSESTree.Comment[] = [];\n for (const candidate of comments) {\n const body = candidate.value.replace(/^\\/*/, \"\").trim();\n if (\n candidate.type !== \"Line\" ||\n !isStandalone(candidate) ||\n isProtected(body) ||\n !WALL_NARRATION_RE.test(body)\n ) {\n continue;\n }\n const previous = cluster.at(-1);\n if (\n previous !== undefined &&\n candidate.loc.start.line - previous.loc.start.line > WALL_CLUSTER_MAX_LINE_GAP\n ) {\n if (cluster.length >= WALL_CLUSTER_MIN_COMMENTS) {\n for (const member of cluster) wallMembers.add(member);\n }\n cluster = [];\n }\n cluster.push(candidate);\n }\n if (cluster.length >= WALL_CLUSTER_MIN_COMMENTS) {\n for (const member of cluster) wallMembers.add(member);\n }\n for (let i = 0; i < comments.length; i++) {\n const comment = comments[i];\n if (comment === undefined || comment.type !== \"Line\") continue;\n if (wallMembers.has(comment)) continue;\n if (!isStandalone(comment)) continue;\n if (\n areAdjacentLineComments(comments[i - 1], comment) ||\n areAdjacentLineComments(comment, comments[i + 1])\n ) {\n continue; // one line of a paragraph, not a label for the next statement\n }\n const body = comment.value.replace(/^\\/*/, \"\").trim();\n if (body.length === 0 || body.endsWith(\"?\")) continue;\n if (DIRECTIVE_RE.test(body) || CODEY_RE.test(body) || BANNERISH_RE.test(body)) continue;\n if (NON_ASCII_LETTER_RE.test(body) || isProtected(body)) continue;\n if (MODALITY_RE.test(body) || LEAD_IN_RE.test(body) || EMPHASIS_RE.test(body)) continue;\n if (NEGATION_WORD_RE.test(body)) continue;\n if (body.split(/\\s+/).length > MAX_WORDS) continue;\n\n const tokens = contentTokens(body);\n if (tokens.length < MIN_CONTENT_TOKENS) continue;\n\n const statement = restatableStatementBelow(comment, sourceCode);\n if (statement === null) continue;\n if (restatesStatementHead(body, statement)) continue; // `no-comment-cruft` owns it\n\n const line = lines[comment.loc.start.line] ?? \"\";\n if (!ACTION_STMT_RE.test(line)) continue;\n\n if (labelsASiblingRun(comment)) continue;\n\n if (restates(tokens, codeTokens(line))) {\n context.report({ node: comment, messageId: \"restatesLineBelow\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restated-jsdoc — a JSDoc block whose every word is already in the signature costs three lines and a review and says nothing.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restated-jsdoc.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isProtected, splitIdentifier, stem } from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"restatesSignature\" | \"deleteBlock\";\ntype Options = readonly [];\n\n// Tags this rule models and can therefore judge. Anything else means the block\n// is doing something the rule does not understand, so it is left alone — which\n// includes every value-carrying tag (`@see`, `@example`, `@deprecated`,\n// `@throws`, …). A separate allowlist of those used to sit above this one; it\n// could be emptied with the whole suite green, because being outside this set\n// is already sufficient and the two sets were disjoint.\nconst MODELLED_TAGS: ReadonlySet<string> = new Set([\n \"arg\", \"argument\", \"async\", \"description\", \"param\", \"return\", \"returns\",\n]);\n\nconst PARAM_TAGS: ReadonlySet<string> = new Set([\"arg\", \"argument\", \"param\"]);\nconst RETURN_TAGS: ReadonlySet<string> = new Set([\"return\", \"returns\"]);\n\nconst DIRECTIVE_RE = /^\\s*(?:eslint\\b|eslint-|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|@vite|webpack|@jsx|@jest-environment|@vitest-environment|#__)/i;\n\n// Prose filler that says nothing about *which* thing is being described. Wider\n// than the comment tokenizer's list because JSDoc conventionally repeats the\n// vocabulary of the type system itself (\"the callback prop\", \"an optional\n// string\") without that being a claim about this declaration.\nconst STOPWORDS: ReadonlySet<string> = new Set(\n `the a an of to for in on with and or as at by is are was be been being\n this that it its if whether when where which what will would can could should\n must may into from over about not no does do done has have had used use uses\n using given provided specified current new existing all any each per via based\n function method component hook class instance object value values data item\n items element callback handler prop props param parameter argument arg return\n returns returning result optional required default true false null undefined\n string number boolean array list promise`.split(/\\s+/),\n);\n\nconst WORD_RE = /[A-Za-z]+/g;\n\ninterface JsDocTag {\n readonly name: string;\n readonly text: string;\n}\n\n/** Split a JSDoc block into its free description and its tags. */\nfunction parseJsDoc(value: string): { description: string; tags: JsDocTag[] } {\n const lines = value.replace(/^\\*/, \"\").split(\"\\n\").map((line) => line.replace(/^\\s*\\*?\\s?/, \"\"));\n const description: string[] = [];\n const tags: { name: string; text: string }[] = [];\n let current: { name: string; text: string } | null = null;\n for (const line of lines) {\n const match = /^\\s*@(\\w[\\w-]*)\\s*(.*)$/.exec(line);\n if (match) {\n current = { name: (match[1] ?? \"\").toLowerCase(), text: match[2] ?? \"\" };\n tags.push(current);\n } else if (current !== null) {\n current.text += ` ${line.trim()}`;\n } else {\n description.push(line);\n }\n }\n return { description: description.join(\"\\n\").trim(), tags };\n}\n\n/** Every content word of `text`, lowercased, with filler dropped. */\nfunction proseTokens(text: string): string[] {\n return (text.match(WORD_RE) ?? [])\n .map((word) => word.toLowerCase())\n .filter((word) => word.length > 1 && !STOPWORDS.has(word));\n}\n\n/** True when every content word of `text` already appears in `known`. */\nfunction covered(text: string, known: ReadonlySet<string>): boolean {\n const stems = new Set<string>();\n for (const token of known) stems.add(stem(token));\n return proseTokens(text).every((word) => known.has(word) || stems.has(stem(word)));\n}\n\n/** The declared name and parameter names of the node a JSDoc block sits above. */\nfunction declarationNames(node: TSESTree.Node): { name: string; params: string[] } | null {\n switch (node.type) {\n // `export function f()` — the JSDoc sits above the `export`, so the token\n // after it resolves to the wrapper, not to the thing being documented.\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n return node.declaration == null ? null : declarationNames(node.declaration);\n case AST_NODE_TYPES.FunctionDeclaration:\n case AST_NODE_TYPES.TSDeclareFunction:\n return node.id === null ? null : { name: node.id.name, params: paramNames(node.params) };\n case AST_NODE_TYPES.ClassDeclaration:\n case AST_NODE_TYPES.TSInterfaceDeclaration:\n case AST_NODE_TYPES.TSTypeAliasDeclaration:\n case AST_NODE_TYPES.TSEnumDeclaration:\n return node.id === null ? null : { name: node.id.name, params: [] };\n case AST_NODE_TYPES.VariableDeclaration: {\n const declarator = node.declarations[0];\n if (declarator === undefined || declarator.id.type !== AST_NODE_TYPES.Identifier) return null;\n const init = declarator.init;\n const params =\n init != null &&\n (init.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n init.type === AST_NODE_TYPES.FunctionExpression)\n ? paramNames(init.params)\n : [];\n return { name: declarator.id.name, params };\n }\n case AST_NODE_TYPES.MethodDefinition:\n case AST_NODE_TYPES.PropertyDefinition:\n case AST_NODE_TYPES.TSMethodSignature:\n case AST_NODE_TYPES.TSPropertySignature: {\n if (node.key.type !== AST_NODE_TYPES.Identifier) return null;\n const params =\n node.type === AST_NODE_TYPES.MethodDefinition\n ? paramNames(node.value.params)\n : node.type === AST_NODE_TYPES.TSMethodSignature\n ? paramNames(node.params)\n : [];\n return { name: node.key.name, params };\n }\n default:\n return null;\n }\n}\n\nfunction paramNames(params: readonly TSESTree.Parameter[]): string[] {\n const names: string[] = [];\n for (const param of params) {\n const target = param.type === AST_NODE_TYPES.AssignmentPattern ? param.left : param;\n if (target.type === AST_NODE_TYPES.Identifier) names.push(target.name);\n else if (target.type === AST_NODE_TYPES.TSParameterProperty) continue;\n }\n return names;\n}\n\nfunction tokensOf(names: readonly string[]): Set<string> {\n const tokens = new Set<string>();\n for (const name of names) for (const part of splitIdentifier(name)) tokens.add(part);\n return tokens;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restated-jsdoc\",\n meta: {\n type: \"suggestion\",\n hasSuggestions: true,\n docs: {\n description:\n \"Flag a JSDoc block whose description and tags only re-spell the signature they document.\",\n },\n schema: [],\n messages: {\n restatesSignature:\n \"JSDoc only re-spells the signature — delete it, or say what the caller cannot read off the name (what it throws, what it assumes, why it exists).\",\n deleteBlock: \"Delete the JSDoc block.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n if (comment.type !== \"Block\" || !comment.value.startsWith(\"*\")) continue;\n const { description, tags } = parseJsDoc(comment.value);\n if (DIRECTIVE_RE.test(description)) continue;\n const tagNames = new Set(tags.map((tag) => tag.name));\n if ([...tagNames].some((name) => !MODELLED_TAGS.has(name))) continue;\n if (isProtected(description)) continue;\n\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) continue;\n let node = sourceCode.getNodeByRangeIndex(token.range[0]);\n let declaration: { name: string; params: string[] } | null = null;\n while (node != null && node.type !== AST_NODE_TYPES.Program) {\n declaration = declarationNames(node);\n if (declaration !== null) break;\n node = node.parent ?? null;\n }\n if (declaration === null) continue;\n\n const paramTags = tags.filter((tag) => PARAM_TAGS.has(tag.name));\n const returnTags = tags.filter((tag) => RETURN_TAGS.has(tag.name));\n if (description.length === 0 && paramTags.length === 0 && returnTags.length === 0) {\n continue;\n }\n\n const nameTokens = tokensOf([declaration.name]);\n const paramTokens = tokensOf(declaration.params);\n const known = new Set([...nameTokens, ...paramTokens]);\n\n let addsNothing = covered(description, known);\n for (const tag of paramTags) {\n const text = tag.text.replace(/^\\{[^}]*\\}\\s*/, \"\");\n const match = /^\\[?([A-Za-z_$][\\w.$]*)\\]?\\s*-?\\s*([\\s\\S]*)$/.exec(text);\n if (match === null) {\n addsNothing = false;\n break;\n }\n const own = new Set([...splitIdentifier(match[1]?.split(\".\").pop() ?? \"\"), ...nameTokens]);\n if (!covered(match[2] ?? \"\", own)) {\n addsNothing = false;\n break;\n }\n for (const part of splitIdentifier(match[1]?.split(\".\").pop() ?? \"\")) known.add(part);\n }\n if (addsNothing) {\n for (const tag of returnTags) {\n if (!covered(tag.text.replace(/^\\{[^}]*\\}\\s*/, \"\"), known)) {\n addsNothing = false;\n break;\n }\n }\n }\n if (!addsNothing) continue;\n\n context.report({\n node: comment,\n messageId: \"restatesSignature\",\n suggest: [\n {\n messageId: \"deleteBlock\",\n fix: (fixer) => fixer.removeRange([comment.range[0], token.range[0]]),\n },\n ],\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-secret-in-log — a secret passed to a logging call persists in log sinks far beyond its intended lifetime.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-secret-in-log.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport {\n FLAG_PREFIXES,\n INNOCUOUS_WORDS,\n isSecretName,\n leadingWord,\n tokenize,\n} from \"./_secret-names.js\";\n\ntype MessageIds = \"noSecretInLog\" | \"noRawBodyInLog\";\ntype Options = readonly [LoggingOptions?];\n\n/**\n * The shared metadata set plus the log-specific extras. Logging a secret's\n * label, expiry, ARN, URL, scope, or the DI component that holds it is metadata\n * ABOUT the credential, never the credential bytes, so it must not fire here —\n * `prefer-constant-time-secret-compare` uses the narrower shared set.\n */\nconst LOG_INNOCUOUS_WORDS: ReadonlySet<string> = new Set([\n ...INNOCUOUS_WORDS,\n \"name\",\n \"names\",\n \"label\",\n \"labels\",\n \"title\",\n \"expiry\",\n \"expiration\",\n \"expires\",\n \"ttl\",\n \"version\",\n \"versions\",\n \"policy\",\n \"rotation\",\n \"arn\",\n \"path\",\n \"paths\",\n \"issuer\",\n \"audience\",\n \"strength\",\n \"manager\",\n \"service\",\n \"services\",\n \"repository\",\n \"provider\",\n \"providers\",\n \"store\",\n \"factory\",\n \"handler\",\n \"controller\",\n \"bucket\",\n \"url\",\n \"uri\",\n \"endpoint\",\n \"endpoints\",\n \"scope\",\n \"scopes\",\n \"event\",\n \"events\",\n \"format\",\n \"at\",\n \"len\",\n \"length\",\n]);\n\nconst REDACTION_RE = /prefix|suffix|redact|mask|hash|hint|_len|length/i;\nconst WHOLE_TOKEN_REDACTION_MARKERS: ReadonlySet<string> = new Set([\"tag\"]);\n\n/** True if the name names a raw secret and is not a redacted derivative. */\nfunction isSecretKeyword(name: string): boolean {\n if (REDACTION_RE.test(name)) {\n return false;\n }\n if (tokenize(name).some((tok) => WHOLE_TOKEN_REDACTION_MARKERS.has(tok))) {\n return false;\n }\n return isSecretName(name, LOG_INNOCUOUS_WORDS);\n}\n\n/**\n * True if `prop`'s value is the raw secret rather than a redacted/derived form.\n * Shorthand (`{ token }`), a bare identifier (`{ apiKey: theKey }`), or a plain\n * member access (`{ apiKey: config.apiKey }`) all carry the secret verbatim. A\n * call (`token.slice(0, 6)`, `mask(token)`), template literal, ternary, concat,\n * or literal placeholder (`\"***\"`) is already redacted — logging it is safe.\n */\nfunction isRawSecretValue(prop: TSESTree.Property): boolean {\n if (prop.shorthand) {\n return true;\n }\n return prop.value.type === \"Identifier\" || prop.value.type === \"MemberExpression\";\n}\n\n/**\n * Trailing camel/snake words that name an un-redacted request/response blob. Kept\n * to an enumerated five: these are the containers whose *whole point* is \"the\n * bytes the client sent / the server returned\". Generic container words (`data`,\n * `input`, `args`, `event`, `result`, `payloadless` domain objects) are excluded\n * on purpose — see the `@fileoverview`.\n */\nconst RAW_BLOB_WORDS: ReadonlySet<string> = new Set([\n \"body\",\n \"bodies\",\n \"payload\",\n \"payloads\",\n \"params\",\n]);\n\n/**\n * Whole identifiers whose camelCase split ends in a word too generic to enumerate\n * (`formData` -> `data`) but which name a blob unambiguously on their own.\n */\nconst RAW_BLOB_IDENTIFIERS: ReadonlySet<string> = new Set([\"formdata\"]);\n\n/**\n * Substrings that mark a blob name as an already-derived, safe-to-log form:\n * `redactedBody`, `sanitizedPayload`, `truncatedBody`, `bodyPreview`.\n */\nconst BLOB_REDACTION_RE = /redact|sanit|scrub|mask|truncat|anonym|filtered|preview|summar/i;\n\n/**\n * Derivation markers that are only safe when matched as a WHOLE token — `safe` as\n * a substring would wrongly exempt `unsafeBody`.\n */\nconst BLOB_REDACTION_TOKENS: ReadonlySet<string> = new Set([\n \"safe\",\n \"clean\",\n \"shape\",\n \"keys\",\n \"public\",\n]);\n\n/** True if the name names a raw request/response blob and is not a derived form. */\nfunction isRawBlobName(name: string): boolean {\n if (REDACTION_RE.test(name) || BLOB_REDACTION_RE.test(name)) {\n return false;\n }\n const tokens = tokenize(name);\n if (tokens.some((tok) => BLOB_REDACTION_TOKENS.has(tok))) {\n return false;\n }\n // Same leading boolean-predicate words the secret arm uses: `hasBody` answers\n // \"is there one?\", it is not the blob.\n const first = leadingWord(name);\n if (first !== undefined && FLAG_PREFIXES.has(first)) {\n return false;\n }\n if (RAW_BLOB_IDENTIFIERS.has(name.toLowerCase())) {\n return true;\n }\n const last = tokens.at(-1);\n return last !== undefined && RAW_BLOB_WORDS.has(last);\n}\n\n/**\n * The blob name a logged value carries VERBATIM, or null when it does not carry\n * one. A bare identifier is the whole object; a non-computed member access is\n * judged by its PROPERTY, so `res.body` is the blob but `body.id` is a picked\n * field. Every other shape — call, template, literal, ternary, spread — has\n * already been through the author's hands and is left alone.\n */\nfunction rawBlobValueName(value: TSESTree.Node): string | null {\n if (value.type === \"Identifier\") {\n return isRawBlobName(value.name) ? value.name : null;\n }\n if (\n value.type === \"MemberExpression\" &&\n !value.computed &&\n value.property.type === \"Identifier\"\n ) {\n return isRawBlobName(value.property.name) ? value.property.name : null;\n }\n return null;\n}\n\n/** The static string name of an object-property key, or null when not statically named. */\nfunction propertyKeyName(prop: TSESTree.Property): string | null {\n if (prop.computed) {\n return null;\n }\n if (prop.key.type === \"Identifier\") {\n return prop.key.name;\n }\n if (prop.key.type === \"Literal\" && typeof prop.key.value === \"string\") {\n return prop.key.value;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-secret-in-log\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow passing a secret-named value or a raw request/response blob to a logging call; both leak to log sinks. Redact or omit.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noSecretInLog:\n \"Secret `{{name}}` passed to a logging call leaks it to log sinks. Redact (e.g. `{{name}}Prefix: {{name}}.slice(0, 6)`) or omit it.\",\n noRawBodyInLog:\n \"Raw `{{name}}` passed to a logging call. Request/response blobs carry PII and often echo credentials back, and log sinks have no retention policy. Log a derived value instead (a status, `{{name}}.id`, a length, a truncated issue list) or pass it through a redactor (`redact({{name}})`).\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n const matcher = createLogMatcher(loggingOptions);\n // Bodies in a test file are fixtures the author wrote, not production PII.\n const blobArmApplies = !isTestFile(context.filename);\n\n /** Reports a bare positional argument that IS the secret. Did it fire? */\n function reportSecretArgument(arg: TSESTree.Node): boolean {\n const name =\n arg.type === \"Identifier\"\n ? arg.name\n : arg.type === \"MemberExpression\" &&\n !arg.computed &&\n arg.property.type === \"Identifier\"\n ? arg.property.name\n : null;\n if (name === null || !isSecretKeyword(name)) {\n return false;\n }\n context.report({ node: arg, messageId: \"noSecretInLog\", data: { name } });\n return true;\n }\n\n /** Reports a meta-object property whose key names a secret it carries raw. Did it fire? */\n function reportSecretProperty(prop: TSESTree.Property): boolean {\n const keyName = propertyKeyName(prop);\n if (keyName === null || !isSecretKeyword(keyName) || !isRawSecretValue(prop)) {\n return false;\n }\n context.report({ node: prop, messageId: \"noSecretInLog\", data: { name: keyName } });\n return true;\n }\n\n /** Reports `node` when `value` carries an un-redacted request/response blob. */\n function reportRawBlob(node: TSESTree.Node, value: TSESTree.Node): void {\n if (!blobArmApplies) {\n return;\n }\n const name = rawBlobValueName(value);\n if (name !== null) {\n context.report({ node, messageId: \"noRawBodyInLog\", data: { name } });\n }\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!matcher.isLoggingCall(node)) {\n return;\n }\n\n for (const arg of node.arguments) {\n if (arg.type === \"ObjectExpression\") {\n for (const prop of arg.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n if (!reportSecretProperty(prop)) {\n reportRawBlob(prop, prop.value);\n }\n }\n continue;\n }\n if (!reportSecretArgument(arg)) {\n reportRawBlob(arg, arg);\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _secret-names — shared predicate for whether an identifier names secret material, rather than merely embedding a secret word.\n *\n */\n\nexport const SECRET_WORDS: ReadonlySet<string> = new Set([\n \"token\",\n \"secret\",\n \"password\",\n \"passwd\",\n \"jwt\",\n \"secrets\",\n \"passwords\",\n \"credential\",\n \"credentials\",\n \"authorization\",\n \"signature\",\n \"hmac\",\n \"digest\",\n \"hash\",\n \"apikey\",\n \"bearer\",\n]);\n\n/** A trailing word in this set makes the identifier metadata, not a credential. */\nexport const INNOCUOUS_WORDS: ReadonlySet<string> = new Set([\n \"count\",\n \"counts\",\n \"budget\",\n \"limit\",\n \"limits\",\n \"id\",\n \"ids\",\n \"enabled\",\n \"disabled\",\n \"flag\",\n \"flags\",\n \"present\",\n \"set\",\n \"unset\",\n \"configured\",\n \"missing\",\n \"required\",\n \"valid\",\n \"invalid\",\n \"exists\",\n \"type\",\n \"types\",\n]);\n\n/** Descriptors excluded from timing checks but retained for logging checks. */\nconst DESCRIPTOR_WORDS: ReadonlySet<string> = new Set([\n \"type\",\n \"types\",\n \"name\",\n \"names\",\n \"id\",\n \"ids\",\n \"kind\",\n \"kinds\",\n]);\n\n/** Category words identify credential discriminators rather than secret bytes. */\nconst CATEGORY_WORDS: ReadonlySet<string> = new Set([\"type\", \"types\", \"kind\", \"kinds\"]);\n\n\n/** A leading predicate makes the identifier a boolean flag, not a credential. */\nexport const FLAG_PREFIXES: ReadonlySet<string> = new Set([\n \"is\",\n \"has\",\n \"was\",\n \"are\",\n \"can\",\n \"should\",\n]);\n\n/** Auth words distinguish access-gating hashes from integrity-only hashes. */\nconst AUTH_WORDS: ReadonlySet<string> = new Set([\n \"token\",\n \"secret\",\n \"secrets\",\n \"password\",\n \"passwd\",\n \"passwords\",\n \"jwt\",\n \"credential\",\n \"credentials\",\n \"authorization\",\n \"signature\",\n \"hmac\",\n \"apikey\",\n \"bearer\",\n]);\n\n/**\n * camelCase / PascalCase / ALLCAPS / digit-run splitter, applied to each\n * snake/kebab segment. `APIKey` -> [\"API\", \"Key\"], `authToken` -> [\"auth\", \"Token\"].\n */\nconst CAMEL_RE = /[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|\\d+/g;\nconst SEGMENT_RE = /[^A-Za-z0-9]+/;\n\n/** Return lowercase whole segments and their camel-case words. */\nexport function tokenize(identifier: string): string[] {\n const tokens: string[] = [];\n for (const segment of identifier.split(SEGMENT_RE)) {\n if (!segment) {\n continue;\n }\n tokens.push(segment.toLowerCase());\n for (const part of segment.match(CAMEL_RE) ?? []) {\n tokens.push(part.toLowerCase());\n }\n }\n return tokens;\n}\n\n/** The first *word* of an identifier, from camelCase splitting. */\nexport function leadingWord(identifier: string): string | undefined {\n for (const segment of identifier.split(SEGMENT_RE)) {\n if (segment) {\n return (segment.match(CAMEL_RE) ?? [segment])[0]?.toLowerCase();\n }\n }\n return undefined;\n}\n\n/** True if an `api` token is immediately followed by a `key` token (`api_key`). */\nexport function hasApiKey(tokens: readonly string[]): boolean {\n for (let i = 0; i + 1 < tokens.length; i++) {\n if (tokens[i] === \"api\" && tokens[i + 1] === \"key\") {\n return true;\n }\n }\n return false;\n}\n\n/** True when an identifier names raw secret material rather than metadata. */\nexport function isSecretName(\n identifier: string,\n innocuous: ReadonlySet<string> = INNOCUOUS_WORDS,\n): boolean {\n const tokens = tokenize(identifier);\n const last = tokens.at(-1);\n if (last !== undefined && innocuous.has(last)) {\n return false;\n }\n const first = leadingWord(identifier);\n if (first !== undefined && FLAG_PREFIXES.has(first)) {\n return false;\n }\n if (tokens.some((tok) => SECRET_WORDS.has(tok))) {\n return true;\n }\n return hasApiKey(tokens);\n}\n\n/** True when an identifier names an access-gating secret. */\nexport function isAuthSecretName(identifier: string): boolean {\n if (!isSecretName(identifier)) {\n return false;\n }\n const tokens = tokenize(identifier);\n const last = tokens.at(-1);\n if (last !== undefined && DESCRIPTOR_WORDS.has(last)) {\n return false;\n }\n if (tokens.some((tok) => CATEGORY_WORDS.has(tok))) {\n return false;\n }\n if (tokens.some((tok) => AUTH_WORDS.has(tok))) {\n return true;\n }\n return hasApiKey(tokens);\n}\n","/**\n * @fileoverview no-select-star — `SELECT *` over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-select-star.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"noSelectStar\";\ntype Options = readonly [];\n\n/** A real SQL query shape, so prose containing the bare word \"from\" isn't matched. */\nconst QUERY_SHAPE = /\\bSELECT\\b[\\s\\S]*?\\bFROM\\b/i;\nconst SELECT_KEYWORD = /\\bSELECT\\b/gi;\nconst FROM_KEYWORD = /^FROM\\b/i;\nconst EXISTS_BEFORE = /\\bEXISTS\\s*\\(\\s*$/i;\n/** A `word.` immediately preceding a `*` marks a qualified star (`c.*`, `main.runs.*`). */\nconst QUALIFIED_PREFIX = /\\w\\.$/;\n\nconst SELECT_GATE = /select/i;\n\n/**\n * True when the `*` at `pos` is a column-projection star.\n *\n * A projection star expands columns: bare (`SELECT *`, `id, *`) or qualified\n * (`c.*`). It is NOT a `COUNT(*)` argument (parenthesised on both sides) nor an\n * `a * b` multiply (an operand follows rather than a terminator).\n */\nfunction isProjectionStar(sql: string, pos: number): boolean {\n if (QUALIFIED_PREFIX.test(sql.slice(0, pos))) {\n return true;\n }\n let before = pos - 1;\n while (before >= 0 && /\\s/.test(sql[before] ?? \"\")) {\n before -= 1;\n }\n let after = pos + 1;\n while (after < sql.length && /\\s/.test(sql[after] ?? \"\")) {\n after += 1;\n }\n const beforeChar = before >= 0 ? (sql[before] ?? \"\") : \"\";\n const afterChar = after < sql.length ? (sql[after] ?? \"\") : \"\";\n const terminates =\n afterChar === \"\" || afterChar === \",\" || afterChar === \")\" || FROM_KEYWORD.test(sql.slice(after));\n if (!terminates) {\n return false;\n }\n return !(beforeChar === \"(\" && afterChar === \")\");\n}\n\n/** True when the query projects a star that is not inside an `EXISTS (...)` subquery. */\nfunction hasRealSelectStar(sql: string): boolean {\n const selects = [...sql.matchAll(SELECT_KEYWORD)].map((m) => m.index);\n for (let pos = 0; pos < sql.length; pos++) {\n if (sql[pos] !== \"*\" || !isProjectionStar(sql, pos)) {\n continue;\n }\n const owning = selects.filter((start) => start < pos).at(-1);\n if (owning !== undefined && !EXISTS_BEFORE.test(sql.slice(0, owning))) {\n return true;\n }\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-select-star\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow SELECT * in embedded SQL; it over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently.\",\n },\n schema: [],\n messages: {\n noSelectStar:\n \"`SELECT *` over-fetches and leaves the row shape implicit — a new or reordered column silently changes what this query returns. List the columns explicitly.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !SELECT_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!QUERY_SHAPE.test(sql) || !hasRealSelectStar(sql)) {\n return;\n }\n context.report({ node, messageId: \"noSelectStar\" });\n });\n },\n});\n","/**\n * @fileoverview no-sentinel-return-on-catch — a `catch` returning `null` / `[]` / `{}` discards the error, so callers cannot tell empty from failed.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-sentinel-return-on-catch.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n calleeName,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n REPORT_NAME_RE,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noSentinelReturn\";\ntype Options = readonly [LoggingOptions?];\n\ntype SentinelKind = \"nullish\" | \"boolean\" | \"array\" | \"object\" | \"string\";\n\n/** The sentinel \"kind\" of a returned expression, or null if not a sentinel. */\nfunction sentinelKind(arg: TSESTree.Expression | null): SentinelKind | null {\n if (arg === null) {\n return null;\n }\n if (arg.type === AST_NODE_TYPES.Literal) {\n if (arg.value === null) {\n return \"nullish\";\n }\n if (typeof arg.value === \"boolean\") {\n return \"boolean\";\n }\n if (typeof arg.value === \"string\") {\n return \"string\";\n }\n return null;\n }\n if (arg.type === AST_NODE_TYPES.Identifier && arg.name === \"undefined\") {\n return \"nullish\";\n }\n if (arg.type === AST_NODE_TYPES.ArrayExpression) {\n return \"array\";\n }\n if (arg.type === AST_NODE_TYPES.ObjectExpression) {\n return \"object\";\n }\n return null;\n}\n\n/** Whether a returned expression is one of the swallowing sentinels we flag. */\nfunction isSentinelArgument(arg: TSESTree.Expression | null): boolean {\n if (arg === null) {\n return false;\n }\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === null) {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === false) {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.Identifier && arg.name === \"undefined\") {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.ArrayExpression && arg.elements.length === 0) {\n return true;\n }\n if (\n arg.type === AST_NODE_TYPES.ObjectExpression &&\n arg.properties.length === 0\n ) {\n return true;\n }\n return false;\n}\n\nfunction isFunctionNode(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.FunctionDeclaration ||\n node.type === AST_NODE_TYPES.FunctionExpression ||\n node.type === AST_NODE_TYPES.ArrowFunctionExpression\n );\n}\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/** Walk a subtree without entering nested functions, stopping on a match. */\nfunction walkWithinScope(\n node: TSESTree.Node,\n visit: (current: TSESTree.Node) => boolean,\n): boolean {\n let found = false;\n\n const recurse = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (visit(current)) {\n found = true;\n return;\n }\n if (isFunctionNode(current)) {\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n recurse(child);\n }\n }\n } else if (isNode(value)) {\n recurse(value);\n }\n }\n };\n\n recurse(node);\n return found;\n}\n\n/** Does this subtree throw (ignoring nested function scopes)? */\nfunction containsThrow(node: TSESTree.Node): boolean {\n return walkWithinScope(\n node,\n (current) => current.type === AST_NODE_TYPES.ThrowStatement,\n );\n}\n\n/** True when a parameter pattern binds `name` (plain, default, rest, or destructured). */\nfunction bindsName(param: TSESTree.Node, name: string): boolean {\n switch (param.type) {\n case AST_NODE_TYPES.Identifier:\n return param.name === name;\n case AST_NODE_TYPES.AssignmentPattern:\n return bindsName(param.left, name);\n case AST_NODE_TYPES.RestElement:\n return bindsName(param.argument, name);\n case AST_NODE_TYPES.ArrayPattern:\n return param.elements.some(\n (element) => element !== null && bindsName(element, name),\n );\n case AST_NODE_TYPES.ObjectPattern:\n return param.properties.some((property) =>\n property.type === AST_NODE_TYPES.RestElement\n ? bindsName(property.argument, name)\n : bindsName(property.value, name),\n );\n default:\n return false;\n }\n}\n\n/** Whether a subtree reads a binding in a value position without shadowing it. */\nfunction subtreeReadsName(node: TSESTree.Node, name: string): boolean {\n let found = false;\n\n /** Whether this function rebinds `name`. */\n const shadowsName = (fn: TSESTree.Node): boolean =>\n isFunctionNode(fn) &&\n (fn as unknown as { params: TSESTree.Parameter[] }).params.some((param) =>\n bindsName(param, name),\n );\n\n const recurse = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (current.type === AST_NODE_TYPES.Identifier && current.name === name) {\n found = true;\n return;\n }\n if (shadowsName(current)) {\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n // `{ error: 1 }` — the key names a field; it does not read the binding.\n if (\n key === \"key\" &&\n current.type === AST_NODE_TYPES.Property &&\n !current.computed\n ) {\n continue;\n }\n // `response.err` — the property names a field on some other object.\n if (\n key === \"property\" &&\n current.type === AST_NODE_TYPES.MemberExpression &&\n !current.computed\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n recurse(child);\n }\n }\n } else if (isNode(value)) {\n recurse(value);\n }\n }\n };\n\n recurse(node);\n return found;\n}\n\n/** Whether any call argument reads the caught-error binding. */\nfunction argsIncludeBinding(\n args: readonly TSESTree.CallExpressionArgument[],\n caughtName: string | null,\n): boolean {\n if (caughtName === null) {\n return false;\n }\n return args.some((arg) => subtreeReadsName(arg, caughtName));\n}\n\n/** The try block guarded by this catch. */\nfunction tryBlockOf(catchNode: TSESTree.CatchClause): TSESTree.BlockStatement {\n return catchNode.parent.block;\n}\n\n/** Constructors that throw on malformed input. */\nconst SAFE_PARSE_CONSTRUCTORS: ReadonlySet<string> = new Set([\n \"RegExp\",\n \"URL\",\n \"URLPattern\",\n]);\n\n/** Whether a node is a parse-style call or constructor that throws on bad input. */\nfunction isParseShapedNode(node: TSESTree.Node): boolean {\n if (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return node.callee.property.name === \"parse\";\n }\n if (\n node.type === AST_NODE_TYPES.NewExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier\n ) {\n return SAFE_PARSE_CONSTRUCTORS.has(node.callee.name);\n }\n return false;\n}\n\n/** Body-decoding methods of a `Request` / `Response` — they throw on bad input. */\nconst BODY_DECODE_METHODS: ReadonlySet<string> = new Set([\n \"json\",\n \"text\",\n \"arrayBuffer\",\n]);\n\nfunction isBodyDecodeNode(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n BODY_DECODE_METHODS.has(node.callee.property.name)\n );\n}\n\n/** Whether a return value contains a match outside nested function scopes. */\nfunction returnsMatching(\n stmt: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n): boolean {\n return (\n stmt.type === AST_NODE_TYPES.ReturnStatement &&\n stmt.argument !== null &&\n walkWithinScope(stmt.argument, predicate)\n );\n}\n\n/** The declared return type annotation of the nearest enclosing function, or null. */\nfunction enclosingReturnTypeNode(\n node: TSESTree.Node,\n): TSESTree.TypeNode | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (isFunctionNode(current) && \"returnType\" in current) {\n return current.returnType?.typeAnnotation ?? null;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Names that conventionally declare a boolean-returning function. */\nconst PREDICATE_NAME_RE = /^(is|has|can|should|must|does|did|was|were|are)[A-Z]/;\nconst PREDICATE_SUFFIX_RE = /(Exists?|Available|Enabled|Disabled)$/;\n\n/** The name of the nearest enclosing function, or null for an anonymous one. */\nfunction enclosingFunctionName(node: TSESTree.Node): string | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (isFunctionNode(current)) {\n if (\n \"id\" in current &&\n isNode(current.id) &&\n current.id.type === AST_NODE_TYPES.Identifier\n ) {\n return current.id.name;\n }\n const parent = current.parent;\n if (\n parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.id.name;\n }\n return null;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Whether an enclosing predicate-named function returns `false` from its catch. */\nfunction isNamedBooleanPredicate(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n if (kind !== \"boolean\") {\n return false;\n }\n const name = enclosingFunctionName(catchNode);\n return (\n name !== null &&\n (PREDICATE_NAME_RE.test(name) || PREDICATE_SUFFIX_RE.test(name))\n );\n}\n\n/** Whether a boolean-returning function returns `false` from its catch. */\nfunction isDeclaredBooleanPredicate(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n if (kind !== \"boolean\") {\n return false;\n }\n let declared = enclosingReturnTypeNode(catchNode);\n if (\n declared?.type === AST_NODE_TYPES.TSTypeReference &&\n declared.typeName.type === AST_NODE_TYPES.Identifier &&\n declared.typeName.name === \"Promise\"\n ) {\n declared = declared.typeArguments?.params[0] ?? null;\n }\n return declared?.type === AST_NODE_TYPES.TSBooleanKeyword;\n}\n\n/** Does the try body return a safe-parse-style expression? */\nfunction tryReturnsSafeParse(catchNode: TSESTree.CatchClause): boolean {\n const tryBlock = tryBlockOf(catchNode);\n if (\n walkWithinScope(tryBlock, (current) =>\n returnsMatching(current, isParseShapedNode),\n )\n ) {\n return true;\n }\n const only = tryBlock.body.length === 1 ? tryBlock.body[0] : undefined;\n return only !== undefined && returnsMatching(only, isBodyDecodeNode);\n}\n\n/** The nearest enclosing function body, or null. */\nfunction enclosingFunctionBody(\n node: TSESTree.Node,\n): TSESTree.BlockStatement | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (\n isFunctionNode(current) &&\n \"body\" in current &&\n isNode(current.body) &&\n current.body.type === AST_NODE_TYPES.BlockStatement\n ) {\n return current.body;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Whether a normal path returns the same sentinel kind as the catch. */\nfunction functionReturnsSameSentinelKindElsewhere(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n const functionBody = enclosingFunctionBody(catchNode);\n if (functionBody === null) {\n return false;\n }\n return walkWithinScope(functionBody, (current) => {\n if (current.type !== AST_NODE_TYPES.ReturnStatement) {\n return false;\n }\n if (isWithin(current, catchNode.body)) {\n return false;\n }\n return returnedSentinelKinds(current.argument).has(kind);\n });\n}\n\n/** Sentinel kinds reachable through a direct, ternary, or fallback return. */\nfunction returnedSentinelKinds(\n arg: TSESTree.Expression | null,\n): ReadonlySet<SentinelKind> {\n const kinds = new Set<SentinelKind>();\n if (arg === null) {\n return kinds;\n }\n const direct = sentinelKind(arg);\n if (direct !== null) {\n kinds.add(direct);\n return kinds;\n }\n if (arg.type === AST_NODE_TYPES.ConditionalExpression) {\n for (const branch of [arg.consequent, arg.alternate]) {\n for (const nested of returnedSentinelKinds(branch)) {\n kinds.add(nested);\n }\n }\n } else if (\n arg.type === AST_NODE_TYPES.LogicalExpression &&\n (arg.operator === \"??\" || arg.operator === \"||\")\n ) {\n for (const nested of returnedSentinelKinds(arg.right)) {\n kinds.add(nested);\n }\n }\n return kinds;\n}\n\n/** Is `node` inside `ancestor`'s subtree? */\nfunction isWithin(node: TSESTree.Node, ancestor: TSESTree.Node): boolean {\n let current: TSESTree.Node | undefined | null = node;\n while (current !== undefined && current !== null) {\n if (current === ancestor) {\n return true;\n }\n current = current.parent;\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-sentinel-return-on-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow swallowing a caught error by returning an empty sentinel (`null`, `undefined`, `false`, `[]`, `{}`) as the final statement of a `catch` block, unless the error is logged/reported or the sentinel is the declared safe-parse/predicate contract.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noSentinelReturn:\n \"This `catch` block swallows the error by returning an empty sentinel without logging it. Rethrow it, log/report it, or return a typed Result.\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const matcher = createLogMatcher(loggingOptions);\n\n /** Whether the catch logs or reports its caught error. */\n function logsOrReportsError(\n catchBody: TSESTree.BlockStatement,\n caughtName: string | null,\n ): boolean {\n return walkWithinScope(catchBody, (current) => {\n if (current.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n if (matcher.isLoggingCall(current)) {\n return true;\n }\n const name = calleeName(current.callee);\n return (\n name !== null &&\n REPORT_NAME_RE.test(name) &&\n argsIncludeBinding(current.arguments, caughtName)\n );\n });\n }\n\n return {\n CatchClause(node: TSESTree.CatchClause): void {\n const body = node.body.body;\n if (body.length === 0) {\n return;\n }\n\n const last = body[body.length - 1];\n if (last === undefined || last.type !== AST_NODE_TYPES.ReturnStatement) {\n return;\n }\n\n if (!isSentinelArgument(last.argument)) {\n return;\n }\n\n if (containsThrow(node.body)) {\n return;\n }\n\n const caughtName =\n node.param?.type === AST_NODE_TYPES.Identifier\n ? node.param.name\n : null;\n\n if (logsOrReportsError(node.body, caughtName)) {\n return;\n }\n\n if (tryReturnsSafeParse(node)) {\n return;\n }\n\n const kind = sentinelKind(last.argument);\n if (kind !== null && isNamedBooleanPredicate(node, kind)) {\n return;\n }\n\n if (kind !== null && isDeclaredBooleanPredicate(node, kind)) {\n return;\n }\n\n if (\n kind !== null &&\n functionReturnsSameSentinelKindElsewhere(node, kind)\n ) {\n return;\n }\n\n context.report({\n node: last,\n messageId: \"noSentinelReturn\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-silent-promise-catch — `.catch(() => null)` deletes the rejection: no log, no metric, no rethrow, and a sentinel to the caller.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-silent-promise-catch.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"silentCatch\";\ntype Options = readonly [];\n\n/** True for `x.json()` / `x.text()` — the receiver of a body-parse-fallback catch. */\nfunction isBodyParseCall(node: TSESTree.Expression): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.arguments.length === 0 &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n (node.callee.property.name === \"json\" ||\n node.callee.property.name === \"text\")\n );\n}\n\n/**\n * Teardown methods that reject when the resource is already gone — which is the\n * state the caller was asking for. The rejection carries no signal, so silencing\n * it is correct, the same reasoning as the `res.json()` fallback above.\n */\nconst TEARDOWN_METHODS: ReadonlySet<string> = new Set([\n \"cancel\",\n \"close\",\n \"abort\",\n \"destroy\",\n \"dispose\",\n \"release\",\n \"unlock\",\n \"disconnect\",\n]);\n\n/**\n * Tooling directives are machinery, not an explanation of the swallow. An\n * `eslint-disable` already suppresses the report through the normal channel, so\n * counting it as documentation would turn every directive into an unused one.\n */\nconst DIRECTIVE_COMMENT_RE =\n /^\\s*(eslint-|@ts-|prettier-ignore|biome-ignore|c8 |v8 |istanbul )/;\n\nconst isExplanatory = (comment: { value: string }): boolean =>\n !DIRECTIVE_COMMENT_RE.test(comment.value);\n\n/** True for `reader.cancel(reason)` / `stream.close()` — a teardown receiver. */\nfunction isTeardownCall(node: TSESTree.Expression): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n TEARDOWN_METHODS.has(node.callee.property.name)\n );\n}\n\n/** True for expressions that provably discard the error: bare literals,\n * `undefined`, empty object/array literals. */\nfunction isSilentExpression(node: TSESTree.Expression): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n // null / number / string / boolean literals (regex literals excluded —\n // nobody writes `.catch(() => /x/)` and they are not sentinel values).\n return !(\"regex\" in node);\n case AST_NODE_TYPES.Identifier:\n return node.name === \"undefined\";\n case AST_NODE_TYPES.UnaryExpression:\n // `void 0` — the other spelling of undefined.\n return (\n node.operator === \"void\" &&\n node.argument.type === AST_NODE_TYPES.Literal\n );\n case AST_NODE_TYPES.ObjectExpression:\n return node.properties.length === 0;\n case AST_NODE_TYPES.ArrayExpression:\n return node.elements.length === 0;\n case AST_NODE_TYPES.TSAsExpression:\n // `.catch(() => null as Foo | null)` is still silent.\n return isSilentExpression(node.expression);\n default:\n return false;\n }\n}\n\n/** True when the handler's whole body provably does nothing with the error. */\nfunction isSilentHandler(\n handler: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n): boolean {\n const body = handler.body;\n\n if (body.type !== AST_NODE_TYPES.BlockStatement) {\n // Arrow expression body: `.catch(() => null)`\n return isSilentExpression(body);\n }\n\n if (body.body.length === 0) {\n // `.catch(() => {})` / `.catch(function () {})`\n return true;\n }\n\n if (body.body.length === 1) {\n const only = body.body[0];\n if (only !== undefined && only.type === AST_NODE_TYPES.ReturnStatement) {\n // `.catch(() => { return null; })`\n return only.argument === null || isSilentExpression(only.argument);\n }\n }\n\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-silent-promise-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `.catch()` handlers that silently swallow the rejection (e.g. `.catch(() => null)`); log, rethrow, or handle the error.\",\n },\n schema: [],\n messages: {\n silentCatch:\n \"This `.catch()` swallows the rejection without logging, rethrowing, or handling it — failures become invisible and callers get an indistinguishable sentinel. Log the error (and only then map to a fallback), or let it propagate.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n\n /**\n * True when the suppression is DOCUMENTED: a comment inside the handler\n * body, trailing the call on the same line, or on the line(s) directly above\n * the statement the call belongs to. The rule's complaint is that the\n * decision to discard the error is invisible — a comment is precisely what\n * makes it visible, so there is nothing left to report.\n */\n const hasExplanatoryComment = (\n call: TSESTree.CallExpression,\n handler: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n ): boolean => {\n const sourceCode = context.sourceCode;\n if (sourceCode.getCommentsInside(handler).some(isExplanatory)) {\n return true;\n }\n // Walk out to the enclosing statement so a comment above or beside\n // `lazyRoutePromise.catch(() => {});` is found rather than one sitting\n // between the receiver and `.catch`.\n let statement: TSESTree.Node = call;\n while (\n statement.parent !== undefined &&\n statement.parent !== null &&\n !statement.type.endsWith(\"Statement\") &&\n statement.type !== AST_NODE_TYPES.VariableDeclaration\n ) {\n statement = statement.parent;\n }\n if (sourceCode.getCommentsBefore(statement).some(isExplanatory)) {\n return true;\n }\n return sourceCode\n .getCommentsAfter(statement)\n .some(\n (c) => isExplanatory(c) && c.loc.start.line === statement.loc.end.line,\n );\n };\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (\n node.callee.type !== AST_NODE_TYPES.MemberExpression ||\n node.callee.computed ||\n node.callee.property.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.name !== \"catch\"\n ) {\n return;\n }\n\n if (isBodyParseCall(node.callee.object)) {\n return;\n }\n\n if (isTeardownCall(node.callee.object)) {\n return;\n }\n\n // `p.catch(() => null).then(...)` — the next link consumes the fallback,\n // so it is a recovery step, not a value handed back to an outside caller.\n if (\n node.parent.type === AST_NODE_TYPES.MemberExpression &&\n node.parent.object === node\n ) {\n return;\n }\n\n if (node.arguments.length !== 1) {\n return;\n }\n const handler = node.arguments[0];\n if (\n handler === undefined ||\n (handler.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n handler.type !== AST_NODE_TYPES.FunctionExpression)\n ) {\n return;\n }\n\n if (hasExplanatoryComment(node, handler)) {\n return;\n }\n\n if (isSilentHandler(handler)) {\n // Anchor on the CallExpression, not the handler: when the handler\n // sits on a later line than the call (multi-line `.catch(`), a\n // handler-anchored report escapes an `eslint-disable-next-line`\n // above the call AND marks that directive as unused.\n context.report({ node, messageId: \"silentCatch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-sleep-in-test-body — a fixed sleep asserts on wall-clock time rather than on the signal, so the test flakes under CI load.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-sleep-in-test-body.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noSleepInTestBody\";\ntype Options = readonly [];\n\n/** Free-function sleep helpers. A `sleep(50)` reads as a sleep whatever its module. */\nconst SLEEP_HELPERS: ReadonlySet<string> = new Set([\"sleep\", \"delay\", \"wait\", \"pause\"]);\n\n/** Test-case and per-test-hook callers whose callback body is \"the test body\". */\nconst TEST_CALLERS: ReadonlySet<string> = new Set([\n \"it\",\n \"test\",\n \"beforeEach\",\n \"afterEach\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** True for a nonzero numeric literal — the timing guess, as opposed to a `0` yield. */\nfunction isNonzeroNumericLiteral(node: TSESTree.Node | undefined): boolean {\n return node?.type === AST_NODE_TYPES.Literal && typeof node.value === \"number\" && node.value !== 0;\n}\n\n/** True when `node` is `setTimeout(<anything>, <nonzero literal>)`. */\nfunction isTimedSetTimeout(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"setTimeout\" &&\n node.arguments.length >= 2 &&\n isNonzeroNumericLiteral(node.arguments[1])\n );\n}\n\n/**\n * True when `node` is `new Promise((r) => setTimeout(r, n))` — including the\n * block-bodied `{ setTimeout(r, n); }` spelling.\n */\nfunction isPromiseSleep(node: TSESTree.NewExpression): boolean {\n if (node.callee.type !== AST_NODE_TYPES.Identifier || node.callee.name !== \"Promise\") {\n return false;\n }\n const executor = node.arguments[0];\n if (\n executor?.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n executor?.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const body = executor.body;\n if (body.type !== AST_NODE_TYPES.BlockStatement) {\n return isTimedSetTimeout(body);\n }\n return body.body.some(\n (stmt) => stmt.type === AST_NODE_TYPES.ExpressionStatement && isTimedSetTimeout(stmt.expression),\n );\n}\n\n/** True when `node` is `sleep(n)` / `delay(n)` with a nonzero numeric literal. */\nfunction isHelperSleep(node: TSESTree.CallExpression): boolean {\n return (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n SLEEP_HELPERS.has(node.callee.name) &&\n node.arguments.length >= 1 &&\n isNonzeroNumericLiteral(node.arguments[0])\n );\n}\n\n/** The nearest enclosing function of `node`, skipping the `new Promise` executor. */\nfunction nearestEnclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (!FUNCTION_TYPES.has(current.type)) {\n continue;\n }\n const grandparent = current.parent;\n const isPromiseExecutor =\n grandparent?.type === AST_NODE_TYPES.NewExpression && isPromiseSleep(grandparent);\n if (!isPromiseExecutor) {\n return current;\n }\n }\n return null;\n}\n\n/** The base callee name of a call, unwrapping `.only` / `.skip` / `.each` chains. */\nfunction testCallerName(callee: TSESTree.Node): string | null {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name;\n }\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n return testCallerName(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return testCallerName(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return testCallerName(callee.tag);\n }\n return null;\n}\n\n/** True when `fn` is the callback argument of an `it`/`test`/per-test-hook call. */\nfunction isTestBody(fn: TSESTree.Node): boolean {\n const call = fn.parent;\n if (\n call?.type !== AST_NODE_TYPES.CallExpression ||\n !call.arguments.some((argument) => argument === fn)\n ) {\n return false;\n }\n const name = testCallerName(call.callee);\n return name !== null && TEST_CALLERS.has(name);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-sleep-in-test-body\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow a fixed timed sleep directly in a test body; it flakes under CI load. Synchronize on the signal or use fake timers.\",\n },\n schema: [],\n messages: {\n noSleepInTestBody:\n \"A fixed sleep in a test body asserts on wall-clock time and flakes under CI load. Await the promise the code returns, or drive time with `vi.useFakeTimers()` + `await vi.advanceTimersByTimeAsync(ms)`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n const report = (node: TSESTree.Node): void => {\n const enclosing = nearestEnclosingFunction(node);\n if (enclosing === null || !isTestBody(enclosing)) {\n return;\n }\n context.report({ node, messageId: \"noSleepInTestBody\" });\n };\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (isPromiseSleep(node)) {\n report(node);\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (isHelperSleep(node)) {\n report(node);\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-storage-in-stateless-modules — private storage inside a module a team declared stateless diverges from the system of record, silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-storage-in-stateless-modules.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"storageInStatelessModule\";\n\nexport interface RuleOptions {\n /** Regex sources matched against the filename. Empty means the rule is off. */\n readonly modules?: readonly string[];\n /** Storage method names to flag. Replaces the defaults. */\n readonly methods?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\nconst DEFAULT_METHODS: readonly string[] = [\n \"prepare\",\n \"put\",\n \"getWithMetadata\",\n];\n\n/**\n * Minimum argument count before a method call counts as storage access. `put`\n * needs a key AND a value; a single-argument `put` is usually something else.\n * Methods absent from this map need one argument.\n */\nconst MIN_ARGUMENTS: ReadonlyMap<string, number> = new Map([[\"put\", 2]]);\n\n/** Compile regex sources, skipping malformed entries rather than throwing. */\nfunction compile(patterns: readonly string[]): RegExp[] {\n const compiled: RegExp[] = [];\n for (const pattern of patterns) {\n try {\n compiled.push(new RegExp(pattern));\n } catch {\n // Skip the malformed entry; the remaining patterns still apply.\n }\n }\n return compiled;\n}\n\n/** The flagged storage method name of `receiver.method(...)`, or null. */\nfunction storageMethodName(\n node: TSESTree.CallExpression,\n methods: ReadonlySet<string>,\n): string | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const name = callee.property.name;\n if (!methods.has(name)) {\n return null;\n }\n if (node.arguments.length < (MIN_ARGUMENTS.get(name) ?? 1)) {\n return null;\n }\n return name;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-storage-in-stateless-modules\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow SQL or key/value access inside modules a team has declared stateless; derive state from the systems of record instead. No-op until `modules` is configured.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n modules: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Regex sources matched against the filename. Empty (the default) disables the rule.\",\n },\n methods: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Storage method names to flag. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n storageInStatelessModule:\n \"`{{method}}()` reaches for private storage inside a module declared stateless. Derive the state from a read against the system of record, or from a marker in the artefact this feature already produces.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const modules = options?.modules ?? [];\n if (modules.length === 0) {\n return {};\n }\n\n const scoped = compile(modules);\n if (!scoped.some((re) => re.test(context.filename))) {\n return {};\n }\n\n const methods = new Set(options?.methods ?? DEFAULT_METHODS);\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const method = storageMethodName(node, methods);\n if (method !== null) {\n context.report({\n node,\n messageId: \"storageInStatelessModule\",\n data: { method },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-string-concat-in-loop — `+=` on a string inside a loop rebuilds the whole string every pass, which is O(n^2).\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-string-concat-in-loop.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\nimport type { Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noStringConcatInLoop\";\ntype Options = readonly [];\n\nconst LOOP_NODE_TYPES = new Set<string>([\n \"ForStatement\",\n \"ForOfStatement\",\n \"ForInStatement\",\n \"WhileStatement\",\n \"DoWhileStatement\",\n]);\n\n/** Checks whether an initializer is a string or template literal. */\nfunction isStringLiteralInit(node: TSESTree.Expression | null): boolean {\n if (node === null) {\n return false;\n }\n if (node.type === \"TemplateLiteral\") {\n return true;\n }\n if (node.type === \"Literal\") {\n return typeof node.value === \"string\";\n }\n return false;\n}\n\n/** Resolves an identifier through its enclosing scopes. */\nfunction findVariable(\n scope: Scope.Scope,\n name: string,\n): Scope.Variable | undefined {\n let current: Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.variables.find((v) => v.name === name);\n if (variable !== undefined) {\n return variable;\n }\n current = current.upper;\n }\n return undefined;\n}\n\n/** Requires exactly one variable declaration with a string-literal initializer. */\nfunction isStringInitializedVariable(variable: Scope.Variable): boolean {\n if (variable.defs.length !== 1) {\n return false;\n }\n const def = variable.defs[0];\n if (def === undefined || def.type !== \"Variable\") {\n return false;\n }\n const declarator = def.node;\n if (declarator.type !== \"VariableDeclarator\") {\n return false;\n }\n return isStringLiteralInit(declarator.init);\n}\n\n/** Finds a target identifier in a chained `+` expression. */\nfunction isConcatOperand(\n node: TSESTree.Expression | TSESTree.PrivateIdentifier,\n target: string,\n): boolean {\n if (node.type === \"Identifier\") {\n return node.name === target;\n }\n if (node.type === \"BinaryExpression\" && node.operator === \"+\") {\n return (\n isConcatOperand(node.left, target) || isConcatOperand(node.right, target)\n );\n }\n return false;\n}\n\n/** Recognizes longhand accumulation such as `s = s + x`. */\nfunction isConcatOntoTarget(\n rhs: TSESTree.Expression,\n target: string,\n): boolean {\n if (rhs.type !== \"BinaryExpression\" || rhs.operator !== \"+\") {\n return false;\n }\n return isConcatOperand(rhs.left, target) || isConcatOperand(rhs.right, target);\n}\n\n/** Checks whether the loop creates a fresh accumulator on every iteration. */\nfunction isDeclaredInsideLoop(\n variable: Scope.Variable,\n loop: TSESTree.Node,\n): boolean {\n const def = variable.defs[0];\n if (def === undefined) {\n return false;\n }\n const body = (\n loop as\n | TSESTree.ForStatement\n | TSESTree.ForOfStatement\n | TSESTree.ForInStatement\n | TSESTree.WhileStatement\n | TSESTree.DoWhileStatement\n ).body;\n const [declStart, declEnd] = def.node.range;\n const [bodyStart, bodyEnd] = body.range;\n return declStart >= bodyStart && declEnd <= bodyEnd;\n}\n\n/** Finds the nearest loop whose body contains the assignment. */\nfunction enclosingLoop(node: TSESTree.Node): TSESTree.Node | null {\n let child: TSESTree.Node = node;\n let parent = node.parent;\n while (parent !== undefined && parent !== null) {\n if (LOOP_NODE_TYPES.has(parent.type)) {\n const loop = parent as\n | TSESTree.ForStatement\n | TSESTree.ForOfStatement\n | TSESTree.ForInStatement\n | TSESTree.WhileStatement\n | TSESTree.DoWhileStatement;\n if (loop.body === child) {\n return loop;\n }\n }\n child = parent;\n parent = parent.parent;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-string-concat-in-loop\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow O(n^2) string building via `+=` on a string variable inside a loop; push parts to an array and `join` instead.\",\n },\n schema: [],\n messages: {\n noStringConcatInLoop:\n \"Avoid building a string with `+=` inside a loop — this is O(n^2). Push the parts onto an array and use `arr.join(\\\"\\\")` after the loop.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n // Report each accumulator once per loop.\n const reported = new WeakMap<TSESTree.Node, Set<string>>();\n\n return {\n AssignmentExpression(node: TSESTree.AssignmentExpression): void {\n // The LHS must be a plain variable reference.\n if (node.left.type !== \"Identifier\") {\n return;\n }\n // Accept both the compound `s += x` and the longhand `s = s + x`; any\n // other operator/shape (`s = x + y`, `s -= x`, ...) is not accumulation.\n const isAccumulation =\n node.operator === \"+=\" ||\n (node.operator === \"=\" &&\n isConcatOntoTarget(node.right, node.left.name));\n if (!isAccumulation) {\n return;\n }\n // Must occur inside a loop body, else it's a one-shot append.\n const loop = enclosingLoop(node);\n if (loop === null) {\n return;\n }\n\n const scope = context.sourceCode.getScope(node);\n const variable = findVariable(scope, node.left.name);\n // Conservative: can't resolve the declaration -> don't flag.\n if (variable === undefined) {\n return;\n }\n if (!isStringInitializedVariable(variable)) {\n return;\n }\n if (isDeclaredInsideLoop(variable, loop)) {\n return;\n }\n\n let seen = reported.get(loop);\n if (seen === undefined) {\n seen = new Set<string>();\n reported.set(loop, seen);\n }\n if (seen.has(node.left.name)) {\n return;\n }\n seen.add(node.left.name);\n\n context.report({\n node,\n messageId: \"noStringConcatInLoop\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-tautological-expect — an assertion whose operands are all literals decided its outcome before the code ran, so it can never fail.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-tautological-expect.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"tautologicalComparison\" | \"tautologicalMatcher\";\ntype Options = readonly [];\n\n/** Matchers that take the expected value as their single argument. */\nconst EQUALITY_MATCHERS: ReadonlySet<string> = new Set([\"toBe\", \"toEqual\", \"toStrictEqual\"]);\n\n/** Matchers that take no argument, so the receiver alone fixes the outcome. */\nconst ZERO_ARG_MATCHERS: ReadonlySet<string> = new Set([\n \"toBeDefined\",\n \"toBeUndefined\",\n \"toBeNull\",\n \"toBeTruthy\",\n \"toBeFalsy\",\n \"toBeNaN\",\n]);\n\n/** Enough of the operand to identify it in the message without pasting a screenful. */\nconst OPERAND_PREVIEW_CHARS = 40;\n\n/** Sign prefixes: `-1` is a unary expression, not a literal, but it is constant. */\nconst NUMERIC_SIGNS: ReadonlySet<string> = new Set([\"-\", \"+\"]);\n\nfunction isLiteral(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0;\n case AST_NODE_TYPES.UnaryExpression:\n return NUMERIC_SIGNS.has(node.operator) && isLiteral(node.argument);\n case AST_NODE_TYPES.ArrayExpression:\n return node.elements.every((element) => element !== null && isLiteral(element));\n case AST_NODE_TYPES.ObjectExpression:\n return node.properties.every(\n (property) =>\n property.type === AST_NODE_TYPES.Property &&\n !property.computed &&\n isLiteral(property.value),\n );\n default:\n return false;\n }\n}\n\n/** The `expect(<single argument>)` call a matcher hangs directly off, if any. */\nfunction expectOperand(callee: TSESTree.MemberExpression): TSESTree.Node | null {\n const receiver = callee.object;\n if (\n receiver.type !== AST_NODE_TYPES.CallExpression ||\n receiver.callee.type !== AST_NODE_TYPES.Identifier ||\n receiver.callee.name !== \"expect\" ||\n receiver.arguments.length !== 1\n ) {\n return null;\n }\n return receiver.arguments[0] ?? null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-tautological-expect\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow an assertion whose operands are all literals; its outcome is fixed before the code runs, so it can never fail.\",\n },\n schema: [],\n messages: {\n tautologicalComparison:\n \"`expect({{operand}}).{{matcher}}({{operand}})` compares a literal with an identical literal — it passes even if the code under test is deleted. Assert on a value the code produced, or delete the test.\",\n tautologicalMatcher:\n \"`expect({{operand}}).{{matcher}}()` asserts on a literal, so its outcome is fixed before the code runs. Assert on a value the code produced, or delete the test.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n /** The operand as written, collapsed to one line and elided for the message. */\n const preview = (node: TSESTree.Node): string => {\n const text = context.sourceCode.getText(node).replaceAll(/\\s+/gu, \" \");\n return text.length > OPERAND_PREVIEW_CHARS\n ? `${text.slice(0, OPERAND_PREVIEW_CHARS)}…`\n : text;\n };\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression || callee.computed) {\n return;\n }\n if (callee.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const matcher = callee.property.name;\n const operand = expectOperand(callee);\n if (operand === null || !isLiteral(operand)) {\n return;\n }\n if (ZERO_ARG_MATCHERS.has(matcher) && node.arguments.length === 0) {\n context.report({\n node,\n messageId: \"tautologicalMatcher\",\n data: { operand: preview(operand), matcher },\n });\n return;\n }\n const expected = node.arguments[0];\n if (\n !EQUALITY_MATCHERS.has(matcher) ||\n node.arguments.length !== 1 ||\n expected === undefined ||\n !isLiteral(expected)\n ) {\n return;\n }\n // Textual identity, not structural: `expect(1).toBe(1.0)` is a\n // deliberate statement about representation and is left alone.\n if (context.sourceCode.getText(operand) !== context.sourceCode.getText(expected)) {\n return;\n }\n context.report({\n node,\n messageId: \"tautologicalComparison\",\n data: { operand: preview(operand), matcher },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-typed-doc-sections — typed signatures do not need parameter or return tables.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-typed-doc-sections.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { documentsTypedFunction, proseGroups } from \"./_prose-budget.js\";\n\ntype MessageIds = \"typedSection\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"no-typed-doc-sections\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Reject typed-signature repetition while preserving behavior that types cannot express.\" },\n schema: [],\n messages: {\n typedSection: \"Typed JSDoc repeats parameters or returns — delete the tags and improve names or types instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode, true)) {\n if (group.hasTypedTags && documentsTypedFunction(context.sourceCode, group.comment)) {\n context.report({ node: group.comment, messageId: \"typedSection\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-trailing-value-narration — a trailing comment restating the literal beside it drifts the moment someone edits the arithmetic.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-trailing-value-narration.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { codeTokens, hasExternalReference, stem } from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"narratesValue\";\ntype Options = readonly [];\n\n// A number that is not part of an identifier or a dotted member path.\nconst NUMBER_RE = /(?<![\\w.])(\\d+(?:\\.\\d+)?)(?![\\w.])/g;\nconst WORD_RE = /[A-Za-z]+(?:'[a-z]+)?|\\d+(?:\\.\\d+)?/g;\n\n// Words that name the unit rather than the quantity — the one thing the code\n// does not say, and the reason the fix is a *name*, not a deletion.\nconst UNIT_WORDS: ReadonlySet<string> = new Set([\n \"bytes\", \"characters\", \"chars\", \"day\", \"days\", \"gb\", \"hour\", \"hours\", \"hr\",\n \"hrs\", \"hz\", \"items\", \"k\", \"kb\", \"khz\", \"m\", \"mb\", \"milliseconds\", \"min\",\n \"mins\", \"minute\", \"minutes\", \"ms\", \"pct\", \"percent\", \"px\", \"retries\", \"rows\",\n \"s\", \"sec\", \"second\", \"seconds\", \"secs\", \"times\", \"tokens\",\n]);\n\nconst STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"an\", \"and\", \"are\", \"as\", \"at\", \"be\", \"by\", \"for\", \"in\", \"is\", \"it\",\n \"of\", \"on\", \"or\", \"that\", \"the\", \"this\", \"we\", \"with\",\n]);\n\nconst DIRECTIVE_RE =\n /^\\s*(?:eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|todo\\b|fixme\\b|hack\\b|xxx\\b)/i;\n\nfunction numbersIn(text: string): Set<string> {\n return new Set(text.match(NUMBER_RE) ?? []);\n}\n\nfunction narratesValue(body: string, code: string): boolean {\n if (body.length === 0 || DIRECTIVE_RE.test(body) || hasExternalReference(body)) return false;\n const codeNumbers = numbersIn(code);\n if (codeNumbers.size === 0) return false;\n const words = (body.match(WORD_RE) ?? []).map((word) => word.toLowerCase());\n if (words.length === 0) return false;\n const commentNumbers = numbersIn(body);\n if (commentNumbers.size === 0) return false;\n for (const number of commentNumbers) {\n if (!codeNumbers.has(number)) return false;\n }\n if (!words.some((word) => UNIT_WORDS.has(word))) return false;\n const identifiers = codeTokens(code);\n const stems = new Set<string>();\n for (const token of identifiers) stems.add(stem(token));\n return words.every(\n (word) =>\n STOPWORDS.has(word) ||\n UNIT_WORDS.has(word) ||\n commentNumbers.has(word) ||\n identifiers.has(word) ||\n stems.has(stem(word)),\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-trailing-value-narration\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a trailing comment that repeats the line's numeric value only to name its unit.\",\n },\n schema: [],\n messages: {\n narratesValue:\n \"Trailing comment restates the literal on this line — put the unit in the name (STALE_TIME_MS) so it cannot drift.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n\n function isTrailing(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n return before !== null && before.loc.end.line === comment.loc.start.line;\n }\n\n function isInsideBrackets(comment: TSESTree.Comment): boolean {\n let node: TSESTree.Node | null | undefined = sourceCode.getNodeByRangeIndex(comment.range[0]);\n while (node != null) {\n if (node.type === \"BlockStatement\" || node.type === \"Program\") return false;\n if (\n node.type === \"ArrayExpression\" ||\n node.type === \"CallExpression\" ||\n node.type === \"NewExpression\"\n ) {\n return true;\n }\n node = node.parent;\n }\n return false;\n }\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n if (!isTrailing(comment) || isInsideBrackets(comment)) continue;\n const line = sourceCode.lines[comment.loc.start.line - 1] ?? \"\";\n const code = line.slice(0, comment.loc.start.column);\n const body = comment.value.replace(/^\\*+/, \"\").replace(/\\*+$/, \"\").trim();\n if (narratesValue(body, code)) {\n context.report({ node: comment, messageId: \"narratesValue\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-declaration-comment-wall — an enum body or class body whose member comments mostly re-spell the members is a wall the reader pays for by the block.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-declaration-comment-wall.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n BARE_LABEL_RE,\n WALL_DEFAULTS,\n WALL_SCHEMA,\n type WallOptions,\n carriesValue,\n commentBody,\n declarationRange,\n isLabel,\n isTagsOnly,\n isWall,\n knownTokens,\n labelStems,\n novelWords,\n} from \"./_comment-wall.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"commentWall\";\n\ntype Options = readonly [Partial<WallOptions>?];\n\n/** A member this rule can judge: something with a name and a source range. */\ninterface Judged {\n readonly node: TSESTree.Node;\n readonly key: TSESTree.Node;\n}\n\nfunction named(node: TSESTree.Node): Judged | undefined {\n switch (node.type) {\n case AST_NODE_TYPES.TSEnumMember:\n return { node, key: node.id };\n case AST_NODE_TYPES.PropertyDefinition:\n case AST_NODE_TYPES.TSAbstractPropertyDefinition:\n case AST_NODE_TYPES.MethodDefinition:\n case AST_NODE_TYPES.TSAbstractMethodDefinition:\n return node.computed ? undefined : { node, key: node.key };\n default:\n return undefined;\n }\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-declaration-comment-wall\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag an enum body or class body whose member comments mostly re-spell the members' own names.\",\n },\n schema: [WALL_SCHEMA],\n messages: {\n commentWall:\n \"{{restated}} of this declaration's {{commented}} member comments only re-spell the member's own name — delete them, and keep the rows that say what the name cannot.\",\n },\n },\n defaultOptions: [WALL_DEFAULTS],\n create(context, [provided]) {\n const options: WallOptions = { ...WALL_DEFAULTS, ...provided };\n const sourceCode = context.sourceCode;\n // Generated or vendored, a test fixture, or a demo story: three kinds of\n // file whose member comments are output rather than commentary.\n if (\n isGeneratedFile(context.filename, sourceCode.text) ||\n isTestFile(context.filename) ||\n isStoryFile(context.filename)\n ) {\n return {};\n }\n\n // One pass over the file's comments, indexed by the line they end on (a\n // leading comment) and the line they start on (a trailing one).\n const endingOn = new Map<number, TSESTree.Comment>();\n const startingOn = new Map<number, TSESTree.Comment>();\n for (const comment of sourceCode.getAllComments()) {\n endingOn.set(comment.loc.end.line, comment);\n if (!startingOn.has(comment.loc.start.line)) startingOn.set(comment.loc.start.line, comment);\n }\n\n /**\n * The comment documenting `member`: the block or line comment on the row\n * above it, or the one trailing its last row.\n *\n * A leading comment counts only when the MEMBER starts its own line, and\n * only when the comment is alone on ITS line; a trailing comment counts only\n * when it sits after the member it is read against. The caller claims each\n * comment once because compact declarations can share a source line.\n */\n function documentingComment(member: TSESTree.Node): TSESTree.Comment | undefined {\n const beforeMember = sourceCode.getTokenBefore(member, { includeComments: false });\n const ownsItsLine =\n beforeMember === null || beforeMember.loc.end.line < member.loc.start.line;\n const lead = ownsItsLine ? endingOn.get(member.loc.start.line - 1) : undefined;\n if (lead !== undefined) {\n const before = sourceCode.getTokenBefore(lead, { includeComments: false });\n if (before === null || before.loc.end.line < lead.loc.start.line) return lead;\n }\n const trail = startingOn.get(member.loc.end.line);\n return trail !== undefined && trail.range[0] > member.range[0] ? trail : undefined;\n }\n\n /**\n * True when a comment heads a REGION instead of describing the member under\n * it. The body is ONE bare identifier word; it names something OTHER than\n * the member below it; and it shows region evidence, heading a run of\n * members of which only the first is commented, or set off by a blank line.\n */\n function isGroupLabel(comment: TSESTree.Comment, member: Judged, headsRun: boolean): boolean {\n if (comment.loc.end.line >= member.node.loc.start.line) return false;\n const body = commentBody(comment);\n if (!BARE_LABEL_RE.test(body)) return false;\n if (labelStems(body) === labelStems(sourceCode.getText(member.key))) return false;\n const lineAbove = sourceCode.lines[comment.loc.start.line - 2];\n return headsRun || (lineAbove !== undefined && lineAbove.trim().length === 0);\n }\n\n function check(node: TSESTree.Node, members: readonly TSESTree.Node[]): void {\n const judged = members.map(named).filter((member): member is Judged => member !== undefined);\n if (judged.length === 0) return;\n\n const documented = judged.map((member) => ({\n member,\n comment: documentingComment(member.node),\n }));\n let commented = 0;\n let restated = 0;\n const claimed = new Set<TSESTree.Comment>();\n for (const [index, { member, comment }] of documented.entries()) {\n if (comment === undefined || claimed.has(comment)) continue;\n const next = documented[index + 1];\n if (isGroupLabel(comment, member, next !== undefined && next.comment === undefined)) {\n continue;\n }\n claimed.add(comment);\n commented += 1;\n const body = commentBody(comment);\n // A tag block is a directive to a documentation generator, and one\n // content word is a label; neither is a re-spelling of the name.\n if (body.length === 0 || carriesValue(body) || isTagsOnly(body) || isLabel(body)) {\n continue;\n }\n const [start, end] = declarationRange(member.node);\n if (novelWords(body, knownTokens(sourceCode.text.slice(start, end))) <= options.maxNovelWords) {\n restated += 1;\n }\n }\n\n if (!isWall(judged.length, commented, restated, options)) return;\n context.report({\n node,\n loc: {\n start: node.loc.start,\n end: { line: node.loc.start.line, column: node.loc.start.column + 1 },\n },\n messageId: \"commentWall\",\n data: { restated: String(restated), commented: String(commented) },\n });\n }\n\n return {\n ClassBody: (node: TSESTree.ClassBody) => {\n check(node, node.body);\n },\n TSEnumDeclaration: (node: TSESTree.TSEnumDeclaration) => {\n check(node, node.body.members);\n },\n };\n },\n});\n","/**\n * @fileoverview _comment-wall — the shared judgement behind the comment-VOLUME rules: a run of member comments that mostly re-spell their members is a wall.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { isProtected, splitIdentifier, stem } from \"./_comments.js\";\n\n/** Every threshold the wall rules apply; each is documented at `WALL_DEFAULTS`. */\nexport interface WallOptions {\n readonly minCommentedMembers: number;\n readonly minCommentedRatio: number;\n readonly minRestatedRatio: number;\n readonly maxNovelWords: number;\n}\n\nexport const WALL_DEFAULTS: WallOptions = {\n // Below three rows \"a wall\" is not a fair description of what the reader sees.\n minCommentedMembers: 3,\n // A minority of commented members is a GROUP LABEL, not a wall.\n minCommentedRatio: 0.6,\n // Room for one substantive row in four; a declaration where a quarter of the\n // comments say something real is one someone was documenting, not decorating.\n minRestatedRatio: 0.75,\n // One word beyond the member's own text. Zero is `no-restated-jsdoc`'s test\n // and is already covered there; two admits definitions (\"Partial match\"\n // beside \"Exact match\").\n maxNovelWords: 1,\n};\n\n/** The `meta.schema` entry both wall rules expose, so the knobs cannot drift. */\nexport const WALL_SCHEMA = {\n type: \"object\",\n additionalProperties: false,\n properties: {\n minCommentedMembers: {\n type: \"integer\",\n minimum: 2,\n description: \"Fewest commented members that can count as a wall.\",\n },\n minCommentedRatio: {\n type: \"number\",\n minimum: 0,\n maximum: 1,\n description:\n \"Least share of the members that must be commented; below it the comments are group labels.\",\n },\n minRestatedRatio: {\n type: \"number\",\n minimum: 0,\n maximum: 1,\n description: \"Least share of the member comments that must be restatements.\",\n },\n maxNovelWords: {\n type: \"integer\",\n minimum: 0,\n description:\n \"Most content words a comment may add beyond its member's own source and still count as a restatement.\",\n },\n },\n} as const;\n\n// Tags that carry what the signature cannot. `no-restated-jsdoc` reaches the\n// same verdict by a different route — anything outside the small set of tags it\n// models leaves the block alone — so there is no shared list to drift against,\n// and this one stands on its own.\nconst VALUE_TAG_RE =\n /@(?:deprecated|see|example|throws|remarks|since|default|defaultvalue|link|internal|alpha|beta|experimental|template|typeparam|inheritdoc|todo|fixme|override)\\b/i;\n\n// A documented default. The default of an optional member is precisely the fact\n// its type cannot hold.\nconst DEFAULT_RE = /^\\s*@?default\\b|\\bdefaults? (?:to|:)/i;\n\n// A digit is a bound, a base, an index origin, a status code or a version — all\n// facts about the world rather than about the name. A unit word is the same fact\n// spelled without one.\nconst DIGIT_RE = /\\d/;\nconst UNIT_WORD_RE =\n /\\b(?:ms|milliseconds?|seconds?|minutes?|hours?|days?|weeks?|months?|years?|bytes?|kb|mb|gb|percent|pixels?|px|utc|epoch)\\b/i;\n\n// A quoted example value or an `e.g.` enumerates what the type only bounds.\nconst EXAMPLE_RE = /[\"'`]|\\be\\.g\\.|\\bi\\.e\\./;\n\n// Every word of the body belongs to a JSDoc tag, so the block is an instruction\n// to a documentation generator rather than a sentence about the member.\nconst TAG_TOKEN_RE = /@\\w+/g;\n\n// A rule of dashes is a banner; `no-comment-cruft` owns that shape.\nconst BANNER_RE = /[=\\-─-╿*#~_.]{3,}/;\n\n// Prose the tokenizer cannot read, so \"adds no new word\" is unmeasurable.\nconst NON_ASCII_LETTER_RE = /[^\\p{ASCII}\\p{N}\\p{P}\\p{Z}]/u;\n\n/**\n * Filler that says nothing about *which* member is being described. Wider than\n * `_comments.STOPWORDS` for the same reason `no-restated-jsdoc`'s list is:\n * member documentation conventionally repeats the vocabulary of the type system\n * itself (\"the optional callback value\") without that being a claim.\n *\n * Deliberately absent: `class`, `method`, `function`, `component`, `hook`,\n * `parameter`, `argument`. In a reflection or decorator type those words are the\n * whole claim — `Function` cannot say \"class\" and `number` cannot say\n * \"parameter\". The tag words `param` and `arg` stay: block punctuation, not\n * prose.\n */\nexport const WALL_STOPWORDS: ReadonlySet<string> = new Set(\n `the a an of to for in on with and or as at by is are was be been being\n this that it its if whether when where which what will would can could should\n must may into from over about not no does do done has have had used use uses\n using given provided specified current new existing all any each per via\n instance object value values data item\n items element callback handler prop props param arg return\n returns returning result optional required true false null undefined\n string number boolean array list promise set map record type name`.split(/\\s+/),\n);\n\nconst WORD_RE = /[A-Za-z][A-Za-z0-9]*/g;\n\n// A label is one bare identifier word: `// links`, `// clientMiddleware`. Two\n// words of prose is already a sentence about the member below it.\nexport const BARE_LABEL_RE = /^[A-Za-z][A-Za-z0-9]*$/;\n\n/** The identifier `body` spells, folded so `links` and `Links` are one word. */\nexport function labelStems(body: string): string {\n return splitIdentifier(body).map(stem).join(\" \");\n}\n\n/** Strip the `*` decoration off a block comment so JSDoc and `//` read alike. */\nexport function commentBody(comment: TSESTree.Comment): string {\n return comment.value\n .replace(/^\\*+/, \"\")\n .replace(/^[ \\t]*\\*[ \\t]?/gm, \"\")\n .trim();\n}\n\n/**\n * True when a member comment carries something a name and a type cannot — the\n * exemption floor shared by both wall rules. Counted as a comment, never as a\n * restatement.\n *\n * `isLabel` and `isTagsOnly` are deliberately NOT folded in here. On an object\n * TYPE a one-word comment really is a name restatement (`// links` over\n * `links`), which that rule's own group-label guard separates; the populations\n * that spell mapping tables that way belong to its sibling.\n */\nexport function carriesValue(body: string): boolean {\n return (\n isProtected(body) ||\n VALUE_TAG_RE.test(body) ||\n DEFAULT_RE.test(body) ||\n DIGIT_RE.test(body) ||\n UNIT_WORD_RE.test(body) ||\n EXAMPLE_RE.test(body) ||\n BANNER_RE.test(body) ||\n NON_ASCII_LETTER_RE.test(body)\n );\n}\n\n/**\n * True when `body` is one content word or fewer — a LABEL or a tag, never a\n * description of the member below it.\n *\n * With `maxNovelWords` at one, a single novel word scores as a restatement by\n * arithmetic rather than by meaning. One word beside a key is the opposite of a\n * re-spelling: it is the one thing the key does not say.\n */\nexport function isLabel(body: string): boolean {\n let content = 0;\n for (const word of body.match(WORD_RE) ?? []) {\n if (word.length >= 2 && !WALL_STOPWORDS.has(word.toLowerCase())) content += 1;\n }\n return content <= 1;\n}\n\n/** True when `body` carries no prose at all beyond its JSDoc tags. */\nexport function isTagsOnly(body: string): boolean {\n return body.length > 0 && body.replace(TAG_TOKEN_RE, \"\").trim().length === 0;\n}\n\n/** Every identifier part of a slice of source, plus its stem. */\nexport function knownTokens(source: string): ReadonlySet<string> {\n const tokens = new Set<string>();\n for (const identifier of source.match(/[A-Za-z_$][\\w$]*/g) ?? []) {\n for (const part of splitIdentifier(identifier)) {\n tokens.add(part);\n tokens.add(stem(part));\n }\n }\n return tokens;\n}\n\n/** Content words of `body` that do not already appear in `known`. */\nexport function novelWords(body: string, known: ReadonlySet<string>): number {\n let novel = 0;\n for (const word of body.match(WORD_RE) ?? []) {\n const lower = word.toLowerCase();\n if (lower.length < 2 || WALL_STOPWORDS.has(lower)) continue;\n if (!known.has(lower) && !known.has(stem(lower))) novel += 1;\n }\n return novel;\n}\n\n/**\n * True when a run of members carrying `commented` comments, `restated` of them\n * restatements, is a wall under `options`.\n */\nexport function isWall(\n members: number,\n commented: number,\n restated: number,\n options: WallOptions,\n): boolean {\n return (\n commented >= options.minCommentedMembers &&\n commented / members >= options.minCommentedRatio &&\n restated / commented >= options.minRestatedRatio\n );\n}\n\nconst OPAQUE_VALUE_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.ObjectExpression,\n AST_NODE_TYPES.ArrayExpression,\n]);\n\n/**\n * The part of a member a reader reads as its DECLARATION — the key, the type\n * annotation and, for a callable, the parameter list.\n *\n * A method body, an object value and an array value are all deliberately\n * excluded. Each names every identifier it touches, so reading a comment against\n * one makes almost any comment \"already said\": the token set stops being the\n * member's own words and becomes the value's. A label naming what a nested\n * object configures shares its vocabulary with that object and with nothing in\n * the name it labels.\n */\nexport function declarationRange(member: TSESTree.Node): [number, number] {\n const body = bodyOf(member);\n if (body === undefined) return [member.range[0], member.range[1]];\n return [member.range[0], body.range[0]];\n}\n\nfunction bodyOf(member: TSESTree.Node): TSESTree.Node | undefined {\n if (\n member.type === AST_NODE_TYPES.MethodDefinition ||\n member.type === AST_NODE_TYPES.TSAbstractMethodDefinition\n ) {\n return member.value.body ?? undefined;\n }\n if (member.type === AST_NODE_TYPES.Property || member.type === AST_NODE_TYPES.PropertyDefinition) {\n const value = member.value;\n if (value !== null && OPAQUE_VALUE_TYPES.has(value.type)) return value;\n }\n return undefined;\n}\n","/**\n * @fileoverview no-union-in-comment — a comment listing a field's allowed strings has written a union type the compiler never gets to enforce.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-union-in-comment.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"unionInComment\";\ntype Options = readonly [];\n\n// A literal long enough to be a sentence is an example, a message or a format\n// string — not an enum member.\nconst MAX_LITERAL_LENGTH = 28;\n\nconst LITERAL = String.raw`(?:'[^'\\n]*'|\"[^\"\\n]*\"|\\`[^\\`\\n]*\\`)`;\n\n// Anchored at BOTH ends on purpose: a literal list inside a sentence is prose\n// that happens to quote values, and the sentence is what carries the meaning.\n// Only a body that is nothing but the list is a type someone wrote down.\nconst LEAD_IN_RE =\n /^(?:one of|either|values?|allowed(?: values)?|options?|possible(?: values)?)\\s*[:=-]?\\s*/i;\nconst UNION_BODY_RE = new RegExp(String.raw`^${LITERAL}(?:\\s*[|,/]\\s*${LITERAL})+\\.?$`);\nconst LITERAL_G = new RegExp(LITERAL, \"g\");\n\n/**\n * Column builders whose call spells the stored type where TypeScript has no\n * annotation to read. A schema row is where a closed set is most often left as\n * `text` with the set in a comment beside it.\n */\nconst STRING_BUILDERS: ReadonlySet<string> = new Set([\n \"char\", \"citext\", \"longtext\", \"mediumtext\", \"string\", \"text\", \"tinytext\", \"varchar\",\n]);\n\n/** True when a type annotation is an unconstrained `string` after all. */\nfunction isBareString(node: TSESTree.TypeNode | undefined): boolean {\n if (node === undefined) return false;\n switch (node.type) {\n case AST_NODE_TYPES.TSStringKeyword:\n return true;\n // `string[]` holds members of the same closed set, one element at a time.\n case AST_NODE_TYPES.TSArrayType:\n return isBareString(node.elementType);\n // `string | null` is still an unconstrained string, and so is `string | \"a\"`\n // — the checker collapses that one to `string`.\n case AST_NODE_TYPES.TSUnionType:\n return node.types.some((member) => isBareString(member));\n default:\n return false;\n }\n}\n\n/** The identifier a call chain hangs off: `text(\"k\").notNull()` -> `text`. */\nfunction rootCallee(node: TSESTree.Node | null | undefined): string | null {\n let current: TSESTree.Node | null | undefined = node;\n for (let hops = 0; current != null && hops < 12; hops += 1) {\n switch (current.type) {\n case AST_NODE_TYPES.CallExpression:\n current = current.callee;\n break;\n case AST_NODE_TYPES.MemberExpression:\n current = current.object;\n break;\n case AST_NODE_TYPES.Identifier:\n return current.name;\n default:\n return null;\n }\n }\n return null;\n}\n\n/** A declaration this rule can judge: a named one that holds a bare string. */\ninterface Target {\n readonly node: TSESTree.Node;\n readonly name: string;\n}\n\nfunction nameOf(key: TSESTree.Node): string | null {\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") return key.value;\n return null;\n}\n\nfunction targetOf(node: TSESTree.Node): Target | null {\n switch (node.type) {\n case AST_NODE_TYPES.TSPropertySignature:\n case AST_NODE_TYPES.PropertyDefinition: {\n const name = node.computed ? null : nameOf(node.key);\n if (name === null || !isBareString(node.typeAnnotation?.typeAnnotation)) return null;\n return { node, name };\n }\n case AST_NODE_TYPES.Property: {\n const name = node.computed || node.shorthand ? null : nameOf(node.key);\n const callee = rootCallee(node.value);\n if (name === null || callee === null || !STRING_BUILDERS.has(callee)) return null;\n return { node, name };\n }\n case AST_NODE_TYPES.VariableDeclarator: {\n if (node.id.type !== AST_NODE_TYPES.Identifier) return null;\n if (!isBareString(node.id.typeAnnotation?.typeAnnotation)) return null;\n return { node, name: node.id.name };\n }\n default:\n return null;\n }\n}\n\n/** The literals a comment lists, or null when its body is not a bare list. */\nfunction unionLiterals(body: string): string[] | null {\n const list = body.replace(LEAD_IN_RE, \"\").trim();\n if (!UNION_BODY_RE.test(list)) return null;\n const literals = (list.match(LITERAL_G) ?? []).map((raw) => raw.slice(1, -1));\n if (literals.some((literal) => literal.length === 0 || literal.length > MAX_LITERAL_LENGTH)) {\n return null;\n }\n return literals;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-union-in-comment\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a comment that lists a `string` field's allowed values instead of the type listing them.\",\n },\n schema: [],\n messages: {\n unionInComment:\n 'This comment is a type — `{{name}}` still accepts every string, so the set it lists is enforced by nobody. Make it a string-literal union (\"{{first}}\" | …) and delete the comment.',\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n if (isGeneratedFile(context.filename, sourceCode.text)) {\n return {};\n }\n\n /**\n * The declaration a comment annotates: the one it trails on its own line, or\n * the one starting on the line below when the comment has that line to\n * itself. Anything else annotates nothing this rule can read.\n */\n function annotated(comment: TSESTree.Comment): Target | null {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n let anchor: TSESTree.Node | null;\n if (before !== null && before.loc.end.line === comment.loc.start.line) {\n // The separator a member ends on belongs to the CONTAINER, so resolving\n // `,` or `;` lands on the object and never reaches the member itself.\n let token: TSESTree.Token | null = before;\n while (token !== null && (token.value === \",\" || token.value === \";\")) {\n token = sourceCode.getTokenBefore(token, { includeComments: false });\n }\n anchor = token === null ? null : sourceCode.getNodeByRangeIndex(token.range[0]);\n } else {\n const after = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (after === null || after.loc.start.line !== comment.loc.end.line + 1) return null;\n anchor = sourceCode.getNodeByRangeIndex(after.range[0]);\n }\n for (\n let node: TSESTree.Node | undefined | null = anchor;\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n const target = targetOf(node);\n if (target !== null) return target;\n }\n return null;\n }\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n const body = comment.value.replace(/^\\*+/, \"\").replace(/\\*+$/, \"\").trim();\n if (body.length === 0) continue;\n const literals = unionLiterals(body);\n if (literals === null) continue;\n const target = annotated(comment);\n if (target === null) continue;\n // A declaration that already spells every value HAS the type; the\n // comment beside it is a restatement, which is a different defect.\n const declaration = sourceCode.getText(target.node);\n if (literals.every((literal) => declaration.includes(literal))) continue;\n context.report({\n node: comment,\n messageId: \"unionInComment\",\n data: { name: target.name, first: literals[0] ?? \"\" },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-type-member-comment-wall — an object type whose member comments mostly re-spell the members is a wall the reader pays for by the block.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-type-member-comment-wall.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\nimport {\n BARE_LABEL_RE,\n WALL_DEFAULTS,\n WALL_SCHEMA,\n type WallOptions,\n carriesValue,\n commentBody,\n isWall,\n knownTokens,\n labelStems,\n novelWords,\n} from \"./_comment-wall.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"commentWall\";\n\ntype Options = readonly [Partial<WallOptions>?];\n\n/** A member the rule can judge: a named property or method signature. */\ntype NamedMember = TSESTree.TSPropertySignature | TSESTree.TSMethodSignature;\n\nfunction isNamedMember(node: TSESTree.TypeElement): node is NamedMember {\n return (\n (node.type === AST_NODE_TYPES.TSPropertySignature ||\n node.type === AST_NODE_TYPES.TSMethodSignature) &&\n !node.computed\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-type-member-comment-wall\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag an object type whose member comments mostly re-spell the members' own names and types.\",\n },\n schema: [WALL_SCHEMA],\n messages: {\n commentWall:\n \"{{restated}} of this type's {{commented}} member comments only re-spell the member's own name and type — delete them, and keep the rows that say what the name cannot.\",\n },\n },\n defaultOptions: [WALL_DEFAULTS],\n create(context, [provided]) {\n const options: WallOptions = { ...WALL_DEFAULTS, ...provided };\n const sourceCode = context.sourceCode;\n // Generated or vendored, a test fixture, or a demo story: three kinds of\n // file whose member comments are output rather than commentary.\n if (\n isGeneratedFile(context.filename, sourceCode.text, [\"externalTree\"]) ||\n isTestFile(context.filename, [\"fixtureTree\"]) ||\n isStoryFile(context.filename, [\"storyTree\"])\n ) {\n return {};\n }\n\n // One pass over the file's comments, indexed by the line they end on (a\n // leading comment) and the line they start on (a trailing one).\n const endingOn = new Map<number, TSESTree.Comment>();\n const startingOn = new Map<number, TSESTree.Comment>();\n for (const comment of sourceCode.getAllComments()) {\n endingOn.set(comment.loc.end.line, comment);\n if (!startingOn.has(comment.loc.start.line)) startingOn.set(comment.loc.start.line, comment);\n }\n\n /**\n * The comment documenting `member`: the block or line comment on the row\n * above it, or the one trailing its last row.\n *\n * A leading comment counts only when the MEMBER starts its own line, and\n * only when the comment is alone on ITS line; a trailing comment counts\n * only when it sits after the member it is read against. All three keep a\n * one-line type literal under a doc block from reading as three members\n * documented three times with the same words.\n */\n function documentingComment(member: NamedMember): TSESTree.Comment | undefined {\n const beforeMember = sourceCode.getTokenBefore(member, { includeComments: false });\n const ownsItsLine =\n beforeMember === null || beforeMember.loc.end.line < member.loc.start.line;\n const lead = ownsItsLine ? endingOn.get(member.loc.start.line - 1) : undefined;\n if (lead !== undefined) {\n const before = sourceCode.getTokenBefore(lead, { includeComments: false });\n if (before === null || before.loc.end.line < lead.loc.start.line) return lead;\n }\n const trail = startingOn.get(member.loc.end.line);\n return trail !== undefined && trail.range[0] > member.range[0] ? trail : undefined;\n }\n\n /**\n * True when a comment heads a REGION of the type instead of describing the\n * member under it — the exemption this rule documents and, before this\n * check, leaked on.\n *\n * Three conditions. The body is ONE bare identifier word; it names\n * something OTHER than the member below it (the decisive one — `// links`\n * over `LinkDescriptors` heads a group, `// links` over `links` restates a\n * name); and it shows region evidence, heading a run of members of which\n * only the first is commented, or set off by a blank line.\n */\n function isGroupLabel(\n comment: TSESTree.Comment,\n member: NamedMember,\n headsRun: boolean,\n ): boolean {\n if (comment.loc.end.line >= member.loc.start.line) return false;\n const body = commentBody(comment);\n if (!BARE_LABEL_RE.test(body)) return false;\n if (labelStems(body) === labelStems(sourceCode.getText(member.key))) return false;\n const lineAbove = sourceCode.lines[comment.loc.start.line - 2];\n return headsRun || (lineAbove !== undefined && lineAbove.trim().length === 0);\n }\n\n function check(node: TSESTree.TSInterfaceBody | TSESTree.TSTypeLiteral): void {\n const members = node.type === AST_NODE_TYPES.TSInterfaceBody ? node.body : node.members;\n const named = members.filter(isNamedMember);\n if (named.length === 0) return;\n\n const documented = named.map((member) => ({ member, comment: documentingComment(member) }));\n let commented = 0;\n let restated = 0;\n // A comment documents at most one member, so a shared block cannot be\n // counted once per member that happens to sit next to it.\n const claimed = new Set<TSESTree.Comment>();\n for (const [index, { member, comment }] of documented.entries()) {\n if (comment === undefined || claimed.has(comment)) continue;\n const next = documented[index + 1];\n if (isGroupLabel(comment, member, next !== undefined && next.comment === undefined)) {\n continue;\n }\n claimed.add(comment);\n commented += 1;\n const body = commentBody(comment);\n if (body.length === 0 || carriesValue(body)) continue;\n if (novelWords(body, knownTokens(sourceCode.getText(member))) <= options.maxNovelWords) {\n restated += 1;\n }\n }\n\n if (!isWall(named.length, commented, restated, options)) return;\n context.report({\n node,\n loc: {\n start: node.loc.start,\n end: { line: node.loc.start.line, column: node.loc.start.column + 1 },\n },\n messageId: \"commentWall\",\n data: { restated: String(restated), commented: String(commented) },\n });\n }\n\n return {\n TSInterfaceBody: check,\n TSTypeLiteral: check,\n };\n },\n});\n","/**\n * @fileoverview no-unnecessary-use-client — a `'use client'` file with no hooks, handlers or browser globals ships to the client for nothing.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-unnecessary-use-client.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"unnecessaryUseClient\";\ntype Options = readonly [];\n\nconst HOOK_REGEX = /^use([A-Z]|$)/;\nconst EVENT_PROP_REGEX = /^on[A-Z]/;\nconst ERROR_FILE_REGEX = /\\b(?:global-)?error\\.[jt]sx?$/;\n\nconst BROWSER_GLOBALS: ReadonlySet<string> = new Set([\n \"window\",\n \"document\",\n \"navigator\",\n \"localStorage\",\n \"sessionStorage\",\n \"location\",\n \"history\",\n \"screen\",\n \"requestAnimationFrame\",\n \"cancelAnimationFrame\",\n \"CustomEvent\",\n \"Event\",\n \"MouseEvent\",\n \"KeyboardEvent\",\n \"TouchEvent\",\n]);\n\n/** Modules whose import requires a client boundary. */\nconst CLIENT_REQUIRED_MODULES: ReadonlySet<string> = new Set([\"next/dynamic\"]);\n\nconst CLIENT_ONLY_PACKAGES_REGEX =\n /^(?:@radix-ui\\/|framer-motion|react-dom|react-day-picker|@floating-ui\\/|react-select|react-toastify|react-hook-form|recharts|react-dropzone|react-slick|react-swipeable|react-resizable|react-draggable|react-beautiful-dnd|@hello-pangea\\/dnd|react-virtualized|react-window|@tanstack\\/react-table|@tanstack\\/react-query|react-redux|recoil|jotai|zustand|@tippyjs\\/react|react-color|react-datepicker|next-themes|react-helmet|react-helmet-async|styled-components|@emotion\\/)/;\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** True for package specifiers whose implementation this rule cannot inspect. */\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith(\".\") && !source.startsWith(\"/\") && !source.startsWith(\"@/\") && !source.startsWith(\"~\");\n\n/** The leftmost identifier of a JSX element name: `Primitive.Tabs` -> `Primitive`. */\nconst jsxRootName = (name: TSESTree.JSXTagNameExpression): string => {\n let current: TSESTree.JSXTagNameExpression = name;\n while (current.type === AST_NODE_TYPES.JSXMemberExpression) {\n current = current.object;\n }\n return current.type === AST_NODE_TYPES.JSXIdentifier ? current.name : \"\";\n};\n\n/** True when any identifier in `node`'s subtree names an imported binding. */\nconst subtreeReadsImportedBinding = (\n node: TSESTree.Node,\n imported: ReadonlySet<string>,\n): boolean => {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return imported.has(node.name);\n }\n for (const key of Object.keys(node) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = node[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\" &&\n subtreeReadsImportedBinding(child as TSESTree.Node, imported)\n ) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isUseClientDirective = (\n node: TSESTree.Statement,\n): node is TSESTree.ExpressionStatement => {\n return (\n node.type === AST_NODE_TYPES.ExpressionStatement &&\n node.expression.type === AST_NODE_TYPES.Literal &&\n node.expression.value === \"use client\"\n );\n};\n\nconst isGlobalReference = (\n node: TSESTree.Identifier,\n context: Ctx,\n): boolean => {\n if (!BROWSER_GLOBALS.has(node.name)) return false;\n\n const parent = node.parent;\n if (parent !== undefined) {\n // `obj.window` — `window` is a property name, not a global reference.\n if (\n parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.property === node &&\n !parent.computed\n ) {\n return false;\n }\n // `{ window: ... }` — property key, not a global reference.\n if (\n parent.type === AST_NODE_TYPES.Property &&\n parent.key === node &&\n !parent.computed\n ) {\n return false;\n }\n // Type annotations / type-only positions are not runtime references.\n if (parent.type.startsWith(\"TS\")) {\n return false;\n }\n }\n\n // If there's a local binding for this name anywhere up the chain, it's not\n // a reference to the browser global.\n let scope: Scope.Scope | null = context.sourceCode.getScope(node);\n while (scope !== null) {\n const variable = scope.set.get(node.name);\n if (variable !== undefined && variable.defs.length > 0) {\n return false;\n }\n scope = scope.upper;\n }\n\n return true;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"no-unnecessary-use-client\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag `'use client'` files with no hooks or event handlers — they could be RSC.\",\n },\n schema: [],\n messages: {\n unnecessaryUseClient:\n \"'use client' directive but no hooks (use*), JSX event handlers (on*), browser globals, or client-only imports found. Consider removing the directive and serving as a React Server Component.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (ERROR_FILE_REGEX.test(filename)) {\n return {};\n }\n\n let directiveNode: TSESTree.ExpressionStatement | null = null;\n let hasClientIndicator = false;\n const importedLocals = new Set<string>();\n const externalLocals = new Set<string>();\n\n const markIfHookOrContext = (\n callee: TSESTree.CallExpression[\"callee\"],\n ): void => {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n if (HOOK_REGEX.test(callee.name) || callee.name === \"createContext\") {\n hasClientIndicator = true;\n }\n return;\n }\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n const name = callee.property.name;\n if (HOOK_REGEX.test(name) || name === \"createContext\") {\n hasClientIndicator = true;\n }\n }\n };\n\n return {\n Program(node): void {\n for (const stmt of node.body) {\n // Directives must be the first statements; once we see a non-\n // ExpressionStatement, stop scanning.\n if (stmt.type !== AST_NODE_TYPES.ExpressionStatement) break;\n if (isUseClientDirective(stmt)) {\n directiveNode = stmt;\n break;\n }\n }\n },\n CallExpression(node): void {\n // The `Program` visitor (entered first) has already determined whether\n // this file has a `'use client'` directive. If it doesn't, the result\n // can't change — skip all of the per-node indicator work, including the\n // hot scope-resolution in the `Identifier` visitor below.\n if (directiveNode === null) return;\n markIfHookOrContext(node.callee);\n },\n JSXAttribute(node): void {\n if (directiveNode === null) return;\n if (\n node.name.type === AST_NODE_TYPES.JSXIdentifier &&\n EVENT_PROP_REGEX.test(node.name.name)\n ) {\n hasClientIndicator = true;\n }\n },\n ImportDeclaration(node): void {\n if (directiveNode === null) return;\n if (typeof node.source.value !== \"string\") return;\n const source = node.source.value;\n if (\n CLIENT_ONLY_PACKAGES_REGEX.test(source) ||\n CLIENT_REQUIRED_MODULES.has(source)\n ) {\n hasClientIndicator = true;\n }\n for (const specifier of node.specifiers) {\n importedLocals.add(specifier.local.name);\n if (isBareSpecifier(source)) {\n externalLocals.add(specifier.local.name);\n }\n }\n },\n JSXOpeningElement(node): void {\n if (directiveNode === null) return;\n // Indicator 1: rendering a third-party component — this rule cannot see\n // whether the dependency itself needs a client boundary.\n if (externalLocals.has(jsxRootName(node.name))) {\n hasClientIndicator = true;\n }\n },\n ExportNamedDeclaration(node): void {\n if (directiveNode === null) return;\n if (node.source !== null) {\n hasClientIndicator = true;\n return;\n }\n // Indicator 2: `export const X = SomeImport.X` — a re-export written\n // the long way, so it must agree with the `export … from` branch above.\n if (\n node.declaration !== null &&\n subtreeReadsImportedBinding(node.declaration, importedLocals)\n ) {\n hasClientIndicator = true;\n }\n },\n ExportAllDeclaration(node): void {\n if (directiveNode === null) return;\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ClassDeclaration(): void {\n if (directiveNode === null) return;\n hasClientIndicator = true;\n },\n ClassExpression(): void {\n if (directiveNode === null) return;\n hasClientIndicator = true;\n },\n Identifier(node): void {\n if (directiveNode === null) return;\n if (isGlobalReference(node, context)) {\n hasClientIndicator = true;\n }\n },\n \"Program:exit\"(): void {\n if (directiveNode !== null && !hasClientIndicator) {\n context.report({\n node: directiveNode,\n messageId: \"unnecessaryUseClient\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-unsafe-mock-casting — a cast to `vi.Mock` / `jest.Mock` asserts a mock that may not exist; `vi.mocked()` checks it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-unsafe-mock-casting.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\nimport { AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"unsafeMockCast\";\n\nfunction isMockTypeReference(node: TSESTree.TypeNode): boolean {\n if (node.type !== AST_NODE_TYPES.TSTypeReference) {\n return false;\n }\n \n const typeName = node.typeName;\n \n if (typeName.type === AST_NODE_TYPES.Identifier) {\n const name = typeName.name;\n return name === \"Mock\" || name === \"MockInstance\" || name === \"SpyInstance\";\n }\n \n if (typeName.type === AST_NODE_TYPES.TSQualifiedName) {\n const rightName = typeName.right.name;\n return rightName === \"Mock\" || rightName === \"MockInstance\" || rightName === \"SpyInstance\";\n }\n \n return false;\n}\n\nexport default createRule<[], MessageIds>({\n name: \"no-unsafe-mock-casting\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow casting to mock types like `jest.Mock` or `vi.Mock`. Use `vi.mocked()` or `jest.mocked()` instead.\",\n },\n schema: [],\n messages: {\n unsafeMockCast:\n \"Do not cast to a Mock type. Use `vi.mocked(fn)` or `jest.mocked(fn)` instead to preserve type safety.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n function checkAssertion(\n node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion,\n ): void {\n if (isMockTypeReference(node.typeAnnotation)) {\n context.report({ node, messageId: \"unsafeMockCast\" });\n }\n }\n\n return {\n TSAsExpression: checkAssertion,\n TSTypeAssertion: checkAssertion,\n };\n },\n});\n","/**\n * @fileoverview no-zod-native-enum — `z.nativeEnum` exists to wrap a TypeScript `enum`, which `no-enum` already bans.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-zod-native-enum.test.ts\n */\n\nimport {\n ESLintUtils,\n type TSESLint,\n type TSESTree,\n type ParserServicesWithTypeInformation,\n AST_NODE_TYPES,\n} from \"@typescript-eslint/utils\";\nimport * as ts from \"typescript\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"nativeEnum\" | \"enumOfTsEnum\";\ntype Options = readonly [];\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/** `zod`, `zod/v4`, `zod/mini`, `@hono/zod-openapi`, `@/lib/zod`, ... */\nfunction isZodModule(source: string): boolean {\n return /(^|[/@-])zod([/-]|$)/.test(source);\n}\n\n/** Unwraps `x as const` / `x satisfies T` / `(x)` down to the inner expression. */\nfunction unwrap(node: TSESTree.Expression): TSESTree.Expression {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression\n ) {\n return unwrap(node.expression);\n }\n return node;\n}\n\n/** Returns unique string-literal values when the object can be safely rewritten. */\nfunction stringValueTexts(\n node: TSESTree.ObjectExpression,\n sourceCode: Readonly<TSESLint.SourceCode>,\n): string[] | null {\n const texts: string[] = [];\n for (const prop of node.properties) {\n if (prop.type !== AST_NODE_TYPES.Property) {\n return null;\n }\n if (prop.computed || prop.shorthand || prop.method || prop.kind !== \"init\") {\n return null;\n }\n const value = prop.value;\n if (\n value.type !== AST_NODE_TYPES.Literal ||\n typeof value.value !== \"string\"\n ) {\n return null;\n }\n const text = sourceCode.getText(value);\n if (!texts.includes(text)) {\n texts.push(text);\n }\n }\n return texts.length > 0 ? texts : null;\n}\n\n/** Resolves an identifier to a `TSEnumDeclaration` declared in this file. */\nfunction resolvesToLocalEnum(\n node: TSESTree.Identifier,\n scope: TSESLint.Scope.Scope,\n): boolean {\n let current: TSESLint.Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.variables.find((v) => v.name === node.name);\n if (variable !== undefined) {\n return variable.defs.some(\n (def) => def.node.type === AST_NODE_TYPES.TSEnumDeclaration,\n );\n }\n current = current.upper;\n }\n return false;\n}\n\nconst ENUM_SYMBOL_FLAGS =\n ts.SymbolFlags.RegularEnum | ts.SymbolFlags.ConstEnum | ts.SymbolFlags.Enum;\n\n/**\n * Whether the identifier's resolved symbol is a TypeScript enum, following\n * import aliases. Catches `import { Status } from \"./types\"; z.enum(Status)`,\n * which lexical resolution alone cannot see.\n */\nfunction resolvesToImportedEnum(\n node: TSESTree.Identifier,\n services: ParserServicesWithTypeInformation,\n): boolean {\n const checker = services.program.getTypeChecker();\n const tsNode = services.esTreeNodeToTSNodeMap.get(node);\n let symbol = checker.getSymbolAtLocation(tsNode);\n if (symbol === undefined) {\n return false;\n }\n if ((symbol.flags & ts.SymbolFlags.Alias) !== 0) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n return (symbol.flags & ENUM_SYMBOL_FLAGS) !== 0;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-zod-native-enum\",\n meta: {\n type: \"suggestion\",\n fixable: \"code\",\n docs: {\n description:\n \"Disallow `z.nativeEnum()` (and `z.enum()` over a TypeScript enum); use `z.enum([\\\"a\\\", \\\"b\\\"])` with a string-literal union instead.\",\n },\n schema: [],\n messages: {\n nativeEnum:\n '`z.nativeEnum()` exists to wrap a TypeScript `enum`, which `no-enum` bans. Use `z.enum([\"a\", \"b\"])` and derive the union with `z.infer<typeof Schema>`.',\n enumOfTsEnum:\n '`z.enum()` is being passed the TypeScript enum `{{name}}`, which `no-enum` bans. Pass a string-literal array instead: `z.enum([\"a\", \"b\"])`.',\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n if (isIgnoredFile(context.filename, sourceCode.getText())) {\n return {};\n }\n // A test that covers `z.nativeEnum` must call it; see @fileoverview.\n if (isTestFile(context.filename)) {\n return {};\n }\n\n let services: ParserServicesWithTypeInformation | null;\n try {\n services = ESLintUtils.getParserServices(context);\n } catch {\n services = null;\n }\n\n /** Local names imported from a zod module, e.g. `nativeEnum`, `enum_`. */\n const zodImportedNames = new Map<string, string>();\n\n function isZodMemberCall(node: TSESTree.CallExpression, api: string): boolean {\n const callee = node.callee;\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return callee.property.name === api;\n }\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return zodImportedNames.get(callee.name) === api;\n }\n return false;\n }\n\n function buildFix(\n node: TSESTree.CallExpression,\n ): TSESLint.ReportFixFunction | null {\n // A bare `nativeEnum(...)` imported from zod cannot be renamed in place —\n // `enum` is a reserved word, so there is no bare callee to rewrite to.\n // Rewriting only the argument would leave a `nativeEnum` call taking an\n // array, so this shape is report-only.\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const arg = node.arguments[0];\n if (\n arg === undefined ||\n node.arguments.length !== 1 ||\n arg.type === AST_NODE_TYPES.SpreadElement\n ) {\n return null;\n }\n const inner = unwrap(arg);\n if (inner.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n const values = stringValueTexts(inner, sourceCode);\n if (values === null) {\n return null;\n }\n const property = callee.property;\n const replacementArg = `[${values.join(\", \")}]`;\n return (fixer) => [\n fixer.replaceText(property, \"enum\"),\n fixer.replaceText(arg, replacementArg),\n ];\n }\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const spec of node.specifiers) {\n if (\n spec.type === AST_NODE_TYPES.ImportSpecifier &&\n spec.imported.type === AST_NODE_TYPES.Identifier\n ) {\n zodImportedNames.set(spec.local.name, spec.imported.name);\n }\n }\n },\n\n CallExpression(node: TSESTree.CallExpression): void {\n if (isZodMemberCall(node, \"nativeEnum\")) {\n const fix = buildFix(node);\n context.report({\n node,\n messageId: \"nativeEnum\",\n ...(fix === null ? {} : { fix }),\n });\n return;\n }\n\n if (!isZodMemberCall(node, \"enum\")) {\n return;\n }\n const arg = node.arguments[0];\n if (arg === undefined || arg.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const isEnum =\n resolvesToLocalEnum(arg, sourceCode.getScope(arg)) ||\n (services !== null && resolvesToImportedEnum(arg, services));\n if (isEnum) {\n context.report({\n node,\n messageId: \"enumOfTsEnum\",\n data: { name: arg.name },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-constant-time-secret-compare — `===` on a secret short-circuits on the first differing byte, so the response time leaks the secret.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-constant-time-secret-compare.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isAuthSecretName } from \"./_secret-names.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"preferConstantTimeSecretCompare\";\ntype Options = readonly [];\n\nconst EQUALITY_OPERATORS: ReadonlySet<string> = new Set([\"===\", \"!==\", \"==\", \"!=\"]);\n\n/**\n * Identifiers that are compile-time sentinels rather than runtime values.\n * `undefined`/`NaN` make the comparison a presence check; an ALL-CAPS name is a\n * named constant or enum member (`TOKEN_TYPE_SYSTEM`), and timing a compare\n * against a value the attacker already knows leaks nothing.\n */\nconst SENTINEL_IDENTIFIERS: ReadonlySet<string> = new Set([\"undefined\", \"NaN\"]);\n\n/**\n * Words that mark a secret-SHAPED name as a placeholder rather than a live\n * credential: `TOKEN_SENTINEL`, `EMPTY_SECRET`, `PLACEHOLDER_API_KEY`. Comparing\n * against one of these is a presence check, not an authentication check, so it\n * stays excluded even though the secret-name heuristics match it.\n */\nconst SENTINEL_WORDS = /(^|_)(SENTINEL|EMPTY|NONE|NULL|UNSET|MISSING|PLACEHOLDER|DUMMY|FAKE|EXAMPLE)(_|$)/;\n\n/**\n * The camelCase spelling of the same idea: a marker VALUE whose name happens to\n * end in a secret-shaped word. A library exports `skipToken` as a unique\n * `Symbol` and callers test identity against it — there are no bytes to compare\n * and nothing an attacker could learn from the timing.\n */\nconst SENTINEL_PREFIX_RE =\n /^(skip|sentinel|empty|none|missing|unset|placeholder|dummy|fake|example|noop)[A-Z]/;\nconst AST_NODE_TYPE_RE = /^(?:TS|JSX)?[A-Z][A-Za-z]*(?:Signature|Keyword|Expression|Declaration|Element|Literal|Identifier)$/;\n\n/**\n * True when every cased character is upper-case and at least one letter exists —\n * AND the name is not itself secret-shaped.\n *\n * The ALL-CAPS carve-out exists for public named constants (`TOKEN_TYPE_SYSTEM`).\n * But environment secrets are conventionally SCREAMING_SNAKE too\n * (`ADMIN_TOKEN`, `ASHBY_API_KEY`, `SLACK_SIGNING_SECRET`), so an unqualified\n * ALL-CAPS bail-out made this rule blind to essentially every real secret\n * compare: `env.ADMIN_TOKEN === supplied` was silent while the camelCase\n * `env.adminToken === supplied` fired. That is the exact comparison this rule\n * exists to catch. Defer to the shared secret-name heuristics first.\n */\nfunction isConstantReference(identifier: string): boolean {\n if (AST_NODE_TYPE_RE.test(identifier)) return true;\n if (isAuthSecretName(identifier) && !SENTINEL_WORDS.test(identifier)) return false;\n return identifier === identifier.toUpperCase() && /[A-Za-z]/.test(identifier);\n}\n\n/**\n * True when this operand makes the comparison a non-timing-attack surface:\n * any literal (string / number / boolean / null / regex), a template literal\n * with no substitutions, `undefined`/`NaN`, or an ALL-CAPS constant reference.\n */\nfunction isExcludedOperand(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0;\n case AST_NODE_TYPES.Identifier:\n return (\n SENTINEL_IDENTIFIERS.has(node.name) ||\n SENTINEL_PREFIX_RE.test(node.name) ||\n isConstantReference(node.name)\n );\n case AST_NODE_TYPES.MemberExpression:\n return (\n !node.computed &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n (SENTINEL_PREFIX_RE.test(node.property.name) ||\n isConstantReference(node.property.name))\n );\n default:\n return false;\n }\n}\n\n/** The identifier a plain operand denotes, or null for anything else. */\nfunction operandName(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return node.name;\n }\n if (\n node.type === AST_NODE_TYPES.MemberExpression &&\n !node.computed &&\n node.property.type === AST_NODE_TYPES.Identifier\n ) {\n return node.property.name;\n }\n return null;\n}\n\n/**\n * True when the operand names an authenticator worth a constant-time compare.\n *\n * A template literal counts when it interpolates one: `header === \\`Bearer\n * ${adminToken}\\`` is the canonical Workers auth check and is exactly as\n * timing-leaky as comparing the bare token, since the constant prefix only makes\n * the first bytes free.\n */\nfunction isSecretOperand(node: TSESTree.Node): boolean {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n return node.expressions.some((expression) => isSecretOperand(expression));\n }\n const name = operandName(node);\n return name !== null && isAuthSecretName(name);\n}\n\n/** The secret identifier this comparison exposes, for the diagnostic message. */\nfunction secretNameOf(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n for (const expression of node.expressions) {\n const nested = secretNameOf(expression);\n if (nested !== null) {\n return nested;\n }\n }\n return null;\n }\n return operandName(node);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-constant-time-secret-compare\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `===`/`!==` on a secret-like value; short-circuiting comparison leaks the secret through timing. Use a constant-time compare.\",\n },\n schema: [],\n messages: {\n preferConstantTimeSecretCompare:\n \"`{{operator}}` on secret `{{name}}` short-circuits on the first differing byte and leaks it through timing. Compare constant-time instead (`crypto.subtle.timingSafeEqual` over equal-length SHA-256 digests).\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n return {\n BinaryExpression(node: TSESTree.BinaryExpression): void {\n if (!EQUALITY_OPERATORS.has(node.operator)) {\n return;\n }\n const { left, right } = node;\n if (isExcludedOperand(left) || isExcludedOperand(right)) {\n return;\n }\n const secret = [left, right].find((operand) => isSecretOperand(operand));\n if (secret === undefined) {\n return;\n }\n context.report({\n node,\n messageId: \"preferConstantTimeSecretCompare\",\n data: { operator: node.operator, name: secretNameOf(secret) ?? \"\" },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-discriminated-union — a boolean status flag beside many optionals makes illegal states representable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-discriminated-union.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"preferDiscriminatedUnion\";\ntype Options = readonly [];\n\n/**\n * Boolean-typed member names that read as a success/error status discriminant.\n */\nconst STATUS_MEMBER_NAMES: ReadonlySet<string> = new Set([\n \"success\",\n \"ok\",\n \"error\",\n \"failed\",\n \"isError\",\n]);\n\nconst MIN_OPTIONAL_MEMBERS = 2;\n\n/**\n * Returns the property key name for a member if it is a plain identifier or\n * string-literal property signature, otherwise `null`.\n */\nfunction getMemberName(member: TSESTree.TypeElement): string | null {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) {\n return null;\n }\n const { key } = member;\n if (key.type === AST_NODE_TYPES.Identifier) {\n return key.name;\n }\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n}\n\n/**\n * Whether a property signature is annotated with `boolean`.\n */\nfunction isBooleanTyped(member: TSESTree.TSPropertySignature): boolean {\n return (\n member.typeAnnotation?.typeAnnotation.type ===\n AST_NODE_TYPES.TSBooleanKeyword\n );\n}\n\n/**\n * Returns true when the object type literal has BOTH a boolean-typed status\n * member AND at least `MIN_OPTIONAL_MEMBERS` optional members.\n */\nfunction looksLikeMutuallyExclusiveState(\n typeLiteral: TSESTree.TSTypeLiteral,\n): boolean {\n let hasStatusBoolean = false;\n let optionalCount = 0;\n let optionalPayloadCount = 0;\n\n for (const member of typeLiteral.members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) {\n continue;\n }\n\n if (member.optional) {\n optionalCount += 1;\n // A non-boolean optional can land in the wrong branch. All-boolean\n // records are independent flag sets, not state machines.\n if (!isBooleanTyped(member)) {\n optionalPayloadCount += 1;\n }\n }\n\n const name = getMemberName(member);\n if (\n name !== null &&\n STATUS_MEMBER_NAMES.has(name) &&\n isBooleanTyped(member)\n ) {\n hasStatusBoolean = true;\n }\n }\n\n return (\n hasStatusBoolean &&\n optionalCount >= MIN_OPTIONAL_MEMBERS &&\n optionalPayloadCount >= 1\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-discriminated-union\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag object types with a boolean status member and at least two optional members, including a non-boolean payload.\",\n },\n schema: [],\n messages: {\n preferDiscriminatedUnion:\n \"This object type uses a boolean status flag alongside several optional fields, which lets illegal states be representable. Model it as a `z.discriminatedUnion` / discriminated union (e.g. `{ ok: true; data: T } | { ok: false; error: E }`) to make illegal states unrepresentable.\",\n },\n },\n defaultOptions: [],\n create(context) {\n function checkTypeLiteral(\n typeLiteral: TSESTree.TSTypeLiteral,\n reportNode: TSESTree.Node,\n ): void {\n if (looksLikeMutuallyExclusiveState(typeLiteral)) {\n context.report({\n node: reportNode,\n messageId: \"preferDiscriminatedUnion\",\n });\n }\n }\n\n return {\n TSInterfaceDeclaration(\n node: TSESTree.TSInterfaceDeclaration,\n ): void {\n // An interface body is structurally an object type literal; reuse the\n // same membership analysis by treating its `body.body` as members.\n const synthetic: TSESTree.TSTypeLiteral = {\n ...node.body,\n type: AST_NODE_TYPES.TSTypeLiteral,\n members: node.body.body,\n };\n checkTypeLiteral(synthetic, node);\n },\n \"TSTypeAliasDeclaration > TSTypeLiteral\"(\n node: TSESTree.TSTypeLiteral,\n ): void {\n checkTypeLiteral(node, node.parent);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-input-group-search — search fields should use the shared input-group primitive.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-input-group-search.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"preferInputGroup\";\ntype Options = readonly [];\n\nconst INPUT_MODULE = /(?:^|\\/)components\\/ui\\/input$/u;\nconst INPUT_GROUP_MODULE = /(?:^|\\/)components\\/ui\\/input-group$/u;\nconst MAX_JSX_DISTANCE = 2;\n\ninterface Occurrence {\n ancestors: readonly TSESTree.Node[];\n node: TSESTree.JSXOpeningElement;\n}\n\nfunction localNamedImports(\n node: TSESTree.ImportDeclaration,\n importedName: string,\n): string[] {\n return node.specifiers\n .filter(\n (specifier): specifier is TSESTree.ImportSpecifier =>\n specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n (specifier.imported.type === AST_NODE_TYPES.Identifier\n ? specifier.imported.name\n : specifier.imported.value) === importedName,\n )\n .map((specifier) => specifier.local.name);\n}\n\nfunction elementName(node: TSESTree.JSXOpeningElement): string | null {\n return node.name.type === AST_NODE_TYPES.JSXIdentifier\n ? node.name.name\n : null;\n}\n\nfunction jsxAncestors(occurrence: Occurrence): TSESTree.JSXElement[] {\n return occurrence.ancestors.filter(\n (ancestor): ancestor is TSESTree.JSXElement =>\n ancestor.type === AST_NODE_TYPES.JSXElement,\n );\n}\n\nfunction isWithinInputGroup(\n occurrence: Occurrence,\n inputGroupNames: ReadonlySet<string>,\n): boolean {\n return jsxAncestors(occurrence).some((ancestor) =>\n inputGroupNames.has(elementName(ancestor.openingElement) ?? \"\"),\n );\n}\n\nfunction nearestEligibleCommonAncestor(\n search: Occurrence,\n input: Occurrence,\n inputGroupNames: ReadonlySet<string>,\n): TSESTree.JSXElement | null {\n const searchAncestors = jsxAncestors(search);\n const inputAncestorList = jsxAncestors(input);\n const inputAncestors = new Set(inputAncestorList);\n\n for (let index = searchAncestors.length - 1; index >= 0; index -= 1) {\n const ancestor = searchAncestors[index];\n if (ancestor === undefined) continue;\n if (!inputAncestors.has(ancestor)) continue;\n\n const searchDistance = searchAncestors.length - index - 1;\n const inputDistance =\n inputAncestorList.length - inputAncestorList.indexOf(ancestor) - 1;\n if (searchDistance > MAX_JSX_DISTANCE || inputDistance > MAX_JSX_DISTANCE) {\n return null;\n }\n\n if (inputGroupNames.has(elementName(ancestor.openingElement) ?? \"\")) {\n return null;\n }\n return ancestor;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-input-group-search\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require search icons and shared Input controls in the same visual wrapper to use InputGroup.\",\n },\n schema: [],\n messages: {\n preferInputGroup:\n \"Use InputGroup with InputGroupAddon and InputGroupInput for this search field.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const inputNames = new Set<string>();\n const inputGroupNames = new Set<string>();\n const searchNames = new Set<string>();\n const inputs: Occurrence[] = [];\n const searches: Occurrence[] = [];\n\n return {\n ImportDeclaration(node): void {\n const source = String(node.source.value);\n if (source === \"lucide-react\") {\n localNamedImports(node, \"Search\").forEach((name) =>\n searchNames.add(name),\n );\n } else if (INPUT_MODULE.test(source)) {\n localNamedImports(node, \"Input\").forEach((name) =>\n inputNames.add(name),\n );\n } else if (INPUT_GROUP_MODULE.test(source)) {\n localNamedImports(node, \"InputGroup\").forEach((name) =>\n inputGroupNames.add(name),\n );\n }\n },\n JSXOpeningElement(node): void {\n const name = elementName(node);\n if (name === null) return;\n const occurrence = {\n ancestors: context.sourceCode.getAncestors(node),\n node,\n };\n if (searchNames.has(name)) searches.push(occurrence);\n if (inputNames.has(name)) inputs.push(occurrence);\n },\n \"Program:exit\"(): void {\n const reported = new Set<TSESTree.JSXElement>();\n for (const search of searches) {\n if (isWithinInputGroup(search, inputGroupNames)) continue;\n for (const input of inputs) {\n if (isWithinInputGroup(input, inputGroupNames)) continue;\n const wrapper = nearestEligibleCommonAncestor(\n search,\n input,\n inputGroupNames,\n );\n if (wrapper === null || reported.has(wrapper)) continue;\n reported.add(wrapper);\n context.report({\n node: wrapper.openingElement,\n messageId: \"preferInputGroup\",\n });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-module-level-constant — a literal-only collection or regex declared inside a function is rebuilt on every call.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-module-level-constant.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"hoistCollection\" | \"hoistRegex\";\n\ntype Options = readonly [\n {\n minElements?: number;\n checkRegex?: boolean;\n ignoreTestFiles?: boolean;\n }?,\n];\n\nconst DEFAULT_MIN_ELEMENTS = 3;\n\n/** How deep a nested literal may go before we stop trying to prove it static. */\nconst MAX_LITERAL_DEPTH = 4;\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\n/**\n * Methods that mutate the receiver. A call to any of these on the binding is\n * proof the value is meant to be rebuilt per call.\n */\nconst MUTATING_METHODS: ReadonlySet<string> = new Set([\n // Array\n \"push\",\n \"pop\",\n \"shift\",\n \"unshift\",\n \"splice\",\n \"sort\",\n \"reverse\",\n \"fill\",\n \"copyWithin\",\n // Set / Map\n \"add\",\n \"set\",\n \"delete\",\n \"clear\",\n // Object-ish escape hatches\n \"assign\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\nconst COLLECTION_CONSTRUCTORS: ReadonlySet<string> = new Set([\"Set\", \"Map\"]);\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/**\n * A test suite or a story: both keep their fixture tables next to the assertion\n * (or the story) that explains them. Delegated to `_paths` so this rule cannot\n * drift away from the other file-kind-scoped rules again.\n */\nfunction isLocalFixtureFile(filename: string): boolean {\n return isTestFile(filename) || isStoryFile(filename);\n}\n\n/** Unwraps `x as const` / `x satisfies T` down to the inner expression. */\nfunction unwrap(node: TSESTree.Node): TSESTree.Node {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n node.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n return unwrap(node.expression);\n }\n return node;\n}\n\n/** `g` and `y` carry `lastIndex` between calls, so hoisting changes behaviour. */\nconst HAS_STATEFUL_FLAG_RE = /[gy]/;\n\nfunction isRegexLiteral(node: TSESTree.Node): node is TSESTree.RegExpLiteral {\n return (\n node.type === AST_NODE_TYPES.Literal &&\n \"regex\" in node &&\n node.regex !== undefined\n );\n}\n\n/**\n * Whether the expression is built entirely out of literals — no identifier, no\n * call, no member access, no interpolation, no spread. This is the gate that\n * makes hoisting provably safe: a literal-only value cannot capture a\n * parameter, cannot observe call-time state, and cannot have side effects.\n */\nfunction isLiteralOnly(node: TSESTree.Node, depth: number): boolean {\n if (depth > MAX_LITERAL_DEPTH) {\n return false;\n }\n const inner = unwrap(node);\n switch (inner.type) {\n case AST_NODE_TYPES.Literal: {\n // A `RegExpLiteral` is an `AST_NODE_TYPES.Literal`, so without this a\n // stateful regex nested in a collection — `const patterns = [/a/g, /b/]`\n // — bypassed the top-level `g`/`y` check and the recommended hoist would\n // have carried `lastIndex` across calls.\n return !(isRegexLiteral(inner) && HAS_STATEFUL_FLAG_RE.test(inner.regex.flags));\n }\n case AST_NODE_TYPES.TemplateLiteral: {\n return inner.expressions.length === 0;\n }\n case AST_NODE_TYPES.UnaryExpression: {\n return (\n (inner.operator === \"-\" || inner.operator === \"+\") &&\n inner.argument.type === AST_NODE_TYPES.Literal &&\n typeof inner.argument.value === \"number\"\n );\n }\n case AST_NODE_TYPES.ArrayExpression: {\n return inner.elements.every(\n (el) =>\n el !== null &&\n el.type !== AST_NODE_TYPES.SpreadElement &&\n isLiteralOnly(el, depth + 1),\n );\n }\n case AST_NODE_TYPES.ObjectExpression: {\n return inner.properties.every((prop) => {\n if (prop.type !== AST_NODE_TYPES.Property) {\n return false;\n }\n if (prop.shorthand || prop.method || prop.kind !== \"init\") {\n return false;\n }\n if (prop.computed && prop.key.type !== AST_NODE_TYPES.Literal) {\n return false;\n }\n return isLiteralOnly(prop.value, depth + 1);\n });\n }\n default: {\n return false;\n }\n }\n}\n\n/** `Object.freeze(x)` → `x`; anything else is returned untouched. */\nfunction unwrapObjectFreeze(node: TSESTree.Node): TSESTree.Node {\n const inner = unwrap(node);\n if (\n inner.type === AST_NODE_TYPES.CallExpression &&\n inner.callee.type === AST_NODE_TYPES.MemberExpression &&\n !inner.callee.computed &&\n inner.callee.object.type === AST_NODE_TYPES.Identifier &&\n inner.callee.object.name === \"Object\" &&\n inner.callee.property.type === AST_NODE_TYPES.Identifier &&\n inner.callee.property.name === \"freeze\" &&\n inner.arguments.length === 1 &&\n inner.arguments[0] !== undefined &&\n inner.arguments[0].type !== AST_NODE_TYPES.SpreadElement\n ) {\n return unwrap(inner.arguments[0]);\n }\n return inner;\n}\n\ntype Candidate =\n | { kind: \"array\" | \"object\" | \"Set\" | \"Map\"; size: number }\n | { kind: \"regex\"; size: number };\n\n/**\n * Classifies the initializer, or returns null when it is not a hoistable\n * literal-only collection / regex.\n */\nfunction classify(init: TSESTree.Node, checkRegex: boolean): Candidate | null {\n const node = unwrapObjectFreeze(init);\n\n if (isRegexLiteral(node)) {\n if (!checkRegex) {\n return null;\n }\n if (HAS_STATEFUL_FLAG_RE.test(node.regex.flags)) {\n return null;\n }\n return { kind: \"regex\", size: 1 };\n }\n\n if (node.type === AST_NODE_TYPES.ArrayExpression) {\n return isLiteralOnly(node, 0)\n ? { kind: \"array\", size: node.elements.length }\n : null;\n }\n\n if (node.type === AST_NODE_TYPES.ObjectExpression) {\n return isLiteralOnly(node, 0)\n ? { kind: \"object\", size: node.properties.length }\n : null;\n }\n\n if (\n node.type === AST_NODE_TYPES.NewExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n COLLECTION_CONSTRUCTORS.has(node.callee.name)\n ) {\n const arg = node.arguments[0];\n if (\n node.arguments.length !== 1 ||\n arg === undefined ||\n arg.type === AST_NODE_TYPES.SpreadElement\n ) {\n return null;\n }\n const entries = unwrap(arg);\n if (entries.type !== AST_NODE_TYPES.ArrayExpression) {\n return null;\n }\n return isLiteralOnly(entries, 0)\n ? { kind: node.callee.name === \"Set\" ? \"Set\" : \"Map\", size: entries.elements.length }\n : null;\n }\n\n return null;\n}\n\n/** The nearest enclosing function, or null when the node is at module scope. */\nfunction enclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n current = current.parent;\n }\n return null;\n}\n\n/**\n * Built-ins that read their argument and return a fresh value without keeping\n * or mutating the original, so passing the binding to them is still a read.\n */\nconst NON_RETAINING_BUILTINS: ReadonlyMap<string, ReadonlySet<string>> = new Map(\n [\n [\n \"Object\",\n new Set([\"keys\", \"values\", \"entries\", \"freeze\", \"fromEntries\", \"assign\"]),\n ],\n [\"Array\", new Set([\"from\", \"isArray\"])],\n [\"JSON\", new Set([\"stringify\"])],\n ],\n);\n\nfunction isNonRetainingBuiltinCall(\n node: TSESTree.CallExpression,\n argument: TSESTree.Identifier,\n): boolean {\n const callee = node.callee;\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n callee.name === \"structuredClone\"\n ) {\n return true;\n }\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.object.type !== AST_NODE_TYPES.Identifier ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return false;\n }\n const members = NON_RETAINING_BUILTINS.get(callee.object.name);\n if (members === undefined || !members.has(callee.property.name)) {\n return false;\n }\n // `Object.assign(X, src)` mutates its FIRST argument; only later positions\n // (sources) are reads.\n if (callee.object.name === \"Object\" && callee.property.name === \"assign\") {\n return node.arguments[0] !== argument;\n }\n return true;\n}\n\n/**\n * Whether this single reference to the binding is a provably non-mutating,\n * non-escaping read. Anything not on the whitelist is treated as unsafe, so an\n * unrecognised usage suppresses the report rather than risking a bad hoist.\n */\nfunction isSafeRead(identifier: TSESTree.Identifier): boolean {\n const parent = identifier.parent;\n\n if (parent.type === AST_NODE_TYPES.MemberExpression) {\n if (parent.object !== identifier) {\n // `foo[X]` — the binding is used as a key, which is a plain read.\n return true;\n }\n const grandparent = parent.parent;\n // `X.a = 1`, `X[0] = 1`, `X.a += 1`\n if (\n grandparent.type === AST_NODE_TYPES.AssignmentExpression &&\n grandparent.left === parent\n ) {\n return false;\n }\n // `X.a++`\n if (grandparent.type === AST_NODE_TYPES.UpdateExpression) {\n return false;\n }\n // `delete X.a`\n if (\n grandparent.type === AST_NODE_TYPES.UnaryExpression &&\n grandparent.operator === \"delete\"\n ) {\n return false;\n }\n // `X.push(...)`, `X.sort()`, ...\n if (\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n MUTATING_METHODS.has(parent.property.name) &&\n grandparent.type === AST_NODE_TYPES.CallExpression &&\n grandparent.callee === parent\n ) {\n return false;\n }\n // Everything else through a member expression — `X.length`, `X.includes(v)`,\n // `X[i]`, `X.get(k)`, even `arr.map(X.has)` — reads a property of the\n // binding without handing the binding itself out, so it cannot mutate it.\n return true;\n }\n\n // `for (const x of X)` — iteration is a read.\n if (\n parent.type === AST_NODE_TYPES.ForOfStatement &&\n parent.right === identifier\n ) {\n return true;\n }\n\n // `[...X]`, `{...X}`, `f(...X)` — every spread copies, so the original is\n // never handed out and hoisting stays safe.\n if (parent.type === AST_NODE_TYPES.SpreadElement) {\n return true;\n }\n\n // `\"a\" in X`, `X instanceof Y`, `X === undefined`\n if (parent.type === AST_NODE_TYPES.BinaryExpression) {\n return true;\n }\n\n // A bare argument to a built-in that is known not to retain or mutate its\n // input: `Object.entries(X)`, `Array.from(X)`, `JSON.stringify(X)`. Any other\n // call receiving the binding bare is an escape.\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.arguments.includes(identifier) &&\n isNonRetainingBuiltinCall(parent, identifier)\n ) {\n return true;\n }\n\n // `typeof X`, `!X`\n if (\n parent.type === AST_NODE_TYPES.UnaryExpression &&\n parent.operator !== \"delete\"\n ) {\n return true;\n }\n\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-module-level-constant\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Hoist literal-only constant collections and regexes out of function bodies to module scope so they are allocated once.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n minElements: { type: \"number\", minimum: 1 },\n checkRegex: { type: \"boolean\" },\n ignoreTestFiles: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n hoistCollection:\n \"`{{name}}` is a literal-only {{kind}} rebuilt on every call. Hoist it to module scope so it is allocated once and can be reused, exported, and tested.\",\n hoistRegex:\n \"`{{name}}` is a constant regex recompiled on every call. Hoist it to module scope.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const options = optionsArg ?? {};\n const minElements = options.minElements ?? DEFAULT_MIN_ELEMENTS;\n const checkRegex = options.checkRegex ?? true;\n const ignoreTestFiles = options.ignoreTestFiles ?? true;\n\n const sourceCode = context.sourceCode;\n const filename = context.filename;\n\n if (isIgnoredFile(filename, sourceCode.getText())) {\n return {};\n }\n if (ignoreTestFiles && isLocalFixtureFile(filename)) {\n return {};\n }\n\n function allReferencesAreSafeReads(\n declarator: TSESTree.VariableDeclarator,\n ): boolean {\n const variables = sourceCode.getDeclaredVariables(declarator);\n const variable = variables[0];\n if (variable === undefined) {\n return false;\n }\n for (const reference of variable.references) {\n // The initializer write itself is not a usage.\n if (reference.init === true) {\n continue;\n }\n if (reference.isWrite()) {\n return false;\n }\n // A `JSXIdentifier` reference means the constant is rendered as a JSX\n // tag name — not something this rule reasons about, so bail.\n if (reference.identifier.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (!isSafeRead(reference.identifier)) {\n return false;\n }\n }\n return true;\n }\n\n return {\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n const declaration = node.parent;\n if (\n declaration.type !== AST_NODE_TYPES.VariableDeclaration ||\n declaration.kind !== \"const\" ||\n declaration.declare === true\n ) {\n return;\n }\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.init === null) {\n return;\n }\n if (enclosingFunction(node) === null) {\n return;\n }\n\n const candidate = classify(node.init, checkRegex);\n if (candidate === null) {\n return;\n }\n if (candidate.kind !== \"regex\" && candidate.size < minElements) {\n return;\n }\n if (!allReferencesAreSafeReads(node)) {\n return;\n }\n\n context.report({\n node: node.id,\n messageId:\n candidate.kind === \"regex\" ? \"hoistRegex\" : \"hoistCollection\",\n data: { name: node.id.name, kind: candidate.kind },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-module-level-schema — a Zod schema built inside a function is rebuilt on every call, every request, every render.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-module-level-schema.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"hoistSchema\";\n\ntype Options = readonly [\n {\n factories?: readonly string[];\n ignoreTestFiles?: boolean;\n minProperties?: number;\n }?,\n];\n\n/**\n * The object-like composites. Each builds a container plus one schema instance\n * per member, so the per-call cost is real rather than notional.\n */\nconst DEFAULT_FACTORIES: readonly string[] = [\n \"discriminatedUnion\",\n \"intersection\",\n \"looseObject\",\n \"object\",\n \"record\",\n \"strictObject\",\n \"tuple\",\n \"union\",\n];\n\n/**\n * Two, not one — the value the \"deliberately not flagged\" list has always\n * PROMISED and never delivered. The gate is `properties.length <\n * minProperties`, so a default of 1 excludes `z.object({})` and nothing else,\n * while the documented exemption is the one-key inline schema.\n */\nconst DEFAULT_MIN_PROPERTIES = 2;\n\n/** Wrappers that already pay the construction cost exactly once. */\nconst MEMO_CALLEES: ReadonlySet<string> = new Set([\n \"lazy\",\n \"memo\",\n \"once\",\n \"useMemo\",\n]);\n\n/**\n * Methods that CONSUME a value rather than extend the schema. The chain walk\n * stops before them: `z.object({...}).parse(raw)` closes over `raw`, but `raw`\n * is the input, not part of the schema, and the schema in front of it hoists\n * perfectly well.\n */\nconst TERMINAL_METHODS: ReadonlySet<string> = new Set([\n \"isNullable\",\n \"isOptional\",\n \"parse\",\n \"parseAsync\",\n \"safeParse\",\n \"safeParseAsync\",\n \"spa\",\n]);\n\n/**\n * Zod combinator methods that take a schema and return a schema. An enclosing\n * one means the reported factory is a FRAGMENT of a larger schema expression\n * rather than a schema in its own right — `AstroConfigSchema.extend({ … })`\n * is not a `z.*` call, so `isZodCall` cannot see it, and the fragment inside it\n * was reported on its own.\n */\nconst ZOD_COMBINATOR_METHODS: ReadonlySet<string> = new Set([\n \"and\",\n \"array\",\n \"catch\",\n \"catchall\",\n \"default\",\n \"extend\",\n \"merge\",\n \"or\",\n \"pipe\",\n \"refine\",\n \"superRefine\",\n \"transform\",\n]);\n\n/**\n * Callees that render text in the CURRENTLY ACTIVE locale.\n *\n * A zero-argument `() => z.object({ otp: z.string().length(6, t`…`) })` exists\n * PRECISELY so the Lingui macro runs after `i18n.activate(locale)`.\n * `closesOverNothing` skips `ImportBinding` defs, so `t` was invisible and the\n * rule advised a hoist that freezes every validation message in whatever locale\n * happened to be active at module-eval time — a correctness regression, not\n * noise. A tagged template is the macro spelling every i18n library uses.\n */\nconst I18N_CALLEE_NAMES: ReadonlySet<string> = new Set([\n \"$t\",\n \"defineMessage\",\n \"gettext\",\n \"msg\",\n \"ngettext\",\n \"t\",\n \"translate\",\n]);\n\n/** Receivers whose methods render locale-dependent text (`i18n._`, `intl.formatMessage`). */\nconst I18N_RECEIVER_NAMES: ReadonlySet<string> = new Set([\n \"$i18n\",\n \"i18n\",\n \"intl\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n]);\n\n/**\n * The whole schema EXPRESSION, not just the factory call: climb out through\n * `.refine(...)`, `.superRefine(...)`, `.transform(...)`, `.default(...)` and\n * every other builder method applied to it.\n */\nfunction schemaExpression(node: TSESTree.CallExpression): TSESTree.Node {\n let current: TSESTree.Node = node;\n for (;;) {\n const parent: TSESTree.Node | undefined = current.parent ?? undefined;\n if (parent === undefined) {\n return current;\n }\n if (\n parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === current &&\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n TERMINAL_METHODS.has(parent.property.name)\n ) {\n return current;\n }\n if (\n (parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === current) ||\n (parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee === current) ||\n (parent.type === AST_NODE_TYPES.TSAsExpression &&\n parent.expression === current) ||\n (parent.type === AST_NODE_TYPES.TSNonNullExpression &&\n parent.expression === current)\n ) {\n current = parent;\n continue;\n }\n return current;\n }\n}\n\n/** The outermost function ancestor — hoisting targets module scope, not the nearest body. */\nfunction outermostEnclosingFunction(\n node: TSESTree.Node,\n): TSESTree.Node | undefined {\n let outermost: TSESTree.Node | undefined;\n let current: TSESTree.Node | undefined = node.parent ?? undefined;\n while (current !== undefined) {\n if (FUNCTION_TYPES.has(current.type)) {\n outermost = current;\n }\n current = current.parent ?? undefined;\n }\n return outermost;\n}\n\n/** Does any node in `root`'s subtree satisfy `predicate`? */\nfunction subtreeSome(\n root: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n): boolean {\n let found = false;\n const visit = (value: unknown): void => {\n if (found || value === null || typeof value !== \"object\") {\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item);\n }\n return;\n }\n const candidate = value as Partial<TSESTree.Node> & Record<string, unknown>;\n if (typeof candidate.type !== \"string\") {\n return;\n }\n if (predicate(candidate as TSESTree.Node)) {\n found = true;\n return;\n }\n for (const key of Object.keys(candidate)) {\n if (key === \"parent\" || key === \"loc\" || key === \"range\") {\n continue;\n }\n visit(candidate[key]);\n }\n };\n visit(root);\n return found;\n}\n\n/** `this` / `super` / `arguments` anywhere inside pins the schema to its receiver. */\nfunction readsReceiver(node: TSESTree.Node): boolean {\n return subtreeSome(\n node,\n (inner) =>\n inner.type === AST_NODE_TYPES.ThisExpression ||\n inner.type === AST_NODE_TYPES.Super ||\n (inner.type === AST_NODE_TYPES.Identifier && inner.name === \"arguments\"),\n );\n}\n\n/**\n * Does the schema build a string whose VALUE depends on when it is evaluated?\n *\n * See `I18N_CALLEE_NAMES`. Hoisting such a schema moves the render from\n * call time to module-eval time, which is a behaviour change, not a\n * refactor — so this is a hard bail rather than a heuristic penalty.\n */\nfunction buildsLocalizedText(node: TSESTree.Node): boolean {\n return subtreeSome(node, (inner) => {\n if (inner.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return true;\n }\n if (inner.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n const { callee } = inner;\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return I18N_CALLEE_NAMES.has(callee.name);\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n I18N_RECEIVER_NAMES.has(callee.object.name)\n );\n });\n}\n\nfunction collectReferences(\n scope: TSESLint.Scope.Scope,\n out: TSESLint.Scope.Reference[],\n): void {\n out.push(...scope.references);\n for (const child of scope.childScopes) {\n collectReferences(child, out);\n }\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-module-level-schema\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Declare a Zod schema at module scope when it closes over nothing in the enclosing function\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n factories: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Zod factory names to check. Defaults to the object-like composites; add `array` / `enum` to widen.\",\n },\n ignoreTestFiles: {\n type: \"boolean\",\n description:\n \"Skip test files, where a fixture schema belongs next to its assertion.\",\n },\n minProperties: {\n type: \"number\",\n minimum: 0,\n description:\n \"Minimum key count before an object-like schema is reported.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n hoistSchema:\n \"Move this `{{factory}}` schema to module scope. It uses nothing from `{{owner}}`, so it is rebuilt on every call for no benefit and cannot be exported, reused, or `z.infer`-ed from where it is.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const factories = new Set(options?.factories ?? DEFAULT_FACTORIES);\n const ignoreTestFiles = options?.ignoreTestFiles ?? true;\n const minProperties = options?.minProperties ?? DEFAULT_MIN_PROPERTIES;\n\n const sourceCode = context.sourceCode;\n const filename = context.filename;\n if (isGeneratedFile(filename, sourceCode.getText())) {\n return {};\n }\n if (ignoreTestFiles && isTestFile(filename)) {\n return {};\n }\n\n const zodNamespaces = new Set<string>();\n\n function isZodCall(node: TSESTree.Node): node is TSESTree.CallExpression {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n zodNamespaces.has(node.callee.object.name)\n );\n }\n\n function isCovered(node: TSESTree.CallExpression): boolean {\n let current: TSESTree.Node | undefined = node.parent ?? undefined;\n while (current !== undefined) {\n if (\n current !== node &&\n isZodCall(current) &&\n current.callee.type === AST_NODE_TYPES.MemberExpression &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n factories.has(current.callee.property.name)\n ) {\n return true;\n }\n if (\n current.type === AST_NODE_TYPES.CallExpression &&\n ((current.callee.type === AST_NODE_TYPES.Identifier &&\n MEMO_CALLEES.has(current.callee.name)) ||\n (current.callee.type === AST_NODE_TYPES.MemberExpression &&\n !current.callee.computed &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n MEMO_CALLEES.has(current.callee.property.name)))\n ) {\n return true;\n }\n current = current.parent ?? undefined;\n }\n return false;\n }\n\n /**\n * The OUTERMOST schema expression `expression` is a part of.\n *\n * `schemaExpression` climbs the builder chain hanging off the factory call;\n * this climbs the other axis — out of the shape object, the array, and the\n * argument list of whatever Zod construct encloses it. It exists because a\n * reported factory can be a FRAGMENT of a schema that does not itself move,\n * and prising one key's value out of an expression that is rebuilt per call\n * anyway saves nothing.\n */\n function outermostSchemaExpression(\n expression: TSESTree.Node,\n ): TSESTree.Node {\n // `confirmed` only advances past a Zod construct. Walking OUT of a shape\n // object is provisional until the call wrapping it turns out to be one:\n // `tool({ inputSchema: z.object({…}), execute })` also puts a schema in an\n // object literal, and treating that literal as the schema would inherit\n // `execute`'s free variables.\n let confirmed = expression;\n let current = expression;\n for (;;) {\n const parent: TSESTree.Node | undefined = current.parent ?? undefined;\n if (parent === undefined) {\n return confirmed;\n }\n if (\n (parent.type === AST_NODE_TYPES.Property && parent.value === current) ||\n parent.type === AST_NODE_TYPES.ObjectExpression ||\n parent.type === AST_NODE_TYPES.ArrayExpression\n ) {\n current = parent;\n continue;\n }\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.arguments.includes(current as TSESTree.CallExpressionArgument) &&\n isSchemaComposition(parent)\n ) {\n current = schemaExpression(parent);\n confirmed = current;\n continue;\n }\n return confirmed;\n }\n }\n\n /** A `z.*(…)` call, or a Zod combinator method applied to an existing schema. */\n function isSchemaComposition(node: TSESTree.CallExpression): boolean {\n // The combinator test runs FIRST: `isZodCall` is a type predicate, so\n // putting it on the left of `||` narrows `node` to `never` in the right\n // operand and the member access stops compiling.\n const { callee } = node;\n const isCombinator =\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n ZOD_COMBINATOR_METHODS.has(callee.property.name);\n return isCombinator || isZodCall(node);\n }\n\n /** No reference inside the schema resolves to a binding the function owns. */\n function closesOverNothing(\n node: TSESTree.Node,\n enclosing: TSESTree.Node,\n ): boolean {\n const references: TSESLint.Scope.Reference[] = [];\n collectReferences(sourceCode.getScope(node), references);\n const [schemaStart, schemaEnd] = node.range;\n const [functionStart, functionEnd] = enclosing.range;\n for (const reference of references) {\n const [identifierStart] = reference.identifier.range;\n if (identifierStart < schemaStart || identifierStart >= schemaEnd) {\n continue;\n }\n const resolved = reference.resolved;\n if (resolved === null) {\n continue;\n }\n for (const definition of resolved.defs) {\n if (definition.type === \"ImportBinding\") {\n continue;\n }\n const [defStart, defEnd] = definition.node.range;\n // A binding declared INSIDE the schema travels with it. The callback\n // parameters of `.refine((value) => …)` / `.superRefine((data, ctx) =>\n // …)` / `z.preprocess((value) => …, …)` are the whole class, and the\n // enclosing-range test alone answered \"this closes over the function\"\n // for every one of them — so any schema carrying a refinement was\n // silently unreportable. What the documented `documenso` case actually\n // needs is the callback reading an OUTER binding, and that still\n // resolves outside this range and still bails.\n if (defStart >= schemaStart && defEnd <= schemaEnd) {\n continue;\n }\n if (defStart >= functionStart && defEnd <= functionEnd) {\n return false;\n }\n }\n }\n return true;\n }\n\n /** How the enclosing function should be named in the message. */\n function ownerName(enclosing: TSESTree.Node): string {\n const parent = enclosing.parent ?? undefined;\n if (\n enclosing.type === AST_NODE_TYPES.FunctionDeclaration &&\n enclosing.id !== null\n ) {\n return enclosing.id.name;\n }\n if (\n parent !== undefined &&\n parent.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.id.name;\n }\n if (\n parent !== undefined &&\n (parent.type === AST_NODE_TYPES.MethodDefinition ||\n parent.type === AST_NODE_TYPES.Property) &&\n parent.key.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.key.name;\n }\n return \"this function\";\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n CallExpression(node): void {\n if (zodNamespaces.size === 0 || !isZodCall(node)) {\n return;\n }\n const callee = node.callee as TSESTree.MemberExpression;\n if (callee.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const factory = callee.property.name;\n if (!factories.has(factory)) {\n return;\n }\n const enclosing = outermostEnclosingFunction(node);\n if (enclosing === undefined) {\n return;\n }\n if (isCovered(node)) {\n return;\n }\n const shape = node.arguments[0];\n if (\n shape !== undefined &&\n shape.type === AST_NODE_TYPES.ObjectExpression &&\n shape.properties.length < minProperties\n ) {\n return;\n }\n const expression = schemaExpression(node);\n if (readsReceiver(expression)) {\n return;\n }\n if (buildsLocalizedText(expression)) {\n return;\n }\n // A fragment of a schema that cannot itself move is not reportable: the\n // enclosing expression is rebuilt on every call whatever we do to this\n // sub-schema. Only checked when an enclosing construct actually exists,\n // so `z.array(z.object({…}))` — where the whole expression IS hoistable\n // and `z.array` is not itself reportable — keeps reporting the inner\n // `z.object`, as the paired regression test requires.\n const outermost = outermostSchemaExpression(expression);\n if (\n outermost !== expression &&\n (readsReceiver(outermost) ||\n buildsLocalizedText(outermost) ||\n !closesOverNothing(outermost, enclosing))\n ) {\n return;\n }\n if (!closesOverNothing(expression, enclosing)) {\n return;\n }\n context.report({\n node,\n messageId: \"hoistSchema\",\n data: { factory: `z.${factory}`, owner: ownerName(enclosing) },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview _zod — the single source of truth for \"does this name read as a Zod schema?\".\n *\n */\n\n/** The `Z<Capital>` prefix convention: `ZUser`, `ZSubmitForm`. */\nexport const ZOD_PREFIX_RE = /^Z[A-Z]/;\n\n/** The `XxxSchema` suffix convention: `userSchema`, `SubmitFormDataSchema`. */\nexport const ZOD_SUFFIX_RE = /Schema$/;\n\n/** Either accepted convention. */\nexport const ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;\n\n/**\n * Whether an import specifier resolves to Zod — `zod`, `zod/v4`, `zod/mini`,\n * `@hono/zod-validator`-style re-exports. Shared by `prefer-zod-enum` and\n * `prefer-zod-infer` so the two cannot disagree about what \"imports Zod\" means.\n */\nexport function isZodModule(source: string): boolean {\n return /(^|[/@-])zod([/-]|$)/.test(source);\n}\n","/**\n * @fileoverview prefer-native-random-uuid — Node 22's native UUID generator makes the dependency unnecessary for UUID v4 calls.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-native-random-uuid.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"preferNative\" | \"replaceWithNative\";\ntype Options = readonly [];\n\ntype ScopeVariable = TSESLint.Scope.Variable;\n\nfunction requireUuid(node: TSESTree.Node | null): boolean {\n return (\n node?.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\" &&\n node.arguments.length === 1 &&\n node.arguments[0]?.type === AST_NODE_TYPES.Literal &&\n node.arguments[0].value === \"uuid\"\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-native-random-uuid\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.\",\n },\n hasSuggestions: true,\n schema: [],\n messages: {\n preferNative:\n \"Use the Node 22 native `globalThis.crypto.randomUUID()` instead of the `uuid` package for UUID v4.\",\n replaceWithNative: \"Replace this UUID v4 call with the native implementation.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const directBindings = new Set<ScopeVariable>();\n const namespaceBindings = new Set<ScopeVariable>();\n\n function resolve(identifier: TSESTree.Identifier): ScopeVariable | null {\n return ASTUtils.findVariable(context.sourceCode.getScope(identifier), identifier.name);\n }\n\n function record(identifier: TSESTree.Identifier, destination: Set<ScopeVariable>): void {\n const variable = resolve(identifier);\n if (variable !== null) destination.add(variable);\n }\n\n function report(node: TSESTree.CallExpression): void {\n context.report({\n node,\n messageId: \"preferNative\",\n suggest: [\n {\n messageId: \"replaceWithNative\",\n fix: (fixer) => fixer.replaceText(node, \"globalThis.crypto.randomUUID()\"),\n },\n ],\n });\n }\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration): void {\n if (node.source.value !== \"uuid\") return;\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n (specifier.imported.type === AST_NODE_TYPES.Identifier\n ? specifier.imported.name === \"v4\"\n : specifier.imported.value === \"v4\")\n ) {\n record(specifier.local, directBindings);\n } else if (specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier) {\n record(specifier.local, namespaceBindings);\n }\n }\n },\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n if (node.parent.kind !== \"const\" || !requireUuid(node.init)) return;\n if (\n node.init?.type !== AST_NODE_TYPES.CallExpression ||\n node.init.callee.type !== AST_NODE_TYPES.Identifier ||\n (resolve(node.init.callee)?.defs.length ?? 0) > 0\n ) {\n return;\n }\n if (node.id.type === AST_NODE_TYPES.Identifier) {\n record(node.id, namespaceBindings);\n return;\n }\n if (node.id.type !== AST_NODE_TYPES.ObjectPattern) return;\n for (const property of node.id.properties) {\n if (\n property.type === AST_NODE_TYPES.Property &&\n !property.computed &&\n ((property.key.type === AST_NODE_TYPES.Identifier && property.key.name === \"v4\") ||\n (property.key.type === AST_NODE_TYPES.Literal && property.key.value === \"v4\")) &&\n property.value.type === AST_NODE_TYPES.Identifier\n ) {\n record(property.value, directBindings);\n }\n }\n },\n \"CallExpression:exit\"(node: TSESTree.CallExpression): void {\n if (node.arguments.length !== 0) return;\n if (node.callee.type === AST_NODE_TYPES.Identifier) {\n const variable = resolve(node.callee);\n if (variable !== null && directBindings.has(variable)) report(node);\n return;\n }\n if (\n node.callee.type !== AST_NODE_TYPES.MemberExpression ||\n node.callee.computed ||\n node.callee.object.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.name !== \"v4\"\n ) {\n return;\n }\n const variable = resolve(node.callee.object);\n if (variable !== null && namespaceBindings.has(variable)) report(node);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-non-nullable-collection — `T[] | null` gives an empty collection two representations and a null check to every caller.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-non-nullable-collection.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"preferNonNullableCollection\";\ntype Options = readonly [];\n\nconst ARRAY_TYPE_NAMES: ReadonlySet<string> = new Set([\"Array\", \"ReadonlyArray\"]);\n\nfunction propertyName(node: TSESTree.TSPropertySignature | TSESTree.PropertyDefinition): string {\n const key = node.key;\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal) return String(key.value);\n return \"collection\";\n}\n\nfunction isArrayType(node: TSESTree.TypeNode): boolean {\n if (node.type === AST_NODE_TYPES.TSArrayType) return true;\n return (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.Identifier &&\n ARRAY_TYPE_NAMES.has(node.typeName.name)\n );\n}\n\nfunction isNullishType(node: TSESTree.TypeNode): boolean {\n return node.type === AST_NODE_TYPES.TSNullKeyword || node.type === AST_NODE_TYPES.TSUndefinedKeyword;\n}\n\nfunction isNullableArrayOnly(node: TSESTree.TSUnionType): boolean {\n const values = node.types.filter((member) => !isNullishType(member));\n return values.length > 0 && values.length < node.types.length && values.every(isArrayType);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-non-nullable-collection\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require declared data-shape properties and direct aliases to use non-null arrays instead of explicit nullish unions.\",\n },\n schema: [],\n messages: {\n preferNonNullableCollection:\n \"`{{name}}` is a nullable array, so nullish and `[]` represent the same empty collection. Use a non-null array and default omitted values to `[]`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const normalizedFilename = context.filename.replaceAll(\"\\\\\", \"/\");\n if (\n isTestFile(context.filename) ||\n isGeneratedFile(context.filename, context.sourceCode.text) ||\n /\\/(?:vendor|vendored)\\//u.test(normalizedFilename)\n ) {\n return {};\n }\n\n function checkOptionalProperty(\n node: TSESTree.TSPropertySignature | TSESTree.PropertyDefinition,\n ): void {\n if (node.optional) return;\n const annotation = node.typeAnnotation?.typeAnnotation;\n if (annotation === undefined) return;\n if (annotation.type !== AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {\n return;\n }\n context.report({\n node,\n messageId: \"preferNonNullableCollection\",\n data: { name: propertyName(node) },\n });\n }\n\n return {\n TSPropertySignature: checkOptionalProperty,\n PropertyDefinition: checkOptionalProperty,\n TSTypeAliasDeclaration(node): void {\n if (node.typeAnnotation.type !== AST_NODE_TYPES.TSUnionType) return;\n if (!isNullableArrayOnly(node.typeAnnotation)) return;\n context.report({\n node,\n messageId: \"preferNonNullableCollection\",\n data: { name: node.id.name },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-schema-for-api-payload — reading a field off `response.json()` propagates `any` inward from the network boundary.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-schema-for-api-payload.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"unparsedJsonAccess\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** Peel TypeScript wrappers that do not affect the underlying value. */\nconst unwrap = (\n node: TSESTree.Node | null | undefined,\n): TSESTree.Node | null => {\n let current: TSESTree.Node | null | undefined = node;\n while (current !== null && current !== undefined) {\n if (\n current.type === AST_NODE_TYPES.TSAsExpression ||\n current.type === AST_NODE_TYPES.TSTypeAssertion ||\n current.type === AST_NODE_TYPES.TSNonNullExpression ||\n current.type === AST_NODE_TYPES.TSSatisfiesExpression\n ) {\n current = current.expression;\n } else if (current.type === AST_NODE_TYPES.ChainExpression) {\n current = current.expression;\n } else {\n break;\n }\n }\n return current ?? null;\n};\n\n/** Promise methods that preserve an unvalidated payload. */\nconst PROMISE_CHAIN_METHODS: ReadonlySet<string> = new Set([\n \"then\",\n \"catch\",\n \"finally\",\n]);\n\n/** True for `ZUser.parse` / `ZUser.safeParse` handed to a chain link as a callback. */\nconst isSchemaParseReference = (\n node: TSESTree.Node | null | undefined,\n): boolean => {\n const inner = unwrap(node);\n return (\n inner !== null &&\n inner.type === AST_NODE_TYPES.MemberExpression &&\n !inner.computed &&\n inner.property.type === AST_NODE_TYPES.Identifier &&\n (inner.property.name === \"parse\" || inner.property.name === \"safeParse\")\n );\n};\n\n/** Match optionally awaited `.json()` calls and non-local `JSON.parse()` calls. */\nconst isRawPayloadSource = (\n node: TSESTree.Node | null | undefined,\n): boolean => {\n let current = unwrap(node);\n if (current === null) return false;\n if (current.type === AST_NODE_TYPES.AwaitExpression) {\n current = unwrap(current.argument);\n }\n if (current === null || current.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n const callee = unwrap(current.callee);\n if (callee === null || callee.type !== AST_NODE_TYPES.MemberExpression) {\n return false;\n }\n const property = unwrap(callee.property);\n if (property === null || property.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (property.name === \"json\") {\n return true;\n }\n // Promise methods preserve taint unless their callback is a schema parser.\n if (PROMISE_CHAIN_METHODS.has(property.name)) {\n return (\n !current.arguments.some(isSchemaParseReference) &&\n isRawPayloadSource(callee.object)\n );\n }\n // Other `.parse()` calls may be the requested schema validation.\n const object = unwrap(callee.object);\n return (\n property.name === \"parse\" &&\n object !== null &&\n object.type === AST_NODE_TYPES.Identifier &&\n object.name === \"JSON\" &&\n !isLocalFileRead(current.arguments[0])\n );\n};\n\n/** Filesystem readers whose result is repo-local text, not a peer's payload. */\nconst FILE_READ_RE = /^(readFile|readFileSync|readJson|readJsonSync|readJSON)$/;\n\n/** Exempt repository-local JSON read through a recognized filesystem reader. */\nconst isLocalFileRead = (node: TSESTree.Node | null | undefined): boolean => {\n let found = false;\n const visit = (current: TSESTree.Node | null | undefined): void => {\n if (found || current === null || current === undefined) return;\n if (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = unwrap(current.callee);\n const name =\n callee?.type === AST_NODE_TYPES.Identifier\n ? callee.name\n : callee?.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : null;\n if (name !== null && FILE_READ_RE.test(name)) {\n found = true;\n return;\n }\n }\n for (const key of Object.keys(current) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = current[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n }\n };\n visit(node);\n return found;\n};\n\n/** Assertion helpers whose argument is being checked, not consumed. */\nconst ASSERTION_CALLEE_RE = /^(expect|assert|should|invariant)$/;\n\n/** Exempt reads consumed by an assertion such as `expect(value.id).toBe(1)`. */\nconst isInsideAssertion = (node: TSESTree.Node): boolean => {\n for (\n let current: TSESTree.Node | undefined | null = node.parent;\n current !== undefined && current !== null;\n current = current.parent\n ) {\n if (current.type !== AST_NODE_TYPES.CallExpression) continue;\n let callee: TSESTree.Node = current.callee;\n while (callee.type === AST_NODE_TYPES.MemberExpression) {\n callee = callee.object;\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n callee = callee.callee;\n }\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n ASSERTION_CALLEE_RE.test(callee.name)\n ) {\n return true;\n }\n }\n return false;\n};\n\nconst findVariable = (\n scope: Scope.Scope | null,\n name: string,\n): Scope.Variable | null => {\n let current: Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.set.get(name);\n if (variable !== undefined) return variable;\n current = current.upper;\n }\n return null;\n};\n\n/** Names that conventionally identify guards or validators. */\nconst GUARD_NAME_RE = /^(?:is|validate|parse|assert|decode|coerce)[A-Z]/;\n\n/** Exempt a field read used by `typeof`, `Array.isArray`, or a named validator. */\nconst isValidationRead = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | null | undefined = current.parent;\n while (\n parent !== null &&\n parent !== undefined &&\n (parent.type === AST_NODE_TYPES.TSAsExpression ||\n parent.type === AST_NODE_TYPES.TSTypeAssertion ||\n parent.type === AST_NODE_TYPES.TSNonNullExpression ||\n parent.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n parent.type === AST_NODE_TYPES.ChainExpression)\n ) {\n current = parent;\n parent = parent.parent;\n }\n if (parent === null || parent === undefined) return false;\n\n if (\n parent.type === AST_NODE_TYPES.UnaryExpression &&\n parent.operator === \"typeof\" &&\n parent.argument === current\n ) {\n return true;\n }\n if (\n parent.type !== AST_NODE_TYPES.CallExpression ||\n !parent.arguments.some((arg): boolean => arg === current)\n ) {\n return false;\n }\n const callee = parent.callee;\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"Array\" &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"isArray\"\n ) {\n return parent.arguments.length === 1;\n }\n return (\n callee.type === AST_NODE_TYPES.Identifier && GUARD_NAME_RE.test(callee.name)\n );\n};\n\n/** Detect calls in boolean-test positions, including logical wrappers. */\nconst isGuardTestPosition = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | null | undefined = current.parent;\n while (parent !== undefined && parent !== null) {\n switch (parent.type) {\n case AST_NODE_TYPES.UnaryExpression:\n case AST_NODE_TYPES.LogicalExpression:\n case AST_NODE_TYPES.ChainExpression:\n current = parent;\n parent = parent.parent;\n continue;\n case AST_NODE_TYPES.IfStatement:\n case AST_NODE_TYPES.ConditionalExpression:\n case AST_NODE_TYPES.WhileStatement:\n case AST_NODE_TYPES.DoWhileStatement:\n case AST_NODE_TYPES.ForStatement:\n return parent.test === current;\n default:\n return false;\n }\n }\n return false;\n};\n\nconst isUnvalidatedVariableRef = (\n node: TSESTree.Node | null | undefined,\n scope: Scope.Scope,\n tracked: ReadonlySet<Scope.Variable>,\n): boolean => {\n const unwrapped = unwrap(node);\n if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n const variable = findVariable(scope, unwrapped.name);\n return variable !== null && tracked.has(variable);\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-schema-for-api-payload\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access.\",\n },\n schema: [],\n messages: {\n unparsedJsonAccess:\n \"Property access on an unvalidated payload (`response.json()` / `JSON.parse()`) without a schema parse. Pipe through `XSchema.parse(...)` (Zod) before reading fields.\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n // Fixtures and generated clients own validation at a different boundary.\n if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const unvalidatedVariables = new Set<Scope.Variable>();\n\n /** Require every destructured binding to be validated. */\n const isFullyNarrowedPattern = (\n declarator: TSESTree.VariableDeclarator,\n ): boolean => {\n const declared = context.sourceCode.getDeclaredVariables(declarator);\n return (\n declared.length > 0 &&\n declared.every((variable) =>\n variable.references.some((reference) =>\n isValidationRead(reference.identifier),\n ),\n )\n );\n };\n\n const trackInitializer = (\n declarator: TSESTree.VariableDeclarator,\n ): void => {\n if (!isRawPayloadSource(declarator.init)) return;\n const declaredVars = context.sourceCode.getDeclaredVariables(declarator);\n const variable = declaredVars[0];\n if (variable !== undefined) {\n unvalidatedVariables.add(variable);\n }\n };\n\n return {\n VariableDeclarator(node): void {\n const scope = context.sourceCode.getScope(node);\n\n if (node.id.type === AST_NODE_TYPES.Identifier) {\n trackInitializer(node);\n return;\n }\n\n if (\n node.id.type === AST_NODE_TYPES.ObjectPattern ||\n node.id.type === AST_NODE_TYPES.ArrayPattern\n ) {\n if (isRawPayloadSource(node.init)) {\n if (!isFullyNarrowedPattern(node)) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\n }\n return;\n }\n if (\n isUnvalidatedVariableRef(node.init, scope, unvalidatedVariables)\n ) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\n }\n }\n },\n AssignmentExpression(node): void {\n const scope = context.sourceCode.getScope(node);\n\n if (node.left.type === AST_NODE_TYPES.Identifier) {\n const variable = findVariable(scope, node.left.name);\n if (variable === null) return;\n if (isRawPayloadSource(node.right)) {\n unvalidatedVariables.add(variable);\n } else {\n unvalidatedVariables.delete(variable);\n }\n return;\n }\n\n if (\n node.left.type === AST_NODE_TYPES.ObjectPattern ||\n node.left.type === AST_NODE_TYPES.ArrayPattern\n ) {\n if (isRawPayloadSource(node.right)) {\n context.report({\n node: node.left,\n messageId: \"unparsedJsonAccess\",\n });\n return;\n }\n if (\n isUnvalidatedVariableRef(node.right, scope, unvalidatedVariables)\n ) {\n context.report({\n node: node.left,\n messageId: \"unparsedJsonAccess\",\n });\n }\n }\n },\n CallExpression(node): void {\n if (node.callee.type !== AST_NODE_TYPES.Identifier) return;\n if (!GUARD_NAME_RE.test(node.callee.name) && !isGuardTestPosition(node)) {\n return;\n }\n const scope = context.sourceCode.getScope(node);\n for (const arg of node.arguments) {\n if (arg.type === AST_NODE_TYPES.SpreadElement) continue;\n const unwrapped = unwrap(arg);\n if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES.Identifier) {\n continue;\n }\n const variable = findVariable(scope, unwrapped.name);\n if (variable !== null) unvalidatedVariables.delete(variable);\n }\n },\n MemberExpression(node): void {\n if (isInsideAssertion(node)) return;\n if (isValidationRead(node)) return;\n const scope = context.sourceCode.getScope(node);\n const obj = unwrap(node.object);\n\n if (isRawPayloadSource(obj)) {\n // Validation and promise methods are calls, not payload field reads.\n const parent = node.parent;\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee === node &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n (node.property.name === \"parse\" ||\n node.property.name === \"safeParse\" ||\n PROMISE_CHAIN_METHODS.has(node.property.name))\n ) {\n return;\n }\n context.report({ node, messageId: \"unparsedJsonAccess\" });\n return;\n }\n\n if (\n obj !== null &&\n obj.type === AST_NODE_TYPES.Identifier &&\n isUnvalidatedVariableRef(obj, scope, unvalidatedVariables)\n ) {\n context.report({ node, messageId: \"unparsedJsonAccess\" });\n const variable = findVariable(scope, obj.name);\n if (variable !== null) {\n unvalidatedVariables.delete(variable);\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-semantic-colors — a raw palette class or hex literal pins a colour the design system can no longer retheme.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-semantic-colors.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\nimport { existsSync, readdirSync, readFileSync } from \"fs\";\nimport { dirname, join, parse } from \"path\";\n\nimport { createRule } from \"./_docs.js\";\nimport { classTokens, tailwindBase } from \"./_tailwind.js\";\n\ntype MessageIds = \"rawPalette\" | \"arbitraryColor\" | \"inlineColor\";\ntype Options = readonly [\n {\n requireSemanticTokens?: boolean;\n }?,\n];\n\nconst COLOR_PREFIXES =\n \"text|bg|border(?:-[trblxyse])?|ring(?:-offset)?|fill|stroke|from|via|to|divide|decoration|placeholder|accent|caret|shadow|outline\";\nconst PALETTE =\n \"red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone\";\nconst COLOR_FN = \"rgba?|hsla?|hwb|oklch|oklab|lab|lch|color\";\n\nconst PALETTE_STEP = \"50|[1-9]00|950\";\nconst RAW_PALETTE_RE = new RegExp(`^(?:${COLOR_PREFIXES})-(?:${PALETTE})-(?:${PALETTE_STEP})(?:/\\\\d{1,3})?$`);\nconst ARBITRARY_COLOR_RE = new RegExp(\n `^(?:${COLOR_PREFIXES})-\\\\[(?:#[0-9a-fA-F]{3,8}|(?:${COLOR_FN})\\\\([^\\\\]]*\\\\))\\\\]$`,\n \"i\",\n);\n\n/** Call expressions whose string args are className fragments. */\nconst CLASS_FNS = new Set<string>([\"cn\", \"clsx\", \"cva\", \"tv\", \"cx\", \"twMerge\", \"classnames\", \"classNames\"]);\nconst CLASS_NAME_RE = /class/i;\n\n/** CSS color-bearing properties, in their JSX (camelCase) and SVG-attribute forms. */\nconst STYLE_COLOR_PROPS = new Set<string>([\n \"color\",\n \"background\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"outlineColor\",\n \"caretColor\",\n \"textDecorationColor\",\n \"columnRuleColor\",\n \"fill\",\n \"stroke\",\n \"stopColor\",\n \"floodColor\",\n \"lightingColor\",\n]);\nconst RAW_COLOR_VALUE_RE = new RegExp(`#[0-9a-fA-F]{3,8}\\\\b|\\\\b(?:${COLOR_FN})\\\\s*\\\\(`, \"i\");\n\nconst CSS_VAR_REFERENCE_RE = /var\\(\\s*--/;\n\nconst STORIES_FILE_RE = /\\.stories\\.[cm]?[jt]sx?$/i;\n\n/** Broad token roles avoid silently disabling the rule for non-shadcn systems. */\nconst TOKEN_ROLES =\n \"background|foreground|primary|secondary|muted|accent|destructive|danger|success|warning|info|border|card|popover|surface|content|base|subtle|default|ring|input|fg|bg\";\nconst SEMANTIC_TOKEN_RE = new RegExp(\n `--(?:color-)?(?:${TOKEN_ROLES})\\\\b|(?:bg|text|border|ring|fill|stroke)-(?:ui-)?(?:${TOKEN_ROLES})\\\\b`,\n);\n\n/** Tailwind v4 declares its theme in CSS instead of a config file. */\nconst THEME_BLOCK_RE = /@theme\\b/;\n\n/** These files prove a token system exists even when its vocabulary comes from a preset. */\nconst PRESENCE_MARKERS = [\n \"components.json\",\n \"tailwind.config.js\",\n \"tailwind.config.cjs\",\n \"tailwind.config.mjs\",\n \"tailwind.config.ts\",\n \"tailwind.config.mts\",\n \"tailwind.config.cts\",\n];\n\n/** Stylesheets count only when their contents declare semantic tokens or an `@theme`. */\nconst CSS_DETECTION_FILES = [\n \"app/globals.css\",\n \"app/global.css\",\n \"app/styles/globals.css\",\n \"src/app/globals.css\",\n \"src/app/global.css\",\n \"src/global.css\",\n \"src/index.css\",\n \"src/styles/globals.css\",\n \"src/styles/index.css\",\n \"styles/globals.css\",\n \"styles/index.css\",\n];\n/** Workspace markers used when no `package.json#workspaces` declaration exists. */\nconst WORKSPACE_ROOT_FILES = [\n \"pnpm-workspace.yaml\",\n \"pnpm-workspace.yml\",\n \"turbo.json\",\n \"lerna.json\",\n];\n\n/** Where workspace packages live when the root declares no globs, or none parse. */\nconst DEFAULT_WORKSPACE_GLOBS = [\"packages/*\", \"apps/*\"];\n\n/** Upper bound on the sideways scan, so a huge monorepo cannot stall a lint run. */\nconst MAX_WORKSPACE_PACKAGES = 512;\n\n/** \"Is there a detection file at or above this directory?\" — a pure ancestry fact. */\nconst ancestryCache = new Map<string, boolean>();\n\n/** \"Does any package of this workspace carry a detection file?\", keyed by root. */\nconst workspaceScanCache = new Map<string, boolean>();\n\n/** Nearest workspace root at or above a directory, `null` if there is none. */\nconst workspaceRootCache = new Map<string, string | null>();\n\n/** SVG container elements whose children carry structural (not UI-token) colors. */\nconst SVG_DEFS_CONTAINERS = new Set<string>([\n \"mask\",\n \"clipPath\",\n \"defs\",\n \"pattern\",\n \"linearGradient\",\n \"radialGradient\",\n]);\n\n/** Neutral fill/stroke literals that are SVG drawing data, never a UI token. */\nconst SVG_EXEMPT_COLOR_VALUES = new Set<string>([\n \"#fff\",\n \"#ffffff\",\n \"#000\",\n \"#000000\",\n \"transparent\",\n \"none\",\n \"currentcolor\",\n \"inherit\",\n]);\n\n// SVG subtree colors are artwork data rather than reusable UI tokens.\nfunction jsxElementName(node: TSESTree.JSXElement): string | null {\n const name = node.openingElement.name;\n if (name.type === AST_NODE_TYPES.JSXIdentifier) return name.name;\n if (name.type === AST_NODE_TYPES.JSXMemberExpression && name.property.type === AST_NODE_TYPES.JSXIdentifier) {\n return name.property.name;\n }\n return null;\n}\n\nfunction isSvgLikeElementName(name: string): boolean {\n return name === \"svg\" || SVG_DEFS_CONTAINERS.has(name) || /svg$/i.test(name);\n}\n\n/** Intrinsic SVG shapes carry artwork colors; `className` and `style` remain checked. */\nconst SVG_SHAPE_PRIMITIVES = new Set<string>([\n \"circle\",\n \"ellipse\",\n \"g\",\n \"line\",\n \"path\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"text\",\n \"tspan\",\n \"use\",\n]);\n\n/** Email and PDF renderers cannot resolve CSS-variable-backed semantic tokens. */\nconst EMAIL_OR_PDF_MODULE_RE = /^@react-(?:email|pdf)\\//;\n\nconst isInsideSvg = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node | null | undefined = node.parent;\n while (current !== undefined && current !== null) {\n if (current.type === AST_NODE_TYPES.JSXElement) {\n const name = jsxElementName(current);\n if (name !== null && isSvgLikeElementName(name)) return true;\n }\n current = current.parent;\n }\n return false;\n};\n\nconst isInsideIconFactoryPath = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node | null | undefined = node.parent;\n while (current !== undefined && current !== null) {\n if (\n current.type === AST_NODE_TYPES.Property &&\n propName(current.key) === \"path\" &&\n current.parent.type === AST_NODE_TYPES.ObjectExpression &&\n current.parent.parent.type === AST_NODE_TYPES.CallExpression &&\n current.parent.parent.callee.type === AST_NODE_TYPES.Identifier &&\n current.parent.parent.callee.name === \"createIcon\"\n ) {\n return true;\n }\n current = current.parent;\n }\n return false;\n};\n\n/** Does this one directory carry a design-token marker? */\nconst hasMarkerAt = (dir: string): boolean => {\n if (PRESENCE_MARKERS.some((rel) => existsSync(join(dir, rel)))) return true;\n for (const rel of CSS_DETECTION_FILES) {\n const candidate = join(dir, rel);\n if (!existsSync(candidate)) continue;\n try {\n const css = readFileSync(candidate, \"utf8\");\n if (SEMANTIC_TOKEN_RE.test(css) || THEME_BLOCK_RE.test(css)) return true;\n } catch {\n // Ignore unreadable stylesheets; absence of evidence means no report.\n }\n }\n return false;\n};\n\n/** Walk to the filesystem root and cache the resolved ancestry answer. */\nconst hasMarkerAtOrAbove = (startDir: string): boolean => {\n let dir = startDir;\n const root = parse(dir).root;\n const visited: string[] = [];\n let answer: boolean;\n\n for (;;) {\n const cached = ancestryCache.get(dir);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n visited.push(dir);\n if (hasMarkerAt(dir)) {\n answer = true;\n break;\n }\n const parent = dirname(dir);\n if (dir === root || parent === dir) {\n answer = false;\n break;\n }\n dir = parent;\n }\n\n for (const seen of visited) ancestryCache.set(seen, answer);\n return answer;\n};\n\n/** Read workspace globs without adding a YAML dependency to the rule. */\nconst readWorkspaceGlobs = (dir: string): string[] => {\n const globs: string[] = [];\n\n const packageJson = join(dir, \"package.json\");\n if (existsSync(packageJson)) {\n try {\n const parsed: unknown = JSON.parse(readFileSync(packageJson, \"utf8\"));\n const declared =\n typeof parsed === \"object\" && parsed !== null && \"workspaces\" in parsed\n ? (parsed as { workspaces?: unknown }).workspaces\n : undefined;\n const list = Array.isArray(declared)\n ? declared\n : typeof declared === \"object\" &&\n declared !== null &&\n Array.isArray((declared as { packages?: unknown }).packages)\n ? (declared as { packages: unknown[] }).packages\n : [];\n for (const entry of list) if (typeof entry === \"string\") globs.push(entry);\n } catch {\n // A malformed package.json is not this rule's problem to report.\n }\n }\n\n for (const name of [\"pnpm-workspace.yaml\", \"pnpm-workspace.yml\"]) {\n const yaml = join(dir, name);\n if (!existsSync(yaml)) continue;\n try {\n for (const line of readFileSync(yaml, \"utf8\").split(\"\\n\")) {\n const match = /^\\s*-\\s*[\"']?([^\"'#\\s]+)[\"']?\\s*$/u.exec(line);\n if (match?.[1] !== undefined) globs.push(match[1]);\n }\n } catch {\n // Same.\n }\n }\n\n return globs;\n};\n\n/** Expand a workspace glob one level: `packages/*`, `packages/**`, or a literal path. */\nconst expandWorkspaceGlob = (root: string, glob: string): string[] => {\n const star = glob.indexOf(\"*\");\n if (star === -1) return [join(root, glob)];\n\n const prefix = glob.slice(0, star).replace(/\\/$/u, \"\");\n const parent = prefix === \"\" ? root : join(root, prefix);\n try {\n return readdirSync(parent, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith(\".\"))\n .map((entry) => join(parent, entry.name));\n } catch {\n return [];\n }\n};\n\n/** Nearest directory at or above `startDir` that declares a multi-package workspace. */\nconst findWorkspaceRoot = (startDir: string): string | null => {\n let dir = startDir;\n const root = parse(dir).root;\n const visited: string[] = [];\n let answer: string | null;\n\n for (;;) {\n const cached = workspaceRootCache.get(dir);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n visited.push(dir);\n if (\n WORKSPACE_ROOT_FILES.some((name) => existsSync(join(dir, name))) ||\n readWorkspaceGlobs(dir).length > 0\n ) {\n answer = dir;\n break;\n }\n const parent = dirname(dir);\n if (dir === root || parent === dir) {\n answer = null;\n break;\n }\n dir = parent;\n }\n\n for (const seen of visited) workspaceRootCache.set(seen, answer);\n return answer;\n};\n\n/** Scan sibling packages because their token config is not on the source file's ancestry. */\nconst workspaceHasMarker = (root: string): boolean => {\n const cached = workspaceScanCache.get(root);\n if (cached !== undefined) return cached;\n\n const globs = readWorkspaceGlobs(root);\n const candidates = new Set<string>();\n for (const glob of globs.length > 0 ? globs : DEFAULT_WORKSPACE_GLOBS) {\n for (const dir of expandWorkspaceGlob(root, glob)) {\n candidates.add(dir);\n if (candidates.size >= MAX_WORKSPACE_PACKAGES) break;\n }\n if (candidates.size >= MAX_WORKSPACE_PACKAGES) break;\n }\n\n let found = false;\n for (const dir of candidates) {\n if (hasMarkerAt(dir)) {\n found = true;\n break;\n }\n }\n workspaceScanCache.set(root, found);\n return found;\n};\n\n/** Does a design-token system exist anywhere this file's project can see? */\nconst hasSemanticTokenSystem = (filename: string): boolean => {\n const dir = dirname(filename);\n if (hasMarkerAtOrAbove(dir)) return true;\n const root = findWorkspaceRoot(dir);\n return root !== null && workspaceHasMarker(root);\n};\n\nconst propName = (key: TSESTree.Property[\"key\"]): string | null => {\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") return key.value;\n return null;\n};\n\nconst staticallyImportsEmailOrPdfRenderer = (program: TSESTree.Program): boolean =>\n program.body.some((statement) => {\n if (\n statement.type !== AST_NODE_TYPES.ImportDeclaration &&\n statement.type !== AST_NODE_TYPES.ExportNamedDeclaration &&\n statement.type !== AST_NODE_TYPES.ExportAllDeclaration\n ) {\n return false;\n }\n return (\n statement.source !== null &&\n typeof statement.source.value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(statement.source.value)\n );\n });\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-semantic-colors\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce design-system semantic color tokens (bg-primary, text-destructive, …) over raw Tailwind palette classes (text-red-500), arbitrary color values (bg-[#fff]), and inline color literals.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n requireSemanticTokens: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n rawPalette:\n \"Raw palette class '{{class}}' — use a semantic token (e.g. text-foreground, bg-primary, text-destructive, bg-muted).\",\n arbitraryColor:\n \"Hardcoded color '{{class}}' — use a semantic token, or var(--…). For charts/brand add an eslint-disable with a reason.\",\n inlineColor:\n \"Hardcoded color '{{value}}' — use a semantic token / CSS variable. For charts/standalone pages add an eslint-disable with a reason.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n if (STORIES_FILE_RE.test(context.filename)) return {};\n if (staticallyImportsEmailOrPdfRenderer(context.sourceCode.ast)) return {};\n if (options?.requireSemanticTokens === true && !hasSemanticTokenSystem(context.filename)) {\n return {};\n }\n\n let importsEmailOrPdfRenderer = false;\n const pendingReports: Array<{\n node: TSESTree.Node;\n messageId: MessageIds;\n data: Record<string, string>;\n }> = [];\n const report = (\n node: TSESTree.Node,\n messageId: MessageIds,\n data: Record<string, string>,\n ): void => {\n pendingReports.push({ node, messageId, data });\n };\n\n const reportClasses = (value: string, node: TSESTree.Node): void => {\n for (const token of classTokens(value)) {\n const base = tailwindBase(token);\n if (RAW_PALETTE_RE.test(base)) {\n report(node, \"rawPalette\", { class: token });\n } else if (ARBITRARY_COLOR_RE.test(base) && !CSS_VAR_REFERENCE_RE.test(base)) {\n report(node, \"arbitraryColor\", { class: token });\n }\n }\n };\n\n // Recurse through class fragments but leave calls to the CallExpression visitor.\n const checkClassNode = (node: TSESTree.Node | null): void => {\n if (node === null) return;\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n if (typeof node.value === \"string\") reportClasses(node.value, node);\n break;\n case AST_NODE_TYPES.TemplateLiteral:\n for (const quasi of node.quasis) reportClasses(quasi.value.cooked ?? \"\", quasi);\n break;\n case AST_NODE_TYPES.ArrayExpression:\n for (const element of node.elements) {\n if (element !== null && element.type !== AST_NODE_TYPES.SpreadElement) checkClassNode(element);\n }\n break;\n case AST_NODE_TYPES.ObjectExpression:\n for (const property of node.properties) {\n if (property.type === AST_NODE_TYPES.Property) checkClassNode(property.value);\n }\n break;\n case AST_NODE_TYPES.ConditionalExpression:\n checkClassNode(node.consequent);\n checkClassNode(node.alternate);\n break;\n case AST_NODE_TYPES.LogicalExpression:\n checkClassNode(node.right);\n break;\n default:\n break;\n }\n };\n\n const checkColorValueNode = (node: TSESTree.Node): void => {\n if (\n node.type === AST_NODE_TYPES.Literal &&\n typeof node.value === \"string\" &&\n RAW_COLOR_VALUE_RE.test(node.value) &&\n !CSS_VAR_REFERENCE_RE.test(node.value)\n ) {\n report(node, \"inlineColor\", { value: node.value });\n }\n };\n\n return {\n \"JSXAttribute[name.name='className']\"(node: TSESTree.JSXAttribute): void {\n if (node.value === null) return;\n if (node.value.type === AST_NODE_TYPES.Literal) checkClassNode(node.value);\n else if (node.value.type === AST_NODE_TYPES.JSXExpressionContainer) {\n if (node.value.expression.type !== AST_NODE_TYPES.JSXEmptyExpression) {\n checkClassNode(node.value.expression);\n }\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\" &&\n node.arguments[0]?.type === AST_NODE_TYPES.Literal &&\n typeof node.arguments[0].value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)\n ) {\n importsEmailOrPdfRenderer = true;\n }\n if (node.callee.type === AST_NODE_TYPES.Identifier && CLASS_FNS.has(node.callee.name)) {\n for (const arg of node.arguments) {\n if (arg.type !== AST_NODE_TYPES.SpreadElement) checkClassNode(arg);\n }\n }\n },\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n if (node.id.type === AST_NODE_TYPES.Identifier && CLASS_NAME_RE.test(node.id.name)) {\n checkClassNode(node.init);\n }\n },\n Property(node: TSESTree.Property): void {\n const name = propName(node.key);\n if (name !== null && CLASS_NAME_RE.test(name)) checkClassNode(node.value);\n },\n // SVG artwork colors are exempt; component presentation colors still report.\n \"JSXAttribute[name.name=/^(fill|stroke|color)$/]\"(node: TSESTree.JSXAttribute): void {\n if (node.value?.type !== AST_NODE_TYPES.Literal) return;\n const owner = node.parent.name;\n if (owner.type === AST_NODE_TYPES.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {\n return;\n }\n if (\n typeof node.value.value === \"string\" &&\n SVG_EXEMPT_COLOR_VALUES.has(node.value.value.toLowerCase())\n ) {\n return;\n }\n if (isInsideSvg(node) || isInsideIconFactoryPath(node)) return;\n checkColorValueNode(node.value);\n },\n \"JSXAttribute[name.name='style'] ObjectExpression > Property\"(node: TSESTree.Property): void {\n const name = propName(node.key);\n if (name !== null && STYLE_COLOR_PROPS.has(name)) checkColorValueNode(node.value);\n },\n ImportExpression(node: TSESTree.ImportExpression): void {\n if (\n node.source.type === AST_NODE_TYPES.Literal &&\n typeof node.source.value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(node.source.value)\n ) {\n importsEmailOrPdfRenderer = true;\n }\n },\n \"Program:exit\"(): void {\n if (importsEmailOrPdfRenderer) return;\n for (const descriptor of pendingReports) context.report(descriptor);\n },\n };\n },\n});\n","/**\n * @fileoverview _tailwind — shared className-position helpers, so the Tailwind rules visit string literals and template quasis alike.\n *\n */\n\n/**\n * Strip Tailwind variant prefixes (`hover:`, `dark:`, `focus-visible:`, …) and a\n * leading `!` important marker, leaving the bare utility. Variants are\n * `[a-z0-9-]+:` runs at the start; a bracketed arbitrary value never starts a\n * token, so the `:` inside `[url(http://…)]` is not a variant separator.\n */\nexport const tailwindBase = (token: string): string =>\n token.replace(/^(?:[a-z0-9-]+:)+/i, \"\").replace(/^!/, \"\");\n\n/** Split a className string into its non-empty class tokens. */\nexport const classTokens = (value: string): readonly string[] =>\n value.split(/\\s+/).filter(Boolean);\n","/**\n * @fileoverview prefer-server-actions — an internal `/api/*` mutation hand-rolls the transport, types and error path a Server Action gets from the framework.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-server-actions.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"preferServerAction\";\ntype Options = readonly [];\n\nconst MUTATION_METHODS = new Set([\"POST\", \"PUT\", \"DELETE\", \"PATCH\"]);\nconst AXIOS_MUTATION_METHODS = new Set([\"post\", \"put\", \"delete\", \"patch\"]);\n\nconst SKIP_FILE_REGEX =\n /(?:\\.test\\.[jt]sx?$|\\.spec\\.[jt]sx?$|-(?:test|spec)\\.[jt]sx?$|\\/tests?\\/|\\/__tests__\\/|\\/__testfixtures__\\/|\\/scripts?\\/|\\/app\\/api\\/.*\\/route\\.[jt]sx?$|\\/pages\\/api\\/)/;\n\nconst NON_REACT_FRAMEWORK_RE =\n /^(?:@angular\\/|@nestjs\\/|vue$|vue\\/|svelte$|svelte\\/|solid-js$|solid-js\\/|@ember\\/|rxjs$|rxjs\\/)/;\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\nfunction getScope(\n context: Ctx,\n node: TSESTree.Node,\n): Scope.Scope {\n return context.sourceCode.getScope(node);\n}\n\n/**\n * Walk up the scope chain looking for a variable declared with a single\n * initializer; if found, return the initializer expression so we can analyze\n * it. Falls back to the original node when resolution is not possible.\n */\nfunction resolveNode(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): TSESTree.Node | null {\n if (!node) return null;\n if (node.type !== \"Identifier\") return node;\n\n let scope: Scope.Scope | null = getScope(context, node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable && variable.defs.length === 1) {\n const def = variable.defs[0];\n if (def && def.type === \"Variable\") {\n const declarator = def.node;\n if (\n declarator.type === \"VariableDeclarator\" &&\n declarator.init\n ) {\n return declarator.init;\n }\n }\n }\n scope = scope.upper;\n }\n return node;\n}\n\nfunction isApiUrl(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (!resolved) return false;\n\n if (resolved.type === \"Literal\" && typeof resolved.value === \"string\") {\n return resolved.value.startsWith(\"/api/\");\n }\n if (resolved.type === \"TemplateLiteral\") {\n const firstQuasi = resolved.quasis[0];\n const cooked = firstQuasi?.value.cooked;\n return typeof cooked === \"string\" && cooked.startsWith(\"/api/\");\n }\n if (resolved.type === \"BinaryExpression\" && resolved.operator === \"+\") {\n return isApiUrl(resolved.left, context);\n }\n return false;\n}\n\nfunction isMutationMethod(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (!resolved) return false;\n\n if (resolved.type === \"Literal\" && typeof resolved.value === \"string\") {\n return MUTATION_METHODS.has(resolved.value.toUpperCase());\n }\n\n if (\n resolved.type === \"TemplateLiteral\" &&\n resolved.expressions.length === 0\n ) {\n const val = resolved.quasis.map((q) => q.value.cooked).join(\"\");\n return MUTATION_METHODS.has(val.toUpperCase());\n }\n\n if (resolved.type === \"ConditionalExpression\") {\n return (\n isMutationMethod(resolved.consequent, context) ||\n isMutationMethod(resolved.alternate, context)\n );\n }\n\n if (resolved.type === \"LogicalExpression\" && resolved.operator === \"||\") {\n return (\n isMutationMethod(resolved.left, context) ||\n isMutationMethod(resolved.right, context)\n );\n }\n\n return false;\n}\n\nfunction isFunctionArgument(\n node: TSESTree.CallExpressionArgument,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (\n resolved?.type === \"ArrowFunctionExpression\" ||\n resolved?.type === \"FunctionExpression\"\n ) {\n return true;\n }\n if (node.type !== \"Identifier\") return false;\n\n let scope: Scope.Scope | null = getScope(context, node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (\n variable?.defs.some((definition) => definition.type === \"FunctionName\")\n ) {\n return true;\n }\n scope = scope.upper;\n }\n return false;\n}\n\nfunction getPropertyNode(\n objNode: TSESTree.Node | null | undefined,\n propName: string,\n): TSESTree.Node | null {\n if (!objNode || objNode.type !== \"ObjectExpression\") return null;\n for (const prop of objNode.properties) {\n if (prop.type !== \"Property\") continue;\n let keyName: string | null = null;\n if (prop.key.type === \"Identifier\" && !prop.computed) {\n keyName = prop.key.name;\n } else if (\n prop.key.type === \"Literal\" &&\n typeof prop.key.value === \"string\"\n ) {\n keyName = prop.key.value;\n }\n if (keyName === propName) {\n // Skip destructuring patterns — they're not valid as config values.\n if (\n prop.value.type === \"AssignmentPattern\" ||\n prop.value.type === \"ArrayPattern\" ||\n prop.value.type === \"ObjectPattern\"\n ) {\n return null;\n }\n return prop.value;\n }\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-server-actions\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Prefer Next.js Server Actions over /api/* mutations.\",\n },\n schema: [],\n messages: {\n preferServerAction:\n \"Mutation against /api/* — prefer a Next.js Server Action for type-safety and to avoid the JSON round-trip.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (SKIP_FILE_REGEX.test(filename)) {\n return {};\n }\n\n const isNonReactFramework = context.sourceCode.ast.body.some(\n (node) =>\n node.type === \"ImportDeclaration\" &&\n typeof node.source.value === \"string\" &&\n NON_REACT_FRAMEWORK_RE.test(node.source.value),\n );\n\n return {\n CallExpression(node) {\n if (isNonReactFramework) return;\n let isMutation = false;\n\n // 1. Standard fetch('/api/orders', { method: 'POST' })\n if (\n node.callee.type === \"Identifier\" &&\n node.callee.name === \"fetch\"\n ) {\n const urlArg = node.arguments[0];\n if (urlArg && urlArg.type !== \"SpreadElement\" && isApiUrl(urlArg, context)) {\n const initArg = node.arguments[1];\n if (initArg && initArg.type !== \"SpreadElement\") {\n const resolvedInit = resolveNode(initArg, context);\n const methodNode = getPropertyNode(resolvedInit, \"method\");\n if (methodNode && isMutationMethod(methodNode, context)) {\n isMutation = true;\n }\n }\n }\n }\n // 2. Custom wrappers or Axios: api.post('/api/orders') or axios.put('/api/orders')\n else if (\n node.callee.type === \"MemberExpression\" &&\n node.callee.property.type === \"Identifier\" &&\n !node.callee.computed\n ) {\n const methodName = node.callee.property.name.toLowerCase();\n if (AXIOS_MUTATION_METHODS.has(methodName)) {\n const urlArg = node.arguments[0];\n const hasHandlerArg = node.arguments.some(\n (arg) =>\n arg.type !== \"SpreadElement\" &&\n isFunctionArgument(arg, context),\n );\n if (\n urlArg &&\n urlArg.type !== \"SpreadElement\" &&\n !hasHandlerArg &&\n isApiUrl(urlArg, context)\n ) {\n isMutation = true;\n }\n }\n }\n // 3. Direct axios/request call: axios({ method: 'post', url: '/api/orders' })\n else if (\n node.callee.type === \"Identifier\" &&\n (node.callee.name === \"axios\" || node.callee.name === \"request\")\n ) {\n const firstArg = node.arguments[0];\n if (firstArg && firstArg.type !== \"SpreadElement\") {\n const configArg = resolveNode(firstArg, context);\n if (configArg && configArg.type === \"ObjectExpression\") {\n const urlNode = getPropertyNode(configArg, \"url\");\n const methodNode = getPropertyNode(configArg, \"method\");\n if (\n urlNode &&\n isApiUrl(urlNode, context) &&\n methodNode &&\n isMutationMethod(methodNode, context)\n ) {\n isMutation = true;\n }\n }\n }\n }\n\n if (isMutation) {\n context.report({ node, messageId: \"preferServerAction\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-single-sentence-comment — two sentences should be reduced to one.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-single-sentence-comment.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { proseGroups, sentenceUnits } from \"./_prose-budget.js\";\n\ntype MessageIds = \"preferOneSentence\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-single-sentence-comment\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Prefer one sentence and self-documenting code over a two-sentence comment.\" },\n schema: [],\n messages: {\n preferOneSentence: \"Two-sentence comment — prefer one sentence and self-documenting code.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode)) {\n if (!group.hasTypedTags && sentenceUnits(group.text) === 2) {\n context.report({ node: group.comment, messageId: \"preferOneSentence\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-string-literal-union — a raw `string` field with a closed set of values accepts every value outside it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-string-literal-union.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport {\n ESLintUtils,\n type TSESTree,\n type ParserServicesWithTypeInformation,\n AST_NODE_TYPES,\n} from \"@typescript-eslint/utils\";\nimport * as ts from \"typescript\";\n\ntype MessageIds = \"bareChoiceField\" | \"comparisonCluster\";\ntype Options = readonly [\n {\n ignoreFields?: readonly string[];\n }?,\n];\n\ntype FunctionNode =\n | TSESTree.FunctionDeclaration\n | TSESTree.FunctionExpression\n | TSESTree.ArrowFunctionExpression;\n\nconst CHOICE_TOKENS: ReadonlySet<string> = new Set([\n \"status\",\n \"state\",\n \"kind\",\n \"role\",\n \"priority\",\n \"severity\",\n \"direction\",\n \"tier\",\n \"stage\",\n \"type\",\n \"mode\",\n \"level\",\n]);\n\nconst LOWER_TOKEN_RE = /^[a-z][a-z0-9_-]{0,30}$/;\nconst MIN_CLUSTER_SIZE = 2;\n\nconst BOOLEANISH: ReadonlySet<string> = new Set([\"true\", \"false\"]);\n\n/**\n * An enum-shaped token worth a string-literal union: a short lowercase word of\n * 2+ chars that isn't a boolean-string. Single characters (`'a'`), file\n * paths/URLs/i18n keys (contain `/`, `:`, `.`), and `'true'`/`'false'` are NOT\n * closed-enum members — comparing against them is a flag/path/boolean guard.\n */\n\nfunction isEnumToken(lit: string): boolean {\n return LOWER_TOKEN_RE.test(lit) && lit.length >= 2 && !BOOLEANISH.has(lit);\n}\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/**\n * The trailing word of a camelCase / snake_case identifier, lowercased.\n * `callStatus` -> `status`, `user_role` -> `role`, `estate` -> `estate`.\n */\nfunction lastWord(name: string): string {\n const words = name\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .split(/[_\\s]+/)\n .filter((w) => w.length > 0);\n const last = words[words.length - 1] ?? name;\n return last.toLowerCase();\n}\n\nfunction isChoiceLikeName(name: string): boolean {\n return CHOICE_TOKENS.has(lastWord(name));\n}\n\nfunction keyName(\n key: TSESTree.PropertyDefinition[\"key\"] | TSESTree.PropertyName,\n): string | null {\n if (key.type === AST_NODE_TYPES.Identifier) {\n return key.name;\n }\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n}\n\nfunction isStringLiteralMember(t: TSESTree.TypeNode): boolean {\n return (\n t.type === AST_NODE_TYPES.TSLiteralType &&\n t.literal.type === AST_NODE_TYPES.Literal &&\n typeof t.literal.value === \"string\"\n );\n}\n\n/** Whether a type node is a union of 2+ string-literal types. */\nfunction isStringLiteralUnion(node: TSESTree.TypeNode | undefined): boolean {\n if (node?.type !== AST_NODE_TYPES.TSUnionType) {\n return false;\n }\n return node.types.filter(isStringLiteralMember).length >= MIN_CLUSTER_SIZE;\n}\n\n/**\n * Whether a resolved TS type includes the general `string` type — as opposed to\n * being (a union of) string-literal types. `CallStatus = \"a\" | \"b\"` has no\n * general-string member and is already the target state; a raw `string` (or\n * `string | undefined`) does, and a comparison cluster on it should become a\n * union. Requires type information; the comparison-cluster path is inert\n * without it.\n */\nfunction typeHasRawString(type: ts.Type): boolean {\n const parts = type.isUnion() ? type.types : [type];\n return parts.some((t) => (t.flags & ts.TypeFlags.String) !== 0);\n}\n\nfunction isExternalSourceFile(sf: ts.SourceFile | undefined): boolean {\n if (sf === undefined) {\n return false;\n }\n return sf.isDeclarationFile || sf.fileName.includes(\"/node_modules/\");\n}\n\nfunction symbolIsExternallyDeclared(sym: ts.Symbol | undefined): boolean {\n return (\n sym?.declarations?.some((d) => isExternalSourceFile(d.getSourceFile())) ??\n false\n );\n}\n\n/**\n * The iterable expression a destructuring binding element draws its value from,\n * e.g. `Object.entries(x)` for `key` in `for (const [key] of Object.entries(x))`\n * or the RHS of `const { a } = rhs`.\n */\nfunction bindingSourceExpression(\n decl: ts.BindingElement,\n): ts.Expression | undefined {\n let node: ts.Node = decl.parent;\n while (\n !ts.isForOfStatement(node) &&\n !(ts.isVariableDeclaration(node) && node.initializer !== undefined)\n ) {\n if (node.parent === undefined) {\n return undefined;\n }\n node = node.parent;\n }\n return ts.isForOfStatement(node) ? node.expression : node.initializer;\n}\n\n/** A stable key for a plain identifier or non-computed member chain, else null. */\nfunction refKey(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return node.name;\n }\n if (node.type === AST_NODE_TYPES.MemberExpression && !node.computed) {\n const inner = refKey(node.object);\n if (inner === null || node.property.type !== AST_NODE_TYPES.Identifier) {\n return null;\n }\n return `${inner}.${node.property.name}`;\n }\n return null;\n}\n\nfunction strLiteral(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\") {\n return node.value;\n }\n return null;\n}\n\ninterface ClusterEntry {\n node: TSESTree.Node;\n literals: Set<string>;\n allTokens: boolean;\n}\n\ninterface Scope {\n clusters: Map<string, ClusterEntry>;\n /** The function this scope belongs to; null at file scope. */\n fn: FunctionNode | null;\n}\n\ninterface CollectedProperty {\n name: string;\n container: TSESTree.Node;\n node: TSESTree.Node;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-string-literal-union\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag raw `string` choice fields and string-literal comparison clusters; prefer a string-literal union type.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreFields: {\n type: \"array\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n bareChoiceField:\n '`{{name}}: string` looks like a choice field — prefer a string-literal union type (e.g. `type X = \"a\" | \"b\"`). Enums are banned by `no-enum`; use a union.',\n comparisonCluster:\n '`{{key}}` is compared against a closed set of string literals — define a string-literal union type (e.g. `type X = \"a\" | \"b\"`).',\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const filename = context.filename;\n const sourceText = context.sourceCode.getText();\n if (isIgnoredFile(filename, sourceText)) {\n return {};\n }\n\n const ignoredFields = new Set(\n (optionsArg?.ignoreFields ?? []).map((name) => name.toLowerCase()),\n );\n\n let services: ParserServicesWithTypeInformation | null;\n try {\n services = ESLintUtils.getParserServices(context);\n } catch {\n services = null;\n }\n\n const scopeStack: Scope[] = [];\n const validClusters: TSESTree.Node[] = [];\n const bareChoiceProps: CollectedProperty[] = [];\n const containersWithUnion = new Set<TSESTree.Node>();\n\n function operandIsRawString(node: TSESTree.Node): boolean {\n if (services === null) {\n return false;\n }\n return typeHasRawString(services.getTypeAtLocation(node));\n }\n\n /**\n * Whether the compared value provably originates from a type we don't own —\n * a property of a `.d.ts` / node_modules type (DOM `getComputedStyle().overflowY`,\n * `Task.status` from another package), the return of such a method\n * (`URLSearchParams.get()`, `str.toLowerCase()`), or a destructuring of one\n * (`Object.entries()` keys). A string-literal union is not an available fix\n * for these, so the cluster shape must not flag them.\n */\n function originIsExternal(node: ts.Node | undefined, depth: number): boolean {\n if (node === undefined || services === null || depth > 6) {\n return false;\n }\n const checker = services.program.getTypeChecker();\n if (\n ts.isParenthesizedExpression(node) ||\n ts.isNonNullExpression(node) ||\n ts.isAsExpression(node)\n ) {\n return originIsExternal(node.expression, depth + 1);\n }\n if (ts.isPropertyAccessExpression(node)) {\n return symbolIsExternallyDeclared(checker.getSymbolAtLocation(node.name));\n }\n if (ts.isCallExpression(node)) {\n return originIsExternal(node.expression, depth + 1);\n }\n if (ts.isIdentifier(node)) {\n const decl = checker.getSymbolAtLocation(node)?.valueDeclaration;\n if (decl === undefined) {\n return false;\n }\n if (ts.isVariableDeclaration(decl) && decl.initializer !== undefined) {\n return originIsExternal(decl.initializer, depth + 1);\n }\n if (ts.isBindingElement(decl)) {\n return originIsExternal(bindingSourceExpression(decl), depth + 1);\n }\n }\n return false;\n }\n\n function operandIsFlaggable(node: TSESTree.Node): boolean {\n return (\n operandIsRawString(node) &&\n !originIsExternal(services?.esTreeNodeToTSNodeMap.get(node), 0)\n );\n }\n\n /**\n * The string-literal members of a function's DECLARED return type, resolved\n * through named aliases and `Promise<...>`. Null when the function has no\n * annotation, type information is unavailable, or the type is not a\n * string-literal union. Computed lazily — only for a function that actually\n * accumulated a cluster — since it costs a type resolution.\n */\n function declaredReturnLiterals(fn: FunctionNode): ReadonlySet<string> | null {\n const annotation = fn.returnType?.typeAnnotation;\n if (annotation === undefined || services === null) {\n return null;\n }\n const tsNode = services.esTreeNodeToTSNodeMap.get(annotation);\n if (!ts.isTypeNode(tsNode)) {\n return null;\n }\n const checker = services.program.getTypeChecker();\n const declared = checker.getTypeFromTypeNode(tsNode);\n const type = checker.getAwaitedType(declared) ?? declared;\n const literals = new Set<string>();\n for (const part of type.isUnion() ? type.types : [type]) {\n if (part.isStringLiteral()) {\n literals.add(part.value);\n }\n }\n return literals.size >= MIN_CLUSTER_SIZE ? literals : null;\n }\n\n function pushScope(node: FunctionNode): void {\n scopeStack.push({ clusters: new Map(), fn: node });\n }\n\n function popScope(): void {\n const scope = scopeStack.pop();\n if (scope === undefined) {\n return;\n }\n const candidates = [...scope.clusters.values()].filter(\n (entry) => entry.allTokens && entry.literals.size >= MIN_CLUSTER_SIZE,\n );\n if (candidates.length === 0) {\n return;\n }\n const returnLiterals =\n scope.fn === null ? null : declaredReturnLiterals(scope.fn);\n for (const entry of candidates) {\n // The enclosing function declares the very union being compared against:\n // this is the narrowing boundary that produces it, so the `string`\n // operand is required, not a defect.\n if (\n returnLiterals !== null &&\n [...entry.literals].every((lit) => returnLiterals.has(lit))\n ) {\n continue;\n }\n validClusters.push(entry.node);\n }\n }\n\n function accumulate(\n key: string,\n literals: string[],\n node: TSESTree.Node,\n ): void {\n const scope = scopeStack[scopeStack.length - 1];\n if (scope === undefined) {\n return;\n }\n const allTokens = literals.every((lit) => isEnumToken(lit));\n const existing = scope.clusters.get(key);\n if (existing === undefined) {\n scope.clusters.set(key, {\n node,\n literals: new Set(literals),\n allTokens,\n });\n return;\n }\n for (const lit of literals) {\n existing.literals.add(lit);\n }\n existing.allTokens = existing.allTokens && allTokens;\n }\n\n function collectProperty(\n key: TSESTree.PropertyDefinition[\"key\"] | TSESTree.PropertyName,\n typeNode: TSESTree.TypeNode | undefined,\n container: TSESTree.Node,\n node: TSESTree.Node,\n ): void {\n if (isStringLiteralUnion(typeNode)) {\n containersWithUnion.add(container);\n return;\n }\n if (typeNode?.type !== AST_NODE_TYPES.TSStringKeyword) {\n return;\n }\n const name = keyName(key);\n if (\n name === null ||\n !isChoiceLikeName(name) ||\n ignoredFields.has(name.toLowerCase())\n ) {\n return;\n }\n bareChoiceProps.push({ name, container, node });\n }\n\n return {\n FunctionDeclaration: pushScope,\n \"FunctionDeclaration:exit\": popScope,\n FunctionExpression: pushScope,\n \"FunctionExpression:exit\": popScope,\n ArrowFunctionExpression: pushScope,\n \"ArrowFunctionExpression:exit\": popScope,\n\n BinaryExpression(node: TSESTree.BinaryExpression): void {\n if (\n node.operator !== \"===\" &&\n node.operator !== \"!==\" &&\n node.operator !== \"==\" &&\n node.operator !== \"!=\"\n ) {\n return;\n }\n const leftKey = refKey(node.left);\n const rightLit = strLiteral(node.right);\n const rightKey = refKey(node.right);\n const leftLit = strLiteral(node.left);\n if (leftKey !== null && rightLit !== null) {\n if (operandIsFlaggable(node.left)) {\n accumulate(leftKey, [rightLit], node);\n }\n } else if (rightKey !== null && leftLit !== null) {\n if (operandIsFlaggable(node.right)) {\n accumulate(rightKey, [leftLit], node);\n }\n }\n },\n\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const key = refKey(node.discriminant);\n if (key === null || !operandIsFlaggable(node.discriminant)) {\n return;\n }\n const literals: string[] = [];\n for (const c of node.cases) {\n if (c.test !== null) {\n const lit = strLiteral(c.test);\n if (lit !== null) {\n literals.push(lit);\n }\n }\n }\n if (literals.length > 0) {\n accumulate(key, literals, node);\n }\n },\n\n TSPropertySignature(node: TSESTree.TSPropertySignature): void {\n collectProperty(\n node.key,\n node.typeAnnotation?.typeAnnotation,\n node.parent,\n node,\n );\n },\n\n PropertyDefinition(node: TSESTree.PropertyDefinition): void {\n collectProperty(\n node.key,\n node.typeAnnotation?.typeAnnotation,\n node.parent,\n node,\n );\n },\n\n \"Program:exit\"(): void {\n for (const clusterNode of validClusters) {\n context.report({\n node: clusterNode,\n messageId: \"comparisonCluster\",\n data: { key: refKeyText(clusterNode) },\n });\n }\n for (const prop of bareChoiceProps) {\n if (containersWithUnion.has(prop.container)) {\n context.report({\n node: prop.node,\n messageId: \"bareChoiceField\",\n data: { name: prop.name },\n });\n }\n }\n },\n };\n\n function refKeyText(node: TSESTree.Node): string {\n if (node.type === AST_NODE_TYPES.BinaryExpression) {\n return refKey(node.left) ?? refKey(node.right) ?? \"value\";\n }\n if (node.type === AST_NODE_TYPES.SwitchStatement) {\n return refKey(node.discriminant) ?? \"value\";\n }\n return \"value\";\n }\n },\n});\n","/**\n * @fileoverview prefer-whole-object-assertion — a run of `expect`s on one receiver fails on the first mismatch and says nothing about the rest of the value.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-whole-object-assertion.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"combineAssertions\" | \"assertArrayOnce\";\ntype Options = readonly [];\n\n/**\n * Matchers whose per-key meaning `toMatchObject` reproduces exactly — but only\n * against a primitive literal, where `Object.is`, deep equality and strict deep\n * equality all coincide. See `literalText` for the other half of that pair.\n */\nconst MERGEABLE_MATCHERS: ReadonlySet<string> = new Set([\"toBe\", \"toEqual\", \"toStrictEqual\"]);\n\n/**\n * Matchers whose whole-array form (`expect(a).toEqual([...])`) preserves the\n * per-element comparison. `toBe` is excluded: element-wise identity is not what\n * `toEqual` on the array would check.\n */\nconst ARRAY_MATCHERS: ReadonlySet<string> = new Set([\"toEqual\", \"toStrictEqual\"]);\n\n/**\n * Properties whose receiver is a collection rather than a record. A run keyed on\n * `length` or `size` describes an array / Map / Set, and `toMatchObject` cannot\n * state a collection's size — this is the `.length`-mixed-with-elements class.\n */\nconst COLLECTION_PROPERTIES: ReadonlySet<string> = new Set([\"length\", \"size\"]);\n\n/**\n * Property names whose meaning as an OBJECT-LITERAL KEY is not \"a property of\n * this name\". There is exactly one in JavaScript.\n *\n * `__proto__: v` in a literal is the prototype SETTER, so the key never exists\n * and `toMatchObject` never checks it — the fix would DELETE the assertion it\n * claims to be merging. Quoting does not help: `\"__proto__\": v` is the same\n * production. The whole run is dropped rather than the one key, because there\n * is no `toMatchObject` literal that says what the run says.\n *\n * Audited for siblings: `constructor`, `toString`, `valueOf` and every other\n * inherited name ARE plain own keys in a literal, and jest's `subsetEquality`\n * walks the prototype chain when reading them off the received value, so those\n * merge faithfully. `get x() {}` / `async x() {}` are different PRODUCTIONS,\n * not different key names, and this fixer only ever emits `key: value`.\n */\nconst LITERAL_KEY_HAZARDS: ReadonlySet<string> = new Set([\"__proto__\"]);\n\n/** `-1` parses as a unary expression, not a literal, but it is still constant. */\nconst NUMERIC_SIGNS: ReadonlySet<string> = new Set([\"-\", \"+\"]);\n\n/** A run shorter than this is a single assertion; there is nothing to combine. */\nconst MIN_RUN_LENGTH = 2;\n\n/** How a run reaches into its receiver: `o.name`, or `xs[0]`. */\ntype AssertionKey =\n | { readonly kind: \"property\"; readonly name: string }\n | { readonly kind: \"index\"; readonly index: number };\n\ninterface Assertion {\n readonly statement: TSESTree.ExpressionStatement;\n /** The object the asserted member expression hangs off — the run's grouping key. */\n readonly receiver: TSESTree.Expression;\n readonly key: AssertionKey;\n readonly matcher: string;\n /** Source text of the expected value; `\"null\"` synthesised for `toBeNull()`. */\n readonly expectedText: string;\n /** False when the expected value is not a primitive literal, so cannot be merged. */\n readonly expectedIsLiteral: boolean;\n}\n\n/**\n * Source text of `node` when it is a primitive literal, otherwise `null`.\n * Regular expressions are excluded: `toBe(/x/)` is an identity check that\n * `toEqual` and `toMatchObject` do not reproduce.\n */\nfunction literalText(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return \"regex\" in node ? null : getText(node);\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0 ? getText(node) : null;\n case AST_NODE_TYPES.UnaryExpression:\n return NUMERIC_SIGNS.has(node.operator) && literalText(node.argument, getText) !== null\n ? getText(node)\n : null;\n default:\n return null;\n }\n}\n\n/**\n * True for a receiver that can be evaluated twice with the same effect: an\n * identifier, `this`, or a member chain over one. A call anywhere in the chain\n * makes the merged form invoke it fewer times than the run did.\n *\n * The `node.optional` guard below — and its twin on `actual` in\n * `parseAssertion` — cannot be reached by any input, and no test pins them:\n * every optional link wraps the whole expression in a `ChainExpression`, which\n * `parseAssertion` has already rejected, and a parenthesised `(a?.b).c` leaves a\n * `ChainExpression` in the object position where this function's `default` arm\n * catches it. They are kept as belt and braces against a parser that stops\n * emitting `ChainExpression`, not because anything currently depends on them —\n * recorded here so the next reader does not spend an afternoon writing the test\n * that would prove them live.\n */\nfunction isPureReceiver(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Identifier:\n case AST_NODE_TYPES.ThisExpression:\n return true;\n case AST_NODE_TYPES.MemberExpression:\n if (node.optional) {\n return false;\n }\n if (node.computed) {\n return node.property.type === AST_NODE_TYPES.Literal && isPureReceiver(node.object);\n }\n return isPureReceiver(node.object);\n default:\n return false;\n }\n}\n\n/** A non-negative integer array index written as a literal, else `null`. */\nfunction literalIndex(node: TSESTree.Node): number | null {\n if (node.type !== AST_NODE_TYPES.Literal || typeof node.value !== \"number\") {\n return null;\n }\n return Number.isInteger(node.value) && node.value >= 0 ? node.value : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-whole-object-assertion\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Collapse a run of consecutive assertions on the same object into one assertion about the whole object, so every mismatch is reported and nothing outside the asserted keys goes unchecked.\",\n },\n fixable: \"code\",\n messages: {\n combineAssertions:\n \"These {{count}} assertions each check one property of `{{receiver}}` against a literal, so the first mismatch hides the rest. Assert the object once: `expect({{receiver}}).toMatchObject({ … })`.\",\n assertArrayOnce:\n \"These {{count}} assertions check `{{receiver}}[0]`…`{{receiver}}[{{last}}]` one at a time, which never checks how long `{{receiver}}` is — extra elements pass unnoticed. Assert the array once: `expect({{receiver}}).{{matcher}}([ … ])`.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const { sourceCode } = context;\n\n function parseAssertion(statement: TSESTree.Statement): Assertion | null {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n return null;\n }\n const call = statement.expression;\n if (call.type !== AST_NODE_TYPES.CallExpression) {\n return null;\n }\n const callee = call.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const matcher = callee.property.name;\n const expectCall = callee.object;\n if (\n expectCall.type !== AST_NODE_TYPES.CallExpression ||\n expectCall.callee.type !== AST_NODE_TYPES.Identifier ||\n expectCall.callee.name !== \"expect\" ||\n expectCall.arguments.length !== 1\n ) {\n return null;\n }\n const actual = expectCall.arguments[0];\n if (actual === undefined || actual.type !== AST_NODE_TYPES.MemberExpression || actual.optional) {\n return null;\n }\n if (!isPureReceiver(actual.object)) {\n return null;\n }\n\n let key: AssertionKey;\n if (actual.computed) {\n const index = literalIndex(actual.property);\n if (index === null) {\n return null;\n }\n key = { kind: \"index\", index };\n } else {\n if (\n actual.property.type !== AST_NODE_TYPES.Identifier ||\n COLLECTION_PROPERTIES.has(actual.property.name) ||\n LITERAL_KEY_HAZARDS.has(actual.property.name)\n ) {\n return null;\n }\n key = { kind: \"property\", name: actual.property.name };\n }\n\n if (matcher === \"toBeNull\" && call.arguments.length === 0) {\n return { statement, receiver: actual.object, key, matcher, expectedText: \"null\", expectedIsLiteral: true };\n }\n if (!MERGEABLE_MATCHERS.has(matcher)) {\n return null;\n }\n const expected = call.arguments[0];\n if (call.arguments.length !== 1 || expected === undefined || expected.type === AST_NODE_TYPES.SpreadElement) {\n return null;\n }\n const literal = literalText(expected, (node) => sourceCode.getText(node));\n return {\n statement,\n receiver: actual.object,\n key,\n matcher,\n expectedText: literal ?? sourceCode.getText(expected),\n expectedIsLiteral: literal !== null,\n };\n }\n\n /**\n * True when a comment sits inside the span the fix rewrites — between two\n * statements of the run, or inside one of them.\n *\n * Such a comment cannot survive: the statements after the first are DELETED,\n * so their leading comments are left dangling above the merged assertion,\n * describing a statement that no longer exists. Worst case the dangling line\n * is an `eslint-disable-next-line`, which then becomes a fresh unused-directive\n * error the author did not write. Dropping a comment is also not \"exactly\n * equivalent to the code it replaces\", so the report stands and the fix is\n * withheld for a human.\n */\n function hasInterveningComment(run: readonly Assertion[]): boolean {\n return run.some(\n (assertion, index) =>\n sourceCode.getCommentsInside(assertion.statement).length > 0 ||\n (index > 0 && sourceCode.getCommentsBefore(assertion.statement).length > 0),\n );\n }\n\n /**\n * A property run is reportable only when the merged `toMatchObject` says\n * exactly what the run says: every matcher mergeable, every expected value a\n * primitive literal, and every key distinct so nothing is lost to a\n * duplicate object property.\n */\n function reportPropertyRun(run: readonly Assertion[]): void {\n const names = new Set<string>();\n for (const assertion of run) {\n if (assertion.key.kind !== \"property\" || !assertion.expectedIsLiteral) {\n return;\n }\n if (!MERGEABLE_MATCHERS.has(assertion.matcher) && assertion.matcher !== \"toBeNull\") {\n return;\n }\n if (names.has(assertion.key.name)) {\n return;\n }\n names.add(assertion.key.name);\n }\n const first = run[0];\n if (first === undefined) {\n return;\n }\n const receiverText = sourceCode.getText(first.receiver);\n const properties = run\n .map((assertion) =>\n assertion.key.kind === \"property\" ? `${assertion.key.name}: ${assertion.expectedText}` : \"\",\n )\n .join(\", \");\n context.report({\n node: first.statement,\n messageId: \"combineAssertions\",\n data: { count: String(run.length), receiver: receiverText },\n fix: hasInterveningComment(run)\n ? null\n : (fixer) => [\n fixer.replaceText(first.statement, `expect(${receiverText}).toMatchObject({ ${properties} });`),\n ...run.slice(1).map((assertion) => fixer.remove(assertion.statement)),\n ],\n });\n }\n\n /**\n * An indexed run is reportable when the indices cover `0..n-1` exactly and\n * one `toEqual` / `toStrictEqual` runs throughout, so `expect(xs).toEqual([…])`\n * makes the same per-element comparisons plus the length check the run is\n * missing. No fix: that added length check can turn a passing test red.\n */\n function reportIndexRun(run: readonly Assertion[]): void {\n const first = run[0];\n if (first === undefined || !ARRAY_MATCHERS.has(first.matcher)) {\n return;\n }\n const indices = new Set<number>();\n for (const assertion of run) {\n if (assertion.key.kind !== \"index\" || assertion.matcher !== first.matcher) {\n return;\n }\n indices.add(assertion.key.index);\n }\n if (indices.size !== run.length || Math.max(...indices) !== run.length - 1) {\n return;\n }\n context.report({\n node: first.statement,\n messageId: \"assertArrayOnce\",\n data: {\n count: String(run.length),\n receiver: sourceCode.getText(first.receiver),\n last: String(run.length - 1),\n matcher: first.matcher,\n },\n });\n }\n\n function checkBody(body: readonly TSESTree.Statement[]): void {\n let run: Assertion[] = [];\n\n const flush = (): void => {\n const first = run[0];\n if (first !== undefined && run.length >= MIN_RUN_LENGTH) {\n if (first.key.kind === \"property\") {\n reportPropertyRun(run);\n } else {\n reportIndexRun(run);\n }\n }\n run = [];\n };\n\n for (const statement of body) {\n const assertion = parseAssertion(statement);\n const previous = run.at(-1);\n if (\n assertion !== null &&\n previous !== undefined &&\n previous.key.kind === assertion.key.kind &&\n sourceCode.getText(previous.receiver) === sourceCode.getText(assertion.receiver)\n ) {\n run.push(assertion);\n continue;\n }\n flush();\n if (assertion !== null) {\n run = [assertion];\n }\n }\n flush();\n }\n\n return {\n BlockStatement: (node: TSESTree.BlockStatement): void => {\n checkBody(node.body);\n },\n Program: (node: TSESTree.Program): void => {\n checkBody(node.body);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-zod-enum — a union of `z.literal` strings infers exactly what `z.enum` does, in more syntax that hides the permitted values.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-zod-enum.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"preferEnum\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-zod-enum\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer z.enum([...]) over z.union([z.literal(...), ...]) for string choices\",\n },\n fixable: \"code\",\n schema: [],\n messages: {\n preferEnum:\n \"Use `z.enum([...])` instead of a union of string-literal schemas.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n const zodNamespaces = new Set<string>();\n\n function enumValues(\n node: TSESTree.CallExpression,\n ): readonly TSESTree.StringLiteral[] | undefined | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.object.type !== AST_NODE_TYPES.Identifier ||\n !zodNamespaces.has(callee.object.name) ||\n callee.property.type !== AST_NODE_TYPES.Identifier ||\n callee.property.name !== \"union\" ||\n node.arguments.length !== 1\n ) {\n return null;\n }\n const argument = node.arguments[0];\n if (\n argument === undefined ||\n argument.type !== AST_NODE_TYPES.ArrayExpression ||\n argument.elements.length === 0\n ) {\n return null;\n }\n\n const values: TSESTree.StringLiteral[] = [];\n let canFix = true;\n for (const element of argument.elements) {\n if (element?.type === AST_NODE_TYPES.SpreadElement) {\n canFix = false;\n continue;\n }\n if (\n element === null ||\n element.type !== AST_NODE_TYPES.CallExpression ||\n element.callee.type !== AST_NODE_TYPES.MemberExpression ||\n element.callee.computed ||\n element.callee.object.type !== AST_NODE_TYPES.Identifier ||\n !zodNamespaces.has(element.callee.object.name) ||\n element.callee.property.type !== AST_NODE_TYPES.Identifier ||\n element.callee.property.name !== \"literal\"\n ) {\n return null;\n }\n const value = element.arguments[0];\n if (\n element.arguments.length !== 1 ||\n value === undefined ||\n value.type !== AST_NODE_TYPES.Literal ||\n typeof value.value !== \"string\"\n ) {\n canFix = false;\n continue;\n }\n values.push(value);\n }\n return canFix ? values : undefined;\n }\n\n function buildFix(\n node: TSESTree.CallExpression,\n values: readonly TSESTree.StringLiteral[],\n ): TSESLint.ReportFixFunction | undefined {\n const argument = node.arguments[0];\n if (\n argument === undefined ||\n argument.type !== AST_NODE_TYPES.ArrayExpression ||\n sourceCode.getCommentsInside(argument).length > 0\n ) {\n return undefined;\n }\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return undefined;\n }\n return (fixer) => [\n fixer.replaceText(callee.property, \"enum\"),\n fixer.replaceText(\n argument,\n `[${values.map((value) => sourceCode.getText(value)).join(\", \")}]`,\n ),\n ];\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n CallExpression(node): void {\n const values = enumValues(node);\n if (values === null) {\n return;\n }\n const fix = values === undefined ? undefined : buildFix(node, values);\n context.report({\n node,\n messageId: \"preferEnum\",\n ...(fix === undefined ? {} : { fix }),\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-zod-infer — a hand-written type beside a Zod schema drifts silently the moment the schema gains a field.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-zod-infer.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"handWrittenTwin\";\ntype Options = readonly [\n {\n ignoreTypeNames?: readonly string[];\n requireIdenticalShape?: boolean;\n }?,\n];\n\n/** Chained methods that preserve a schema's inferred shape. */\nconst SHAPE_PRESERVING_METHODS: ReadonlySet<string> = new Set([\n \"describe\",\n \"refine\",\n \"superRefine\",\n \"check\",\n \"meta\",\n \"register\",\n]);\n\n/** Modifiers that make a member optional in the inferred type. */\nconst OPTIONAL_MODIFIERS: ReadonlySet<string> = new Set([\n \"optional\",\n \"nullish\",\n \"default\",\n \"prefault\",\n \"catch\",\n]);\n\n/** Modifiers that admit `null`. */\nconst NULLABLE_MODIFIERS: ReadonlySet<string> = new Set([\"nullable\", \"nullish\"]);\n\n/** Modifiers that replace the member's type outright. */\nconst RESHAPING_MODIFIERS: ReadonlySet<string> = new Set([\n \"transform\",\n \"pipe\",\n \"preprocess\",\n \"brand\",\n \"overwrite\",\n]);\n\n/** Methods that reshape their receiver schema. */\nconst MODULE_LEVEL_RESHAPERS: ReadonlySet<string> = new Set([\n \"transform\",\n \"pipe\",\n \"preprocess\",\n]);\n\n/** Type names whose type arguments are hand-written types by construction. */\nconst ZOD_TYPE_CONSTRAINTS: ReadonlySet<string> = new Set([\n \"ZodType\",\n \"ZodSchema\",\n \"ZodTypeAny\",\n \"ZodMiniType\",\n \"Schema\",\n]);\n\n/** Zod leaf constructors and the TS AST node their inferred type is written as. */\nconst LEAF_NODE_TYPES: Readonly<Record<string, readonly AST_NODE_TYPES[]>> = {\n string: [AST_NODE_TYPES.TSStringKeyword],\n email: [AST_NODE_TYPES.TSStringKeyword],\n url: [AST_NODE_TYPES.TSStringKeyword],\n uuid: [AST_NODE_TYPES.TSStringKeyword],\n ulid: [AST_NODE_TYPES.TSStringKeyword],\n cuid: [AST_NODE_TYPES.TSStringKeyword],\n cuid2: [AST_NODE_TYPES.TSStringKeyword],\n nanoid: [AST_NODE_TYPES.TSStringKeyword],\n iso: [AST_NODE_TYPES.TSStringKeyword],\n number: [AST_NODE_TYPES.TSNumberKeyword],\n int: [AST_NODE_TYPES.TSNumberKeyword],\n float32: [AST_NODE_TYPES.TSNumberKeyword],\n float64: [AST_NODE_TYPES.TSNumberKeyword],\n boolean: [AST_NODE_TYPES.TSBooleanKeyword],\n bigint: [AST_NODE_TYPES.TSBigIntKeyword],\n symbol: [AST_NODE_TYPES.TSSymbolKeyword],\n any: [AST_NODE_TYPES.TSAnyKeyword],\n unknown: [AST_NODE_TYPES.TSUnknownKeyword],\n never: [AST_NODE_TYPES.TSNeverKeyword],\n void: [AST_NODE_TYPES.TSVoidKeyword],\n null: [AST_NODE_TYPES.TSNullKeyword],\n undefined: [AST_NODE_TYPES.TSUndefinedKeyword],\n literal: [AST_NODE_TYPES.TSLiteralType],\n date: [AST_NODE_TYPES.TSTypeReference],\n array: [AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSTypeReference],\n tuple: [AST_NODE_TYPES.TSTupleType],\n object: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n strictObject: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n looseObject: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n record: [AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSTypeLiteral],\n map: [AST_NODE_TYPES.TSTypeReference],\n set: [AST_NODE_TYPES.TSTypeReference],\n promise: [AST_NODE_TYPES.TSTypeReference],\n enum: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType],\n nativeEnum: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType],\n union: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference],\n discriminatedUnion: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference],\n intersection: [AST_NODE_TYPES.TSIntersectionType, AST_NODE_TYPES.TSTypeReference],\n};\n\ninterface SchemaField {\n readonly optional: boolean;\n readonly nullable: boolean;\n /** The `z.<leaf>` constructor, or `null` when the member references another schema. */\n readonly leaf: string | null;\n readonly reshaped: boolean;\n}\n\ninterface SchemaInfo {\n readonly name: string;\n readonly fields: ReadonlyMap<string, SchemaField>;\n}\n\ninterface TypeMember {\n readonly optional: boolean;\n readonly nullable: boolean;\n readonly annotation: TSESTree.TypeNode | null;\n}\n\ninterface TypeDeclaration {\n readonly name: string;\n readonly node: TSESTree.Node;\n readonly members: ReadonlyMap<string, TypeMember>;\n}\n\n/** `ZUserSchema` / `userSchema` / `ZUser` all describe the thing named `User`. */\nfunction normalizeSchemaName(name: string): string {\n return name\n .replace(/Schema$/i, \"\")\n .replace(/^Z(?=[A-Z])/, \"\")\n .toLowerCase();\n}\n\n/** `UserType` is the same claim as `User`; nothing else is stripped. */\nfunction normalizeTypeName(name: string): string {\n return name.replace(/Type$/, \"\").toLowerCase();\n}\n\n/** Strips `| null` / `| undefined` from a union and reports what it removed. */\nfunction unwrapNullish(annotation: TSESTree.TypeNode): {\n readonly core: TSESTree.TypeNode | null;\n readonly nullable: boolean;\n} {\n if (annotation.type !== AST_NODE_TYPES.TSUnionType) {\n return {\n core: annotation,\n nullable: annotation.type === AST_NODE_TYPES.TSNullKeyword,\n };\n }\n const rest: TSESTree.TypeNode[] = [];\n let nullable = false;\n for (const member of annotation.types) {\n if (member.type === AST_NODE_TYPES.TSNullKeyword) {\n nullable = true;\n continue;\n }\n if (member.type === AST_NODE_TYPES.TSUndefinedKeyword) {\n continue;\n }\n rest.push(member);\n }\n if (rest.length === 1) {\n return { core: rest[0] ?? null, nullable };\n }\n // A genuine union of two or more non-nullish members stays a union.\n return { core: rest.length === 0 ? null : annotation, nullable };\n}\n\n/** Compares a TypeScript annotation with a known Zod leaf; `null` means unknown. */\nfunction leafAgrees(\n leaf: string | null,\n annotation: TSESTree.TypeNode | null,\n): boolean | null {\n if (leaf === null || annotation === null) {\n return null;\n }\n const expected = LEAF_NODE_TYPES[leaf];\n if (expected === undefined) {\n return null;\n }\n const { core } = unwrapNullish(annotation);\n if (core === null) {\n return null;\n }\n return expected.includes(core.type);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-zod-infer\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreTypeNames: {\n type: \"array\",\n items: { type: \"string\" },\n },\n requireIdenticalShape: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n handWrittenTwin:\n \"`{{typeName}}` restates the shape of the Zod schema `{{schemaName}}` declared in this module. Derive it instead — `type {{typeName}} = z.infer<typeof {{schemaName}}>` — so a field added to the schema cannot silently leave the type behind.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const ignorePatterns = (optionsArg?.ignoreTypeNames ?? []).map(\n (source) => new RegExp(source, \"u\"),\n );\n const requireIdenticalShape = optionsArg?.requireIdenticalShape ?? true;\n\n if (\n isTestFile(context.filename) ||\n isStoryFile(context.filename) ||\n isGeneratedFile(context.filename, context.sourceCode.text)\n ) {\n return {};\n }\n\n const zodNamespaces = new Set<string>();\n const schemas: SchemaInfo[] = [];\n const typeDeclarations: TypeDeclaration[] = [];\n /** Names intentionally constraining a `z.ZodType<...>`. */\n const constrainedTypeNames = new Set<string>();\n /** Schemas reshaped elsewhere in this module. */\n const reshapedSchemaNames = new Set<string>();\n\n /** The `z.…` call chain of `node`, base call first, or `null`. */\n function zodCallChain(\n node: TSESTree.Node,\n ): readonly TSESTree.CallExpression[] | null {\n const chain: TSESTree.CallExpression[] = [];\n let current: TSESTree.Node = node;\n while (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = current.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n chain.push(current);\n const receiver = callee.object;\n if (receiver.type === AST_NODE_TYPES.Identifier) {\n return zodNamespaces.has(receiver.name) ? chain.reverse() : null;\n }\n current = receiver;\n }\n return null;\n }\n\n /** The method name of a `z.foo()` / `.foo()` link in a chain. */\n function methodName(call: TSESTree.CallExpression): string {\n const callee = call.callee;\n return callee.type === AST_NODE_TYPES.MemberExpression &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : \"\";\n }\n\n /** Modifier/leaf analysis of one `z.object({ key: <here> })` value. */\n function schemaField(node: TSESTree.Node): SchemaField {\n const modifiers: string[] = [];\n let current: TSESTree.Node = node;\n let leaf: string | null = null;\n\n while (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = current.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n break;\n }\n const receiver = callee.object;\n if (\n receiver.type === AST_NODE_TYPES.Identifier &&\n zodNamespaces.has(receiver.name)\n ) {\n leaf = callee.property.name;\n break;\n }\n modifiers.push(callee.property.name);\n current = receiver;\n }\n\n return {\n leaf,\n optional: modifiers.some((name) => OPTIONAL_MODIFIERS.has(name)),\n nullable: modifiers.some((name) => NULLABLE_MODIFIERS.has(name)),\n reshaped: modifiers.some((name) => RESHAPING_MODIFIERS.has(name)),\n };\n }\n\n /** Extracts fields only from plain object literals with shape-preserving chains. */\n function schemaFields(\n init: TSESTree.Node,\n ): ReadonlyMap<string, SchemaField> | null {\n const chain = zodCallChain(init);\n if (chain === null || chain.length === 0) {\n return null;\n }\n const [base, ...rest] = chain;\n if (base === undefined) {\n return null;\n }\n const baseMethod = methodName(base);\n if (baseMethod !== \"object\" && baseMethod !== \"strictObject\") {\n return null;\n }\n if (rest.some((call) => !SHAPE_PRESERVING_METHODS.has(methodName(call)))) {\n return null;\n }\n const shape = base.arguments[0];\n if (shape === undefined || shape.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n\n const fields = new Map<string, SchemaField>();\n for (const property of shape.properties) {\n if (property.type !== AST_NODE_TYPES.Property || property.computed) {\n return null; // a spread or computed key hides members from us\n }\n const { key } = property;\n const name =\n key.type === AST_NODE_TYPES.Identifier\n ? key.name\n : key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\"\n ? key.value\n : null;\n if (name === null) {\n return null;\n }\n fields.set(name, schemaField(property.value));\n }\n return fields.size === 0 ? null : fields;\n }\n\n /** The property signatures of an object type, or `null` if any member is exotic. */\n function typeMembers(\n members: readonly TSESTree.TypeElement[],\n ): ReadonlyMap<string, TypeMember> | null {\n const result = new Map<string, TypeMember>();\n for (const member of members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature || member.computed) {\n return null;\n }\n const { key } = member;\n const name =\n key.type === AST_NODE_TYPES.Identifier\n ? key.name\n : key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\"\n ? key.value\n : null;\n if (name === null) {\n return null;\n }\n const annotation = member.typeAnnotation?.typeAnnotation ?? null;\n result.set(name, {\n optional: member.optional === true,\n nullable: annotation !== null && unwrapNullish(annotation).nullable,\n annotation,\n });\n }\n return result.size === 0 ? null : result;\n }\n\n function collectConstrainedNames(node: TSESTree.TypeNode): void {\n if (node.type === AST_NODE_TYPES.TSTypeReference) {\n if (node.typeName.type === AST_NODE_TYPES.Identifier) {\n constrainedTypeNames.add(node.typeName.name);\n }\n for (const argument of node.typeArguments?.params ?? []) {\n collectConstrainedNames(argument);\n }\n return;\n }\n if (node.type === AST_NODE_TYPES.TSArrayType) {\n collectConstrainedNames(node.elementType);\n return;\n }\n if (\n node.type === AST_NODE_TYPES.TSUnionType ||\n node.type === AST_NODE_TYPES.TSIntersectionType\n ) {\n for (const member of node.types) {\n collectConstrainedNames(member);\n }\n }\n }\n\n /** True when the pair is close enough to call one a restatement of the other. */\n function isTwin(\n fields: ReadonlyMap<string, SchemaField>,\n members: ReadonlyMap<string, TypeMember>,\n ): boolean {\n if (!requireIdenticalShape) {\n return true;\n }\n if (fields.size !== members.size) {\n return false;\n }\n let agreements = 0;\n for (const [name, field] of fields) {\n const member = members.get(name);\n if (member === undefined) {\n return false;\n }\n // A reshaped member's inferred type is not what is written.\n if (field.reshaped) {\n return false;\n }\n if (field.optional !== member.optional) {\n return false;\n }\n if (field.nullable !== member.nullable) {\n return false;\n }\n const agrees = leafAgrees(field.leaf, member.annotation);\n if (agrees === false) {\n return false;\n }\n if (agrees === true) {\n agreements += 1;\n }\n }\n // At least one member has to positively agree; a pair of types whose\n // members are all references to other symbols is a name coincidence.\n return agreements > 0;\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n\n VariableDeclarator(node): void {\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.init == null) {\n return;\n }\n const fields = schemaFields(node.init);\n if (fields !== null) {\n schemas.push({ name: node.id.name, fields });\n }\n },\n\n /** Records `XSchema.transform(...)` and equivalent module-level reshaping. */\n \"MemberExpression[computed=false]\"(node: TSESTree.MemberExpression): void {\n if (\n node.object.type === AST_NODE_TYPES.Identifier &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n MODULE_LEVEL_RESHAPERS.has(node.property.name)\n ) {\n reshapedSchemaNames.add(node.object.name);\n }\n },\n\n /** Records every type argument carried by a Zod constraint. */\n TSTypeReference(node): void {\n const { typeName } = node;\n const referenced =\n typeName.type === AST_NODE_TYPES.Identifier\n ? typeName.name\n : typeName.type === AST_NODE_TYPES.TSQualifiedName &&\n typeName.right.type === AST_NODE_TYPES.Identifier\n ? typeName.right.name\n : null;\n if (referenced === null || !ZOD_TYPE_CONSTRAINTS.has(referenced)) {\n return;\n }\n for (const argument of node.typeArguments?.params ?? []) {\n collectConstrainedNames(argument);\n }\n },\n\n TSInterfaceDeclaration(node): void {\n // Generics and `extends` cannot be replaced by direct schema inference.\n if (node.typeParameters !== undefined || (node.extends?.length ?? 0) > 0) {\n return;\n }\n const members = typeMembers(node.body.body);\n if (members !== null) {\n typeDeclarations.push({ name: node.id.name, node: node.id, members });\n }\n },\n\n TSTypeAliasDeclaration(node): void {\n if (\n node.typeParameters !== undefined ||\n node.typeAnnotation.type !== AST_NODE_TYPES.TSTypeLiteral\n ) {\n return;\n }\n const members = typeMembers(node.typeAnnotation.members);\n if (members !== null) {\n typeDeclarations.push({ name: node.id.name, node: node.id, members });\n }\n },\n\n \"Program:exit\"(): void {\n if (schemas.length === 0 || typeDeclarations.length === 0) {\n return;\n }\n const byName = new Map<string, SchemaInfo>();\n for (const schema of schemas) {\n const key = normalizeSchemaName(schema.name);\n if (key !== \"\" && !byName.has(key)) {\n byName.set(key, schema);\n }\n }\n\n for (const declaration of typeDeclarations) {\n if (constrainedTypeNames.has(declaration.name)) {\n continue;\n }\n if (ignorePatterns.some((pattern) => pattern.test(declaration.name))) {\n continue;\n }\n const schema = byName.get(normalizeTypeName(declaration.name));\n if (schema === undefined || reshapedSchemaNames.has(schema.name)) {\n continue;\n }\n if (!isTwin(schema.fields, declaration.members)) {\n continue;\n }\n context.report({\n node: declaration.node,\n messageId: \"handWrittenTwin\",\n data: { typeName: declaration.name, schemaName: schema.name },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-assert-never — a switch over a union whose `default` does no runtime work stops being exhaustive the day the union grows.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-assert-never.test.ts\n */\n\nimport { type TSESLint, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"missingAssertNever\";\ntype Options = readonly [];\n\n/** Empty statements and empty blocks are not runtime handling. */\nconst isRuntimeHandlingStatement = (statement: TSESTree.Statement): boolean => {\n if (statement.type === AST_NODE_TYPES.EmptyStatement) return false;\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.some(isRuntimeHandlingStatement);\n }\n return true;\n};\n\n/** An empty non-final default falls through to a case that handles it. */\nconst isFallthroughDefault = (\n node: TSESTree.SwitchStatement,\n defaultIndex: number,\n): boolean => {\n const defaultCase = node.cases[defaultIndex];\n return (\n defaultCase !== undefined &&\n defaultCase.consequent.length === 0 &&\n defaultIndex < node.cases.length - 1\n );\n};\n\n/** Honor a comment that makes an empty default an intentional no-op. */\nconst isCommentOnlyNoopDefault = (\n defaultCase: TSESTree.SwitchCase,\n sourceCode: Readonly<TSESLint.SourceCode>,\n): boolean => {\n if (defaultCase.consequent.length === 0) {\n const defaultToken = sourceCode.getFirstToken(defaultCase);\n const colonToken = defaultToken\n ? sourceCode.getTokenAfter(defaultToken)\n : null;\n return (\n colonToken !== null && sourceCode.getCommentsAfter(colonToken).length > 0\n );\n }\n const only = defaultCase.consequent[0];\n if (\n only !== undefined &&\n defaultCase.consequent.length === 1 &&\n only.type === AST_NODE_TYPES.BlockStatement &&\n only.body.length === 0\n ) {\n return sourceCode.getCommentsInside(only).length > 0;\n }\n return false;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-assert-never\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an exhaustive-style switch whose `default` case does no runtime work to call `assertNever(_)` so that discriminated unions are exhaustively checked at compile time. Switches with a legitimate runtime default (a reducer's `return state`, an HTTP-status `return fallback()`, a `break`, a `throw`, etc.) are left alone.\",\n },\n schema: [],\n messages: {\n missingAssertNever:\n \"Empty switch `default` case — add runtime handling or call `assertNever()` so the discriminated union is exhaustively checked at compile time.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const defaultIndex = node.cases.findIndex(\n (caseNode) => caseNode.test === null,\n );\n // Only present no-op defaults opt into this syntactic check.\n if (defaultIndex === -1) return;\n const defaultCase = node.cases[defaultIndex];\n if (defaultCase === undefined) return;\n\n // Any runtime work, including assertNever(), handles the default.\n if (defaultCase.consequent.some(isRuntimeHandlingStatement)) return;\n\n // A non-final empty default is handled by its following case.\n if (isFallthroughDefault(node, defaultIndex)) return;\n\n // Comments distinguish deliberate no-ops without requiring type info.\n if (isCommentOnlyNoopDefault(defaultCase, context.sourceCode)) return;\n\n context.report({\n node: defaultCase,\n messageId: \"missingAssertNever\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview require-fetch-timeout — a `fetch` with no signal hangs for as long as the upstream stalls, holding the caller open with it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-fetch-timeout.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"missingSignal\";\ntype Options = readonly [\n {\n allowIn?: readonly string[];\n }?,\n];\n\n/** The explicit-global receivers of `<obj>.fetch(...)`. */\nconst GLOBAL_OBJECTS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n]);\n\nfunction matchesAnyPattern(\n filename: string,\n patterns: readonly string[],\n): boolean {\n for (const pattern of patterns) {\n // Convert minimatch-ish globs to regex: ** -> .*, * -> [^/\\\\]*\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * True when the init argument provably lacks an abort signal: it is an object\n * literal with no `signal` property and no spread element. Any other shape\n * (identifier, call, spread, conditional, ...) may carry a signal, so it is\n * treated as safe.\n */\nfunction initProvablyLacksSignal(init: TSESTree.CallExpressionArgument): boolean {\n if (init.type !== AST_NODE_TYPES.ObjectExpression) {\n return false;\n }\n for (const prop of init.properties) {\n if (prop.type === AST_NODE_TYPES.SpreadElement) {\n return false;\n }\n if (\n (prop.key.type === AST_NODE_TYPES.Identifier &&\n prop.key.name === \"signal\") ||\n (prop.key.type === AST_NODE_TYPES.Literal && prop.key.value === \"signal\")\n ) {\n return false;\n }\n // A computed key could be \"signal\" at runtime; assume it is.\n if (prop.computed) {\n return false;\n }\n }\n return true;\n}\n\n/** True for a string or template literal — a URL spelled inline. */\nfunction isStringish(node: TSESTree.CallExpressionArgument): boolean {\n return (\n (node.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\") ||\n node.type === AST_NODE_TYPES.TemplateLiteral\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"require-fetch-timeout\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an abort `signal` (e.g. `AbortSignal.timeout(ms)`) on global `fetch()` calls so stalled upstreams cannot hang the caller forever.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n allowIn: {\n description:\n \"Glob patterns for wrapper modules exempt from the rule. Matched against the ABSOLUTE file path, so anchor with a `**/` prefix (e.g. `**/http-client.ts`).\",\n type: \"array\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n missingSignal:\n \"This `fetch()` has no abort `signal` — a stalled upstream will hang it forever. Pass `{ signal: AbortSignal.timeout(ms) }` or a signal from an AbortController.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n // `isTestFile` knows jscodeshift's `__testfixtures__/` spelling, so the\n // local pattern this rule used to keep for it decided nothing.\n if (isTestFile(context.filename) || isScriptFile(context.filename)) {\n return {};\n }\n const allowIn = optionsArg?.allowIn ?? [];\n if (allowIn.length > 0 && matchesAnyPattern(context.filename, allowIn)) {\n return {};\n }\n\n /** True when `identifier` resolves to the global (no local binding shadows it). */\n function resolvesToGlobal(identifier: TSESTree.Identifier): boolean {\n const scope = context.sourceCode.getScope(identifier);\n const variable = ASTUtils.findVariable(scope, identifier.name);\n // Unresolved → implicit global. Resolved with zero defs → declared\n // global (languageOptions.globals). Any def is a local shadow.\n return variable === null || variable.defs.length === 0;\n }\n\n /** True for `fetch(...)` / `globalThis.fetch(...)` / `window.fetch(...)` /\n * `self.fetch(...)` where the receiver resolves to the global scope. */\n function isGlobalFetchCall(callee: TSESTree.Expression): boolean {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"fetch\" && resolvesToGlobal(callee);\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"fetch\" &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n GLOBAL_OBJECTS.has(callee.object.name) &&\n resolvesToGlobal(callee.object)\n );\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isGlobalFetchCall(node.callee)) {\n return;\n }\n\n // Proxy passthrough: a lone non-string argument is a Request (or\n // equivalent) being forwarded — the inbound request owns the\n // lifetime, and a fresh signal cannot be attached without an init.\n const [first, init] = node.arguments;\n if (node.arguments.length === 1 && first !== undefined && !isStringish(first)) {\n return;\n }\n\n if (init === undefined || initProvablyLacksSignal(init)) {\n context.report({ node, messageId: \"missingSignal\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-interface-for-injected-service — an exported class with injected collaborators and no port above it can only be tested by mocking the class.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-interface-for-injected-service.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isScriptFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"requireInterface\";\ntype Options = readonly [];\n\nconst CONFIGISH_TYPE_RE =\n /(?:Options|Opts|Config|Configuration|Settings|Params|Props|Args|Env|Environment|Callbacks|Flags)$/;\n\n/** Configuration names plus logger and clock, which alone do not establish a service seam. */\nconst CONFIGISH_NAME_RE =\n /^(?:options|opts|config|configuration|settings|params|props|args|env|environment|callbacks|flags|logger|log|clock)$/i;\n\n/** Third-party transports commonly replaced below a thin client wrapper. */\nconst HTTP_TRANSPORT_TYPE_RE = /^(?:KyInstance|AxiosInstance|Session)$/;\n\n/** Containers and mapped helpers describe data rather than substitutable implementations. */\nconst BUILTIN_CONTAINER_TYPE_RE =\n /^(?:Record|Map|WeakMap|Set|WeakSet|Array|ReadonlyArray|ReadonlyMap|ReadonlySet|Promise|Partial|Required|Readonly|Pick|Omit|Exclude|Extract|NonNullable|Awaited|Parameters|ReturnType|InstanceType)$/;\n\nconst TRANSPORT_WRAPPER_NAME_RE = /Client$/;\n\n/** Router-factory call that marks HTTP wiring. */\nconst ROUTER_FACTORY_NAME = \"Router\";\n\n/** Namespaced framework HTTP types; unqualified DOM globals do not match. */\nconst FRAMEWORK_HTTP_TYPES: ReadonlySet<string> = new Set([\"Request\", \"Response\", \"NextFunction\"]);\n\ninterface Collaborator {\n readonly name: string;\n /** Rightmost segment of the type name — what the config-ish guards test. */\n readonly typeName: string;\n /** Full source spelling, including any namespace qualifier, for the message. */\n readonly display: string;\n}\n\n/** The class's own declaration is what `export`s it; anonymous defaults have no name to report. */\nconst isExportedClass = (node: TSESTree.ClassDeclaration): boolean =>\n node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration;\n\n/** `catalog.Client` -> `\"catalog.Client\"`; a nested qualifier is flattened the same way. */\nconst qualifiedName = (name: TSESTree.EntityName): string =>\n name.type === AST_NODE_TYPES.Identifier\n ? name.name\n : name.type === AST_NODE_TYPES.TSQualifiedName\n ? `${qualifiedName(name.left)}.${name.right.name}`\n : \"\";\n\n/** The rightmost segment plus the full spelling of a bare type reference, or null for anything else. */\nconst readTypeReference = (\n annotation: TSESTree.TypeNode | undefined,\n): { readonly typeName: string; readonly display: string } | null => {\n // A bare type reference is the only shape that names a nominal collaborator.\n // A union, an array, or a function type is data or a callback, never something\n // a consumer would want to swap wholesale.\n if (annotation === undefined || annotation.type !== AST_NODE_TYPES.TSTypeReference) return null;\n const { typeName } = annotation;\n const rightmost =\n typeName.type === AST_NODE_TYPES.Identifier\n ? typeName.name\n : typeName.type === AST_NODE_TYPES.TSQualifiedName\n ? typeName.right.name\n : null;\n if (rightmost === null) return null;\n return { typeName: rightmost, display: qualifiedName(typeName) };\n};\n\nconst namedParameterCollaborator = (annotated: TSESTree.Parameter): Collaborator | null => {\n let target: TSESTree.Node = annotated;\n if (target.type === AST_NODE_TYPES.TSParameterProperty) target = target.parameter;\n if (target.type === AST_NODE_TYPES.AssignmentPattern) target = target.left;\n if (target.type !== AST_NODE_TYPES.Identifier) return null;\n // An inline `{ a: string }` on a NAMED parameter stays out: the bindings the\n // options-object walk below reads do not exist, so there is no collaborator to\n // name. `deps: SomeDeps` is covered by the bare-reference path.\n const reference = readTypeReference(target.typeAnnotation?.typeAnnotation);\n if (reference === null) return null;\n return { name: target.name, ...reference };\n};\n\ntype TypeReference = { readonly typeName: string; readonly display: string };\ntype MemberTypes = ReadonlyMap<string, TypeReference>;\n\n/** Property signatures of a `{ a: A; b: B }` body, keyed by property name. */\nconst propertySignatureTypes = (\n members: readonly TSESTree.TypeElement[],\n): Map<string, TypeReference> => {\n const types = new Map<string, TypeReference>();\n for (const member of members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) continue;\n if (member.computed || member.key.type !== AST_NODE_TYPES.Identifier) continue;\n const reference = readTypeReference(member.typeAnnotation?.typeAnnotation);\n if (reference === null) continue;\n types.set(member.key.name, reference);\n }\n return types;\n};\n\n/** Locally declared object shapes and function aliases used to resolve constructor bags. */\ninterface FileTypeIndex {\n /** `interface Deps { … }` / `type Deps = { … }`, by name. */\n readonly objects: ReadonlyMap<string, MemberTypes>;\n /** `type Replayer = (e: Event) => void` — a callback with a nominal name. */\n readonly functionAliases: ReadonlySet<string>;\n}\n\nconst fileTypeIndex = (program: TSESTree.Program): FileTypeIndex => {\n const objects = new Map<string, MemberTypes>();\n const functionAliases = new Set<string>();\n for (const statement of program.body) {\n const declaration =\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;\n if (declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration) {\n objects.set(declaration.id.name, propertySignatureTypes(declaration.body.body));\n continue;\n }\n if (declaration?.type !== AST_NODE_TYPES.TSTypeAliasDeclaration) continue;\n const aliased = declaration.typeAnnotation;\n if (\n aliased.type === AST_NODE_TYPES.TSFunctionType ||\n aliased.type === AST_NODE_TYPES.TSConstructorType\n ) {\n functionAliases.add(declaration.id.name);\n continue;\n }\n // `type Deps = { … }` and `type Deps = Base & { … }` both resolve; the\n // intersection form is how a bag is usually extended.\n const literals =\n aliased.type === AST_NODE_TYPES.TSTypeLiteral\n ? [aliased]\n : aliased.type === AST_NODE_TYPES.TSIntersectionType\n ? aliased.types.filter((part) => part.type === AST_NODE_TYPES.TSTypeLiteral)\n : [];\n if (literals.length === 0) continue;\n const merged = new Map<string, TypeReference>();\n for (const literal of literals) {\n for (const [name, reference] of propertySignatureTypes(literal.members)) {\n merged.set(name, reference);\n }\n }\n objects.set(declaration.id.name, merged);\n }\n return { objects, functionAliases };\n};\n\n/**\n * Member types of an options-object parameter's annotation: the annotation's own\n * body when it is written inline, otherwise the declaration it names, resolved\n * in this file only.\n */\nconst bagMemberTypes = (\n annotation: TSESTree.TypeNode,\n declared: () => FileTypeIndex,\n): MemberTypes | null => {\n if (annotation.type === AST_NODE_TYPES.TSTypeLiteral) {\n return propertySignatureTypes(annotation.members);\n }\n // A qualified `catalog.Deps` names another module by construction.\n if (\n annotation.type !== AST_NODE_TYPES.TSTypeReference ||\n annotation.typeName.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n return declared().objects.get(annotation.typeName.name) ?? null;\n};\n\n/** Resolve separately stored collaborators from a locally typed constructor bag. */\nconst objectPatternCollaborators = (\n pattern: TSESTree.ObjectPattern,\n declared: () => FileTypeIndex,\n): Collaborator[] => {\n const annotation = pattern.typeAnnotation?.typeAnnotation;\n if (annotation === undefined) return [];\n const members = bagMemberTypes(annotation, declared);\n if (members === null) return [];\n\n const collaborators: Collaborator[] = [];\n for (const property of pattern.properties) {\n if (property.type !== AST_NODE_TYPES.Property || property.computed) continue;\n if (property.key.type !== AST_NODE_TYPES.Identifier) continue;\n const key = property.key.name;\n const bound =\n property.value.type === AST_NODE_TYPES.AssignmentPattern\n ? property.value.left\n : property.value;\n if (bound.type !== AST_NODE_TYPES.Identifier) continue;\n // A renamed binding (`{ repo: userRepo }`) offers two names; either one\n // reading as config-ish is enough to drop it, on the same reasoning that\n // drops a config-ish parameter name.\n if (CONFIGISH_NAME_RE.test(key)) continue;\n const reference = members.get(key);\n if (reference === undefined) continue;\n collaborators.push({ name: bound.name, ...reference });\n }\n return collaborators;\n};\n\n/** Every collaborator a single constructor parameter contributes: 0, 1, or (destructured) many. */\nconst parameterCollaborators = (\n parameter: TSESTree.Parameter,\n declared: () => FileTypeIndex,\n): readonly Collaborator[] => {\n let target: TSESTree.Node = parameter;\n if (target.type === AST_NODE_TYPES.AssignmentPattern) target = target.left;\n if (target.type === AST_NODE_TYPES.ObjectPattern) {\n return objectPatternCollaborators(target, declared);\n }\n const named = namedParameterCollaborator(parameter);\n return named === null ? [] : [named];\n};\n\ninterface ConstructorFacts {\n /** Parameters assigned to an instance field, either as a parameter property or in the body. */\n readonly collaborators: readonly Collaborator[];\n /** How many instance fields the constructor fills with a `new` expression. */\n readonly constructedFields: number;\n}\n\n/** Names bound by `class Foo<T>` / `constructor<T>()` — placeholders, not implementations. */\nconst typeParameterNames = (\n ...declarations: readonly (TSESTree.TSTypeParameterDeclaration | undefined)[]\n): ReadonlySet<string> => {\n const names = new Set<string>();\n for (const declaration of declarations) {\n for (const parameter of declaration?.params ?? []) names.add(parameter.name.name);\n }\n return names;\n};\n\nconst readConstructor = (\n ctor: TSESTree.MethodDefinition,\n declared: () => FileTypeIndex,\n typeParameters: ReadonlySet<string>,\n): ConstructorFacts => {\n const body = ctor.value.body;\n const storedFrom = new Set<string>();\n let constructedFields = 0;\n\n if (body !== null && body !== undefined) {\n for (const statement of body.body) {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) continue;\n const expression = statement.expression;\n if (\n expression.type !== AST_NODE_TYPES.AssignmentExpression ||\n expression.operator !== \"=\" ||\n expression.left.type !== AST_NODE_TYPES.MemberExpression ||\n expression.left.object.type !== AST_NODE_TYPES.ThisExpression\n ) {\n continue;\n }\n const source = expression.right;\n if (source.type === AST_NODE_TYPES.NewExpression) {\n constructedFields += 1;\n } else if (source.type === AST_NODE_TYPES.Identifier) {\n // `this.svc = svc`\n storedFrom.add(source.name);\n } else if (\n source.type === AST_NODE_TYPES.MemberExpression &&\n source.object.type === AST_NODE_TYPES.Identifier\n ) {\n // `this.slack = deps.slack` — a dependency bag spread onto fields.\n storedFrom.add(source.object.name);\n }\n }\n }\n\n const collaborators: Collaborator[] = [];\n for (const parameter of ctor.value.params) {\n for (const reference of parameterCollaborators(parameter, declared)) {\n const stored =\n parameter.type === AST_NODE_TYPES.TSParameterProperty || storedFrom.has(reference.name);\n if (!stored) continue;\n if (CONFIGISH_TYPE_RE.test(reference.typeName)) continue;\n if (CONFIGISH_NAME_RE.test(reference.name)) continue;\n // A bare type reference can still be one of three things a port would\n // protect nothing about, each of them the inline shape this rule already\n // rejects wearing a nominal name.\n if (typeParameters.has(reference.typeName)) continue;\n if (BUILTIN_CONTAINER_TYPE_RE.test(reference.typeName)) continue;\n if (declared().functionAliases.has(reference.typeName)) continue;\n collaborators.push(reference);\n }\n }\n\n return { collaborators, constructedFields };\n};\n\n/** Walk every descendant node, `parent` links excluded, until `found` returns true. */\nconst subtreeHas = (root: TSESTree.Node, found: (node: TSESTree.Node) => boolean): boolean => {\n let hit = false;\n const visit = (current: TSESTree.Node): void => {\n if (hit) return;\n if (found(current)) {\n hit = true;\n return;\n }\n for (const key of Object.keys(current) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = current[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n }\n };\n visit(root);\n return hit;\n};\n\n/** Framework router wiring is mounted at bootstrap rather than injected into consumers. */\nconst isFrameworkWiring = (body: TSESTree.ClassBody): boolean =>\n subtreeHas(body, (node) => {\n if (node.type === AST_NODE_TYPES.CallExpression) {\n const { callee } = node;\n if (callee.type === AST_NODE_TYPES.Identifier) return callee.name === ROUTER_FACTORY_NAME;\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === ROUTER_FACTORY_NAME\n );\n }\n // `express.Request` — qualified on purpose, so the DOM `Request`/`Response`\n // globals a Workers `fetch` handler names do not read as express wiring.\n return (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.TSQualifiedName &&\n FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name)\n );\n });\n\nconst stem = (name: string): string => name.replace(/^I(?=[A-Z])/, \"\").replace(/Impl$/, \"\");\n\n/** Interface declarations at the top level of this module, exported or not. */\nconst fileInterfaceNames = (program: TSESTree.Program): string[] => {\n const names: string[] = [];\n for (const statement of program.body) {\n const declaration =\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;\n if (declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration) names.push(declaration.id.name);\n }\n return names;\n};\n\n/** Report whether the class is a thin wrapper over somebody else's HTTP transport. */\nconst isTransportWrapper = (\n className: string,\n collaborators: readonly Collaborator[],\n program: TSESTree.Program,\n): boolean => {\n const [only] = collaborators;\n if (collaborators.length !== 1 || only === undefined) return false;\n if (!HTTP_TRANSPORT_TYPE_RE.test(only.typeName)) return false;\n if (!TRANSPORT_WRAPPER_NAME_RE.test(className)) return false;\n const target = stem(className);\n return !fileInterfaceNames(program).some((name) => {\n const other = stem(name);\n return target.endsWith(other) || other.endsWith(target);\n });\n};\n\n/**\n * Public instance methods only. `kind === \"method\"` excludes getters and setters\n * on purpose: a class that exposes only accessors is a value object, and the\n * constructor is not a seam worth porting.\n */\nconst publicMethodNames = (body: TSESTree.ClassBody): string[] => {\n const names: string[] = [];\n for (const member of body.body) {\n if (member.type !== AST_NODE_TYPES.MethodDefinition) continue;\n if (member.kind !== \"method\" || member.static) continue;\n if (member.accessibility === \"private\" || member.accessibility === \"protected\") continue;\n if (member.key.type === AST_NODE_TYPES.PrivateIdentifier) continue;\n if (member.key.type === AST_NODE_TYPES.Identifier) names.push(member.key.name);\n else names.push(\"…\");\n }\n return names;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-interface-for-injected-service\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"An exported service class with constructor-injected collaborators must implement an interface, so consumers depend on a port they can substitute instead of mocking the class.\",\n },\n schema: [],\n messages: {\n requireInterface:\n \"`{{name}}` stores injected collaborator(s) ({{deps}}) but implements no interface, so every consumer depends on this concrete class and can only be tested by mocking it. Declare an interface with its public method signature(s) ({{methods}}) and `class {{name}} implements <Interface>`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const { filename } = context;\n if (isTestFile(filename) || isStoryFile(filename) || isScriptFile(filename)) return {};\n if (isGeneratedFile(filename, context.sourceCode.getText())) return {};\n\n // One pass over the module's top level, and only for a file that actually\n // has an options-object constructor to read.\n let declaredTypes: FileTypeIndex | null = null;\n const objectTypes = (): FileTypeIndex =>\n (declaredTypes ??= fileTypeIndex(context.sourceCode.ast));\n\n return {\n ClassDeclaration(node: TSESTree.ClassDeclaration): void {\n if (node.id === null) return;\n if (!isExportedClass(node)) return;\n // The port itself must never fire, and a class that extends anything —\n // an abstract base, a framework class, `Error` — already has one.\n if (node.abstract === true) return;\n if (node.superClass !== null) return;\n if (node.implements.length > 0) return;\n // A framework that instantiates by class token (NestJS `@Injectable()`)\n // makes the class its own contract.\n if (node.decorators.length > 0) return;\n\n const ctor = node.body.body.find(\n (member): member is TSESTree.MethodDefinition =>\n member.type === AST_NODE_TYPES.MethodDefinition && member.kind === \"constructor\",\n );\n if (ctor === undefined) return;\n\n const { collaborators, constructedFields } = readConstructor(\n ctor,\n objectTypes,\n typeParameterNames(node.typeParameters, ctor.value.typeParameters),\n );\n if (collaborators.length === 0) return;\n // A composition root BUILDS more than it RECEIVES — that is where\n // concrete types are supposed to be named, and a port above it protects\n // nobody. Constructing one internal helper while receiving a real\n // collaborator is an ordinary service, not a wiring class, so the test\n // is a ratio rather than the mere presence of a `new`.\n if (constructedFields > collaborators.length) return;\n // HTTP wiring: a router factory is mounted by the bootstrap, not injected.\n if (isFrameworkWiring(node.body)) return;\n // A lone third-party transport is not a seam a port could protect.\n if (isTransportWrapper(node.id.name, collaborators, context.sourceCode.ast)) return;\n\n const methods = publicMethodNames(node.body);\n if (methods.length === 0) return;\n\n context.report({\n node: node.id,\n messageId: \"requireInterface\",\n data: {\n name: node.id.name,\n deps: collaborators.map((c) => `${c.name}: ${c.display}`).join(\", \"),\n methods: methods.join(\", \"),\n },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview require-static-next-matcher — Next.js matcher configuration must be statically analyzable at build time.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-static-next-matcher.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"dynamicMatcher\";\ntype Options = readonly [];\n\nconst NEXT_ENTRY_FILE = /(?:^|[/\\\\])(?:middleware|proxy)\\.[cm]?[jt]sx?$/u;\n\nfunction unwrapExpression(node: TSESTree.Node): TSESTree.Node {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n node.type === AST_NODE_TYPES.TSNonNullExpression ||\n node.type === AST_NODE_TYPES.TSTypeAssertion\n ) {\n return unwrapExpression(node.expression);\n }\n return node;\n}\n\nfunction isStaticValue(node: TSESTree.Node): boolean {\n const value = unwrapExpression(node);\n if (value.type === AST_NODE_TYPES.Literal) {\n return true;\n }\n if (value.type === AST_NODE_TYPES.TemplateLiteral) {\n return value.expressions.length === 0;\n }\n if (value.type === AST_NODE_TYPES.ArrayExpression) {\n return value.elements.every(\n (element) =>\n element !== null &&\n element.type !== AST_NODE_TYPES.SpreadElement &&\n isStaticValue(element),\n );\n }\n if (value.type === AST_NODE_TYPES.ObjectExpression) {\n return value.properties.every(\n (property) =>\n property.type === AST_NODE_TYPES.Property &&\n property.kind === \"init\" &&\n !property.computed &&\n property.value.type !== AST_NODE_TYPES.AssignmentPattern &&\n isStaticValue(property.value),\n );\n }\n return false;\n}\n\nfunction propertyName(property: TSESTree.Property): string | null {\n if (property.computed) return null;\n if (property.key.type === AST_NODE_TYPES.Identifier) return property.key.name;\n return typeof property.key.value === \"string\" ? property.key.value : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"require-static-next-matcher\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Next.js middleware and proxy matcher configuration to contain only build-time literals.\",\n },\n schema: [],\n messages: {\n dynamicMatcher:\n \"Next.js matcher values must contain only literal arrays and objects. Calls, identifiers, concatenation, interpolated templates, and spreads are not statically analyzable and fail the production build.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!NEXT_ENTRY_FILE.test(context.filename)) {\n return {};\n }\n\n return {\n ExportNamedDeclaration(node): void {\n if (node.declaration?.type !== AST_NODE_TYPES.VariableDeclaration) {\n return;\n }\n for (const declaration of node.declaration.declarations) {\n if (\n declaration.id.type !== AST_NODE_TYPES.Identifier ||\n declaration.id.name !== \"config\" ||\n declaration.init === null\n ) {\n continue;\n }\n const config = unwrapExpression(declaration.init);\n if (config.type !== AST_NODE_TYPES.ObjectExpression) {\n continue;\n }\n for (const property of config.properties) {\n if (\n property.type !== AST_NODE_TYPES.Property ||\n propertyName(property) !== \"matcher\" ||\n property.value.type === AST_NODE_TYPES.AssignmentPattern\n ) {\n continue;\n }\n if (!isStaticValue(property.value)) {\n context.report({ node: property.value, messageId: \"dynamicMatcher\" });\n }\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-zod-form-validation — `formData.get(k)` hands back an attacker-controlled `FormDataEntryValue | null`.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-zod-form-validation.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { ZOD_SCHEMA_NAME_RE } from \"./_zod.js\";\n\ntype MessageIds = \"missingZodValidation\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** Recognize the supported Zod receiver naming conventions. */\nconst looksLikeZodSchema = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n while (true) {\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name === \"z\" || ZOD_SCHEMA_NAME_RE.test(current.name);\n }\n if (current.type === AST_NODE_TYPES.CallExpression) {\n current = current.callee;\n continue;\n }\n if (current.type === AST_NODE_TYPES.MemberExpression) {\n current = current.object;\n continue;\n }\n return false;\n }\n};\n\n/** Match `parse` and `safeParse` only on Zod-shaped receivers. */\nconst isZodParseCall = (node: TSESTree.Node): boolean => {\n if (node.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return false;\n if (callee.computed) return false;\n if (callee.property.type !== AST_NODE_TYPES.Identifier) return false;\n const method = callee.property.name;\n if (method !== \"parse\" && method !== \"safeParse\") return false;\n return looksLikeZodSchema(callee.object);\n};\n\n/** Match an optionally awaited `<x>.formData()` call. */\nconst isFormDataMethodCall = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n if (current.type === AST_NODE_TYPES.AwaitExpression) {\n current = current.argument;\n }\n if (current.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = current.callee;\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"formData\"\n );\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-zod-form-validation\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.\",\n },\n schema: [],\n messages: {\n missingZodValidation:\n \"FormData parsing must use Zod schema validation (e.g., Schema.parse() / Schema.safeParse())\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n if (isTestFile(context.filename)) {\n return {};\n }\n\n // Recognize conventional names and bindings initialized by `.formData()`.\n const isFormSourceIdentifier = (node: TSESTree.Node): boolean => {\n if (node.type !== AST_NODE_TYPES.Identifier) return false;\n if (/formdata/i.test(node.name)) return true;\n\n let scope: Scope.Scope | null = context.sourceCode.getScope(node);\n while (scope !== null) {\n const variable = scope.set.get(node.name);\n if (variable !== undefined && variable.defs.length === 1) {\n const def = variable.defs[0];\n if (\n def !== undefined &&\n def.type === \"Variable\" &&\n def.node.type === AST_NODE_TYPES.VariableDeclarator &&\n def.node.init !== null\n ) {\n return isFormDataMethodCall(def.node.init);\n }\n return false;\n }\n scope = scope.upper;\n }\n return false;\n };\n\n const isFormDataGetCall = (node: TSESTree.CallExpression): boolean => {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return false;\n if (\n callee.property.type !== AST_NODE_TYPES.Identifier ||\n callee.property.name !== \"get\"\n ) {\n return false;\n }\n return isFormSourceIdentifier(callee.object);\n };\n\n const hasZodParseAncestor = (node: TSESTree.Node): boolean => {\n let parent: TSESTree.Node | null | undefined = node.parent;\n while (parent !== null && parent !== undefined) {\n if (isZodParseCall(parent)) return true;\n parent = parent.parent;\n }\n return false;\n };\n\n const isInstanceofNarrowing = (node: TSESTree.Node): boolean => {\n const parent: TSESTree.Node | null | undefined = node.parent;\n return (\n parent !== null &&\n parent !== undefined &&\n parent.type === AST_NODE_TYPES.BinaryExpression &&\n parent.operator === \"instanceof\" &&\n parent.left === node &&\n parent.right.type === AST_NODE_TYPES.Identifier &&\n (parent.right.name === \"File\" || parent.right.name === \"Blob\")\n );\n };\n\n /** The identifier this `.get(...)` call is bound to, or null. */\n const boundDeclarator = (\n node: TSESTree.CallExpression,\n ): TSESTree.VariableDeclarator | null => {\n const parent = node.parent;\n if (\n parent.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.init === node &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent;\n }\n return null;\n };\n\n /** Is any read of this binding validated (Zod parse, or `instanceof File`)? */\n const bindingIsValidated = (\n declarator: TSESTree.VariableDeclarator,\n ): boolean => {\n const variable = context.sourceCode.getDeclaredVariables(declarator)[0];\n if (variable === undefined) return false;\n return variable.references.some(\n (ref) =>\n hasZodParseAncestor(ref.identifier) ||\n isInstanceofNarrowing(ref.identifier),\n );\n };\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isFormDataGetCall(node)) return;\n\n if (hasZodParseAncestor(node) || isInstanceofNarrowing(node)) return;\n\n const declarator = boundDeclarator(node);\n if (declarator !== null && bindingIsValidated(declarator)) return;\n\n context.report({\n node,\n messageId: \"missingZodValidation\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview store-insert-requires-on-conflict — a bare `INSERT` duplicates rows or throws under cron re-runs and queue redelivery.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/store-insert-requires-on-conflict.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"storeInsertRequiresOnConflict\";\ntype Options = readonly [];\n\n/** Matches INSERT writes only when their SQL keywords are adjacent. */\nconst INSERT_WRITE =\n /\\bINSERT\\s+(?:OR\\s+\\w+\\s+)?INTO\\s+[\\w.\"'`?$:@-]+\\s*(?:\\([^)]*\\)\\s*)?(?:VALUES|SELECT|DEFAULT\\s+VALUES)\\b/i;\n\n/** Matches supported replay-safe insert forms. */\nconst CONFLICT_HANDLED = /\\bON\\s+CONFLICT\\b|\\bON\\s+DUPLICATE\\s+KEY\\b|\\bINSERT\\s+OR\\s+(?:IGNORE|REPLACE)\\b/i;\n\nconst INSERT_GATE = /insert/i;\n\nexport default createRule<Options, MessageIds>({\n name: \"store-insert-requires-on-conflict\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an embedded SQL INSERT to carry ON CONFLICT; store writes replay under cron re-runs and queue redelivery and must be idempotent upserts.\",\n },\n schema: [],\n messages: {\n storeInsertRequiresOnConflict:\n \"This INSERT is not replay-safe: a cron re-run or queue redelivery duplicates the row (or fails the handler on a unique-constraint violation). Add `ON CONFLICT (...) DO UPDATE` / `DO NOTHING` (or `INSERT OR IGNORE`).\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !INSERT_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!INSERT_WRITE.test(sql) || CONFLICT_HANDLED.test(sql)) {\n return;\n }\n context.report({ node, messageId: \"storeInsertRequiresOnConflict\" });\n });\n },\n});\n","/**\n * @fileoverview zod-naming-convention — a schema you cannot recognise at its use site sends every reader back to the declaration.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/zod-naming-convention.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\nimport { ZOD_PREFIX_RE, ZOD_SCHEMA_NAME_RE, ZOD_SUFFIX_RE } from \"./_zod.js\";\n\ntype MessageIds = \"zPrefix\" | \"schemaSuffix\" | \"zodSchemaName\";\ntype Convention = \"prefix\" | \"suffix\" | \"either\";\ntype Options = readonly [\n {\n convention?: Convention;\n }?,\n];\n\nconst CONVENTIONS: Record<\n Convention,\n { readonly test: RegExp; readonly messageId: MessageIds }\n> = {\n prefix: { test: ZOD_PREFIX_RE, messageId: \"zPrefix\" },\n suffix: { test: ZOD_SUFFIX_RE, messageId: \"schemaSuffix\" },\n either: { test: ZOD_SCHEMA_NAME_RE, messageId: \"zodSchemaName\" },\n};\n\n/** Names containing \"schema\" are already recognisable at the use site. */\nconst CONTAINS_SCHEMA_RE = /schema/i;\n\n/** Benchmark-local schemas are fixtures; require a complete path segment. */\nconst BENCHMARK_PATH_RE = /(^|[\\\\/])(?:benchmarks?|bench)[\\\\/]/;\n\n/**\n * Terminal methods whose results are values, result envelopes, registries,\n * JSON objects, or functions rather than schemas.\n */\nconst NON_SCHEMA_TERMINALS: ReadonlySet<string> = new Set([\n \"parse\",\n \"parseAsync\",\n \"safeParse\",\n \"safeParseAsync\",\n \"encode\",\n \"decode\",\n \"encodeAsync\",\n \"decodeAsync\",\n \"safeEncode\",\n \"safeDecode\",\n \"safeEncodeAsync\",\n \"safeDecodeAsync\",\n \"toJSONSchema\",\n \"registry\",\n \"implement\",\n]);\n\n/** Return the final method name in a call chain. */\nconst terminalMethodName = (callee: TSESTree.MemberExpression): string | null =>\n !callee.computed && callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : null;\n\n/** Return whether a call chain originates from the bare `z` identifier. */\nconst calleeChainStartsWithZ = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n\n while (current.type === AST_NODE_TYPES.MemberExpression) {\n const receiver: TSESTree.Node = current.object;\n if (receiver.type === AST_NODE_TYPES.Identifier && receiver.name === \"z\") {\n return true;\n }\n if (receiver.type === AST_NODE_TYPES.CallExpression) {\n current = receiver.callee;\n continue;\n }\n return false;\n }\n\n return false;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"zod-naming-convention\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce a consistent Zod schema naming convention — a `Z` prefix (`ZUser`) or a `Schema` suffix (`userSchema`); both are accepted by default.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n convention: {\n type: \"string\",\n enum: [\"prefix\", \"suffix\", \"either\"],\n },\n },\n },\n ],\n messages: {\n zPrefix: \"Zod schema names should start with Z (e.g. `ZUser`)\",\n schemaSuffix: \"Zod schema names should end with Schema (e.g. `userSchema`)\",\n zodSchemaName:\n \"Zod schema names should start with Z (`ZUser`) or end with Schema (`userSchema`)\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const convention = optionsArg?.convention ?? \"either\";\n const { test, messageId } = CONVENTIONS[convention];\n // A schema-containing name does not satisfy an explicitly prefix-only policy.\n const acceptsSchemaWord = convention !== \"prefix\";\n\n // Test and benchmark schemas are local fixtures rather than APIs.\n if (\n isTestFile(context.filename) ||\n BENCHMARK_PATH_RE.test(context.filename.replaceAll(\"\\\\\", \"/\")) ||\n isGeneratedFile(context.filename, context.sourceCode.text)\n ) {\n return {};\n }\n\n return {\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n const init = node.init;\n if (init === null || init === undefined) return;\n if (init.type !== AST_NODE_TYPES.CallExpression) return;\n\n const callee = init.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return;\n\n if (!calleeChainStartsWithZ(callee)) return;\n\n // Do not apply schema naming to calls that return non-schema values.\n const terminal = terminalMethodName(callee);\n if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;\n\n if (node.id.type !== AST_NODE_TYPES.Identifier) return;\n if (test.test(node.id.name)) return;\n // The name already identifies a schema in any casing.\n if (acceptsSchemaWord && CONTAINS_SCHEMA_RE.test(node.id.name)) return;\n\n context.report({\n node: node.id,\n messageId,\n });\n },\n };\n },\n});\n","/**\n * @fileoverview _renames — every rule this plugin has renamed, old name to new; the old names no longer resolve, so this map is what says what to write instead.\n *\n * `sarj-standards repo sync-ledger` turns each entry into the consumer-facing ledger row.\n *\n */\n\nexport const renamedRules = {\n \"jsdoc-restates-signature\": \"no-restated-jsdoc\",\n \"no-async-callback-in-waitfor\": \"no-async-callback-in-wait-for\",\n \"strict-test-assertions\": \"prefer-whole-object-assertion\",\n \"trailing-value-narration\": \"no-trailing-value-narration\",\n} as const;\n\nexport type RenamedFrom = keyof typeof renamedRules;\nexport type RenamedTo = (typeof renamedRules)[RenamedFrom];\n","/** @fileoverview _retired — burned rule names and their migration action. */\n\n/** Why a name was withdrawn, and in which release. */\nexport interface RetiredRule {\n /** The plugin version whose release removed the rule. */\n readonly removedIn: string;\n /** One line a consumer can act on: why it went, and what (if anything) replaced it. */\n readonly reason: string;\n}\n\nexport const retiredRules: Readonly<Record<string, RetiredRule>> = {\n \"ban-loose-type-guards-in-tests\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-implicit-attribute-access\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-sequential-await\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; core `no-await-in-loop` covers it.\",\n },\n \"no-template-literal-in-log\": {\n removedIn: \"2.3.1\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-unsafe-cast\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; keep `@typescript-eslint/consistent-type-assertions` enabled.\",\n },\n \"prefer-setup-file-mocks\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"prefer-shadcn\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; use `react/forbid-elements` for element restrictions.\",\n },\n \"primary-export-file-name\": {\n removedIn: \"4.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"require-parameterized-tests\": {\n removedIn: \"4.0.0\",\n reason: \"Delete stale references; the rule was never registered.\",\n },\n \"require-schema-validate-search\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; use `@typescript-eslint/consistent-type-assertions`.\",\n },\n \"single-public-export\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAAA,gBAA8C;;;ACD9C,mBAA4B;AAErB,IAAM,YAAY;AAClB,IAAM,YAAY;AAElB,IAAM,eAAe,CAAC,SAC3B,GAAG,SAAS,IAAI,IAAI;AAEf,IAAM,cAAc,CAAC,SAC1B,GAAG,SAAS,IAAI,aAAa,IAAI,CAAC;AAE7B,IAAM,aAAa,yBAAY,YAAY,WAAW;;;ACT7D,IAAM,iBAAiB;AAEvB,IAAM,gBAAgB;AAGtB,IAAM,gBAAgB;AAItB,IAAM,oBACJ;AAGF,IAAM,m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AAA,EACrC,mCAAmC;AAAA,EACnC,gCAAgC;AAAA,EAChC,4BAA4B;AAAA,EAC5B,6CAA6C;AAAA,EAC7C,oCAAoC;AAAA,EACpC,mCAAmC;AAAA,EACnC,sCAAsC;AAAA,EACtC,oCAAoC;AAAA,EACpC,wCAAwC;AAAA,EACxC,uCAAuC;AAAA,EACvC,gCAAgC,CAAC,SAAS,EAAE,uBAAuB,KAAK,CAAC;AAAA,EACzE,+BAA+B;AAAA,EAC/B,wCAAwC;AAAA,EACxC,qCAAqC;AAAA,EACrC,uCAAuC;AAAA,EACvC,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,gDAAgD;AAAA,EAChD,qCAAqC;AAAA,EACrC,qCAAqC;AAAA,EACrC,2CAA2C;AAAA,EAC3C,+BAA+B;AACjC;AAaA,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA,SAAS;AAAA,IACP,aAAa,CAAC;AAAA,IACd,QAAQ,CAAC;AAAA,EACX;AACF;AAEA,OAAO,QAAQ,cAAc;AAAA,EAC3B,MAAM;AAAA,EACN,SAAS,EAAE,SAAS,OAAO;AAAA,EAC3B,OAAO;AACT;AAEA,OAAO,QAAQ,SAAS;AAAA,EACtB,MAAM;AAAA,EACN,SAAS,EAAE,SAAS,OAAO;AAAA,EAC3B,OAAO;AACT;AAEA,IAAO,gBAAQ;","names":["import_utils","body","import_utils","import_utils","import_utils","import_utils","body","body","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","isNode","subtreeMatches","body","import_utils","matchesAnyPattern","import_utils","import_utils","import_utils","propName","body","import_utils","import_utils","calleeName","FUNCTION_TYPES","body","import_utils","DIRECTIVE_RE","LICENSE_RE","import_utils","import_utils","import_utils","import_utils","import_utils","module","import_utils","FUNCTION_TYPES","import_utils","DIRECTIVE_RE","WALL_NARRATION_RE","areAdjacentLineComments","body","import_utils","DIRECTIVE_RE","STOPWORDS","WORD_RE","import_utils","propertyKeyName","keyName","import_utils","import_utils","isNode","calleeName","body","import_utils","body","import_utils","TEST_CALLERS","FUNCTION_TYPES","body","nearestEnclosingFunction","testCallerName","isTestBody","import_utils","DEFAULT_METHODS","compile","import_utils","body","import_utils","preview","import_utils","WORD_RE","STOPWORDS","DIRECTIVE_RE","body","import_utils","import_utils","VALUE_TAG_RE","NON_ASCII_LETTER_RE","WORD_RE","body","body","import_utils","LEAD_IN_RE","body","import_utils","body","named","import_utils","import_utils","import_utils","unwrap","import_utils","import_utils","import_utils","import_utils","import_utils","IGNORE_PATTERNS","FUNCTION_TYPES","isIgnoredFile","unwrap","enclosingFunction","import_utils","isZodModule","FUNCTION_TYPES","isZodModule","import_utils","variable","import_utils","import_utils","unwrap","findVariable","import_utils","import_utils","propName","keyName","import_utils","ts","IGNORE_PATTERNS","isIgnoredFile","import_utils","NUMERIC_SIGNS","body","import_utils","isZodModule","import_utils","isZodModule","import_utils","import_utils","GLOBAL_OBJECTS","matchesAnyPattern","isGlobalFetchCall","import_utils","named","body","stem","import_utils","propertyName","import_utils","import_utils","import_utils"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/rules/enforce-file-structure.ts","../src/rules/_docs.ts","../src/rules/_paths.ts","../src/rules/no-async-callback-in-wait-for.ts","../src/rules/no-client-side-data-fetching.ts","../src/rules/no-comment-cruft.ts","../src/rules/_comments.ts","../src/rules/no-conditional-in-test.ts","../src/rules/no-cors-wildcard-with-credentials.ts","../src/rules/no-dynamic-sql.ts","../src/rules/_sql.ts","../src/rules/no-enum.ts","../src/rules/no-fat-try-blocks.ts","../src/rules/no-hand-rolled-sleep.ts","../src/rules/no-hand-rolled-spinner.ts","../src/rules/no-insecure-random-id.ts","../src/rules/no-json-stringify-error.ts","../src/rules/no-log-only-catch.ts","../src/rules/_logging.ts","../src/rules/_prose-budget.ts","../src/rules/no-long-comment.ts","../src/rules/no-offset-pagination.ts","../src/rules/no-positional-tuple-return.ts","../src/rules/no-raw-env.ts","../src/rules/no-raw-fetch-outside-clients.ts","../src/rules/no-restricted-library-load.ts","../src/rules/no-repeated-string-literal.ts","../src/rules/no-restated-comment.ts","../src/rules/no-restated-jsdoc.ts","../src/rules/no-secret-in-log.ts","../src/rules/_secret-names.ts","../src/rules/no-select-star.ts","../src/rules/no-sentinel-return-on-catch.ts","../src/rules/no-silent-promise-catch.ts","../src/rules/no-sleep-in-test-body.ts","../src/rules/no-storage-in-stateless-modules.ts","../src/rules/no-string-concat-in-loop.ts","../src/rules/no-tautological-expect.ts","../src/rules/no-typed-doc-sections.ts","../src/rules/no-trailing-value-narration.ts","../src/rules/no-declaration-comment-wall.ts","../src/rules/_comment-wall.ts","../src/rules/no-union-in-comment.ts","../src/rules/no-type-member-comment-wall.ts","../src/rules/no-unnecessary-use-client.ts","../src/rules/no-unsafe-mock-casting.ts","../src/rules/no-zod-native-enum.ts","../src/rules/prefer-constant-time-secret-compare.ts","../src/rules/prefer-discriminated-union.ts","../src/rules/prefer-input-group-search.ts","../src/rules/prefer-shadcn-primitives.ts","../src/rules/prefer-module-level-constant.ts","../src/rules/prefer-module-level-schema.ts","../src/rules/_zod.ts","../src/rules/prefer-native-random-uuid.ts","../src/rules/prefer-non-nullable-collection.ts","../src/rules/prefer-schema-for-api-payload.ts","../src/rules/prefer-semantic-colors.ts","../src/rules/_tailwind.ts","../src/rules/prefer-server-actions.ts","../src/rules/prefer-single-sentence-comment.ts","../src/rules/prefer-string-literal-union.ts","../src/rules/prefer-whole-object-assertion.ts","../src/rules/prefer-zod-enum.ts","../src/rules/prefer-zod-infer.ts","../src/rules/require-assert-never.ts","../src/rules/require-fetch-timeout.ts","../src/rules/require-interface-for-injected-service.ts","../src/rules/require-static-next-matcher.ts","../src/rules/require-zod-form-validation.ts","../src/rules/store-insert-requires-on-conflict.ts","../src/rules/zod-naming-convention.ts","../src/rules/_renames.ts","../src/rules/_retired.ts"],"sourcesContent":["/**\n * @fileoverview index — the plugin's rule registry and its two presets; the historical rename map lives in `rules/_renames.ts`.\n */\n\nimport enforceFileStructure from \"./rules/enforce-file-structure.js\";\nimport noAsyncCallbackInWaitFor from \"./rules/no-async-callback-in-wait-for.js\";\nimport noClientSideDataFetching from \"./rules/no-client-side-data-fetching.js\";\nimport noCommentCruft from \"./rules/no-comment-cruft.js\";\nimport noConditionalInTest from \"./rules/no-conditional-in-test.js\";\nimport noCorsWildcardWithCredentials from \"./rules/no-cors-wildcard-with-credentials.js\";\nimport noDynamicSql from \"./rules/no-dynamic-sql.js\";\nimport noEnum from \"./rules/no-enum.js\";\nimport noFatTryBlocks from \"./rules/no-fat-try-blocks.js\";\nimport noHandRolledSleep from \"./rules/no-hand-rolled-sleep.js\";\nimport noHandRolledSpinner from \"./rules/no-hand-rolled-spinner.js\";\nimport noInsecureRandomId from \"./rules/no-insecure-random-id.js\";\nimport noJsonStringifyError from \"./rules/no-json-stringify-error.js\";\nimport noLogOnlyCatch from \"./rules/no-log-only-catch.js\";\nimport noLongComment from \"./rules/no-long-comment.js\";\nimport noOffsetPagination from \"./rules/no-offset-pagination.js\";\nimport noPositionalTupleReturn from \"./rules/no-positional-tuple-return.js\";\nimport noRawEnv from \"./rules/no-raw-env.js\";\nimport noRawFetchOutsideClients from \"./rules/no-raw-fetch-outside-clients.js\";\nimport noRestrictedLibraryLoad from \"./rules/no-restricted-library-load.js\";\nimport noRepeatedStringLiteral from \"./rules/no-repeated-string-literal.js\";\nimport noRestatedComment from \"./rules/no-restated-comment.js\";\nimport noRestatedJsdoc from \"./rules/no-restated-jsdoc.js\";\nimport noSecretInLog from \"./rules/no-secret-in-log.js\";\nimport noSelectStar from \"./rules/no-select-star.js\";\nimport noSentinelReturnOnCatch from \"./rules/no-sentinel-return-on-catch.js\";\nimport noSilentPromiseCatch from \"./rules/no-silent-promise-catch.js\";\nimport noSleepInTestBody from \"./rules/no-sleep-in-test-body.js\";\nimport noStorageInStatelessModules from \"./rules/no-storage-in-stateless-modules.js\";\nimport noStringConcatInLoop from \"./rules/no-string-concat-in-loop.js\";\nimport noTautologicalExpect from \"./rules/no-tautological-expect.js\";\nimport noTypedDocSections from \"./rules/no-typed-doc-sections.js\";\nimport noTrailingValueNarration from \"./rules/no-trailing-value-narration.js\";\nimport noDeclarationCommentWall from \"./rules/no-declaration-comment-wall.js\";\nimport noUnionInComment from \"./rules/no-union-in-comment.js\";\nimport noTypeMemberCommentWall from \"./rules/no-type-member-comment-wall.js\";\nimport noUnnecessaryUseClient from \"./rules/no-unnecessary-use-client.js\";\nimport noUnsafeMockCasting from \"./rules/no-unsafe-mock-casting.js\";\nimport noZodNativeEnum from \"./rules/no-zod-native-enum.js\";\nimport preferConstantTimeSecretCompare from \"./rules/prefer-constant-time-secret-compare.js\";\nimport preferDiscriminatedUnion from \"./rules/prefer-discriminated-union.js\";\nimport preferInputGroupSearch from \"./rules/prefer-input-group-search.js\";\nimport preferShadcnPrimitives from \"./rules/prefer-shadcn-primitives.js\";\nimport preferModuleLevelConstant from \"./rules/prefer-module-level-constant.js\";\nimport preferModuleLevelSchema from \"./rules/prefer-module-level-schema.js\";\nimport preferNativeRandomUuid from \"./rules/prefer-native-random-uuid.js\";\nimport preferNonNullableCollection from \"./rules/prefer-non-nullable-collection.js\";\nimport preferSchemaForApiPayload from \"./rules/prefer-schema-for-api-payload.js\";\nimport preferSemanticColors from \"./rules/prefer-semantic-colors.js\";\nimport preferServerActions from \"./rules/prefer-server-actions.js\";\nimport preferSingleSentenceComment from \"./rules/prefer-single-sentence-comment.js\";\nimport preferStringLiteralUnion from \"./rules/prefer-string-literal-union.js\";\nimport preferWholeObjectAssertion from \"./rules/prefer-whole-object-assertion.js\";\nimport preferZodEnum from \"./rules/prefer-zod-enum.js\";\nimport preferZodInfer from \"./rules/prefer-zod-infer.js\";\nimport requireAssertNever from \"./rules/require-assert-never.js\";\nimport requireFetchTimeout from \"./rules/require-fetch-timeout.js\";\nimport requireInterfaceForInjectedService from \"./rules/require-interface-for-injected-service.js\";\nimport requireStaticNextMatcher from \"./rules/require-static-next-matcher.js\";\nimport requireZodFormValidation from \"./rules/require-zod-form-validation.js\";\nimport storeInsertRequiresOnConflict from \"./rules/store-insert-requires-on-conflict.js\";\nimport zodNamingConvention from \"./rules/zod-naming-convention.js\";\nimport { renamedRules } from \"./rules/_renames.js\";\nimport { retiredRules } from \"./rules/_retired.js\";\n\nconst rules = {\n\"enforce-file-structure\": enforceFileStructure,\n \"no-async-callback-in-wait-for\": noAsyncCallbackInWaitFor,\n \"no-client-side-data-fetching\": noClientSideDataFetching,\n \"no-comment-cruft\": noCommentCruft,\n \"no-conditional-in-test\": noConditionalInTest,\n \"no-cors-wildcard-with-credentials\": noCorsWildcardWithCredentials,\n \"no-dynamic-sql\": noDynamicSql,\n \"no-enum\": noEnum,\n \"no-fat-try-blocks\": noFatTryBlocks,\n \"no-hand-rolled-sleep\": noHandRolledSleep,\n \"no-hand-rolled-spinner\": noHandRolledSpinner,\n \"no-insecure-random-id\": noInsecureRandomId,\n \"no-json-stringify-error\": noJsonStringifyError,\n \"no-log-only-catch\": noLogOnlyCatch,\n \"no-long-comment\": noLongComment,\n \"no-offset-pagination\": noOffsetPagination,\n \"no-positional-tuple-return\": noPositionalTupleReturn,\n \"no-raw-env\": noRawEnv,\n \"no-raw-fetch-outside-clients\": noRawFetchOutsideClients,\n \"no-restricted-library-load\": noRestrictedLibraryLoad,\n \"no-repeated-string-literal\": noRepeatedStringLiteral,\n \"no-restated-comment\": noRestatedComment,\n \"no-restated-jsdoc\": noRestatedJsdoc,\n \"no-secret-in-log\": noSecretInLog,\n \"no-select-star\": noSelectStar,\n \"no-sentinel-return-on-catch\": noSentinelReturnOnCatch,\n \"no-silent-promise-catch\": noSilentPromiseCatch,\n \"no-sleep-in-test-body\": noSleepInTestBody,\n \"no-storage-in-stateless-modules\": noStorageInStatelessModules,\n \"no-string-concat-in-loop\": noStringConcatInLoop,\n \"no-tautological-expect\": noTautologicalExpect,\n \"no-typed-doc-sections\": noTypedDocSections,\n \"no-trailing-value-narration\": noTrailingValueNarration,\n \"no-declaration-comment-wall\": noDeclarationCommentWall,\n \"no-union-in-comment\": noUnionInComment,\n \"no-type-member-comment-wall\": noTypeMemberCommentWall,\n \"no-unnecessary-use-client\": noUnnecessaryUseClient,\n \"no-unsafe-mock-casting\": noUnsafeMockCasting,\n \"no-zod-native-enum\": noZodNativeEnum,\n \"prefer-constant-time-secret-compare\": preferConstantTimeSecretCompare,\n \"prefer-discriminated-union\": preferDiscriminatedUnion,\n \"prefer-input-group-search\": preferInputGroupSearch,\n \"prefer-shadcn-primitives\": preferShadcnPrimitives,\n \"prefer-module-level-constant\": preferModuleLevelConstant,\n \"prefer-module-level-schema\": preferModuleLevelSchema,\n \"prefer-native-random-uuid\": preferNativeRandomUuid,\n \"prefer-non-nullable-collection\": preferNonNullableCollection,\n \"prefer-schema-for-api-payload\": preferSchemaForApiPayload,\n \"prefer-semantic-colors\": preferSemanticColors,\n \"prefer-server-actions\": preferServerActions,\n \"prefer-single-sentence-comment\": preferSingleSentenceComment,\n \"prefer-string-literal-union\": preferStringLiteralUnion,\n \"prefer-whole-object-assertion\": preferWholeObjectAssertion,\n \"prefer-zod-enum\": preferZodEnum,\n \"prefer-zod-infer\": preferZodInfer,\n \"require-assert-never\": requireAssertNever,\n \"require-fetch-timeout\": requireFetchTimeout,\n \"require-interface-for-injected-service\": requireInterfaceForInjectedService,\n \"require-static-next-matcher\": requireStaticNextMatcher,\n \"require-zod-form-validation\": requireZodFormValidation,\n \"store-insert-requires-on-conflict\": storeInsertRequiresOnConflict,\n \"zod-naming-convention\": zodNamingConvention,\n};\n\nconst meta = {\n name: \"@sarj/eslint-plugin\",\n version: \"9.12.1\",\n} as const;\n\n/** Rules registered for application-profile configs but intentionally absent from general presets. */\nconst applicationOnlyRules = [\n \"no-restricted-library-load\",\n \"prefer-native-random-uuid\",\n \"prefer-shadcn-primitives\",\n] as const;\n\nconst recommendedRules = {\n\"@sarj/enforce-file-structure\": \"warn\",\n \"@sarj/no-async-callback-in-wait-for\": \"warn\",\n \"@sarj/no-client-side-data-fetching\": \"warn\",\n \"@sarj/no-comment-cruft\": \"warn\",\n \"@sarj/no-conditional-in-test\": \"warn\",\n \"@sarj/no-cors-wildcard-with-credentials\": \"warn\",\n \"@sarj/no-dynamic-sql\": \"warn\",\n \"@sarj/no-fat-try-blocks\": \"warn\",\n \"@sarj/no-hand-rolled-sleep\": \"warn\",\n \"@sarj/no-hand-rolled-spinner\": \"error\",\n \"@sarj/no-insecure-random-id\": \"warn\",\n \"@sarj/no-json-stringify-error\": \"warn\",\n \"@sarj/no-log-only-catch\": \"warn\",\n \"@sarj/no-long-comment\": \"warn\",\n \"@sarj/no-offset-pagination\": \"warn\",\n \"@sarj/no-positional-tuple-return\": \"warn\",\n \"@sarj/no-repeated-string-literal\": \"warn\",\n \"@sarj/no-restated-comment\": \"warn\",\n \"@sarj/no-restated-jsdoc\": \"warn\",\n \"@sarj/no-secret-in-log\": \"warn\",\n \"@sarj/no-select-star\": \"warn\",\n \"@sarj/no-sentinel-return-on-catch\": \"warn\",\n \"@sarj/no-silent-promise-catch\": \"warn\",\n \"@sarj/no-sleep-in-test-body\": \"warn\",\n \"@sarj/no-string-concat-in-loop\": \"warn\",\n \"@sarj/no-tautological-expect\": \"warn\",\n \"@sarj/no-typed-doc-sections\": \"warn\",\n \"@sarj/no-trailing-value-narration\": \"warn\",\n \"@sarj/no-declaration-comment-wall\": \"warn\",\n \"@sarj/no-union-in-comment\": \"warn\",\n \"@sarj/no-type-member-comment-wall\": \"warn\",\n \"@sarj/no-unnecessary-use-client\": \"warn\",\n \"@sarj/no-unsafe-mock-casting\": \"warn\",\n \"@sarj/no-zod-native-enum\": \"warn\",\n \"@sarj/prefer-constant-time-secret-compare\": \"error\",\n \"@sarj/prefer-discriminated-union\": \"warn\",\n \"@sarj/prefer-input-group-search\": \"error\",\n \"@sarj/prefer-module-level-constant\": \"warn\",\n \"@sarj/prefer-module-level-schema\": \"warn\",\n \"@sarj/prefer-non-nullable-collection\": \"warn\",\n \"@sarj/prefer-schema-for-api-payload\": \"warn\",\n \"@sarj/prefer-semantic-colors\": [\"warn\", { requireSemanticTokens: true }],\n \"@sarj/prefer-server-actions\": \"warn\",\n \"@sarj/prefer-single-sentence-comment\": \"warn\",\n \"@sarj/prefer-string-literal-union\": \"warn\",\n \"@sarj/prefer-whole-object-assertion\": \"warn\",\n \"@sarj/prefer-zod-enum\": \"warn\",\n \"@sarj/prefer-zod-infer\": \"warn\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-fetch-timeout\": \"warn\",\n \"@sarj/require-interface-for-injected-service\": \"warn\",\n \"@sarj/require-static-next-matcher\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/store-insert-requires-on-conflict\": \"warn\",\n \"@sarj/zod-naming-convention\": \"warn\",\n} as const;\n\nconst strictRules = {\n\"@sarj/enforce-file-structure\": \"error\",\n \"@sarj/no-async-callback-in-wait-for\": \"error\",\n \"@sarj/no-client-side-data-fetching\": \"error\",\n \"@sarj/no-comment-cruft\": \"error\",\n \"@sarj/no-conditional-in-test\": \"error\",\n \"@sarj/no-cors-wildcard-with-credentials\": \"error\",\n \"@sarj/no-dynamic-sql\": \"error\",\n \"@sarj/no-enum\": \"error\",\n \"@sarj/no-fat-try-blocks\": \"error\",\n \"@sarj/no-hand-rolled-sleep\": \"error\",\n \"@sarj/no-hand-rolled-spinner\": \"error\",\n \"@sarj/no-insecure-random-id\": \"error\",\n \"@sarj/no-json-stringify-error\": \"error\",\n \"@sarj/no-log-only-catch\": \"error\",\n \"@sarj/no-long-comment\": \"error\",\n \"@sarj/no-offset-pagination\": \"error\",\n \"@sarj/no-positional-tuple-return\": \"error\",\n \"@sarj/no-raw-env\": \"error\",\n \"@sarj/no-raw-fetch-outside-clients\": \"error\",\n \"@sarj/no-repeated-string-literal\": \"error\",\n \"@sarj/no-restated-comment\": \"error\",\n \"@sarj/no-restated-jsdoc\": \"error\",\n \"@sarj/no-secret-in-log\": \"error\",\n \"@sarj/no-select-star\": \"error\",\n \"@sarj/no-sentinel-return-on-catch\": \"error\",\n \"@sarj/no-silent-promise-catch\": \"error\",\n \"@sarj/no-sleep-in-test-body\": \"error\",\n \"@sarj/no-storage-in-stateless-modules\": \"error\",\n \"@sarj/no-string-concat-in-loop\": \"error\",\n \"@sarj/no-tautological-expect\": \"error\",\n \"@sarj/no-typed-doc-sections\": \"error\",\n \"@sarj/no-trailing-value-narration\": \"error\",\n \"@sarj/no-declaration-comment-wall\": \"error\",\n \"@sarj/no-union-in-comment\": \"error\",\n \"@sarj/no-type-member-comment-wall\": \"error\",\n \"@sarj/no-unnecessary-use-client\": \"error\",\n \"@sarj/no-unsafe-mock-casting\": \"error\",\n \"@sarj/no-zod-native-enum\": \"error\",\n \"@sarj/prefer-constant-time-secret-compare\": \"error\",\n \"@sarj/prefer-discriminated-union\": \"error\",\n \"@sarj/prefer-input-group-search\": \"error\",\n \"@sarj/prefer-module-level-constant\": \"error\",\n \"@sarj/prefer-module-level-schema\": \"error\",\n \"@sarj/prefer-non-nullable-collection\": \"error\",\n \"@sarj/prefer-schema-for-api-payload\": \"error\",\n \"@sarj/prefer-semantic-colors\": [\"error\", { requireSemanticTokens: true }],\n \"@sarj/prefer-server-actions\": \"error\",\n \"@sarj/prefer-single-sentence-comment\": \"warn\",\n \"@sarj/prefer-string-literal-union\": \"error\",\n \"@sarj/prefer-whole-object-assertion\": \"error\",\n \"@sarj/prefer-zod-enum\": \"error\",\n \"@sarj/prefer-zod-infer\": \"error\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-fetch-timeout\": \"error\",\n \"@sarj/require-interface-for-injected-service\": \"error\",\n \"@sarj/require-static-next-matcher\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/store-insert-requires-on-conflict\": \"error\",\n \"@sarj/zod-naming-convention\": \"error\",\n} as const;\n\ntype FlatPreset = {\n readonly name: string;\n readonly plugins: Record<string, unknown>;\n readonly rules: Record<string, unknown>;\n};\n\n/**\n * The presets, as FLAT config objects — `plugins` is the object form, so both go\n * straight into an `eslint.config.mjs` array with no spread. Neither sets\n * `files` or a parser, so they compose with whatever a repo already has.\n */\nconst plugin = {\n meta,\n rules,\n // Withdrawn names travel WITH the plugin so a consumer's migration script and\n // this repo's gates read one map, not two. See src/rules/_retired.ts.\n retiredRules,\n configs: {\n recommended: {} as FlatPreset,\n strict: {} as FlatPreset,\n },\n};\n\nplugin.configs.recommended = {\n name: \"@sarj/recommended\",\n plugins: { \"@sarj\": plugin },\n rules: recommendedRules,\n};\n\nplugin.configs.strict = {\n name: \"@sarj/strict\",\n plugins: { \"@sarj\": plugin },\n rules: strictRules,\n};\n\nexport default plugin;\nexport { type RetiredRule, retiredRules } from \"./rules/_retired.js\";\nexport { applicationOnlyRules, recommendedRules, renamedRules, rules, strictRules };\n","/**\n * @fileoverview enforce-file-structure — imports come first, then step-down order; a `use server` directive that is not the first statement is inert.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/enforce-file-structure.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"importsFirst\" | \"useServerDirective\";\ntype Options = readonly [];\n\ntype StatementKind = \"import\" | \"reexport\" | \"body\";\n\n/** Classify declarations by what they introduce; re-exports are neutral. */\nconst classifyStatement = (\n statement: TSESTree.ProgramStatement,\n): StatementKind => {\n switch (statement.type) {\n case AST_NODE_TYPES.ImportDeclaration:\n return \"import\";\n case AST_NODE_TYPES.ExportAllDeclaration:\n return \"reexport\";\n case AST_NODE_TYPES.ExportNamedDeclaration:\n // Only `export <declaration>` introduces a body statement.\n return statement.declaration === null ? \"reexport\" : \"body\";\n default:\n return \"body\";\n }\n};\n\nconst isStringDirective = (statement: TSESTree.ProgramStatement): boolean =>\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n statement.expression.type === AST_NODE_TYPES.Literal &&\n typeof statement.expression.value === \"string\" &&\n statement.expression.value.startsWith(\"use \");\n\nconst isUseServerDirective = (\n statement: TSESTree.ProgramStatement,\n): boolean => {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) return false;\n const expr = statement.expression;\n if (expr.type !== AST_NODE_TYPES.Literal) return false;\n return expr.value === \"use server\";\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"enforce-file-structure\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require `import` statements to come first, then allow step-down ordering (public API first, private helpers below) for the rest of the file. Exported statements are classified by WHAT they export — an exported interface is a declaration, an exported function is a function — so a public exported function followed by a private helper, or an exported interface among declarations, is allowed. Re-exports (`export { … } from`, `export *`, `export { … }`) are a neutral group, so generated namespace barrels pass. When a module contains a `use server` directive, it must be the first statement in the file.\",\n },\n schema: [],\n messages: {\n importsFirst:\n \"File structure violation: import statements must come before other declarations\",\n useServerDirective:\n \"A 'use server' directive must be the first statement in the file\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n return {\n Program(node: TSESTree.Program): void {\n const body = node.body;\n\n const misplacedUseServer = body.find(\n (statement, index) => index > 0 && isUseServerDirective(statement),\n );\n if (misplacedUseServer !== undefined) {\n context.report({\n node: misplacedUseServer,\n messageId: \"useServerDirective\",\n });\n }\n\n let seenBody = false;\n let inMisplacedRun = false;\n\n for (const statement of body) {\n if (isStringDirective(statement)) continue;\n\n switch (classifyStatement(statement)) {\n case \"reexport\":\n continue;\n case \"body\":\n seenBody = true;\n inMisplacedRun = false;\n continue;\n case \"import\":\n if (seenBody && !inMisplacedRun) {\n inMisplacedRun = true;\n context.report({\n node: statement,\n messageId: \"importsFirst\",\n });\n }\n continue;\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _docs — a rule links directly to executable examples derived from its name.\n *\n */\n\nimport { ESLintUtils } from \"@typescript-eslint/utils\";\n\nexport const REPO_BLOB = \"https://github.com/sarj-ai/standards/blob/main\";\nexport const TESTS_DIR = \"packages/typescript/tests/rules\";\n\nexport const examplesPath = (name: string): string =>\n `${TESTS_DIR}/${name}.test.ts`;\n\nexport const examplesUrl = (name: string): string =>\n `${REPO_BLOB}/${examplesPath(name)}`;\n\nexport const createRule = ESLintUtils.RuleCreator(examplesUrl);\n","/**\n * @fileoverview _paths — shared file-kind predicates, so \"is this a test / script / generated file?\" is answered in exactly one place.\n *\n * A path joins a shared default only if its NAME makes a claim true for every rule; anything one rule needs alone is a named gate that rule opts into.\n *\n */\n\nconst SCRIPT_FILE_RE = /([\\\\/]scripts[\\\\/])|(\\.mjs$)/;\n\nconst STORY_FILE_RE = /\\.stories\\.[cm]?[jt]sx?$/i;\n// `storyTree` includes Storybook's suffixed directories. It stays opt-in because\n// some repositories keep production components under `stories/`.\nconst STORY_TREE_RE = /(^|\\/)stories(?:[_-][^/]*)?\\//i;\n\n// These directory names explicitly identify upstream-owned code, so every rule\n// may safely ignore them.\nconst GENERATED_FILE_RE =\n /([\\\\/](?:generated|openapi-gen|graphql[\\\\/]types|vendor|vendored|third[-_]?party)[\\\\/])|(\\.gen\\.[cm]?[jt]sx?$)|(\\.generated\\.[cm]?[jt]sx?$)|(\\.d\\.[cm]?ts$)|(\\.types\\.[cm]?ts$)/;\n// `externalTree` stays opt-in because `external/` often contains first-party\n// integration code.\nconst EXTERNAL_TREE_RE = /[\\\\/]external[\\\\/]/;\n\n// A banner must claim that the file itself is generated. This avoids treating\n// prose about generated values or warnings as generated-file declarations.\nconst GENERATED_MARKER_RE =\n /(?:@generated\\b|this file (?:is|was|has been)[\\w\\s,'-]{0,40}?generated|auto-?generated file\\b|generated (?:with|by)|generated (?:graphql )?types|do not edit(?: directly| manually)?|do not (?:modify|change) this file)/i;\n\nconst TEST_BASENAME_RE = /[.\\-_](test|spec|e2e)\\.[cm]?[jt]sx?$/;\nconst TEST_INTEGRATION_BASENAME_RE = /\\.integration\\.[cm]?[jt]sx?$/;\n// Double-underscore fixture directories are alternate spellings of `fixtures/`.\nconst TEST_DIR_RE = /(^|\\/)(tests?|__tests__|__mocks__|fixtures|__fixtures__|__testfixtures__|e2e|integration)\\//;\n// Singular `fixture/` stays opt-in because it can contain production seeders.\nconst FIXTURE_TREE_RE = /(^|\\/)fixture\\//;\n\n/** Extra path gates that `isGeneratedFile` honours on request. */\nexport type GeneratedPathGate = \"externalTree\";\n\n/** Extra path gates `isTestFile` honours on request. */\nexport type TestPathGate = \"fixtureTree\";\n\n/** Extra path gates `isStoryFile` honours on request. */\nexport type StoryPathGate = \"storyTree\";\n\n/**\n * True for a test file: a `*.test.*` / `*.spec.*` basename, the `-test` /\n * `_test` suffix forms of the same, or anything under a `test/` / `tests/` /\n * `__tests__/` / `__mocks__/` / `fixtures/` / `__fixtures__/` /\n * `__testfixtures__/` / `e2e/` / `integration/` directory.\n *\n * Pass `[\"fixtureTree\"]` to also exempt the singular `fixture/`.\n */\nexport function isTestFile(filename: string, gates: readonly TestPathGate[] = []): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n const base = normalized.slice(normalized.lastIndexOf(\"/\") + 1);\n if (TEST_BASENAME_RE.test(base) || TEST_INTEGRATION_BASENAME_RE.test(base)) {\n return true;\n }\n if (TEST_DIR_RE.test(normalized)) {\n return true;\n }\n return gates.includes(\"fixtureTree\") && FIXTURE_TREE_RE.test(normalized);\n}\n\n/**\n * True for a `*.stories.*` file. Pass `[\"storyTree\"]` to also match anything\n * inside a `stories/` tree.\n */\nexport function isStoryFile(filename: string, gates: readonly StoryPathGate[] = []): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n if (STORY_FILE_RE.test(normalized)) {\n return true;\n }\n return gates.includes(\"storyTree\") && STORY_TREE_RE.test(normalized);\n}\n\n/**\n * True for a file whose text an upstream owns: generator output or a vendored\n * copy by path, or any file whose own header declares it generated.\n *\n * The banner arm is universal; the path arm defaults to generator output and\n * vendored trees, while `[\"externalTree\"]` adds `external/`.\n */\nexport function isGeneratedFile(\n filename: string,\n sourceText = \"\",\n gates: readonly GeneratedPathGate[] = [],\n): boolean {\n const normalized = filename.replaceAll(\"\\\\\", \"/\");\n if (GENERATED_FILE_RE.test(normalized)) {\n return true;\n }\n if (gates.includes(\"externalTree\") && EXTERNAL_TREE_RE.test(normalized)) {\n return true;\n }\n return GENERATED_MARKER_RE.test(sourceText.slice(0, 2048));\n}\n\n/**\n * True for one-off tooling files: anything under a `scripts/` directory or a\n * `*.mjs` file. Dev scripts run interactively and die with the terminal, so\n * production-hardening rules (e.g. fetch timeouts) do not apply there.\n */\nexport function isScriptFile(filename: string): boolean {\n return SCRIPT_FILE_RE.test(filename);\n}\n","/**\n * @fileoverview no-async-callback-in-wait-for — an async `waitFor` callback swallows its own rejection, so the assertion inside it can never fail the test.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-async-callback-in-wait-for.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noAsyncCallbackInWaitFor\";\ntype Options = readonly [];\n\n/** Match bare and non-computed member calls; the receiver does not change the polling contract. */\nconst isWaitForCallee = (callee: TSESTree.CallExpression[\"callee\"]): boolean => {\n if (callee.type === AST_NODE_TYPES.Identifier) return callee.name === \"waitFor\";\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"waitFor\"\n );\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"no-async-callback-in-wait-for\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow async callbacks in `waitFor` to prevent swallowed promise rejections.\",\n },\n schema: [],\n messages: {\n noAsyncCallbackInWaitFor:\n \"The callback to `waitFor` should not be async. It expects synchronous assertions and runs the callback repeatedly.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n return {\n CallExpression(node: TSESTree.CallExpression) {\n if (!isWaitForCallee(node.callee)) return;\n const callback = node.arguments[0];\n if (\n callback &&\n (callback.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n callback.type === AST_NODE_TYPES.FunctionExpression) &&\n callback.async\n ) {\n context.report({\n node: callback,\n messageId: \"noAsyncCallbackInWaitFor\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-client-side-data-fetching — fetching in `useEffect` is a render -> effect -> fetch -> re-render waterfall with no server cache.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-client-side-data-fetching.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"noClientFetch\";\ntype Options = readonly [];\n\nconst FETCH_LIBS: ReadonlySet<string> = new Set([\"axios\", \"ky\", \"superagent\"]);\n\n// Real HTTP verbs only. Explicitly excludes `create`, `defaults`,\n// `interceptors`, `isAxiosError`, etc.\nconst HTTP_METHOD_NAMES: ReadonlySet<string> = new Set([\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"request\",\n \"head\",\n \"options\",\n]);\n\n// Matched against whole path SEGMENTS (split on `/` and `.`), never as raw\n// substrings — otherwise `/api/login` (\"log\"), `/blog` (\"log\"), `/api/events`\n// (\"event\"), `/catalog` (\"log\"), and `/api/shipping` (\"ping\") would be wrongly\n// exempted.\nconst ANALYTICS_SEGMENTS: ReadonlySet<string> = new Set([\n \"analytics\",\n \"telemetry\",\n \"track\",\n \"log\",\n \"ping\",\n \"beacon\",\n \"metrics\",\n \"event\",\n]);\n\nfunction isEffectHookCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n // useEffect(...) / useLayoutEffect(...)\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"useEffect\" || callee.name === \"useLayoutEffect\";\n }\n\n // React.useEffect(...) / React.useLayoutEffect(...)\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"React\" &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return (\n callee.property.name === \"useEffect\" ||\n callee.property.name === \"useLayoutEffect\"\n );\n }\n\n return false;\n}\n\n/**\n * Reads the `method` property of an options object passed to `fetch` / `axios`.\n * Returns the uppercased method name, or `null` if not statically determinable.\n */\nfunction readMethodProperty(\n optionsArg: TSESTree.Node | undefined,\n): string | null {\n if (!optionsArg || optionsArg.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n for (const prop of optionsArg.properties) {\n if (prop.type !== AST_NODE_TYPES.Property) continue;\n if (prop.computed) continue;\n const key = prop.key;\n const matchesMethodKey =\n (key.type === AST_NODE_TYPES.Identifier && key.name === \"method\") ||\n (key.type === AST_NODE_TYPES.Literal && key.value === \"method\");\n if (!matchesMethodKey) continue;\n if (\n prop.value.type === AST_NODE_TYPES.Literal &&\n typeof prop.value.value === \"string\"\n ) {\n return prop.value.value.toUpperCase();\n }\n return null;\n }\n return null;\n}\n\nfunction isFetchCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n callee.name === \"fetch\"\n ) {\n const method = readMethodProperty(node.arguments[1]);\n if (method !== null && method !== \"GET\") {\n return false;\n }\n return true;\n }\n\n // axios.get(...), ky.post(...), superagent.delete(...), ...\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n FETCH_LIBS.has(callee.object.name) &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n // Only flag actual HTTP method calls — NOT `axios.create`, `axios.defaults`,\n // `axios.interceptors`, `axios.isAxiosError`, etc.\n return HTTP_METHOD_NAMES.has(callee.property.name);\n }\n\n // axios(config) / ky(config) — treat as request unless method is explicitly non-GET.\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n (callee.name === \"axios\" || callee.name === \"ky\")\n ) {\n const firstArg = node.arguments[0];\n const secondArg = node.arguments[1];\n let configArg: TSESTree.Node | undefined;\n if (firstArg?.type === AST_NODE_TYPES.ObjectExpression) {\n configArg = firstArg;\n } else if (secondArg?.type === AST_NODE_TYPES.ObjectExpression) {\n configArg = secondArg;\n }\n const method = readMethodProperty(configArg);\n if (method !== null && method !== \"GET\") {\n return false;\n }\n return true;\n }\n\n return false;\n}\n\nfunction extractUrlString(node: TSESTree.CallExpression): string {\n const firstArg = node.arguments[0];\n if (!firstArg) return \"\";\n\n if (\n firstArg.type === AST_NODE_TYPES.Literal &&\n typeof firstArg.value === \"string\"\n ) {\n return firstArg.value;\n }\n if (firstArg.type === AST_NODE_TYPES.TemplateLiteral) {\n return firstArg.quasis.map((q) => q.value.cooked).join(\"\");\n }\n if (firstArg.type === AST_NODE_TYPES.Identifier) {\n return firstArg.name;\n }\n return \"\";\n}\n\nfunction isAnalyticsCall(node: TSESTree.CallExpression): boolean {\n const url = extractUrlString(node).toLowerCase();\n if (url === \"\") return false;\n // Split into path segments and file-extension parts; exempt only when a\n // WHOLE segment is a known analytics keyword.\n return url\n .split(/[/.]/)\n .some((segment) => ANALYTICS_SEGMENTS.has(segment));\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-client-side-data-fetching\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow data fetching inside `useEffect` / `useLayoutEffect`; prefer React Server Components, Server Actions, or a client-side cache (SWR / React Query).\",\n },\n schema: [],\n messages: {\n noClientFetch:\n \"Avoid direct data fetching inside useEffect / useLayoutEffect. This causes waterfalls and layout shifts. Prefer React Server Components, Server Actions, or client-side caching libraries like SWR or React Query.\",\n },\n },\n defaultOptions: [],\n create(context) {\n let effectDepth = 0;\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (isEffectHookCall(node)) {\n effectDepth += 1;\n return;\n }\n if (effectDepth === 0) return;\n if (!isFetchCall(node)) return;\n if (isAnalyticsCall(node)) return;\n context.report({ node, messageId: \"noClientFetch\" });\n },\n \"CallExpression:exit\"(node: TSESTree.CallExpression): void {\n if (isEffectHookCall(node)) {\n effectDepth -= 1;\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-comment-cruft — commented-out code, section banners and file-header preambles are volume the reader pays for and nothing maintains.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-comment-cruft.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport {\n codeTokens,\n contentTokens,\n hasExternalReference,\n isProtected,\n restates,\n restatableStatementBelow,\n restatesStatementHead,\n} from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds =\n | \"commentedOutCode\"\n | \"sectionBanner\"\n | \"fileHeaderPreamble\"\n | \"commentWall\"\n | \"redundantNarration\"\n | \"untrackedTodo\";\ntype Options = readonly [];\n\nconst LEADING_PREAMBLE_MIN = 4;\nconst WALL_MIN_STATEMENTS = 4;\nconst WALL_MIN_COMMENTS = 3;\nconst WALL_MIN_COMMENTED_RATIO = 0.6;\nconst WALL_MIN_WEAK_RATIO = 0.75;\nconst WALL_MAX_WORDS = 18;\nconst WALL_MAX_NOVEL_WORDS = 2;\nconst WALL_NARRATION_RE =\n /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|now|finally|lastly|add|append|assign|await|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|define|delete|extract|fetch|filter|find|format|generate|get|handle|initialize|insert|iterate|join|load|log|loop|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|d|ed|ing)?\\b/i;\nconst WALL_STEP_PREFIX_RE = /^(?:\\d+[.)]|(?:phase|step)\\s+\\d+\\s*:)\\s*/i;\n\n// Require punctuation after step adverbs so ordinary prose does not match.\nconst STEP_NARRATION_RE =\n /^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|after(?:wards| that)?|finally|lastly|now)\\s*[,:]\\s*\\S/i;\n\n// These phrases name debt; `isBareDeferral` handles content-free `for now` notes.\nconst META_COMMENTARY_RE =\n /\\b(?:keeping (?:it|this) simple|could be (?:refactored|improved|cleaned up|simplified)|refactor(?:ed|ing)? (?:later|this)|not sure (?:if|whether|why|how)|quick[- ](?:and[- ]dirty|fix)|(?:a |bit of a )?hacky|is a hack|temporary (?:solution|workaround|fix|hack)|revisit (?:this|later|below)|clean (?:this|it) up|not ideal|placeholder for now)\\b/i;\n\nconst FOR_NOW_RE = /\\bfor now\\b/i;\n\n// Stopwords do not identify what is deferred.\nconst DEFERRAL_STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"an\", \"and\", \"are\", \"as\", \"at\", \"be\", \"but\", \"by\", \"can\", \"could\", \"do\",\n \"does\", \"for\", \"from\", \"had\", \"has\", \"have\", \"here\", \"i\", \"in\", \"is\", \"it\",\n \"its\", \"just\", \"may\", \"might\", \"no\", \"not\", \"now\", \"of\", \"on\", \"only\", \"our\",\n \"shall\", \"should\", \"so\", \"still\", \"that\", \"the\", \"then\", \"there\", \"this\",\n \"to\", \"us\", \"was\", \"we\", \"were\", \"will\", \"with\", \"would\", \"you\", \"your\",\n]);\n\n/** Most content words a `for now` comment may carry and still be pure deferral. */\nconst DEFERRAL_MAX_CONTENT_WORDS = 2;\n\n/** Match `for now` only when at most two content words identify the deferral. */\nfunction isBareDeferral(text: string): boolean {\n if (!FOR_NOW_RE.test(text)) return false;\n const rest = text.replace(FOR_NOW_RE, \" \");\n const content = (rest.match(/[A-Za-z][\\w']*/g) ?? []).filter(\n (word) => !DEFERRAL_STOPWORDS.has(word.toLowerCase()),\n );\n return content.length <= DEFERRAL_MAX_CONTENT_WORDS;\n}\n\n// Suppression and tool directives are instructions, not prose.\nconst DIRECTIVE_RE =\n /^(eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier-ignore|prettier\\b|biome-|c8\\b|v8\\b|istanbul\\b|@type\\b|@vite|webpack|<reference|<amd|global\\b|noinspection|hack\\b|xxx\\b)/i;\n\nconst LICENSE_RE =\n /copyright|licen[cs]ed?|spdx|permission is hereby granted|all rights reserved/i;\n\n// Multiple explanatory list items form a walkthrough, not a content-free preamble.\nconst ENUMERATED_ITEM_RE = /^(?:\\d+[.):]|[-*•])\\s+\\S/;\nconst ENUMERATED_ITEM_MIN_WORDS = 3;\nconst ENUMERATED_PREAMBLE_MIN_ITEMS = 2;\n\nconst BANNER_FULL_RE = /^[\\s\\-=*#~_+.]{4,}$/;\nconst BANNER_RUN_RE = /={4,}|-{4,}|#{4,}|\\*{4,}|~{4,}|[\\u2500-\\u257f]{4,}/;\n\nconst REGION_MARKER_RE = /^#?(?:end)?region\\b(.*)$/i;\nconst REGION_TITLE_RE = /^[\\s:\\-\\u2013\\u2014]*\\w[\\w \\-/&+]*$/;\nconst REGION_TITLE_MAX_WORDS = 5;\n\nfunction isRegionMarker(text: string): boolean {\n const match = REGION_MARKER_RE.exec(text);\n if (match === null) return false;\n const title = (match[1] ?? \"\").trim();\n if (title.length === 0) return true;\n if (!REGION_TITLE_RE.test(title)) return false;\n return title.split(/\\s+/).length <= REGION_TITLE_MAX_WORDS;\n}\n\nconst SECTION_LABEL_WORDS: ReadonlySet<string> = new Set([\n \"actions\", \"components\", \"config\", \"configuration\", \"constant\", \"constants\",\n \"enums\", \"exports\", \"fixtures\", \"getters\", \"globals\", \"handler\", \"handlers\",\n \"helper\", \"helpers\", \"hook\", \"hooks\", \"imports\", \"interfaces\", \"main\",\n \"mocks\", \"models\", \"mutations\", \"props\", \"queries\", \"reducers\", \"routes\",\n \"schemas\", \"selectors\", \"setters\", \"setup\", \"state\", \"styles\", \"teardown\",\n \"type\", \"types\", \"util\", \"utilities\", \"utils\",\n]);\nconst SECTION_LABEL_RE = /^([A-Za-z]+)\\s*:?\\s*$/;\n\nfunction isSectionLabel(text: string): boolean {\n const match = SECTION_LABEL_RE.exec(text);\n return match !== null && SECTION_LABEL_WORDS.has((match[1] ?? \"\").toLowerCase());\n}\n\n// Match two-to-four shouted words; preserve acronyms and numbered standards.\nconst SHOUTED_LABEL_RE = /^[A-Z]{2,}(?:[ -][A-Z]{2,}){1,3}$/;\n\nconst HELPER_OPENER_RE = /^(?:a\\s+)?helper\\s+(?:function|method|component|hook|class|type|util(?:ity)?)\\b/i;\n\n// Match walkthrough `let's`, but preserve third-person `lets` explanations.\nconst LETS_RE =\n /^let'?s\\s+(?:not\\s+|just\\s+|now\\s+|first\\s+)?(?:add|append|assign|await|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|decrement|define|delete|extract|fetch|filter|find|format|generate|get|handle|increment|init|initialise|initialize|insert|iterate|join|load|log|loop|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|ed|ing)?\\b/i;\n\n// Flag an isolated numbered step; preserve walkthrough runs and JSX labels.\nconst ENUMERATION_RE = /^(?:\\d+[.)]\\s+\\S|(?:phase|step)\\s+\\d+\\b)/i;\n\n// Dummy translational comments: ultra-short comments that just restate the code.\n// Corroborated against the statement below by `restatesWholeStatement` — the\n// lexical match alone is NOT evidence. See that function.\nconst DUMMY_TRANSLATION_RE = /^(?:increment|return|returns|get|gets|set\\b(?! up\\b)|sets\\b(?! up\\b)|function to|method to)\\b/i;\n\nconst DIAGRAM_ARROW_RE = /[-=~]{2,}>|<[-=~]{2,}/;\n\nconst CODE_KEYWORD_RE =\n /^(import |export |const |let |var |function\\b|class |interface |type \\w|enum |return\\b|throw |await |async |if\\s*\\(|for\\s*\\(|while\\s*\\(|switch\\s*\\(|new |console\\.)/;\nconst CODE_TAIL_RE = /[;{}()]\\s*$|=>\\s*$|,\\s*$/;\n// Require an identifier LHS and code tail so prose equations do not match.\nconst ASSIGN_RE = /^[A-Za-z_$][\\w.$[\\]]*\\s*(?:=(?![=>])|\\+=|-=|\\*=)\\s*\\S.*[;)}\\]]\\s*$/;\nconst CALL_RE = /^[A-Za-z_$][\\w.$]*\\([^)]*\\)\\s*;?\\s*$/;\n// Assertion chains often contain nested calls, so the generic CALL_RE cannot\n// recognize them. A disabled assertion is especially dangerous: the test still\n// passes, but verifies nothing. Keep this narrow to established assertion APIs.\nconst ASSERTION_CODE_RE =\n /^(?:await\\s+)?(?:expect(?:TypeOf)?\\s*\\(.+\\)\\s*(?:\\.\\w+(?:<[^\\n]*>)?)+(?:\\s*\\(.*\\))?|assert(?:\\.\\w+)?\\s*\\(.+\\))\\s*;?\\s*$/;\n\n// Placeholders that only appear in grammar productions / desugaring examples,\n// never in real code: `%sent%`, `[opt]`, a standalone `<FunctionBody>`, `…` / `...`.\nconst PSEUDOCODE_RE = /%\\w+%|\\[opt\\]|(?:^|\\s)<[A-Za-z]\\w*>|…|\\.\\.\\./;\n\n// A triple-slash `///` directive keeps its third `/` after ESLint strips the\n// leading `//`, so strip 1–2 leading slashes (not exactly two) for `<reference`.\nfunction stripCommentMarker(line: string): string {\n return line.replace(/^\\s*\\/{1,2}/, \"\").replace(/^\\s*\\*+/, \"\").trim();\n}\n\nfunction isDirective(text: string): boolean {\n return DIRECTIVE_RE.test(text.trim());\n}\n\nfunction isBanner(text: string): boolean {\n const t = text.trim();\n if (!t) return false;\n if (BANNER_FULL_RE.test(t) || isRegionMarker(t)) return true;\n return BANNER_RUN_RE.test(t) && !DIAGRAM_ARROW_RE.test(t);\n}\n\n/**\n * `allowCall` is false where a bare statement cannot legally appear — inside an\n * interface body or a type literal. See `TYPE_MEMBER_CONTAINERS`.\n */\nfunction looksLikeCode(text: string, allowCall = true): boolean {\n const t = text.trim();\n if (!t) return false;\n if (CODE_KEYWORD_RE.test(t) && CODE_TAIL_RE.test(t)) return true;\n if (ASSIGN_RE.test(t)) return true;\n if (ASSERTION_CODE_RE.test(t)) return true;\n return allowCall && CALL_RE.test(t);\n}\n\nfunction hasPseudocode(text: string): boolean {\n return PSEUDOCODE_RE.test(text);\n}\n\n/** An explanatory item of a numbered/bulleted walkthrough. */\nfunction isEnumeratedProseItem(text: string): boolean {\n const t = text.trim();\n return ENUMERATED_ITEM_RE.test(t) && t.split(/\\s+/).length >= ENUMERATED_ITEM_MIN_WORDS;\n}\n\n// A prose lead-in preceding a code-shaped line marks that line as an\n// illustration (`// For example:`, a grammar production `FunctionExpression:`),\n// not commented-out code.\nfunction isProse(text: string): boolean {\n const t = text.trim();\n if (!t) return false;\n if (t.endsWith(\":\")) return true;\n if (\n /[.!?]$/.test(t) &&\n /\\s/.test(t) &&\n /[a-z]/.test(t) &&\n !looksLikeCode(t) &&\n t.split(/\\s+/).length >= 3\n ) {\n return true;\n }\n return false;\n}\n\nconst JUSTIFICATION_RE =\n /\\b(?:because|since|until|due to|so that|so we|so it|so the|otherwise|which is why|in order to|to avoid|to work around|to prevent|backwards? compat(?:ibility)?|for compatibility)\\b/i;\n\n/** Apply total corroboration to the whole statement, including call arguments. */\nfunction restatesWholeStatement(body: string, statement: string | null): boolean {\n return statement !== null && restatesStatementHead(body, statement.replaceAll(\"(\", \" \"));\n}\n\n/**\n * Whether a single-line comment merely narrates the code rather than explaining\n * the *why*. Three deterministic shapes: step narration (\"First, …\"), self-\n * admitted meta-commentary (\"keeping it simple\"), and a restatement of the very\n * next line (`// increment the counter` above `counter += 1`).\n */\nfunction isRedundantNarration(\n body: string,\n statementBelow: string | null,\n standalone: boolean,\n isolatedEnumeration: boolean,\n nested: boolean,\n): boolean {\n const t = body.trim();\n if (!t || looksLikeCode(t) || hasPseudocode(t)) return false;\n if (standalone) {\n const justified = JUSTIFICATION_RE.test(t);\n if (STEP_NARRATION_RE.test(t) && !justified) return true;\n if (META_COMMENTARY_RE.test(t) && !justified) return true;\n if (isBareDeferral(t) && !justified) return true;\n if (HELPER_OPENER_RE.test(t) || LETS_RE.test(t)) return true;\n\n const words = t.split(/\\s+/);\n if (words.length > 1 && words.length <= 4 && DUMMY_TRANSLATION_RE.test(t) && !/[():=]/.test(t)) {\n const lowerT = t.toLowerCase();\n const rationaleWords = [\"when\", \"because\", \"if\", \"so that\", \"due to\", \"for\", \"instead of\", \"to prevent\", \"to avoid\", \"only\"];\n if (!rationaleWords.some((w) => lowerT.includes(w)) && restatesWholeStatement(t, statementBelow)) {\n return true;\n }\n }\n\n if (!nested && isSectionLabel(t)) return true;\n if (isolatedEnumeration && ENUMERATION_RE.test(t)) return true;\n }\n return restatesStatementHead(t, statementBelow);\n}\n\n// Outside these containers, a short label groups expression elements.\nconst STATEMENT_CONTAINERS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.Program,\n AST_NODE_TYPES.BlockStatement,\n AST_NODE_TYPES.ClassBody,\n AST_NODE_TYPES.StaticBlock,\n AST_NODE_TYPES.SwitchCase,\n AST_NODE_TYPES.TSModuleBlock,\n AST_NODE_TYPES.TSInterfaceBody,\n]);\n\ninterface CommentWall {\n readonly leader: TSESTree.Comment;\n readonly members: ReadonlySet<TSESTree.Comment>;\n}\n\ninterface WallAttachment {\n readonly container: TSESTree.Node;\n readonly index: number;\n readonly statement: string;\n}\n\nfunction directStatements(container: TSESTree.Node): readonly TSESTree.Node[] {\n switch (container.type) {\n case AST_NODE_TYPES.Program:\n case AST_NODE_TYPES.BlockStatement:\n case AST_NODE_TYPES.ClassBody:\n case AST_NODE_TYPES.StaticBlock:\n case AST_NODE_TYPES.TSModuleBlock:\n return container.body;\n case AST_NODE_TYPES.SwitchCase:\n return container.consequent;\n case AST_NODE_TYPES.TSInterfaceBody:\n return container.body;\n default:\n return [];\n }\n}\n\nconst WALL_STATEMENTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ExpressionStatement,\n AST_NODE_TYPES.ReturnStatement,\n AST_NODE_TYPES.ThrowStatement,\n AST_NODE_TYPES.VariableDeclaration,\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.ForStatement,\n AST_NODE_TYPES.ForOfStatement,\n AST_NODE_TYPES.ForInStatement,\n AST_NODE_TYPES.WhileStatement,\n AST_NODE_TYPES.DoWhileStatement,\n AST_NODE_TYPES.SwitchStatement,\n AST_NODE_TYPES.TryStatement,\n]);\n\nfunction statementAttachmentBelow(\n comment: TSESTree.Comment,\n sourceCode: Readonly<{\n getNodeByRangeIndex(index: number): TSESTree.Node | null;\n getTokenAfter(\n node: TSESTree.Comment,\n options: { includeComments: boolean },\n ): TSESTree.Token | null;\n getText(node: TSESTree.Node): string;\n }>,\n): WallAttachment | null {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (\n token === null ||\n token.loc.start.line !== comment.loc.end.line + 1 ||\n token.loc.start.column !== comment.loc.start.column\n ) {\n return null;\n }\n for (\n let node: TSESTree.Node | null | undefined = sourceCode.getNodeByRangeIndex(token.range[0]);\n node?.parent != null;\n node = node.parent\n ) {\n if (!STATEMENT_CONTAINERS.has(node.parent.type) || !WALL_STATEMENTS.has(node.type)) {\n continue;\n }\n const siblings = directStatements(node.parent);\n const index = siblings.indexOf(node);\n return index < 0\n ? null\n : { container: node.parent, index, statement: sourceCode.getText(node) };\n }\n return null;\n}\n\nfunction isWeakWalkthroughComment(body: string, statement: string): boolean {\n const normalized = body.replace(WALL_STEP_PREFIX_RE, \"\");\n if (\n normalized.length === 0 ||\n normalized.endsWith(\"?\") ||\n normalized.split(/\\s+/).length > WALL_MAX_WORDS ||\n isDirective(normalized) ||\n isProtected(normalized) ||\n !WALL_NARRATION_RE.test(normalized)\n ) {\n return false;\n }\n const words = contentTokens(normalized);\n const described = words.slice(1);\n if (described.length === 0) return false;\n const code = codeTokens(statement);\n const matched = described.filter((word) => restates([word], code)).length;\n return (\n matched / described.length >= 0.5 &&\n described.length - matched <= WALL_MAX_NOVEL_WORDS\n );\n}\n\n/** Type-member containers cannot contain bare call statements. */\nconst TYPE_MEMBER_CONTAINERS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.TSInterfaceBody,\n AST_NODE_TYPES.TSTypeLiteral,\n]);\n\n/** Preserve an entire contiguous comment run when any line cites a reference. */\nfunction runCitesAReference(comments: readonly TSESTree.Comment[], index: number): boolean {\n for (let i = index; i >= 0; i--) {\n if (i < index && !areAdjacentLineComments(comments[i], comments[i + 1])) break;\n if (hasExternalReference(stripCommentMarker(comments[i]?.value ?? \"\"))) return true;\n }\n for (let i = index + 1; i < comments.length; i++) {\n if (!areAdjacentLineComments(comments[i - 1], comments[i])) break;\n if (hasExternalReference(stripCommentMarker(comments[i]?.value ?? \"\"))) return true;\n }\n return false;\n}\n\n/** True when `a` and `b` are `//` comments on consecutive lines. */\nfunction areAdjacentLineComments(\n a: TSESTree.Comment | undefined,\n b: TSESTree.Comment | undefined,\n): boolean {\n return (\n a !== undefined &&\n b !== undefined &&\n a.type === \"Line\" &&\n b.type === \"Line\" &&\n b.loc.start.line === a.loc.end.line + 1\n );\n}\n\n/**\n * True when the comment at `index` is one line of a contiguous `//` block rather\n * than a lone annotation.\n */\nfunction isInsideCommentRun(comments: readonly TSESTree.Comment[], index: number): boolean {\n const comment = comments[index];\n return (\n areAdjacentLineComments(comments[index - 1], comment) ||\n areAdjacentLineComments(comment, comments[index + 1])\n );\n}\n\n/** How far back the illustration lead-in scan walks within one `//` block. */\nconst LEAD_IN_SCAN_LIMIT = 24;\n\nfunction hasIllustrationLeadInAbove(\n comments: readonly TSESTree.Comment[],\n index: number,\n): boolean {\n for (let i = index - 1; i >= 0 && index - i <= LEAD_IN_SCAN_LIMIT; i--) {\n if (!areAdjacentLineComments(comments[i], comments[i + 1])) return false;\n const body = stripCommentMarker(comments[i]?.value ?? \"\");\n if (body.length > 0 && body.endsWith(\":\")) return true;\n }\n return false;\n}\n\nfunction hasCommentedOutCode(\n texts: readonly string[],\n precedingProse: boolean,\n allowCall: boolean,\n): boolean {\n for (let i = 0; i < texts.length; i++) {\n const line = texts[i];\n if (line === undefined || !looksLikeCode(line, allowCall) || hasPseudocode(line)) {\n continue;\n }\n const prev = i > 0 ? texts[i - 1] : undefined;\n if (prev !== undefined ? isProse(prev) : precedingProse) continue;\n return true;\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-comment-cruft\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag commented-out code, section-banner comments, and leading file-header comment preambles.\",\n },\n schema: [],\n messages: {\n commentedOutCode:\n \"Commented-out code — delete it; git history remembers.\",\n sectionBanner:\n \"Section-banner / region comment — structure code with functions, not ASCII rules.\",\n fileHeaderPreamble:\n \"File-header comment preamble — use a brief doc comment for the why, not a block of `//` lines.\",\n commentWall:\n \"Statement comment wall ({{count}} narrated steps) — delete the walkthrough and name the operations in code; keep only constraints or rationale.\",\n redundantNarration:\n \"Comment narrates the code — delete it or say *why*, not *what*. Code is self-documenting.\",\n untrackedTodo:\n \"Untracked TODO/FIXME marker — add an issue ticket or context link.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const sourceCode = context.sourceCode;\n\n function isStandalone(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, {\n includeComments: false,\n });\n return !before || before.loc.end.line < comment.loc.start.line;\n }\n\n function isJsDoc(comment: TSESTree.Comment): boolean {\n return comment.type === \"Block\" && /^\\*/.test(comment.value);\n }\n\n function findCommentWalls(comments: readonly TSESTree.Comment[]): CommentWall[] {\n const attached = new Map<\n TSESTree.Node,\n Array<{ comment: TSESTree.Comment; index: number; weak: boolean }>\n >();\n for (const comment of comments) {\n if (comment.type !== \"Line\" || !isStandalone(comment)) continue;\n const attachment = statementAttachmentBelow(comment, sourceCode);\n if (attachment === null) continue;\n const body = stripCommentMarker(comment.value);\n const entries = attached.get(attachment.container) ?? [];\n entries.push({\n comment,\n index: attachment.index,\n weak: isWeakWalkthroughComment(body, attachment.statement),\n });\n attached.set(attachment.container, entries);\n }\n\n const walls: CommentWall[] = [];\n for (const entries of attached.values()) {\n const sorted = entries.toSorted((left, right) => left.index - right.index);\n const clusters: Array<typeof sorted> = [];\n for (const entry of sorted) {\n const cluster = clusters.at(-1);\n if (cluster !== undefined && entry.index <= (cluster.at(-1)?.index ?? 0) + 2) {\n cluster.push(entry);\n } else {\n clusters.push([entry]);\n }\n }\n for (const cluster of clusters) {\n const firstIndex = cluster[0]?.index;\n const lastIndex = cluster.at(-1)?.index;\n if (firstIndex === undefined || lastIndex === undefined) continue;\n const span = lastIndex - firstIndex + 1;\n const weak = cluster.filter((entry) => entry.weak).map((entry) => entry.comment);\n if (\n span < WALL_MIN_STATEMENTS ||\n weak.length < WALL_MIN_COMMENTS ||\n cluster.length / span < WALL_MIN_COMMENTED_RATIO ||\n weak.length / cluster.length < WALL_MIN_WEAK_RATIO\n ) {\n continue;\n }\n const leader = weak[0];\n if (leader !== undefined) walls.push({ leader, members: new Set(weak) });\n }\n }\n return walls;\n }\n\n /** True when every content line of a JSDoc block is a banner or a section title. */\n function isSectionJsDoc(comment: TSESTree.Comment): boolean {\n const texts = comment.value\n .split(\"\\n\")\n .map(stripCommentMarker)\n .filter((line) => line.length > 0 && !isDirective(line));\n return (\n texts.length > 0 &&\n texts.every(\n (text) =>\n !isProtected(text) &&\n (isBanner(text) ||\n isSectionLabel(text) ||\n SHOUTED_LABEL_RE.test(text.replace(/[.:]$/, \"\"))),\n )\n );\n }\n\n function reportLeadingPreamble(\n comments: readonly TSESTree.Comment[],\n firstCodeLine: number,\n ): void {\n const leading: TSESTree.Comment[] = [];\n let prevLine: number | null = null;\n for (const comment of comments) {\n if (comment.type !== \"Line\") break;\n if (comment.loc.start.line >= firstCodeLine) break;\n if (!isStandalone(comment)) break;\n const body = stripCommentMarker(comment.value);\n if (isDirective(body) || body.startsWith(\"!\")) continue;\n if (prevLine !== null && comment.loc.start.line !== prevLine + 1) break;\n leading.push(comment);\n prevLine = comment.loc.start.line;\n }\n const first = leading[0];\n if (first === undefined || leading.length < LEADING_PREAMBLE_MIN) return;\n const bodies = leading.map((c) => stripCommentMarker(c.value));\n if (bodies.some((body) => LICENSE_RE.test(body))) return;\n // A preamble carrying at least one prose sentence is documentation — the\n // \"why\" the rule wants — regardless of which comment syntax carries it.\n if (bodies.some((body) => isProse(body))) return;\n if (bodies.filter(isEnumeratedProseItem).length >= ENUMERATED_PREAMBLE_MIN_ITEMS) {\n return;\n }\n context.report({ node: first, messageId: \"fileHeaderPreamble\" });\n }\n\n return {\n Program(): void {\n const comments = sourceCode.getAllComments();\n const walls = findCommentWalls(comments);\n const wallByLeader = new Map(walls.map((wall) => [wall.leader, wall]));\n const wallMembers = new Set(walls.flatMap((wall) => [...wall.members]));\n const firstCodeLine =\n sourceCode.ast.tokens[0]?.loc.start.line ?? Number.MAX_SAFE_INTEGER;\n const enumerated = comments.filter(\n (c) => c.type === \"Line\" && ENUMERATION_RE.test(stripCommentMarker(c.value)),\n );\n\n for (let i = 0; i < comments.length; i++) {\n const comment = comments[i];\n if (comment === undefined) continue;\n const wall = wallByLeader.get(comment);\n if (wall !== undefined) {\n context.report({\n node: comment,\n messageId: \"commentWall\",\n data: { count: String(wall.members.size) },\n });\n continue;\n }\n if (wallMembers.has(comment)) continue;\n if (isJsDoc(comment)) {\n // JSDoc is preserved unless its entire body is a section signpost.\n if (isStandalone(comment) && isSectionJsDoc(comment)) {\n context.report({ node: comment, messageId: \"sectionBanner\" });\n }\n continue;\n }\n if (!isStandalone(comment)) continue;\n if (LICENSE_RE.test(comment.value)) continue;\n const texts = comment.value\n .split(\"\\n\")\n .map(stripCommentMarker)\n .filter((l) => l.length > 0 && !isDirective(l));\n\n const firstText = texts[0];\n if (firstText !== undefined && /^(?:todo|fixme)\\b/i.test(firstText)) {\n if (!runCitesAReference(comments, i)) {\n context.report({\n node: comment,\n messageId: \"untrackedTodo\",\n });\n }\n continue;\n }\n\n if (texts.some(isBanner)) {\n context.report({ node: comment, messageId: \"sectionBanner\" });\n continue;\n }\n const prev = comments[i - 1];\n const precedingProse =\n prev !== undefined &&\n prev.type === \"Line\" &&\n prev.loc.end.line === comment.loc.start.line - 1 &&\n isProse(stripCommentMarker(prev.value));\n const container = sourceCode.getNodeByRangeIndex(comment.range[0]);\n const inTypeMembers = container !== null && TYPE_MEMBER_CONTAINERS.has(container.type);\n if (\n hasCommentedOutCode(texts, precedingProse, !inTypeMembers) &&\n !hasIllustrationLeadInAbove(comments, i)\n ) {\n context.report({ node: comment, messageId: \"commentedOutCode\" });\n continue;\n }\n // Narration only for single-line comments (a multi-line block is\n // usually a real doc).\n if (comment.type === \"Line\" && texts.length === 1) {\n const body = texts[0];\n const statement = restatableStatementBelow(comment, sourceCode);\n const standalone = !isInsideCommentRun(comments, i);\n const nested = container !== null && !STATEMENT_CONTAINERS.has(container.type);\n if (\n body !== undefined &&\n !runCitesAReference(comments, i) &&\n isRedundantNarration(body, statement, standalone, enumerated.length === 1, nested)\n ) {\n context.report({ node: comment, messageId: \"redundantNarration\" });\n }\n }\n }\n\n reportLeadingPreamble(comments, firstCodeLine);\n },\n };\n },\n});\n","/**\n * @fileoverview _comments — shared comment analysis for the comment-hygiene rules, kept signal-for-signal identical to Python's `_comments.py`.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\n// S1 — external reference: URL, ticket key, RFC/PEP/CVE, bare issue number, or\n// an email/handle domain. Ticket keys allow letters after the first digit\n// (`PLATFORM-1YC`) and exclude the encoding acronyms sharing the shape.\nconst REF_RE =\n /https?:\\/\\/|\\bRFC[- ]?\\d+|\\bPEP[- ]?\\d+|\\bCVE-\\d{4}|\\b(?!UTF-|SHA-|ISO-|AES-|CRC-|MD-|PCM-|EOF-|API-|BASE-)[A-Z][A-Z0-9]{1,9}-\\d[A-Z0-9]{0,5}\\b|(?<![&\\w])#\\d{2,6}\\b|@[a-z][\\w.-]*\\.(?:us|com|ai|io|net|org|dev)\\b/;\n\n// S2 — version pin or comparison.\nconst VERSION_RE =\n /(?:>=|<=|==|<|>)\\s*v?\\d+\\.\\d+|\\bv\\d+\\.\\d+|\\b(?:since|until|as of)\\s+(?:v?\\d+\\.\\d+|Python\\s*\\d)/i;\n\n// S3 — a number carrying a unit, or an HTTP status code.\nconst UNITS_RE =\n /[~<>]?\\d+(?:\\.\\d+)?\\s?(?:ms|s\\b|sec\\b|seconds?\\b|min\\b|minutes?\\b|hours?\\b|days?\\b|KB|MB|MiB|GiB|kHz|Hz|bytes?\\b|bit\\b|-bit\\b|%|px\\b|rps\\b|qps\\b)|\\b[1-5]xx\\b|\\b(?:301|302|304|307|308|400|401|403|404|405|409|410|412|422|425|429|500|501|502|503|504)\\b/;\n\n// S4 — a causal connective tying behaviour to a consequence.\nconst CAUSAL_RE =\n /\\b(?:because|otherwise|so that|or else|would (?:break|fail|race|deadlock|leak|clobber|loop|crash|page|stall)|breaks?\\b|so we don'?t|to avoid\\b|caused\\b|causes\\b|gets? clobbered|keeps? (?:us|it|them) from|doesn'?t\\b.{0,24}\\b(?:page|fire|break|leak|loop)|eat into|would otherwise|trade-?offs?\\b)\\b/i;\n\n// S5 — negation of the obvious, or a flagged deliberate deviation.\nconst NEGATION_RE =\n /\\b(?:must not|must never|do(?:es)? not\\b|don'?t\\b.{0,30}\\b(?:leak|log|cache|retry|block|steal|wipe)|never\\b|deliberately|intentionally|counterintuitiv|NOT\\b)|(?<!based )\\bon purpose\\b|\\(not\\s|\\binstead of\\b|\\brather than\\b/;\n\n// S6 — upstream/vendor quirk, workaround provenance, or an external contract.\nconst UPSTREAM_RE =\n /\\b(?:upstream|workaround|quirk|backport|vendored|regression|fixed upstream|requires?\\b|convention\\b|rate.?limit|deprecat|opts? in(?:to)?\\b|raises?\\b.{0,60}\\b(?:when|if|unless)\\b)/i;\n\n// S7 — concurrency, ordering, or invariant vocabulary.\nconst INVARIANT_RE =\n /\\b(?:invariant|idempotent|race\\b|deadlock|re-?entran|atomic|thread-?safe|signal-?safe|lexicographic(?:al(?:ly)?)?|monotonic|must (?:run|be|happen|come|stay|hit|converge|configure)|before any\\b|lost the (?:claim )?race)\\b/i;\n\n// S8 — security reasoning.\nconst SECURITY_RE =\n /\\b(?:timing attack|constant-?time|replay|PII\\b|redact|secret|injection|spoof|fail-?closed|fail-?open|auth bypass|early-?exit timing)\\b/i;\n\nconst VENDOR_RE =\n /\\b(?:GitHub|Slack|Twilio|LiveKit|Kamailio|Groq|OpenAI|Anthropic|Cloudflare|FastAPI|Starlette|Sentry|Zoho|Salla|Ashby|Linear|BigQuery|Postgres|Neon|Drizzle|Vertex|Gemini|Firestore|Stripe|Next\\.js|React Compiler|pydantic|ruff|loguru|Lexical|Farasa|Orpheus|Whisper|schemathesis)(?:'s\\b|\\s+(?:requires?|returns?|expects?|allows?|rejects?|accepts?|sends?|caps?|limits?|wraps?|silently|outputs?|stores?|treats?|doesn'?t|does not|won'?t|can'?t|only|models)\\b)/;\n\nconst PROTECTED_SIGNALS: readonly RegExp[] = [\n REF_RE,\n VERSION_RE,\n UNITS_RE,\n CAUSAL_RE,\n NEGATION_RE,\n UPSTREAM_RE,\n INVARIANT_RE,\n SECURITY_RE,\n VENDOR_RE,\n];\n\n/**\n * True when a comment carries any of the nine protected-class signals.\n *\n * EXEMPTION FLOOR ONLY — a false result is not evidence the comment is worthless.\n */\nexport function isProtected(body: string): boolean {\n return PROTECTED_SIGNALS.some((signal) => signal.test(body));\n}\n\n/**\n * True when a comment cites a ticket, URL, RFC/PEP/CVE or issue number (signal\n * S1 alone). Naming where a decision is recorded is the one thing code cannot\n * do, and it separates an owned scoping note from an unowned admission.\n */\nexport function hasExternalReference(body: string): boolean {\n return REF_RE.test(body);\n}\n\n/**\n * Words that say nothing about *which* code a comment describes. Kept in step\n * with `_comments.py`: shrinking the list costs recall, growing it costs\n * precision by discounting a genuinely novel word.\n */\nexport const STOPWORDS: ReadonlySet<string> = new Set(\n `a an the this that these those it its their his her our your my\n is are was were be been being am do does did done doing has have had having\n will would shall should can could may might must\n and or but nor so yet not no none\n to of for in on at by with from into onto out up down over under about\n as if then than when where which who whom whose what how why while\n we you they i he she them him us me\n also just only even still already again there here\n all any each every some\n via per etc eg ie vs\n need needs needed want wants make makes making let lets\n please note see above below`.split(/\\s+/),\n);\n\nconst CAMEL_PART_RE = /[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|\\d+/g;\nconst WORD_RE = /[A-Za-z_$][\\w$]*|\\d+/g;\n\n/** Split `snake_case` / `camelCase` / `SCREAMING_CASE` into lowercase parts. */\nexport function splitIdentifier(token: string): string[] {\n const parts: string[] = [];\n for (const chunk of token.split(/[_$]/)) {\n for (const match of chunk.match(CAMEL_PART_RE) ?? []) {\n parts.push(match.toLowerCase());\n }\n }\n return parts;\n}\n\n/**\n * Fold the common English inflections so `updates` / `updating` match `update`.\n *\n * The trailing-`e` strip is what makes the fold *symmetric*: without it\n * `creates` / `creating` reduce to `creat` while `create` stays `create`, and\n * the two never match — the shape that most often made a restatement look\n * novel. Deliberately crude otherwise; every extra conflation is a chance to\n * call a novel word a restatement.\n */\nexport function stem(word: string): string {\n let base = word;\n for (const suffix of [\"ing\", \"ied\", \"ies\", \"ers\", \"er\", \"ed\", \"es\", \"s\"]) {\n if (word.endsWith(suffix) && word.length - suffix.length >= 3) {\n base = word.slice(0, word.length - suffix.length);\n if (suffix === \"ied\" || suffix === \"ies\") return `${base}y`;\n break;\n }\n }\n return base.endsWith(\"e\") && base.length - 1 >= 3 ? base.slice(0, -1) : base;\n}\n\n/** Split prose into lowercase content words, dropping stopwords. */\nexport function contentTokens(text: string): string[] {\n const tokens: string[] = [];\n for (const match of text.match(WORD_RE) ?? []) {\n tokens.push(...splitIdentifier(match));\n }\n return tokens.filter((token) => !STOPWORDS.has(token));\n}\n\n/** Every identifier part appearing in a slice of source. */\nexport function codeTokens(text: string): Set<string> {\n const tokens = new Set<string>();\n for (const match of text.match(WORD_RE) ?? []) {\n for (const part of splitIdentifier(match)) tokens.add(part);\n }\n return tokens;\n}\n\n/** True when every content token of a comment already appears in the code. */\nexport function restates(commentTokens: readonly string[], code: ReadonlySet<string>): boolean {\n const stems = new Set<string>();\n for (const token of code) stems.add(stem(token));\n return commentTokens.every((token) => code.has(token) || stems.has(stem(token)));\n}\n\nconst NARRATION_MAX_WORDS = 6;\nconst NARRATION_MIN_CONTENT = 1;\nconst TOKEN_PLURAL_MIN = 4;\n\n// Statements that compute something a comment could be restating. A block, a\n// class/function/type declaration, an `if`, a `for` — anything whose body the\n// comment could be labelling instead — is deliberately absent.\nconst RESTATABLE_STATEMENTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ExpressionStatement,\n AST_NODE_TYPES.ReturnStatement,\n AST_NODE_TYPES.ThrowStatement,\n AST_NODE_TYPES.VariableDeclaration,\n]);\n\n// Verbs that describe the mechanics of the next statement. A comment opening\n// with anything else (a noun, \"because\", \"we\", a ticket id) is not narration.\nconst NARRATION_VERB_RE =\n /^(?:add|append|assign|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|decrement|define|delete|extract|fetch|filter|find|format|generate|get|handle|increment|init|initialise|initialize|insert|iterate|join|load|log|loop|make|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|d|ed|ing)?$/i;\n\n// Words that carry no information about *which* code the comment describes, so\n// they are not required to appear in the line below.\nconst NARRATION_STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"all\", \"an\", \"and\", \"any\", \"are\", \"as\", \"at\", \"back\", \"be\", \"both\", \"by\",\n \"each\", \"for\", \"from\", \"here\", \"if\", \"in\", \"into\", \"is\", \"it\", \"its\", \"just\",\n \"new\", \"of\", \"on\", \"one\", \"onto\", \"or\", \"our\", \"out\", \"over\", \"so\", \"that\",\n \"the\", \"then\", \"this\", \"to\", \"up\", \"us\", \"we\", \"when\", \"with\",\n]);\n\n/** Lowercase, with a single plural `s` folded away so `users` matches `user`. */\nexport function normalizeToken(word: string): string {\n const lower = word.toLowerCase();\n return lower.length > TOKEN_PLURAL_MIN && lower.endsWith(\"s\") && !lower.endsWith(\"ss\")\n ? lower.slice(0, -1)\n : lower;\n}\n\n/** Every identifier in a slice of source, plus its parts, with plurals folded. */\nfunction headTokens(source: string): ReadonlySet<string> {\n const tokens = new Set<string>();\n for (const identifier of source.match(/[A-Za-z_$][\\w$]*/g) ?? []) {\n tokens.add(normalizeToken(identifier));\n for (const part of identifier.split(/[_$]+|(?<=[a-z0-9])(?=[A-Z])/)) {\n if (part.length > 0) tokens.add(normalizeToken(part));\n }\n }\n return tokens;\n}\n\n/** The slice of ESLint's `SourceCode` these shapes read. */\nexport interface StatementReader {\n getTokenAfter: (\n node: TSESTree.Comment,\n options: { includeComments: boolean },\n ) => TSESTree.Token | null;\n getNodeByRangeIndex: (index: number) => TSESTree.Node | null;\n getText: (node: TSESTree.Node) => string;\n}\n\n/** A declaration with nothing but a zero/empty seed computes nothing to restate. */\nfunction isTrivialInitializer(node: TSESTree.VariableDeclaration): boolean {\n return node.declarations.every((declarator) => {\n const init = declarator.init;\n if (init == null || init.type === AST_NODE_TYPES.Literal) return true;\n return (\n (init.type === AST_NODE_TYPES.ArrayExpression && init.elements.length === 0) ||\n (init.type === AST_NODE_TYPES.ObjectExpression && init.properties.length === 0)\n );\n });\n}\n\n/**\n * The source of the single-line statement a comment sits directly above, or null\n * when what follows is a block, a declaration, a type member or anything else\n * the comment could be *labelling* rather than restating.\n */\nexport function restatableStatementBelow(comment: TSESTree.Comment, sourceCode: StatementReader): string | null {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) return null;\n for (\n let node: TSESTree.Node | undefined | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n if (!RESTATABLE_STATEMENTS.has(node.type)) continue;\n if (node.loc.start.line !== token.loc.start.line || node.loc.end.line !== node.loc.start.line) {\n return null;\n }\n if (node.type === AST_NODE_TYPES.VariableDeclaration && isTrivialInitializer(node)) {\n return null;\n }\n return sourceCode.getText(node);\n }\n return null;\n}\n\n/**\n * True when a short verb-led comment adds nothing to the statement beneath it:\n * every content word after the opening verb already appears in that statement's\n * head — its assignment target or its callee.\n *\n * Corroboration is TOTAL: one unmatched word means the comment carries\n * something the code does not, so it stays. Only the head counts — everything\n * up to the first `(` — so the comment must restate what the statement\n * *computes*, not something it merely passes as an argument.\n */\nexport function restatesStatementHead(body: string, statement: string | null): boolean {\n if (statement === null) return false;\n const words = body.match(/[A-Za-z][\\w$]*/g) ?? [];\n const opener = words[0];\n if (opener === undefined || words.length > NARRATION_MAX_WORDS) return false;\n if (!NARRATION_VERB_RE.test(opener)) return false;\n const content = words\n .slice(1)\n .map(normalizeToken)\n .filter((word) => !NARRATION_STOPWORDS.has(word));\n if (content.length < NARRATION_MIN_CONTENT) return false;\n const head = statement.split(\"(\")[0] ?? statement;\n const code = headTokens(head);\n return content.every((word) => code.has(word));\n}\n","/**\n * @fileoverview no-conditional-in-test — a conditional in a test body can route around the assertion, so the test passes without asserting.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-conditional-in-test.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noConditionalInTest\";\ntype Options = readonly [];\n\nconst TEST_CALLERS: ReadonlySet<string> = new Set([\"it\", \"test\"]);\n\n/** Members whose callbacks define suites or lifecycle work rather than tests. */\nconst NON_TEST_MEMBERS: ReadonlySet<string> = new Set([\n \"afterAll\",\n \"afterEach\",\n \"beforeAll\",\n \"beforeEach\",\n \"describe\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** Roots of assertion calls: `expect(x)`, `assert.ok(x)`, `expectTypeOf<T>()`. */\nconst ASSERTION_ROOTS: ReadonlySet<string> = new Set([\n \"expect\",\n \"expectTypeOf\",\n \"assert\",\n \"assertType\",\n]);\n\n/** Assertions that exist only in the type system and are erased at run time. */\nconst TYPE_ASSERTION_ROOTS: ReadonlySet<string> = new Set([\n \"expectTypeOf\",\n \"assertType\",\n]);\n\nfunction nearestEnclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n }\n return null;\n}\n\n/** The base callee name of a call, unwrapping `.only` / `.skip` / `.each` chains. */\nfunction testCallerName(callee: TSESTree.Node): string | null {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name;\n }\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n return testCallerName(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return testCallerName(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return testCallerName(callee.tag);\n }\n return null;\n}\n\n/** Return whether any member in a chained callee identifies suite or lifecycle work. */\nfunction hasNonTestMember(callee: TSESTree.Node): boolean {\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n if (\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n NON_TEST_MEMBERS.has(callee.property.name)\n ) {\n return true;\n }\n return hasNonTestMember(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return hasNonTestMember(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return hasNonTestMember(callee.tag);\n }\n return false;\n}\n\n/** True when `fn` is the callback argument of an `it` or `test` call. */\nfunction isTestBody(fn: TSESTree.Node): boolean {\n const call = fn.parent;\n if (\n call?.type !== AST_NODE_TYPES.CallExpression ||\n !call.arguments.some((argument) => argument === fn)\n ) {\n return false;\n }\n if (hasNonTestMember(call.callee)) {\n return false;\n }\n const name = testCallerName(call.callee);\n return name !== null && TEST_CALLERS.has(name);\n}\n\n/** Walk `node`'s subtree until `predicate` matches. */\nfunction subtreeMatches(\n node: TSESTree.Node,\n predicate: (current: TSESTree.Node) => boolean,\n descendIntoFunctions = true,\n): boolean {\n let found = false;\n const visit = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (predicate(current)) {\n found = true;\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n if (\n !descendIntoFunctions &&\n FUNCTION_TYPES.has(current.type) &&\n key === \"body\"\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (\n typeof child === \"object\" &&\n child !== null &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n } else if (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n ) {\n visit(value as TSESTree.Node);\n }\n if (found) {\n return;\n }\n }\n };\n visit(node);\n return found;\n}\n\n/** The leftmost identifier a reference chain is rooted at: `!r.a.b` -> `r`. */\nfunction rootIdentifier(node: TSESTree.Node): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Identifier:\n return node.name;\n case AST_NODE_TYPES.MemberExpression:\n return rootIdentifier(node.object);\n case AST_NODE_TYPES.UnaryExpression:\n return rootIdentifier(node.argument);\n case AST_NODE_TYPES.AwaitExpression:\n return rootIdentifier(node.argument);\n case AST_NODE_TYPES.ChainExpression:\n case AST_NODE_TYPES.TSNonNullExpression:\n case AST_NODE_TYPES.TSAsExpression:\n return rootIdentifier(node.expression);\n case AST_NODE_TYPES.BinaryExpression:\n case AST_NODE_TYPES.LogicalExpression:\n return rootIdentifier(node.left);\n case AST_NODE_TYPES.CallExpression:\n return rootIdentifier(node.callee);\n default:\n return null;\n }\n}\n\n/** The identifier a call is rooted at: `expect(x).not.toBe(y)` -> `expect`. */\nfunction calleeRootName(call: TSESTree.CallExpression): string | null {\n let current: TSESTree.Node = call.callee;\n for (;;) {\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name;\n }\n if (current.type === AST_NODE_TYPES.MemberExpression) {\n current = current.object;\n continue;\n }\n if (current.type === AST_NODE_TYPES.CallExpression) {\n current = current.callee;\n continue;\n }\n if (\n current.type === AST_NODE_TYPES.ChainExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n continue;\n }\n return null;\n }\n}\n\nconst isAssertionCall = (node: TSESTree.Node): boolean =>\n node.type === AST_NODE_TYPES.CallExpression &&\n ASSERTION_ROOTS.has(calleeRootName(node) ?? \"\");\n\nconst isTypeAssertionCall = (node: TSESTree.Node): boolean =>\n node.type === AST_NODE_TYPES.CallExpression &&\n TYPE_ASSERTION_ROOTS.has(calleeRootName(node) ?? \"\");\n\nconst containsAssertion = (node: TSESTree.Node): boolean =>\n subtreeMatches(node, isAssertionCall);\n\n/** `test.skip(...)`, `this.skip()`, `ctx.skip()` — an explicit test escape. */\nconst containsSkipCall = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (current) =>\n current.type === AST_NODE_TYPES.CallExpression &&\n current.callee.type === AST_NODE_TYPES.MemberExpression &&\n !current.callee.computed &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n current.callee.property.name === \"skip\",\n );\n\n/**\n * `return` / `continue` / `break` in the branch's own scope — the ways a branch\n * can cut the rest of the test short. A `return` inside a nested callback does\n * not leave the test, so the walk stops at function boundaries.\n */\nconst containsEscape = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (current) =>\n current.type === AST_NODE_TYPES.ReturnStatement ||\n current.type === AST_NODE_TYPES.ContinueStatement ||\n current.type === AST_NODE_TYPES.BreakStatement,\n false,\n );\n\n/** The statements of a branch, whether or not it is wrapped in a block. */\nfunction branchStatements(\n branch: TSESTree.Statement,\n): readonly TSESTree.Statement[] {\n return branch.type === AST_NODE_TYPES.BlockStatement ? branch.body : [branch];\n}\n\n/** The statement immediately before `node` among its siblings, if any. */\nfunction previousSibling(node: TSESTree.Statement): TSESTree.Node | null {\n const parent = node.parent;\n let siblings: readonly TSESTree.Node[] | null = null;\n if (\n parent.type === AST_NODE_TYPES.BlockStatement ||\n parent.type === AST_NODE_TYPES.Program ||\n parent.type === AST_NODE_TYPES.StaticBlock\n ) {\n siblings = parent.body;\n } else if (parent.type === AST_NODE_TYPES.SwitchCase) {\n siblings = parent.consequent;\n }\n if (siblings === null) {\n return null;\n }\n const index = siblings.indexOf(node);\n return index > 0 ? (siblings[index - 1] ?? null) : null;\n}\n\n/**\n * Guard 1 — a narrowing `if` pinned by the assertion directly above it. The\n * preceding statement must assert on the same value the `if` narrows, so the\n * branch's direction is already established by a check that can fail.\n */\nfunction isPinnedNarrowingGuard(node: TSESTree.IfStatement): boolean {\n const testRoot = rootIdentifier(node.test);\n if (testRoot === null) {\n return false;\n }\n const previous = previousSibling(node);\n if (previous === null || previous.type !== AST_NODE_TYPES.ExpressionStatement) {\n return false;\n }\n let matched = false;\n subtreeMatches(previous, (current) => {\n if (\n current.type !== AST_NODE_TYPES.CallExpression ||\n current.callee.type !== AST_NODE_TYPES.Identifier ||\n current.callee.name !== \"expect\"\n ) {\n return false;\n }\n const subject = current.arguments[0];\n if (subject === undefined) {\n return false;\n }\n if (rootIdentifier(subject) === testRoot) {\n matched = true;\n return true;\n }\n return false;\n });\n return matched;\n}\n\n/** Guard 2 — the branch is an assertion spelled as a throw; the test stops here. */\nfunction isThrowingGuard(node: TSESTree.IfStatement): boolean {\n if (node.alternate !== null) {\n return false;\n }\n const statements = branchStatements(node.consequent);\n return (\n statements.length === 1 &&\n statements[0]?.type === AST_NODE_TYPES.ThrowStatement\n );\n}\n\n/** Every statement in `branch` is a bare type-level assertion call. */\nfunction isTypeAssertionBranch(branch: TSESTree.Statement): boolean {\n const statements = branchStatements(branch);\n return (\n statements.length > 0 &&\n statements.every(\n (statement) =>\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n isTypeAssertionCall(statement.expression),\n )\n );\n}\n\n/** Guard 4 — narrowing around assertions that are erased at run time. */\nfunction isTypeLevelNarrowing(node: TSESTree.IfStatement): boolean {\n return (\n isTypeAssertionBranch(node.consequent) &&\n (node.alternate === null || isTypeAssertionBranch(node.alternate))\n );\n}\n\n/** A branch that asserts nothing and cannot cut the test short. */\nconst isInertBranch = (branch: TSESTree.Statement): boolean =>\n !containsAssertion(branch) &&\n !containsEscape(branch) &&\n !containsSkipCall(branch);\n\n/**\n * Does the branch only REWRITE state — assign, update, delete, declare?\n *\n * Guard 5 is named \"state normalization\", and \"no assertion and no escape\" is a\n * strictly weaker test than that name implies: a branch full of ACTIONS asserts\n * nothing and escapes nothing either, and it is precisely the branch that makes\n * one test take two paths through the UI.\n */\nfunction isNormalizationStatement(statement: TSESTree.Statement): boolean {\n if (statement.type === AST_NODE_TYPES.VariableDeclaration) {\n return true;\n }\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.every(isNormalizationStatement);\n }\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n return false;\n }\n const { expression } = statement;\n return (\n expression.type === AST_NODE_TYPES.AssignmentExpression ||\n expression.type === AST_NODE_TYPES.UpdateExpression ||\n (expression.type === AST_NODE_TYPES.UnaryExpression &&\n expression.operator === \"delete\")\n );\n}\n\n/**\n * Guard 5 — state normalization. The branch has no assertion to skip, no way\n * out of the test, and does nothing but rewrite state. Deliberately narrow: a\n * branch that returns, breaks, continues, calls `.skip(`, or DOES something is\n * exactly the defect this rule exists for and is NOT exempt.\n */\nfunction isInertNormalization(node: TSESTree.IfStatement): boolean {\n const branches = [node.consequent, node.alternate].filter(\n (branch): branch is TSESTree.Statement => branch !== null,\n );\n return branches.every(\n (branch) => isInertBranch(branch) && isNormalizationStatement(branch),\n );\n}\n\n/**\n * State normalization: a branch with no assertion to skip and no way out of the\n * test cannot hide anything. Deliberately narrow — a branch that returns,\n * breaks, continues or calls `.skip(` is the shape the rule exists for.\n */\nfunction isExemptIfStatement(node: TSESTree.IfStatement): boolean {\n return (\n isPinnedNarrowingGuard(node) ||\n isThrowingGuard(node) ||\n isTypeLevelNarrowing(node) ||\n isInertNormalization(node)\n );\n}\n\n/**\n * Guard 3 — `??` never reports (it is a default, never control flow over an\n * assertion), and `&&` / `||` report only in the shape that can actually skip an\n * assertion: a bare `a && expect(a).toBe(1);` statement.\n */\nfunction isShortCircuitedAssertion(node: TSESTree.LogicalExpression): boolean {\n return (\n node.operator !== \"??\" &&\n node.parent.type === AST_NODE_TYPES.ExpressionStatement &&\n containsAssertion(node.right)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-conditional-in-test\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow conditional logic (if, switch, ternary) in test bodies, which can hide missing assertions or test multiple code paths.\",\n },\n schema: [],\n messages: {\n noConditionalInTest:\n \"Avoid using conditional logic in tests. It can obscure intent and hide unexecuted assertions. Split the test instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n const report = (node: TSESTree.Node): void => {\n const enclosing = nearestEnclosingFunction(node);\n if (enclosing === null || !isTestBody(enclosing)) {\n return;\n }\n context.report({ node, messageId: \"noConditionalInTest\" });\n };\n return {\n IfStatement(node: TSESTree.IfStatement): void {\n if (isExemptIfStatement(node)) {\n return;\n }\n report(node);\n },\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n report(node);\n },\n ConditionalExpression(node: TSESTree.ConditionalExpression): void {\n report(node);\n },\n LogicalExpression(node: TSESTree.LogicalExpression): void {\n if (!isShortCircuitedAssertion(node)) {\n return;\n }\n report(node);\n },\n };\n },\n});\n","/**\n * @fileoverview no-cors-wildcard-with-credentials — `Access-Control-Allow-Origin: *` together with credentials lets any site read authenticated responses.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-cors-wildcard-with-credentials.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"corsWildcardWithCredentials\";\ntype Options = readonly [];\n\nconst ACAO_HEADER = \"access-control-allow-origin\";\nconst ACAC_HEADER = \"access-control-allow-credentials\";\nconst HEADER_SET_METHODS = new Set([\"setheader\", \"set\", \"append\"]);\n\n/**\n * True only for the boolean literal `true` (not `1`, not a truthy expression).\n */\nfunction isTrueLiteral(node: TSESTree.Node): boolean {\n return node.type === \"Literal\" && node.value === true;\n}\n\n/**\n * True if `node` is a string literal whose value equals `\"true\"`\n * (case-insensitive), or the boolean literal `true`. Header values are strings,\n * but some frameworks coerce a boolean, so both are accepted.\n */\nfunction isCredentialsTrueValue(node: TSESTree.Node): boolean {\n if (node.type === \"Literal\") {\n if (node.value === true) {\n return true;\n }\n if (typeof node.value === \"string\") {\n return node.value.trim().toLowerCase() === \"true\";\n }\n }\n return false;\n}\n\nfunction isStarLiteral(node: TSESTree.Node): boolean {\n return node.type === \"Literal\" && node.value === \"*\";\n}\n\n/**\n * True if a `\"*\"` string literal appears anywhere in `node`'s subtree. Walking\n * the whole subtree catches `\"*\"`, `[\"*\"]`, and the `flag ? origins : \"*\"`\n * conditional branch. A dynamic `origin: someVar` has no `\"*\"` literal, so it\n * does not fire.\n */\nfunction subtreeContainsStarLiteral(node: TSESTree.Node): boolean {\n if (isStarLiteral(node)) {\n return true;\n }\n for (const key of Object.keys(node)) {\n if (key === \"parent\" || key === \"loc\" || key === \"range\") {\n continue;\n }\n const value = (node as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child) && subtreeContainsStarLiteral(child)) {\n return true;\n }\n }\n } else if (isNode(value) && subtreeContainsStarLiteral(value)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/**\n * Returns the (non-computed) string name of a property key, or `undefined`.\n */\nfunction propertyKeyName(prop: TSESTree.Property): string | undefined {\n if (prop.computed) {\n return undefined;\n }\n const key = prop.key;\n if (key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n}\n\n/**\n * Extracts the callee's terminal identifier name for a call/new expression\n * (`cors` for `cors(...)` and `app.cors(...)`, `Cors` for `new Cors(...)`).\n */\nfunction calleeName(\n node: TSESTree.CallExpression | TSESTree.NewExpression,\n): string | undefined {\n const callee = node.callee;\n if (callee.type === \"Identifier\") {\n return callee.name;\n }\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\"\n ) {\n return callee.property.name;\n }\n return undefined;\n}\n\n/**\n * Detects the `cors({ origin: \"*\", credentials: true })` shape. Returns true\n * when the callee is `cors` / `Cors` and the first ObjectExpression argument\n * has `credentials: true` AND an `origin` whose subtree contains `\"*\"`.\n */\nfunction isCorsWildcardCredentialsCall(\n node: TSESTree.CallExpression | TSESTree.NewExpression,\n): boolean {\n const name = calleeName(node);\n if (name === undefined || name.toLowerCase() !== \"cors\") {\n return false;\n }\n const options = node.arguments.find(\n (arg): arg is TSESTree.ObjectExpression => arg.type === \"ObjectExpression\",\n );\n if (options === undefined) {\n return false;\n }\n let hasCredentials = false;\n let hasWildcardOrigin = false;\n for (const prop of options.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n const key = propertyKeyName(prop);\n if (key === \"credentials\" && isTrueLiteral(prop.value)) {\n hasCredentials = true;\n } else if (key === \"origin\" && subtreeContainsStarLiteral(prop.value)) {\n hasWildcardOrigin = true;\n }\n }\n return hasCredentials && hasWildcardOrigin;\n}\n\n/**\n * True if the ObjectExpression is a header map setting BOTH\n * `Access-Control-Allow-Origin: \"*\"` and\n * `Access-Control-Allow-Credentials: \"true\"` (case-insensitive keys).\n */\nfunction isWildcardCredentialsHeaderObject(\n node: TSESTree.ObjectExpression,\n): boolean {\n let wildcardOrigin = false;\n let credentialsTrue = false;\n for (const prop of node.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n const key = propertyKeyName(prop);\n if (key === undefined) {\n continue;\n }\n const header = key.toLowerCase();\n if (header === ACAO_HEADER && isStarLiteral(prop.value)) {\n wildcardOrigin = true;\n } else if (header === ACAC_HEADER && isCredentialsTrueValue(prop.value)) {\n credentialsTrue = true;\n }\n }\n return wildcardOrigin && credentialsTrue;\n}\n\ntype HeaderSetKind = \"origin\" | \"credentials\";\n\n/**\n * Classifies a `x.setHeader(name, value)` / `x.set(name, value)` /\n * `x.append(name, value)` call as an ACAO-wildcard set, an ACAC-true set, or\n * neither.\n */\nfunction classifyHeaderSetCall(\n node: TSESTree.CallExpression,\n): HeaderSetKind | undefined {\n const callee = node.callee;\n if (\n callee.type !== \"MemberExpression\" ||\n callee.computed ||\n callee.property.type !== \"Identifier\" ||\n !HEADER_SET_METHODS.has(callee.property.name.toLowerCase())\n ) {\n return undefined;\n }\n const [nameArg, valueArg] = node.arguments;\n if (\n nameArg === undefined ||\n valueArg === undefined ||\n nameArg.type !== \"Literal\" ||\n typeof nameArg.value !== \"string\"\n ) {\n return undefined;\n }\n const header = nameArg.value.toLowerCase();\n if (header === ACAO_HEADER && isStarLiteral(valueArg)) {\n return \"origin\";\n }\n if (header === ACAC_HEADER && isCredentialsTrueValue(valueArg)) {\n return \"credentials\";\n }\n return undefined;\n}\n\n/**\n * Nearest enclosing function node, or `undefined` for module scope. Used to\n * group split `setHeader`/`set` header assignments so a wildcard origin and a\n * credentials=true set only pair up when they live in the same scope.\n */\nfunction enclosingScope(node: TSESTree.Node): TSESTree.Node | undefined {\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (\n current.type === \"FunctionDeclaration\" ||\n current.type === \"FunctionExpression\" ||\n current.type === \"ArrowFunctionExpression\"\n ) {\n return current;\n }\n current = current.parent;\n }\n return undefined;\n}\n\ninterface ScopeHeaderSets {\n originNodes: TSESTree.CallExpression[];\n credentialsNodes: TSESTree.CallExpression[];\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-cors-wildcard-with-credentials\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n 'Disallow CORS that reflects any Origin (`\"*\"`) while allowing credentials; any site could then read authenticated responses. Enumerate explicit trusted origins instead.',\n },\n schema: [],\n messages: {\n corsWildcardWithCredentials:\n 'CORS reflects any Origin (`\"*\"`) while allowing credentials — any site can read authenticated responses. Enumerate explicit trusted origins instead of using `\"*\"` with credentials.',\n },\n },\n defaultOptions: [],\n create(context) {\n const scopeHeaderSets = new Map<TSESTree.Node | \"module\", ScopeHeaderSets>();\n\n function recordHeaderSet(\n node: TSESTree.CallExpression,\n kind: HeaderSetKind,\n ): void {\n const key = enclosingScope(node) ?? \"module\";\n let entry = scopeHeaderSets.get(key);\n if (entry === undefined) {\n entry = { originNodes: [], credentialsNodes: [] };\n scopeHeaderSets.set(key, entry);\n }\n if (kind === \"origin\") {\n entry.originNodes.push(node);\n } else {\n entry.credentialsNodes.push(node);\n }\n }\n\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (isCorsWildcardCredentialsCall(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (isCorsWildcardCredentialsCall(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n return;\n }\n const kind = classifyHeaderSetCall(node);\n if (kind !== undefined) {\n recordHeaderSet(node, kind);\n }\n },\n ObjectExpression(node: TSESTree.ObjectExpression): void {\n if (isWildcardCredentialsHeaderObject(node)) {\n context.report({ node, messageId: \"corsWildcardWithCredentials\" });\n }\n },\n \"Program:exit\"(): void {\n for (const { originNodes, credentialsNodes } of scopeHeaderSets.values()) {\n if (originNodes.length > 0 && credentialsNodes.length > 0) {\n for (const node of originNodes) {\n context.report({\n node,\n messageId: \"corsWildcardWithCredentials\",\n });\n }\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-dynamic-sql — a runtime value interpolated into statement text is SQL injection, and it defeats the prepared-statement cache.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-dynamic-sql.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { stripSqlNoise } from \"./_sql.js\";\n\ntype MessageIds = \"dynamicSql\";\n\nexport interface RuleOptions {\n /** Statement-taking method names to inspect. Replaces the defaults. */\n readonly methods?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\nconst DEFAULT_METHODS: readonly string[] = [\"prepare\", \"exec\", \"query\"];\n\n/** A module-level constant fragment: `CANDIDATE_COLS`, `TABLE_NAME`. */\nconst CONSTANT_CASE_RE = /^[A-Z][A-Z0-9_]*$/;\n\n/**\n * True when an interpolated expression is a compile-time SQL fragment rather\n * than runtime data: a CONSTANT_CASE identifier, a member access whose final\n * property is CONSTANT_CASE (`TABLES.USERS`), or a string literal.\n */\nfunction isStaticFragment(expression: TSESTree.Expression): boolean {\n if (expression.type === AST_NODE_TYPES.Identifier) {\n return CONSTANT_CASE_RE.test(expression.name);\n }\n if (\n expression.type === AST_NODE_TYPES.MemberExpression &&\n !expression.computed &&\n expression.property.type === AST_NODE_TYPES.Identifier\n ) {\n return CONSTANT_CASE_RE.test(expression.property.name);\n }\n if (expression.type === AST_NODE_TYPES.Literal) {\n return typeof expression.value === \"string\";\n }\n return false;\n}\n\n/** The interpolated runtime expressions in a template literal. */\nfunction runtimeInterpolations(\n template: TSESTree.TemplateLiteral,\n): TSESTree.Expression[] {\n return template.expressions.filter(\n (expression) => !isStaticFragment(expression),\n );\n}\n\n/**\n * Flatten a `+` chain into its operands. `\"a\" + b + \"c\"` yields three nodes so\n * each can be judged independently.\n */\nfunction concatOperands(node: TSESTree.Expression): TSESTree.Expression[] {\n if (node.type === AST_NODE_TYPES.BinaryExpression && node.operator === \"+\") {\n return [...concatOperands(node.left), ...concatOperands(node.right)];\n }\n return [node];\n}\n\n/**\n * The runtime operands of a string-concatenation chain, or an empty array when\n * the node is not a concatenation that mixes a literal with a runtime value.\n * Requiring at least one string literal is what distinguishes statement\n * building from ordinary arithmetic.\n */\nfunction runtimeConcatOperands(node: TSESTree.Node): TSESTree.Expression[] {\n if (node.type !== AST_NODE_TYPES.BinaryExpression || node.operator !== \"+\") {\n return [];\n }\n const operands = concatOperands(node);\n const hasStringLiteral = operands.some(\n (operand) =>\n operand.type === AST_NODE_TYPES.Literal &&\n typeof operand.value === \"string\",\n );\n if (!hasStringLiteral) {\n return [];\n }\n return operands.filter(\n (operand) =>\n operand.type !== AST_NODE_TYPES.Literal && !isStaticFragment(operand),\n );\n}\n\n/**\n * A SQL data/DDL statement keyword. `exec` and `query` are generic method names\n * — `child_process.exec` shares them — so the statement text itself has to prove\n * it is SQL before an interpolation into it can be an injection.\n */\nconst SQL_STATEMENT_RE =\n /\\b(?:select\\s|insert\\s+into\\b|insert\\s+or\\b|update\\s+\\w|delete\\s+from\\b|replace\\s+into\\b|merge\\s+into\\b|upsert\\s+into\\b|create\\s+(?:temp(?:orary)?\\s+)?(?:table|index|view|trigger|schema|database)\\b|alter\\s+table\\b|drop\\s+(?:table|index|view|trigger)\\b|truncate\\s+table\\b|pragma\\s+\\w|with\\s+\\w+\\s+as\\s*\\(|from\\s+\\w+\\s+where\\b)/i;\n\n/** The marker a non-static operand contributes to the reconstructed statement text. */\nconst RUNTIME_MARKER = \" ? \";\n\n/**\n * The statically known text of a statement argument, with every runtime operand\n * replaced by a placeholder. Enough to answer \"is this SQL?\" for both the\n * template-literal and the `+`-concatenation shape.\n */\nfunction staticStatementText(node: TSESTree.Node): string {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n return node.quasis.map((quasi) => quasi.value.cooked ?? quasi.value.raw).join(RUNTIME_MARKER);\n }\n if (node.type === AST_NODE_TYPES.Literal) {\n return typeof node.value === \"string\" ? node.value : RUNTIME_MARKER;\n }\n if (node.type === AST_NODE_TYPES.BinaryExpression && node.operator === \"+\") {\n return staticStatementText(node.left) + staticStatementText(node.right);\n }\n return RUNTIME_MARKER;\n}\n\n/** True when the statement argument reads as SQL rather than as a shell command line. */\nfunction looksLikeSql(node: TSESTree.Node): boolean {\n return SQL_STATEMENT_RE.test(stripSqlNoise(staticStatementText(node)));\n}\n\n/** The inspected method name of `receiver.method(...)`, or null. */\nfunction statementMethodName(\n node: TSESTree.CallExpression,\n methods: ReadonlySet<string>,\n): string | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const name = callee.property.name;\n return methods.has(name) ? name : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-dynamic-sql\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow interpolating or concatenating a runtime value into a SQL statement passed to `prepare`/`exec`/`query`; use a placeholder and bind the value.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n methods: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Statement-taking method names to inspect. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n dynamicSql:\n \"Runtime value built into a SQL statement passed to `{{method}}()`. Use a `?` placeholder and pass the value through `.bind(...)` so the driver parameterises it.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const methods = new Set(options?.methods ?? DEFAULT_METHODS);\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const method = statementMethodName(node, methods);\n if (method === null) {\n return;\n }\n\n const statement = node.arguments[0];\n if (statement === undefined || !looksLikeSql(statement)) {\n return;\n }\n\n const offenders =\n statement.type === AST_NODE_TYPES.TemplateLiteral\n ? runtimeInterpolations(statement)\n : runtimeConcatOperands(statement);\n\n for (const offender of offenders) {\n context.report({\n node: offender,\n messageId: \"dynamicSql\",\n data: { method },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _sql — shared extraction of statically-resolvable SQL strings, with literal values and comments neutralised before any keyword scan.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\n/** Mask SQL values and comments without changing text or line lengths. */\nexport function stripSqlNoise(text: string): string {\n const out = [...text];\n const n = text.length;\n let i = 0;\n while (i < n) {\n const ch = text[i];\n if (ch === \"'\" || ch === '\"') {\n out[i] = \" \";\n i += 1;\n while (i < n) {\n const c = text[i];\n if (c === ch) {\n if (i + 1 < n && text[i + 1] === ch) {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n continue;\n }\n out[i] = \" \";\n i += 1;\n break;\n }\n if (c !== \"\\n\") {\n out[i] = \" \";\n }\n i += 1;\n }\n continue;\n }\n if (ch === \"-\" && text[i + 1] === \"-\") {\n while (i < n && text[i] !== \"\\n\") {\n out[i] = \" \";\n i += 1;\n }\n continue;\n }\n if (ch === \"/\" && text[i + 1] === \"*\") {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) {\n if (text[i] !== \"\\n\") {\n out[i] = \" \";\n }\n i += 1;\n }\n if (i < n) {\n out[i] = \" \";\n out[i + 1] = \" \";\n i += 2;\n }\n continue;\n }\n i += 1;\n }\n return out.join(\"\");\n}\n\n/** The parameter marker a `${...}` substitution is replaced with before scanning. */\nconst SUBSTITUTION_MARKER = \"?\";\n\n/** Reconstruct static SQL literals, templates, concatenations, and fragment arrays. */\nexport function sqlTextOf(node: TSESTree.Node): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return typeof node.value === \"string\" ? node.value : null;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.quasis.map((q) => q.value.cooked ?? q.value.raw).join(SUBSTITUTION_MARKER);\n case AST_NODE_TYPES.TaggedTemplateExpression:\n return sqlTextOf(node.quasi);\n case AST_NODE_TYPES.BinaryExpression: {\n if (node.operator !== \"+\") {\n return null;\n }\n const left = sqlTextOf(node.left);\n const right = sqlTextOf(node.right);\n return left !== null && right !== null ? left + right : null;\n }\n case AST_NODE_TYPES.ArrayExpression: {\n const parts: string[] = [];\n for (const element of node.elements) {\n if (element === null) {\n return null;\n }\n const part = sqlTextOf(element);\n if (part === null) {\n return null;\n }\n parts.push(part);\n }\n return parts.length > 0 ? parts.join(\" \") : null;\n }\n default:\n return null;\n }\n}\n\n/** Return whether an array's fragments are consumed together by `.join(...)`. */\nfunction isJoinedFragmentArray(node: TSESTree.ArrayExpression): boolean {\n const parent = node.parent;\n return (\n parent?.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === node &&\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n parent.property.name === \"join\" &&\n parent.parent?.type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** Every string-bearing descendant that a composite node has already absorbed. */\nfunction markConsumed(node: TSESTree.Node, consumed: WeakSet<TSESTree.Node>): void {\n consumed.add(node);\n for (const key of Object.keys(node)) {\n if (key === \"parent\") {\n continue;\n }\n const value = (node as unknown as Record<string, unknown>)[key];\n for (const child of Array.isArray(value) ? value : [value]) {\n if (child !== null && typeof child === \"object\" && \"type\" in child) {\n markConsumed(child as TSESTree.Node, consumed);\n }\n }\n }\n}\n\n/** Hand each whole, statically resolvable SQL statement to `handler` once. */\nexport function createSqlListener(\n handler: (sql: string, node: TSESTree.Node) => void,\n): TSESLint.RuleListener {\n const consumed = new WeakSet<TSESTree.Node>();\n\n const visit = (node: TSESTree.Node): void => {\n if (consumed.has(node)) {\n return;\n }\n const text = sqlTextOf(node);\n if (text === null) {\n return;\n }\n markConsumed(node, consumed);\n handler(stripSqlNoise(text), node);\n };\n\n return {\n BinaryExpression: (node: TSESTree.BinaryExpression): void => {\n visit(node);\n },\n ArrayExpression: (node: TSESTree.ArrayExpression): void => {\n if (isJoinedFragmentArray(node)) {\n visit(node);\n }\n },\n TemplateLiteral: (node: TSESTree.TemplateLiteral): void => {\n visit(node);\n },\n Literal: (node: TSESTree.Literal): void => {\n visit(node);\n },\n };\n}\n","/**\n * @fileoverview no-enum — a TypeScript `enum` emits runtime code, defaults to numbers, and does not tree-shake.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-enum.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noEnum\";\ntype Options = readonly [\n {\n ignoreFiles?: readonly string[];\n }?,\n];\n\nfunction matchesAnyPattern(\n filename: string,\n patterns: readonly string[],\n): boolean {\n for (const pattern of patterns) {\n // Convert minimatch-ish globs to regex: ** -> .*, * -> [^/\\\\]*\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-enum\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow TypeScript `enum`; use string-literal unions or `as const` objects instead.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreFiles: {\n type: \"array\",\n description:\n \"Additional generated-file globs to ignore; shared generated paths and header markers are always ignored.\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n noEnum:\n 'Enums are discouraged. Use a string-literal union (e.g. `type Status = \"active\" | \"inactive\"`) or an `as const` object instead.',\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const options = optionsArg ?? {};\n const ignoreFiles = options.ignoreFiles ?? [];\n const filename = context.filename;\n const sourceText = context.sourceCode.getText();\n\n // `ignoreFiles` adds repository-specific paths to shared generated-file detection.\n const isIgnoredByOption =\n ignoreFiles.length > 0 && matchesAnyPattern(filename, ignoreFiles);\n\n if (isIgnoredByOption || isGeneratedFile(filename, sourceText)) {\n return {};\n }\n\n return {\n TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void {\n context.report({\n node,\n messageId: \"noEnum\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-fat-try-blocks — a `try` holding more than three throwing statements catches failures its handler was never written for.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-fat-try-blocks.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"fatTryBlock\";\ntype Options = readonly [];\n\nconst MAX_TRY_BODY_STATEMENTS = 3;\n\nconst NESTED_FUNCTION_TYPES = new Set<AST_NODE_TYPES>([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** Pure method names must not overlap common I/O-client methods such as `get`, `set`, or `find`. */\nconst PURE_METHODS = new Set<string>([\n \"map\", \"filter\", \"forEach\", \"reduce\", \"reduceRight\", \"findIndex\",\n \"findLast\", \"findLastIndex\", \"some\", \"every\", \"push\", \"pop\", \"shift\",\n \"unshift\", \"slice\", \"splice\", \"concat\", \"flat\", \"flatMap\", \"join\", \"reverse\",\n \"sort\", \"fill\", \"includes\", \"indexOf\", \"lastIndexOf\", \"at\", \"toString\",\n \"toLocaleString\", \"valueOf\", \"charAt\", \"charCodeAt\", \"codePointAt\", \"split\",\n \"padStart\", \"padEnd\", \"repeat\", \"trim\", \"trimStart\", \"trimEnd\", \"toUpperCase\",\n \"toLowerCase\", \"toFixed\", \"toPrecision\", \"startsWith\", \"endsWith\",\n]);\n\n/** Non-throwing global namespaces called as `X.method(...)`. */\nconst PURE_NAMESPACES = new Set<string>([\n \"Object\", \"Array\", \"Math\", \"JSON\", \"Number\", \"String\", \"Boolean\", \"console\",\n]);\n\n/** Namespace exceptions that commonly throw; `JSON.stringify` remains a deliberate recall tradeoff. */\nconst IMPURE_NAMESPACE_METHODS = new Set<string>([\"JSON.parse\"]);\n\n/** Constructors that do not throw on construction. */\nconst PURE_CONSTRUCTORS = new Set<string>([\n \"Map\", \"Set\", \"WeakMap\", \"WeakSet\", \"Date\", \"Error\", \"TypeError\",\n \"RangeError\", \"Array\", \"Object\", \"Headers\", \"URLSearchParams\", \"FormData\",\n \"TextEncoder\", \"TextDecoder\", \"Blob\", \"ReadableStream\", \"WritableStream\",\n \"TransformStream\", \"Response\", \"AbortController\",\n]);\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/** A call whose value is a known pure, non-throwing helper. */\nfunction isPureCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) {\n return false;\n }\n const property = callee.property;\n if (property.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (\n callee.object.type === AST_NODE_TYPES.Identifier &&\n PURE_NAMESPACES.has(callee.object.name)\n ) {\n return !IMPURE_NAMESPACE_METHODS.has(`${callee.object.name}.${property.name}`);\n }\n return PURE_METHODS.has(property.name);\n}\n\nfunction isPureNew(node: TSESTree.NewExpression): boolean {\n return (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n PURE_CONSTRUCTORS.has(node.callee.name)\n );\n}\n\n/**\n * Walk `stmt`'s subtree until `predicate` matches a node. By default the walk\n * stays in the same scope (it does not descend into nested function/arrow\n * bodies); pass `descendIntoFunctions` to visit those too.\n */\nfunction subtreeMatches(\n stmt: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n descendIntoFunctions = false,\n): boolean {\n let found = false;\n\n const visit = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (predicate(current)) {\n found = true;\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n if (\n !descendIntoFunctions &&\n NESTED_FUNCTION_TYPES.has(current.type) &&\n key === \"body\"\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n visit(child);\n }\n }\n } else if (isNode(value)) {\n visit(value);\n }\n if (found) {\n return;\n }\n }\n };\n\n visit(stmt);\n return found;\n}\n\nconst hasAwait = (node: TSESTree.Node): boolean =>\n subtreeMatches(node, (n) => n.type === AST_NODE_TYPES.AwaitExpression);\n\nconst hasThrowingCallOrNew = (node: TSESTree.Node): boolean =>\n subtreeMatches(\n node,\n (n) =>\n (n.type === AST_NODE_TYPES.CallExpression && !isPureCall(n)) ||\n (n.type === AST_NODE_TYPES.NewExpression && !isPureNew(n)),\n );\n\n/** Unwrap `await` / optional-chain / non-null wrappers to the core expression. */\nfunction unwrap(expr: TSESTree.Expression): TSESTree.Expression {\n let current = expr;\n while (\n current.type === AST_NODE_TYPES.ChainExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n }\n return current;\n}\n\n/** A bare fire-and-forget call statement — `toast(\"done\");`, `logEvent(...);`. */\nfunction isBareCallStatement(stmt: TSESTree.Statement): boolean {\n return (\n stmt.type === AST_NODE_TYPES.ExpressionStatement &&\n unwrap(stmt.expression).type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** `await` and used calls count; bare calls do not, including inside blocks and branches. */\nfunction canThrow(stmt: TSESTree.Statement): boolean {\n if (hasAwait(stmt)) {\n return true;\n }\n if (isBareCallStatement(stmt)) {\n return false;\n }\n if (stmt.type === AST_NODE_TYPES.BlockStatement) {\n return stmt.body.some(canThrow);\n }\n if (stmt.type === AST_NODE_TYPES.IfStatement) {\n return (\n hasThrowingCallOrNew(stmt.test) ||\n canThrow(stmt.consequent) ||\n (stmt.alternate !== null && canThrow(stmt.alternate))\n );\n }\n return hasThrowingCallOrNew(stmt);\n}\n\n/**\n * Conservative: is the `catch` handler guaranteed to re-throw? True when a\n * handler is present and its body's last statement is a `throw`.\n */\nfunction handlerRethrows(handler: TSESTree.CatchClause | null): boolean {\n if (handler === null) {\n return false;\n }\n const body = handler.body.body;\n const last = body[body.length - 1];\n return last !== undefined && last.type === AST_NODE_TYPES.ThrowStatement;\n}\n\n/** Statements that hand control straight through to their own parent. */\nconst PASS_THROUGH_PARENTS = new Set<AST_NODE_TYPES>([\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.TryStatement,\n AST_NODE_TYPES.CatchClause,\n AST_NODE_TYPES.LabeledStatement,\n]);\n\n/** A terminal node is last through every enclosing block up to its function, without a loop or switch. */\nfunction isTerminalInFunction(node: TSESTree.Node): boolean {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | undefined = current.parent;\n\n while (parent !== undefined) {\n if (parent.type === AST_NODE_TYPES.BlockStatement) {\n if (parent.body[parent.body.length - 1] !== current) {\n return false;\n }\n } else if (parent.type === AST_NODE_TYPES.Program) {\n return parent.body[parent.body.length - 1] === current;\n } else if (NESTED_FUNCTION_TYPES.has(parent.type)) {\n return true;\n } else if (!PASS_THROUGH_PARENTS.has(parent.type)) {\n return false;\n }\n current = parent;\n parent = current.parent;\n }\n return false;\n}\n\n/** `await f()` unwrapped to `f()`; everything else unwrapped as usual. */\nfunction unwrapAwait(expr: TSESTree.Expression): TSESTree.Expression {\n const inner = unwrap(expr);\n return inner.type === AST_NODE_TYPES.AwaitExpression\n ? unwrap(inner.argument)\n : inner;\n}\n\n/** A propagating handler ends with `return`, `throw`, or a bare call. */\nfunction handlerEndsByHandingOff(handler: TSESTree.CatchClause): boolean {\n const body = handler.body.body;\n const last = body[body.length - 1];\n if (last === undefined) {\n return false;\n }\n if (\n last.type === AST_NODE_TYPES.ReturnStatement ||\n last.type === AST_NODE_TYPES.ThrowStatement\n ) {\n return true;\n }\n return (\n last.type === AST_NODE_TYPES.ExpressionStatement &&\n unwrapAwait(last.expression).type === AST_NODE_TYPES.CallExpression\n );\n}\n\n/** Collect identifiers bound by a catch pattern, excluding type annotations. */\nfunction collectBindingNames(\n pattern: TSESTree.Node,\n names: Set<string>,\n): void {\n if (pattern.type === AST_NODE_TYPES.Identifier) {\n names.add(pattern.name);\n return;\n }\n if (pattern.type === AST_NODE_TYPES.ObjectPattern) {\n for (const property of pattern.properties) {\n collectBindingNames(\n property.type === AST_NODE_TYPES.RestElement\n ? property.argument\n : property.value,\n names,\n );\n }\n return;\n }\n if (pattern.type === AST_NODE_TYPES.ArrayPattern) {\n for (const element of pattern.elements) {\n if (element !== null) {\n collectBindingNames(element, names);\n }\n }\n return;\n }\n if (\n pattern.type === AST_NODE_TYPES.AssignmentPattern ||\n pattern.type === AST_NODE_TYPES.RestElement\n ) {\n collectBindingNames(\n pattern.type === AST_NODE_TYPES.AssignmentPattern\n ? pattern.left\n : pattern.argument,\n names,\n );\n }\n}\n\nfunction caughtBindingNames(handler: TSESTree.CatchClause): ReadonlySet<string> {\n const names = new Set<string>();\n if (handler.param !== null) {\n collectBindingNames(handler.param, names);\n }\n return names;\n}\n\n/** A member property / object key spelled `x` is not a reference to `x`. */\nfunction isPropertyName(node: TSESTree.Identifier): boolean {\n const parent = node.parent;\n if (parent.type === AST_NODE_TYPES.MemberExpression) {\n return parent.property === node && !parent.computed;\n }\n if (parent.type === AST_NODE_TYPES.Property) {\n return parent.key === node && !parent.computed;\n }\n return false;\n}\n\n/** A boundary must reference its caught error, including through nested callbacks. */\nfunction handlerMentionsCaughtBinding(handler: TSESTree.CatchClause): boolean {\n const names = caughtBindingNames(handler);\n if (names.size === 0) {\n return false;\n }\n return subtreeMatches(\n handler.body,\n (n) =>\n n.type === AST_NODE_TYPES.Identifier &&\n names.has(n.name) &&\n !isPropertyName(n),\n true,\n );\n}\n\n/** `null`, `undefined`, `false`, `void 0`, `[]`, `{}` — a success-shaped value. */\nfunction isSuccessShapedValue(expr: TSESTree.Expression): boolean {\n let current: TSESTree.Expression = expr;\n while (\n current.type === AST_NODE_TYPES.TSAsExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n current = current.expression;\n }\n if (current.type === AST_NODE_TYPES.Literal) {\n return current.value === null || current.value === false;\n }\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name === \"undefined\";\n }\n if (current.type === AST_NODE_TYPES.UnaryExpression) {\n return current.operator === \"void\";\n }\n if (current.type === AST_NODE_TYPES.ArrayExpression) {\n return current.elements.length === 0;\n }\n if (current.type === AST_NODE_TYPES.ObjectExpression) {\n return current.properties.length === 0;\n }\n return false;\n}\n\n/** Empty or false results hide which operation failed and are not error propagation. */\nconst handlerReturnsSuccessShaped = (handler: TSESTree.CatchClause): boolean =>\n subtreeMatches(\n handler.body,\n (n) =>\n n.type === AST_NODE_TYPES.ReturnStatement &&\n n.argument !== null &&\n isSuccessShapedValue(n.argument),\n );\n\n/** Exempt terminal boundaries that propagate the caught error without fabricating success. */\nfunction isTerminalErrorBoundary(node: TSESTree.TryStatement): boolean {\n const handler = node.handler;\n return (\n handler !== null &&\n isTerminalInFunction(node) &&\n handlerEndsByHandingOff(handler) &&\n handlerMentionsCaughtBinding(handler) &&\n !handlerReturnsSuccessShaped(handler)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-fat-try-blocks\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `try` blocks with more than three top-level statements that can throw — isolate the throwing statement and move non-throwing work outside.\",\n },\n schema: [],\n messages: {\n fatTryBlock:\n \"This `try` block has {{count}} statements that can throw (max {{max}}). Isolate the throwing statement(s); move non-throwing work outside the `try`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const sourceCode = context.sourceCode;\n\n return {\n TryStatement(node: TSESTree.TryStatement): void {\n if (node.finalizer !== null) {\n return;\n }\n if (handlerRethrows(node.handler)) {\n return;\n }\n if (isTerminalErrorBoundary(node)) {\n return;\n }\n\n const count = node.block.body.filter(canThrow).length;\n if (count <= MAX_TRY_BODY_STATEMENTS) {\n return;\n }\n\n const tryKeyword = sourceCode.getFirstToken(node);\n context.report({\n node: tryKeyword ?? node,\n messageId: \"fatTryBlock\",\n data: { count, max: MAX_TRY_BODY_STATEMENTS },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-hand-rolled-sleep — a hand-rolled promisified timer cannot be cancelled; the stdlib form takes an `AbortSignal`.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-hand-rolled-sleep.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"handRolledSleep\" | \"handRolledTimeoutRace\";\ntype Options = readonly [\n {\n allowIn?: readonly string[];\n checkClientModules?: boolean;\n }?,\n];\n\nconst GLOBAL_OBJECTS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n \"global\",\n]);\n\nconst CLIENT_ONLY_MODULES =\n /^(react|react-dom|react-native|svelte|vue|preact|solid-js)(\\/|$)|^next\\/(navigation|router|link|image)$/;\n\nconst RACE_METHODS: ReadonlySet<string> = new Set([\"race\", \"any\"]);\n\n/** Match configured paths where `**` spans separators and `*` does not. */\nfunction matchesAnyPattern(filename: string, patterns: readonly string[]): boolean {\n for (const pattern of patterns) {\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isSetTimeoutCallee(callee: TSESTree.Node): boolean {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"setTimeout\";\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"setTimeout\" &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n GLOBAL_OBJECTS.has(callee.object.name)\n );\n}\n\nfunction soleCall(fn: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression):\n | TSESTree.CallExpression\n | null {\n if (fn.body.type !== AST_NODE_TYPES.BlockStatement) {\n return fn.body.type === AST_NODE_TYPES.CallExpression ? fn.body : null;\n }\n if (fn.body.body.length !== 1) {\n return null;\n }\n const [only] = fn.body.body;\n if (only?.type !== AST_NODE_TYPES.ExpressionStatement) {\n return null;\n }\n return only.expression.type === AST_NODE_TYPES.CallExpression ? only.expression : null;\n}\n\nfunction isTimedDelay(delay: TSESTree.Node | undefined): boolean {\n if (delay === undefined) {\n return false;\n }\n if (delay.type === AST_NODE_TYPES.Literal && typeof delay.value === \"number\") {\n return delay.value !== 0;\n }\n return true;\n}\n\nfunction settlesWithoutValue(callback: TSESTree.Node, name: string): boolean {\n if (callback.type === AST_NODE_TYPES.Identifier) {\n return callback.name === name;\n }\n if (\n callback.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n callback.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const call = soleCall(callback);\n return (\n call !== null &&\n call.arguments.length === 0 &&\n call.callee.type === AST_NODE_TYPES.Identifier &&\n call.callee.name === name\n );\n}\n\nfunction rejectsInCallback(callback: TSESTree.Node, name: string): boolean {\n if (callback.type === AST_NODE_TYPES.Identifier) {\n return callback.name === name;\n }\n if (\n callback.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n callback.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const call = soleCall(callback);\n return (\n call !== null &&\n call.callee.type === AST_NODE_TYPES.Identifier &&\n call.callee.name === name\n );\n}\n\nfunction parameterName(\n fn: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n index: number,\n): string | null {\n const parameter = fn.params[index];\n return parameter?.type === AST_NODE_TYPES.Identifier ? parameter.name : null;\n}\n\nfunction isRaceArm(node: TSESTree.NewExpression): boolean {\n const array = node.parent;\n if (array?.type !== AST_NODE_TYPES.ArrayExpression) {\n return false;\n }\n const call = array.parent;\n return (\n call?.type === AST_NODE_TYPES.CallExpression &&\n call.arguments[0] === array &&\n call.callee.type === AST_NODE_TYPES.MemberExpression &&\n !call.callee.computed &&\n call.callee.object.type === AST_NODE_TYPES.Identifier &&\n call.callee.object.name === \"Promise\" &&\n call.callee.property.type === AST_NODE_TYPES.Identifier &&\n RACE_METHODS.has(call.callee.property.name)\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-hand-rolled-sleep\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow hand-rolled promisified timers (`new Promise((r) => setTimeout(r, ms))`) and hand-rolled `Promise.race` timeout arms; the stdlib forms are cancellable, these are not.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n allowIn: {\n description:\n \"Glob patterns for modules exempt from the rule (e.g. a single sanctioned `sleep` utility). Matched against the ABSOLUTE file path, so anchor with a `**/` prefix (e.g. `**/lib/sleep.ts`).\",\n type: \"array\",\n items: { type: \"string\" },\n },\n checkClientModules: {\n description:\n \"Also report the sleep form in browser/React Native modules. Off by default: those bundles cannot import `node:timers/promises` and the web platform has no equivalent, so the fix is impossible to follow. Turn on only where every file can resolve `node:` builtins.\",\n type: \"boolean\",\n },\n },\n },\n ],\n messages: {\n handRolledSleep:\n \"Hand-rolled sleep: `new Promise((resolve) => setTimeout(resolve, ms))` cannot be cancelled, so an aborted request or a lost race still waits out the full delay. Use `import { setTimeout as sleep } from \\\"node:timers/promises\\\"` and pass `{ signal }`.\",\n handRolledTimeoutRace:\n \"Hand-rolled timeout arm: when the other promise wins, this timer is never cleared and keeps the event loop alive until it fires. Use `AbortSignal.timeout(ms)` and pass the signal to the operation.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const { filename, sourceCode } = context;\n if (\n isTestFile(filename) ||\n isScriptFile(filename) ||\n isGeneratedFile(filename, sourceCode.getText())\n ) {\n return {};\n }\n\n const allowIn = optionsArg?.allowIn ?? [];\n if (allowIn.length > 0 && matchesAnyPattern(filename, allowIn)) {\n return {};\n }\n\n const checkClientModules = optionsArg?.checkClientModules ?? false;\n\n function isClientModule(): boolean {\n if (/\\.[cm]?[jt]sx$/.test(filename)) {\n return true;\n }\n const program = sourceCode.ast;\n for (const statement of program.body) {\n if (\n statement.type === AST_NODE_TYPES.ExpressionStatement &&\n statement.expression.type === AST_NODE_TYPES.Literal &&\n statement.expression.value === \"use client\"\n ) {\n return true;\n }\n if (\n statement.type === AST_NODE_TYPES.ImportDeclaration &&\n typeof statement.source.value === \"string\" &&\n CLIENT_ONLY_MODULES.test(statement.source.value)\n ) {\n return true;\n }\n }\n return false;\n }\n\n let clientModule: boolean | null = null;\n const reportsSleepHere = (): boolean => {\n if (checkClientModules) {\n return true;\n }\n clientModule ??= isClientModule();\n return !clientModule;\n };\n\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (node.callee.type !== AST_NODE_TYPES.Identifier || node.callee.name !== \"Promise\") {\n return;\n }\n const executor = node.arguments[0];\n if (\n executor?.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n executor?.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return;\n }\n const call = soleCall(executor);\n if (call === null || !isSetTimeoutCallee(call.callee)) {\n return;\n }\n const [callback, delay] = call.arguments;\n if (callback === undefined || !isTimedDelay(delay)) {\n return;\n }\n\n const resolveName = parameterName(executor, 0);\n if (resolveName !== null && settlesWithoutValue(callback, resolveName)) {\n if (reportsSleepHere()) {\n context.report({ node, messageId: \"handRolledSleep\" });\n }\n return;\n }\n\n const rejectName = parameterName(executor, 1);\n if (\n rejectName !== null &&\n isRaceArm(node) &&\n rejectsInCallback(callback, rejectName)\n ) {\n context.report({ node, messageId: \"handRolledTimeoutRace\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-hand-rolled-spinner — border-ring loading indicators should use the design-system spinner.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-hand-rolled-spinner.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"handRolledSpinner\";\ntype Options = readonly [];\n\nconst DESIGN_SYSTEM_PATH = /(?:^|[/\\\\])components[/\\\\]ui[/\\\\]/u;\nconst BORDER_WIDTH = /^border(?:-[0-9]+)?$/u;\nconst TRANSPARENT_EDGE = /^border-[trbl]-transparent$/u;\n\nfunction staticClassName(attribute: TSESTree.JSXAttribute): string | null {\n const value = attribute.value;\n if (value?.type === AST_NODE_TYPES.Literal && typeof value.value === \"string\") {\n return value.value;\n }\n if (\n value?.type === AST_NODE_TYPES.JSXExpressionContainer &&\n value.expression.type === AST_NODE_TYPES.Literal &&\n typeof value.expression.value === \"string\"\n ) {\n return value.expression.value;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-hand-rolled-spinner\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow intrinsic elements styled as Tailwind border-ring spinners outside the design-system implementation.\",\n },\n schema: [],\n messages: {\n handRolledSpinner:\n \"Use the design-system Spinner component instead of rebuilding a border-ring spinner with utility classes.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (DESIGN_SYSTEM_PATH.test(context.filename)) {\n return {};\n }\n\n return {\n JSXOpeningElement(node): void {\n if (\n node.name.type !== AST_NODE_TYPES.JSXIdentifier ||\n (node.name.name !== \"div\" && node.name.name !== \"span\")\n ) {\n return;\n }\n const classNameAttribute = node.attributes.find(\n (attribute): attribute is TSESTree.JSXAttribute =>\n attribute.type === AST_NODE_TYPES.JSXAttribute &&\n attribute.name.type === AST_NODE_TYPES.JSXIdentifier &&\n attribute.name.name === \"className\",\n );\n if (classNameAttribute === undefined) return;\n const className = staticClassName(classNameAttribute);\n if (className === null) return;\n const classes = className.split(/\\s+/u);\n if (\n classes.includes(\"animate-spin\") &&\n classes.includes(\"rounded-full\") &&\n classes.some((token) => BORDER_WIDTH.test(token)) &&\n classes.some((token) => TRANSPARENT_EDGE.test(token))\n ) {\n context.report({ node, messageId: \"handRolledSpinner\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-insecure-random-id — `Math.random()` is predictable, so an id, token or key built from it is guessable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-insecure-random-id.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"insecureRandomId\";\ntype Options = readonly [];\n\nconst STRONG_SECURITY_PATTERN =\n /token|secret|csrf|password|passwd|apikey|api[-_]?key|nonce|salt|uuid|authid/i;\n\nconst NON_SECURITY_ID_PATTERN =\n /temp|tmp|cache|correlation|request|req|trace|execution|dev|hmr|mock|test|perf|marker/i;\n\n/** Matches a static string fragment that reads as a path or DOM-id context. */\nconst PATH_OR_DOM_MARKER = /[\\\\/#]|\\.[A-Za-z0-9]/;\n\n/**\n * Returns true if `node` is a `Math.random()` CallExpression.\n */\nfunction isMathRandomCall(node: TSESTree.Node): node is TSESTree.CallExpression {\n if (node.type !== \"CallExpression\") {\n return false;\n }\n const callee = node.callee;\n if (callee.type !== \"MemberExpression\" || callee.computed) {\n return false;\n }\n const { object, property } = callee;\n return (\n object.type === \"Identifier\" &&\n object.name === \"Math\" &&\n property.type === \"Identifier\" &&\n property.name === \"random\"\n );\n}\n\n/**\n * Climbs the member/call chain in which `node` is the object/callee end, and\n * returns the outermost value node of that chain. For\n * `Math.random().toString(36).slice(2)` this returns the `.slice(2)` call —\n * i.e. the value that actually gets assigned/concatenated.\n */\nfunction climbValueChain(node: TSESTree.Node): TSESTree.Node {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (\n parent.type === \"MemberExpression\" &&\n parent.object === current &&\n !parent.computed\n ) {\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"CallExpression\" && parent.callee === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n return current;\n}\n\n/**\n * Returns true if `node` (a `Math.random()` call) is the base of a member\n * chain that calls `.toString(36)` somewhere above it, e.g.\n * `Math.random().toString(36)` or `Math.random().toString(36).slice(2)`.\n */\nfunction isPartOfToString36Chain(node: TSESTree.Node): boolean {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (\n parent.type === \"MemberExpression\" &&\n parent.object === current &&\n !parent.computed &&\n parent.property.type === \"Identifier\" &&\n parent.property.name === \"toString\"\n ) {\n const grandparent = parent.parent;\n if (\n grandparent &&\n grandparent.type === \"CallExpression\" &&\n grandparent.callee === parent\n ) {\n const firstArg = grandparent.arguments[0];\n if (firstArg && firstArg.type === \"Literal\" && firstArg.value === 36) {\n return true;\n }\n }\n }\n\n if (parent.type === \"MemberExpression\" && parent.object === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"CallExpression\" && parent.callee === current) {\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n return false;\n}\n\n/** Finds the nearest binding or property name without leaving its value. */\nfunction findEnclosingName(node: TSESTree.Node): string | undefined {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n if (parent.type === \"VariableDeclarator\" && parent.init === current) {\n if (parent.id.type === \"Identifier\") {\n return parent.id.name;\n }\n return undefined;\n }\n\n if (parent.type === \"Property\" && parent.value === current) {\n const key = parent.key;\n if (!parent.computed && key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n }\n\n if (parent.type === \"PropertyDefinition\" && parent.value === current) {\n const key = parent.key;\n if (!parent.computed && key.type === \"Identifier\") {\n return key.name;\n }\n if (key.type === \"Literal\" && typeof key.value === \"string\") {\n return key.value;\n }\n return undefined;\n }\n\n if (\n parent.type === \"FunctionDeclaration\" ||\n parent.type === \"FunctionExpression\" ||\n parent.type === \"ArrowFunctionExpression\" ||\n parent.type === \"BlockStatement\" ||\n parent.type === \"ReturnStatement\" ||\n parent.type === \"ExpressionStatement\"\n ) {\n return undefined;\n }\n\n current = parent;\n parent = current.parent;\n }\n\n return undefined;\n}\n\n/**\n * Collects the static string fragments of a `+` concatenation / template\n * literal subtree into `out`.\n */\nfunction collectStaticStringParts(\n node: TSESTree.Node,\n out: string[],\n): void {\n if (node.type === \"Literal\" && typeof node.value === \"string\") {\n out.push(node.value);\n return;\n }\n if (node.type === \"TemplateLiteral\") {\n for (const quasi of node.quasis) {\n out.push(quasi.value.cooked ?? quasi.value.raw);\n }\n return;\n }\n if (node.type === \"BinaryExpression\" && node.operator === \"+\") {\n collectStaticStringParts(node.left, out);\n collectStaticStringParts(node.right, out);\n }\n}\n\n/**\n * Returns true if the random value is concatenated into a string whose static\n * parts read as a filename/path/DOM id (contain a slash, backslash, `#`, or a\n * `.ext`-style fragment).\n */\nfunction isConcatenatedIntoPathOrDomId(node: TSESTree.Node): boolean {\n const valueNode = climbValueChain(node);\n\n let current: TSESTree.Node = valueNode;\n let parent = current.parent;\n let top: TSESTree.Node | undefined;\n\n while (parent) {\n if (\n parent.type === \"BinaryExpression\" &&\n parent.operator === \"+\" &&\n (parent.left === current || parent.right === current)\n ) {\n top = parent;\n current = parent;\n parent = current.parent;\n continue;\n }\n if (parent.type === \"TemplateLiteral\") {\n top = parent;\n current = parent;\n parent = current.parent;\n continue;\n }\n break;\n }\n\n if (!top) {\n return false;\n }\n\n const parts: string[] = [];\n collectStaticStringParts(top, parts);\n return parts.some((part) => PATH_OR_DOM_MARKER.test(part));\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-insecure-random-id\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow using `Math.random()` to generate identifiers, tokens, or secrets; use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.\",\n },\n schema: [],\n messages: {\n insecureRandomId:\n \"`Math.random()` is not cryptographically secure and is predictable; do not use it to generate IDs, tokens, or secrets. Use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isMathRandomCall(node)) {\n return;\n }\n\n const name = findEnclosingName(node);\n\n // Security signals take precedence over non-security signals.\n if (name !== undefined && STRONG_SECURITY_PATTERN.test(name)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n return;\n }\n\n // Ignore ephemeral and correlation identifiers.\n if (name !== undefined && NON_SECURITY_ID_PATTERN.test(name)) {\n return;\n }\n\n // Ignore filename, path, and DOM-id fragments.\n if (isConcatenatedIntoPathOrDomId(node)) {\n return;\n }\n\n // The classic insecure random-id idiom.\n if (isPartOfToString36Chain(node)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-json-stringify-error — `JSON.stringify` on an Error yields `{}` — `message` and `stack` are non-enumerable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-json-stringify-error.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { Scope, SourceCode } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"noJsonStringifyError\";\ntype Options = readonly [];\n\nconst ERROR_NAME_PATTERN = /^(e|err|error|ex|exc)$/i;\n\n/** Property names whose value is itself an error object (unsafe to stringify). */\nconst ERROR_PROP_PATTERN = /^(cause|lastError|error|err|exception|originalError|innerError)$/i;\n\n/** Property names whose value is a plain string — the recommended escape hatch. */\nconst SAFE_STRING_PROPS: ReadonlySet<string> = new Set([\"message\", \"stack\", \"name\"]);\n\n/**\n * Accessors that hold an error's *data* payload rather than a nested error.\n * These are ordinary enumerable JSON, so `JSON.stringify` on them is correct —\n * react-router's `ErrorResponse.data`, zod's `ZodError.issues`, an HTTP client's\n * `.status` / `.response.body`.\n */\nconst PAYLOAD_PROPS: ReadonlySet<string> = new Set([\n \"data\",\n \"status\",\n \"statuscode\",\n \"statustext\",\n \"code\",\n \"issues\",\n \"details\",\n \"body\",\n \"payload\",\n \"response\",\n \"info\",\n \"meta\",\n \"metadata\",\n \"context\",\n]);\n\n/**\n * Walk up the scope chain looking for a `catch` clause whose binding matches\n * `name`. We rely on the scope analysis provided by the parser rather than\n * type information, keeping the rule type-free.\n */\nfunction isCatchBinding(scope: Scope.Scope, name: string): boolean {\n let current: Scope.Scope | null = scope;\n while (current) {\n const variable = current.set.get(name);\n if (variable) {\n for (const def of variable.defs) {\n if (def.type === \"CatchClause\") {\n return true;\n }\n }\n }\n current = current.upper;\n }\n return false;\n}\n\n/**\n * True if a member-expression argument (`err.cause`, `this.lastError`) denotes an\n * Error value: an error-suggesting property name, or an error-suggesting base whose\n * property is not a known string accessor (`.message` / `.stack` / `.name`).\n */\nfunction memberSuggestsError(\n member: TSESTree.MemberExpression,\n scope: Scope.Scope,\n): boolean {\n const propName =\n !member.computed && member.property.type === \"Identifier\" ? member.property.name : null;\n\n if (propName !== null && ERROR_PROP_PATTERN.test(propName)) {\n return true;\n }\n\n const base = member.object;\n const baseSuggestsError =\n base.type === \"Identifier\" &&\n (ERROR_NAME_PATTERN.test(base.name) || isCatchBinding(scope, base.name));\n if (baseSuggestsError) {\n if (propName === null) {\n return true;\n }\n const lowered = propName.toLowerCase();\n return !SAFE_STRING_PROPS.has(lowered) && !PAYLOAD_PROPS.has(lowered);\n }\n\n return false;\n}\n\nfunction instanceofErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n if (\n test.type === \"BinaryExpression\" &&\n test.operator === \"instanceof\" &&\n test.right.type === \"Identifier\" &&\n test.right.name === \"Error\"\n ) {\n return test.left;\n }\n return null;\n}\n\n/** Names of a user-defined type-guard predicate: `isErrorLike`, `isError`, `hasErrorShape`. */\nconst TYPE_GUARD_PATTERN = /^(is|has)[A-Z]/;\n\n/** The narrowed subject `x` of a user-defined type-guard call `isFoo(x)`, or null. */\nfunction typeGuardSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n const arg = test.type === \"CallExpression\" ? test.arguments[0] : undefined;\n if (\n test.type === \"CallExpression\" &&\n test.callee.type === \"Identifier\" &&\n TYPE_GUARD_PATTERN.test(test.callee.name) &&\n test.arguments.length === 1 &&\n arg !== undefined &&\n arg.type !== \"SpreadElement\"\n ) {\n return arg;\n }\n return null;\n}\n\n/**\n * The subject `x` of a positive error-narrowing test — `x instanceof Error` or a\n * user-defined guard `isErrorLike(x)`. In both, the value IS the error in the\n * truthy branch, so `JSON.stringify(x)` belongs in the falsy (alternate) branch.\n */\nfunction positiveErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n return instanceofErrorSubject(test) ?? typeGuardSubject(test);\n}\n\n/** The subject `x` of a negated error-narrowing test — `!(x instanceof Error)` / `!isErrorLike(x)`. */\nfunction negatedInstanceofErrorSubject(\n test: TSESTree.Expression,\n): TSESTree.Expression | null {\n if (test.type === \"UnaryExpression\" && test.operator === \"!\") {\n return positiveErrorSubject(test.argument);\n }\n return null;\n}\n\n/** Whether a branch statement unconditionally exits (its last statement returns/throws). */\nfunction branchTerminates(branch: TSESTree.Statement): boolean {\n const body = branch.type === \"BlockStatement\" ? branch.body : [branch];\n const last = body[body.length - 1];\n return (\n last !== undefined &&\n (last.type === \"ReturnStatement\" || last.type === \"ThrowStatement\")\n );\n}\n\n/**\n * True if an earlier guard `if (isErrorLike(arg)) return …` (or `instanceof Error`)\n * in an enclosing block narrows `argExpr` away from the error case before `node`,\n * so by the time `JSON.stringify(arg)` runs the value is the non-Error fallback.\n */\nfunction isNarrowedByEarlyReturn(\n node: TSESTree.Node,\n argExpr: TSESTree.Expression,\n sourceCode: Readonly<SourceCode>,\n): boolean {\n const argText = sourceCode.getText(argExpr);\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (current.type === \"BlockStatement\" || current.type === \"Program\") {\n for (const stmt of current.body) {\n if (stmt.range[0] >= node.range[0]) {\n break;\n }\n if (\n stmt.type === \"IfStatement\" &&\n stmt.alternate === null &&\n branchTerminates(stmt.consequent)\n ) {\n const subject = positiveErrorSubject(stmt.test);\n if (subject && sourceCode.getText(subject) === argText) {\n return true;\n }\n }\n }\n }\n current = current.parent;\n }\n return false;\n}\n\nfunction nodeWithin(node: TSESTree.Node, container: TSESTree.Node | null): boolean {\n return (\n container !== null &&\n node.range[0] >= container.range[0] &&\n node.range[1] <= container.range[1]\n );\n}\n\n/**\n * True if `node` sits in the NON-error branch of an `argExpr instanceof Error`\n * guard — the branch where `argExpr` is provably not an Error, so stringifying it\n * is the correct fallback. Handles both the ternary and `if`/`else` shapes,\n * including the negated `!(x instanceof Error)` form.\n */\nfunction isGuardedByInstanceofError(\n node: TSESTree.Node,\n argExpr: TSESTree.Expression,\n sourceCode: Readonly<SourceCode>,\n): boolean {\n const argText = sourceCode.getText(argExpr);\n const sameSubject = (subject: TSESTree.Expression): boolean =>\n sourceCode.getText(subject) === argText;\n\n let current: TSESTree.Node | undefined = node.parent;\n while (current) {\n if (current.type === \"ConditionalExpression\") {\n const subject = positiveErrorSubject(current.test);\n if (subject && sameSubject(subject) && nodeWithin(node, current.alternate)) {\n return true;\n }\n const negated = negatedInstanceofErrorSubject(current.test);\n if (negated && sameSubject(negated) && nodeWithin(node, current.consequent)) {\n return true;\n }\n } else if (current.type === \"IfStatement\") {\n const subject = positiveErrorSubject(current.test);\n if (subject && sameSubject(subject) && nodeWithin(node, current.alternate)) {\n return true;\n }\n const negated = negatedInstanceofErrorSubject(current.test);\n if (negated && sameSubject(negated) && nodeWithin(node, current.consequent)) {\n return true;\n }\n }\n current = current.parent;\n }\n return false;\n}\n\nfunction isJsonStringify(callee: TSESTree.Expression): boolean {\n return (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.object.type === \"Identifier\" &&\n callee.object.name === \"JSON\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === \"stringify\"\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-json-stringify-error\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `JSON.stringify` on an Error value; it yields `{}` because `message`/`stack` are non-enumerable.\",\n },\n schema: [],\n messages: {\n noJsonStringifyError:\n \"`JSON.stringify` on an Error yields `{}` because `message`/`stack` are non-enumerable. Log `err.message` / `err.stack`, or use a proper error serializer.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isJsonStringify(node.callee)) {\n return;\n }\n\n const firstArg = node.arguments[0];\n if (!firstArg) {\n return;\n }\n\n const scope = context.sourceCode.getScope(firstArg);\n\n let suggestsError: boolean;\n if (firstArg.type === \"Identifier\") {\n suggestsError =\n ERROR_NAME_PATTERN.test(firstArg.name) || isCatchBinding(scope, firstArg.name);\n } else if (firstArg.type === \"MemberExpression\") {\n suggestsError = memberSuggestsError(firstArg, scope);\n } else {\n return;\n }\n\n if (!suggestsError) {\n return;\n }\n\n if (\n isGuardedByInstanceofError(node, firstArg, context.sourceCode) ||\n isNarrowedByEarlyReturn(node, firstArg, context.sourceCode)\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: \"noJsonStringifyError\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-log-only-catch — a catch that only logs keeps the program running broken, with a log line as the only signal.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-log-only-catch.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noLogOnlyCatch\" | \"emptyCatch\";\ntype Options = readonly [LoggingOptions?];\n\n// A micro-benchmark harness swallows the throw it is timing; `_paths` owns the\n// test-file question but does not yet know this segment, so it is local.\nconst BENCHMARK_DIR_RE = /(?:^|[\\\\/])benchmarks?[\\\\/]/;\n\n// Loop and branch bodies a lone try can be the whole content of. Reaching one\n// level up through these is what finds the rationale comment that real code\n// writes above the guard rather than inside the catch.\nconst SINGLE_STATEMENT_HOSTS: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.DoWhileStatement,\n AST_NODE_TYPES.ForInStatement,\n AST_NODE_TYPES.ForOfStatement,\n AST_NODE_TYPES.ForStatement,\n AST_NODE_TYPES.IfStatement,\n AST_NODE_TYPES.WhileStatement,\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<string> = new Set([\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n]);\n\n/** The statement list a node sits directly in, plus its index in that list. */\nfunction statementSlot(\n node: TSESTree.Node,\n): { readonly list: readonly TSESTree.Node[]; readonly index: number } | null {\n const parent = node.parent;\n if (parent === undefined) return null;\n let list: readonly TSESTree.Node[];\n switch (parent.type) {\n case AST_NODE_TYPES.BlockStatement:\n case AST_NODE_TYPES.Program:\n case AST_NODE_TYPES.StaticBlock:\n list = parent.body;\n break;\n case AST_NODE_TYPES.SwitchCase:\n list = parent.consequent;\n break;\n default:\n return null;\n }\n const index = list.indexOf(node);\n return index === -1 ? null : { list, index };\n}\n\nfunction hasFollowingStatement(node: TSESTree.Node): boolean {\n for (\n let current: TSESTree.Node | undefined = node;\n current !== undefined && !FUNCTION_TYPES.has(current.type);\n current = current.parent\n ) {\n const slot = statementSlot(current);\n if (slot !== null && slot.index < slot.list.length - 1) return true;\n }\n return false;\n}\n\n/**\n * Class 1 — the try ends in a `return` and something follows the try, so the\n * catch's only job is to let control fall through to that fallback.\n */\nfunction fallbackFollowsTry(tryStatement: TSESTree.TryStatement): boolean {\n const body = tryStatement.block.body;\n const last = body.at(-1);\n return last?.type === AST_NODE_TYPES.ReturnStatement && hasFollowingStatement(tryStatement);\n}\n\n/** An explicit fallback seed: a literal, `undefined`, or an empty array/object. */\nfunction isSeedValue(node: TSESTree.Expression): boolean {\n const inner = node.type === AST_NODE_TYPES.TSAsExpression ? node.expression : node;\n switch (inner.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.Identifier:\n return inner.name === \"undefined\";\n case AST_NODE_TYPES.UnaryExpression:\n return inner.argument.type === AST_NODE_TYPES.Literal;\n case AST_NODE_TYPES.ArrayExpression:\n return inner.elements.length === 0;\n case AST_NODE_TYPES.ObjectExpression:\n return inner.properties.length === 0;\n default:\n return false;\n }\n}\n\n/**\n * Class 2 — `let x = <seed>;` immediately above the try, written inside it, read\n * after it. The seed IS the recovery value, so an empty catch is the whole\n * handler and there is nothing left for a comment to add.\n */\nfunction seededFallbackHandled(\n tryStatement: TSESTree.TryStatement,\n scope: TSESLint.Scope.Scope,\n): boolean {\n const slot = statementSlot(tryStatement);\n if (slot === null || slot.index === 0) return false;\n const previous = slot.list[slot.index - 1];\n if (previous?.type !== AST_NODE_TYPES.VariableDeclaration || previous.kind === \"const\") {\n return false;\n }\n const declarator = previous.declarations[0];\n if (previous.declarations.length !== 1 || declarator === undefined) return false;\n if (declarator.id.type !== AST_NODE_TYPES.Identifier) return false;\n if (declarator.init == null || !isSeedValue(declarator.init)) return false;\n\n const variable = ASTUtils.findVariable(scope, declarator.id.name);\n if (variable === null) return false;\n const [tryStart, tryEnd] = tryStatement.block.range;\n let writtenInTry = false;\n let readAfter = false;\n for (const reference of variable.references) {\n const [start] = reference.identifier.range;\n if (reference.isWrite() && start >= tryStart && start < tryEnd) writtenInTry = true;\n if (reference.isRead() && start >= tryStatement.range[1]) readAfter = true;\n }\n return writtenInTry && readAfter;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-log-only-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `catch` clauses that only log (or silently do nothing) and then swallow the error; rethrow or handle it instead.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noLogOnlyCatch:\n \"Logging then swallowing the error hides failures. Rethrow the error or handle it for real.\",\n emptyCatch:\n \"Empty catch silently swallows the error. Rethrow it, handle it, or add a comment explaining why it is safe to ignore.\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n const matcher = createLogMatcher(loggingOptions);\n const filename = context.filename;\n const sourceCode = context.sourceCode;\n\n /** True when a statement is exactly a bare logging call, e.g. `console.error(err);`. */\n function isLoggingCallStatement(statement: TSESTree.Statement): boolean {\n if (statement.type !== \"ExpressionStatement\") {\n return false;\n }\n return matcher.isLoggingCall(statement.expression);\n }\n\n /** True when a `//`/`/* *\\/` run ends on the line directly above `node`. */\n function hasCommentDirectlyAbove(node: TSESTree.Node): boolean {\n const above = sourceCode.getCommentsBefore(node).at(-1);\n return above !== undefined && above.loc.end.line === node.loc.start.line - 1;\n }\n\n /**\n * Class 3 — a rationale written next to the braces instead of inside them.\n */\n function hasAdjacentRationale(node: TSESTree.CatchClause): boolean {\n const tryStatement = node.parent;\n if (hasCommentDirectlyAbove(tryStatement) || hasCommentDirectlyAbove(node)) return true;\n const block = tryStatement.parent;\n if (\n block?.type !== AST_NODE_TYPES.BlockStatement ||\n block.body.length !== 1 ||\n block.parent === undefined ||\n !SINGLE_STATEMENT_HOSTS.has(block.parent.type)\n ) {\n return false;\n }\n return hasCommentDirectlyAbove(block.parent);\n }\n\n if (isTestFile(filename) || BENCHMARK_DIR_RE.test(filename.replaceAll(\"\\\\\", \"/\"))) {\n return {};\n }\n\n return {\n CatchClause(node: TSESTree.CatchClause): void {\n const statements = node.body.body;\n\n // A comment inside the block documents an intentional ignore — for a\n // silent swallow and for a log-and-continue alike.\n const isDocumented =\n sourceCode.getCommentsInside(node.body).length > 0 || hasAdjacentRationale(node);\n\n if (statements.length === 0) {\n if (isDocumented) {\n return;\n }\n // The recovery can live outside the catch, where no comment can\n // describe it better than the code already does.\n if (\n fallbackFollowsTry(node.parent) ||\n seededFallbackHandled(node.parent, sourceCode.getScope(node))\n ) {\n return;\n }\n context.report({ node, messageId: \"emptyCatch\" });\n return;\n }\n\n if (isDocumented) {\n return;\n }\n\n const everyStatementIsLogging = statements.every((statement) =>\n isLoggingCallStatement(statement),\n );\n\n if (everyStatementIsLogging) {\n context.report({ node, messageId: \"noLogOnlyCatch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _logging — shared recognition of logging / error-reporting calls, so the catch rules and the secret rule cannot disagree.\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nexport const LOG_METHODS: ReadonlySet<string> = new Set([\n \"debug\",\n \"info\",\n \"warn\",\n \"warning\",\n \"error\",\n \"exception\",\n \"critical\",\n \"trace\",\n \"log\",\n \"fatal\",\n \"success\",\n]);\n\nexport const LOGGER_NAMES: ReadonlySet<string> = new Set([\n \"logger\",\n \"log\",\n \"logging\",\n \"loguru\",\n \"console\",\n \"_logger\",\n \"_log\",\n]);\n\n/** Factory methods that RETURN a logger (`logging.getLogger(name).info(...)`). */\nexport const LOGGER_FACTORIES: ReadonlySet<string> = new Set([\n \"getlogger\",\n \"get_logger\",\n]);\n\n/** Reporting names stay broad because consumers also require the caught binding. */\nexport const REPORT_NAME_RE = /error|report|capture|log|trace|warn/i;\n\n/** Shared `loggerNames` / `logFunctions` option shape. */\nexport interface LoggingOptions {\n readonly loggerNames?: readonly string[];\n readonly logFunctions?: readonly string[];\n}\n\n/** Shared schema properties keep logging options consistent across consumers. */\nexport const LOGGING_OPTION_PROPERTIES = {\n loggerNames: { type: \"array\", items: { type: \"string\" } },\n logFunctions: { type: \"array\", items: { type: \"string\" } },\n} as const;\n\n/** The static callee name of a call (free function or method), or null. */\nexport function calleeName(callee: TSESTree.Node): string | null {\n if (callee.type === \"Identifier\") {\n return callee.name;\n }\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\"\n ) {\n return callee.property.name;\n }\n return null;\n}\n\nexport interface LogMatcher {\n /** Is `expr` a logger receiver (bare name, member chain, or factory call)? */\n isLoggerReceiver(expr: TSESTree.Expression | TSESTree.PrivateIdentifier): boolean;\n /** Is `expr` a project-declared free logging function call (`logEvent(...)`)? */\n isLogFunctionCall(expr: TSESTree.Node): boolean;\n /** Is `expr` a logging call of either shape? */\n isLoggingCall(expr: TSESTree.Node): boolean;\n}\n\n/** Builds a matcher with the project's declared receivers and functions. */\nexport function createLogMatcher(options: LoggingOptions = {}): LogMatcher {\n const loggerNames: ReadonlySet<string> = new Set([\n ...LOGGER_NAMES,\n ...(options.loggerNames ?? []).map((name) => name.toLowerCase()),\n ]);\n const logFunctions: ReadonlySet<string> = new Set(options.logFunctions ?? []);\n\n function isLoggerReceiver(\n expr: TSESTree.Expression | TSESTree.PrivateIdentifier,\n ): boolean {\n switch (expr.type) {\n case \"Identifier\":\n return loggerNames.has(expr.name.toLowerCase());\n case \"MemberExpression\": {\n const { property, object } = expr;\n if (!expr.computed && property.type === \"Identifier\") {\n const lowered = property.name.toLowerCase();\n if (loggerNames.has(lowered) || LOGGER_FACTORIES.has(lowered)) {\n return true;\n }\n }\n return isLoggerReceiver(object);\n }\n case \"CallExpression\": {\n const callee = expr.callee;\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\" &&\n LOGGER_FACTORIES.has(callee.property.name.toLowerCase())\n ) {\n return true;\n }\n if (callee.type !== \"Super\") {\n return isLoggerReceiver(callee);\n }\n return false;\n }\n default:\n return false;\n }\n }\n\n function isLogFunctionCall(expr: TSESTree.Node): boolean {\n if (expr.type !== \"CallExpression\" || logFunctions.size === 0) {\n return false;\n }\n const name = calleeName(expr.callee);\n return name !== null && logFunctions.has(name);\n }\n\n function isLoggingCall(expr: TSESTree.Node): boolean {\n if (expr.type !== \"CallExpression\") {\n return false;\n }\n if (isLogFunctionCall(expr)) {\n return true;\n }\n const callee = expr.callee;\n if (\n callee.type !== \"MemberExpression\" ||\n callee.computed ||\n callee.property.type !== \"Identifier\"\n ) {\n return false;\n }\n if (!LOG_METHODS.has(callee.property.name.toLowerCase())) {\n return false;\n }\n return isLoggerReceiver(callee.object);\n }\n\n return { isLoggerReceiver, isLogFunctionCall, isLoggingCall };\n}\n","/**\n * @fileoverview _prose-budget — shared extraction and sentence counting for comment-budget rules.\n */\n\nimport { AST_NODE_TYPES, type TSESTree, type TSESLint } from \"@typescript-eslint/utils\";\n\nimport { isGeneratedFile, isStoryFile } from \"./_paths.js\";\n\nconst DIRECTIVE_RE = /^(?:!|eslint\\b|eslint-|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|@vite|webpack|@jsx|@jest-environment|@vitest-environment|#__|todo\\b|fixme\\b|hack\\b)/i;\nconst LICENSE_RE = /\\b(?:copyright|spdx-license-identifier|licensed under)\\b/i;\nconst TYPED_TAG_RE = /@(arg|argument|param|return|returns|yield|yields)\\b/i;\nconst VALUE_TAG_RE = /@(example|deprecated|see|remarks|throws|internal|public|alpha|beta|since|template|fileoverview)\\b/i;\nconst BOUNDARY_RE = /(?<=[.!?])[\"'`)\\]]*\\s+(?=[A-Z0-9`])/;\nconst BULLET_RE = /^\\s*(?:[-*+] |\\d+[.)] )/;\n\nexport interface ProseGroup {\n readonly comment: TSESTree.Comment;\n readonly text: string;\n readonly hasTypedTags: boolean;\n}\n\nfunction body(comment: TSESTree.Comment): string {\n return comment.value\n .replace(/^\\*/, \"\")\n .split(\"\\n\")\n .map((line) => line.replace(/^\\s*\\*?\\s?/, \"\"))\n .join(\"\\n\")\n .trim();\n}\n\nfunction eligible(text: string, includeValueTags: boolean): boolean {\n return text.length > 0 && !DIRECTIVE_RE.test(text) && !LICENSE_RE.test(text) && (includeValueTags || !VALUE_TAG_RE.test(text));\n}\n\nexport function sentenceUnits(text: string): number {\n const cleaned = text\n .replace(/https?:\\/\\/\\S+/g, \"URL\")\n .replace(/`[^`\\n]+`/g, \"CODE\")\n .replace(/\\b\\d+\\.\\d+\\b/g, \"NUMBER\")\n .replace(/\\b(?:e\\.g\\.|i\\.e\\.|vs\\.|etc\\.)/gi, \"ABBREVIATION\");\n let units = 0;\n const prose: string[] = [];\n for (const raw of cleaned.split(\"\\n\")) {\n const line = raw.trim();\n if (line.length === 0 || /^[A-Za-z][A-Za-z ]+:$/.test(line)) continue;\n if (BULLET_RE.test(line)) units += 1;\n else prose.push(line);\n }\n if (prose.length > 0) units += prose.join(\" \").split(BOUNDARY_RE).length;\n return units;\n}\n\nexport function proseGroups(\n filename: string,\n sourceCode: Readonly<TSESLint.SourceCode>,\n includeValueTags = false,\n): ProseGroup[] {\n if (isGeneratedFile(filename, sourceCode.text) || isStoryFile(filename)) return [];\n const groups: ProseGroup[] = [];\n let run: TSESTree.Comment[] = [];\n const flush = (): void => {\n if (run.length === 0) return;\n const text = run.map(body).join(\"\\n\");\n if (eligible(text, includeValueTags)) groups.push({ comment: run[0]!, text, hasTypedTags: TYPED_TAG_RE.test(text) });\n run = [];\n };\n for (const comment of sourceCode.getAllComments()) {\n const text = body(comment);\n if (comment.type === \"Block\") {\n flush();\n if (eligible(text, includeValueTags)) groups.push({ comment, text, hasTypedTags: TYPED_TAG_RE.test(text) });\n continue;\n }\n const ownLine = sourceCode.lines[comment.loc.start.line - 1]?.slice(0, comment.loc.start.column).trim() === \"\";\n if (!ownLine || !eligible(text, includeValueTags)) {\n flush();\n continue;\n }\n const previous = run.at(-1);\n if (previous !== undefined && (comment.loc.start.line !== previous.loc.end.line + 1 || comment.loc.start.column !== previous.loc.start.column)) flush();\n run.push(comment);\n }\n flush();\n return groups;\n}\n\nfunction annotatedParameter(parameter: TSESTree.Parameter): boolean {\n if (parameter.type === AST_NODE_TYPES.TSParameterProperty) return annotatedParameter(parameter.parameter);\n const target = parameter.type === AST_NODE_TYPES.AssignmentPattern ? parameter.left : parameter;\n return \"typeAnnotation\" in target && target.typeAnnotation != null;\n}\n\nfunction typedFunction(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n return node.declaration != null && typedFunction(node.declaration);\n case AST_NODE_TYPES.FunctionDeclaration:\n case AST_NODE_TYPES.TSDeclareFunction:\n return node.returnType != null && node.params.every(annotatedParameter);\n case AST_NODE_TYPES.VariableDeclaration: {\n const init = node.declarations[0]?.init;\n return init != null &&\n (init.type === AST_NODE_TYPES.ArrowFunctionExpression || init.type === AST_NODE_TYPES.FunctionExpression) &&\n init.returnType != null && init.params.every(annotatedParameter);\n }\n case AST_NODE_TYPES.MethodDefinition:\n return node.value.returnType != null && node.value.params.every(annotatedParameter);\n case AST_NODE_TYPES.TSMethodSignature:\n return node.returnType != null && node.params.every(annotatedParameter);\n default:\n return false;\n }\n}\n\nexport function documentsTypedFunction(\n sourceCode: Readonly<TSESLint.SourceCode>,\n comment: TSESTree.Comment,\n): boolean {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) return false;\n let node: TSESTree.Node | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n while (node != null && node.type !== AST_NODE_TYPES.Program) {\n if (typedFunction(node)) return true;\n node = node.parent ?? null;\n }\n return false;\n}\n","/**\n * @fileoverview no-long-comment — three or more sentences exceed the in-code prose budget.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-long-comment.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { proseGroups, sentenceUnits } from \"./_prose-budget.js\";\n\ntype MessageIds = \"tooLong\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"no-long-comment\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Limit in-code prose to two sentences.\" },\n schema: [],\n messages: {\n tooLong: \"Comment exceeds two sentences — keep one local fact and clarify the code itself.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode)) {\n if (!group.hasTypedTags && sentenceUnits(group.text) >= 3) {\n context.report({ node: group.comment, messageId: \"tooLong\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-offset-pagination — `OFFSET m` scans and discards m rows per page and shifts under concurrent writes, so rows repeat or vanish.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-offset-pagination.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"noOffsetPagination\";\ntype Options = readonly [];\n\n/** Match pagination across the parameter styles supported by the TS, Python, and SQL rules. */\nconst OFFSET_PAGINATION = /\\bOFFSET\\s+(?:%s|%\\(\\w+\\)s|\\?\\d*|:\\w+|@\\w+|\\$\\d+|\\d+)/i;\n\n/** Cheap substring gate; noise-stripping can only ever remove keywords, never add them. */\nconst OFFSET_GATE = /offset/i;\n\nexport default createRule<Options, MessageIds>({\n name: \"no-offset-pagination\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow OFFSET pagination in embedded SQL; it is O(N) per page and drops or repeats rows under concurrent writes. Use a keyset cursor.\",\n },\n schema: [],\n messages: {\n noOffsetPagination:\n \"OFFSET pagination scans and discards every skipped row (O(N) per page) and shifts under concurrent inserts, so rows get repeated or missed. Use a keyset cursor: `WHERE id > ? ORDER BY id LIMIT ?`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !OFFSET_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!OFFSET_PAGINATION.test(sql)) {\n return;\n }\n context.report({ node, messageId: \"noOffsetPagination\" });\n });\n },\n});\n","/**\n * @fileoverview no-positional-tuple-return — a positional tuple crossing a module boundary names its fields only at the call site, so call sites disagree.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-positional-tuple-return.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"noPositionalTupleReturn\";\ntype Options = readonly [];\n\nconst MIN_ELEMENTS = 2;\n\n/** The pair length an accessor/mutator tuple has. */\nconst ACCESSOR_PAIR_LENGTH = 2;\n\n/** Type wrappers whose single type argument is the value actually returned. */\nconst AWAITABLE_TYPES: ReadonlySet<string> = new Set([\"Promise\", \"PromiseLike\", \"Awaited\"]);\n\n/** The tuple type a return annotation resolves to, unwrapping `Promise<...>`. */\nfunction tupleReturnType(node: TSESTree.TypeNode): TSESTree.TSTupleType | null {\n if (node.type === AST_NODE_TYPES.TSTupleType) {\n return node;\n }\n if (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.Identifier &&\n AWAITABLE_TYPES.has(node.typeName.name)\n ) {\n const argument = node.typeArguments?.params[0];\n return argument === undefined ? null : tupleReturnType(argument);\n }\n return null;\n}\n\n/** Source text with all whitespace runs collapsed, for structural comparison. */\nfunction normalizedText(sourceCode: { getText: (node: TSESTree.Node) => string }, node: TSESTree.Node): string {\n return sourceCode.getText(node).replaceAll(/\\s+/g, \" \").trim();\n}\n\n/**\n * True when the tuple is one of the permitted shapes: variadic, labeled, tagged\n * by a leading literal type, or structurally homogeneous.\n */\nfunction isPermittedTuple(\n tuple: TSESTree.TSTupleType,\n sourceCode: { getText: (node: TSESTree.Node) => string },\n): boolean {\n const elements = tuple.elementTypes;\n if (elements.length < MIN_ELEMENTS) {\n return true;\n }\n if (elements.some((element) => element.type === AST_NODE_TYPES.TSRestType)) {\n return true;\n }\n if (elements.some((element) => element.type === AST_NODE_TYPES.TSNamedTupleMember)) {\n return true;\n }\n if (elements[0]?.type === AST_NODE_TYPES.TSLiteralType) {\n return true;\n }\n if (\n elements.length === ACCESSOR_PAIR_LENGTH &&\n elements.some((element) => element.type === AST_NODE_TYPES.TSFunctionType)\n ) {\n return true;\n }\n const texts = new Set(elements.map((element) => normalizedText(sourceCode, element)));\n return texts.size === 1;\n}\n\n/** The declared name of a function-ish node, or null for an anonymous one. */\nfunction functionName(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.FunctionDeclaration) {\n return node.id?.name ?? null;\n }\n const parent = node.parent;\n if (parent?.type === AST_NODE_TYPES.VariableDeclarator && parent.id.type === AST_NODE_TYPES.Identifier) {\n return parent.id.name;\n }\n if (\n (parent?.type === AST_NODE_TYPES.MethodDefinition ||\n parent?.type === AST_NODE_TYPES.PropertyDefinition ||\n parent?.type === AST_NODE_TYPES.Property) &&\n parent.key.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.key.name;\n }\n return null;\n}\n\n/**\n * True when an ancestor statement carries the `export` keyword inline —\n * `export function f`, `export const f =`, `export default function f`.\n */\nfunction isInlineExported(node: TSESTree.Node): boolean {\n for (let current: TSESTree.Node | undefined | null = node; current != null; current = current.parent) {\n const parent = current.parent;\n if (\n parent?.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n parent?.type === AST_NODE_TYPES.ExportDefaultDeclaration\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The module-scope binding the function lives under — `split` for a top-level\n * `function split`, `Repo` for a method of a top-level `class Repo`. That is the\n * name an `export { … }` specifier elsewhere in the file would refer to. Null\n * when the function is not anchored to a named top-level declaration.\n */\nfunction moduleScopeBindingName(node: TSESTree.Node): string | null {\n let current: TSESTree.Node = node;\n let child: TSESTree.Node = node;\n while (current.parent != null && current.parent.type !== AST_NODE_TYPES.Program) {\n child = current;\n current = current.parent;\n }\n if (current.parent?.type !== AST_NODE_TYPES.Program) {\n return null;\n }\n if (\n current.type === AST_NODE_TYPES.FunctionDeclaration ||\n current.type === AST_NODE_TYPES.ClassDeclaration\n ) {\n return current.id?.name ?? null;\n }\n if (current.type === AST_NODE_TYPES.VariableDeclaration) {\n if (child.type !== AST_NODE_TYPES.VariableDeclarator || child.id.type !== AST_NODE_TYPES.Identifier) {\n return null;\n }\n return child.id.name;\n }\n return null;\n}\n\n/**\n * Local names this module puts on its public surface through a *detached* export\n * statement: `export { split }`, `export { split as s }`, `export default split`,\n * `export = split`. A re-export (`export { x } from \"./other\"`) names a binding\n * owned by another module, and a type-only export (`export type { x }`) does not\n * expose the value, so neither counts.\n */\nfunction specifierExportedNames(program: TSESTree.Program): ReadonlySet<string> {\n const names = new Set<string>();\n for (const statement of program.body) {\n if (\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration &&\n statement.declaration == null &&\n statement.source == null &&\n statement.exportKind !== \"type\"\n ) {\n for (const specifier of statement.specifiers) {\n if (specifier.exportKind !== \"type\" && specifier.local.type === AST_NODE_TYPES.Identifier) {\n names.add(specifier.local.name);\n }\n }\n continue;\n }\n if (\n statement.type === AST_NODE_TYPES.ExportDefaultDeclaration &&\n statement.declaration.type === AST_NODE_TYPES.Identifier\n ) {\n names.add(statement.declaration.name);\n continue;\n }\n if (\n statement.type === AST_NODE_TYPES.TSExportAssignment &&\n statement.expression.type === AST_NODE_TYPES.Identifier\n ) {\n names.add(statement.expression.name);\n }\n }\n return names;\n}\n\n/**\n * True when the function is reachable from outside the module — the boundary the\n * rule is about. Either the declaration is exported inline, or its module-scope\n * binding is exported later through an export specifier.\n */\nfunction isExported(node: TSESTree.Node, specifierExports: ReadonlySet<string>): boolean {\n if (isInlineExported(node)) {\n return true;\n }\n if (specifierExports.size === 0) {\n return false;\n }\n const binding = moduleScopeBindingName(node);\n return binding !== null && specifierExports.has(binding);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-positional-tuple-return\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow returning a positional tuple of distinct fields from an exported function; return a named object so call sites cannot mismatch slots.\",\n },\n schema: [],\n messages: {\n noPositionalTupleReturn:\n \"Exported `{{name}}` returns a positional {{count}}-tuple, so every call site re-invents the field names and can disagree. Return a named object (or label the tuple members) instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const specifierExports = specifierExportedNames(context.sourceCode.ast);\n const check = (\n node:\n | TSESTree.FunctionDeclaration\n | TSESTree.FunctionExpression\n | TSESTree.ArrowFunctionExpression,\n ): void => {\n const annotation = node.returnType?.typeAnnotation;\n if (annotation === undefined) {\n return;\n }\n const tuple = tupleReturnType(annotation);\n if (tuple === null || isPermittedTuple(tuple, context.sourceCode)) {\n return;\n }\n const name = functionName(node);\n if (name === null || name.startsWith(\"_\") || /^use[A-Z]/.test(name)) {\n return;\n }\n if (!isExported(node, specifierExports)) {\n return;\n }\n context.report({\n node: tuple,\n messageId: \"noPositionalTupleReturn\",\n data: { name, count: String(tuple.elementTypes.length) },\n });\n };\n return {\n FunctionDeclaration: check,\n FunctionExpression: check,\n ArrowFunctionExpression: check,\n };\n },\n});\n","/**\n * @fileoverview no-raw-env — a raw `process.env` read is untyped and unvalidated, so a missing variable surfaces as `undefined` in business logic.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-raw-env.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noRawEnv\";\ntype Options = readonly [];\n\n/** Build / test / tooling config: `vite.config.ts`, `vitest.config.mts`, `playwright.config.ts`. */\nconst CONFIG_FILE_RE = /(^|[\\\\/])[\\w.-]+\\.config\\.[cm]?[jt]sx?$/;\n\n/** Exempt only boundary-named modules that contain a validation marker. */\nconst ENV_BOUNDARY_FILE_RE =\n /(^|[\\\\/])(?:env|client-env|server-env|client-settings|server-settings)\\.[cm]?[jt]sx?$/;\n\nconst ENV_VALIDATION_MARKER_RE =\n /\\bcreateEnv\\s*\\(|\\bz\\.object\\s*\\(|\\.(?:safeParse|parse)\\s*\\(/;\n\nfunction isValidatedEnvBoundary(filename: string, sourceText: string): boolean {\n return (\n ENV_BOUNDARY_FILE_RE.test(filename.replaceAll(\"\\\\\", \"/\")) &&\n ENV_VALIDATION_MARKER_RE.test(sourceText)\n );\n}\n\n/** True for the `process.env` member node (dotted or as the base of `process.env[key]`). */\nfunction isProcessEnv(node: TSESTree.MemberExpression): boolean {\n return (\n !node.computed &&\n node.object.type === \"Identifier\" &&\n node.object.name === \"process\" &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\"\n );\n}\n\n/** True for the `import.meta.env` member node (dotted or as the base of `import.meta.env[key]`). */\nfunction isImportMetaEnv(node: TSESTree.MemberExpression): boolean {\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\" &&\n node.object.type === \"MetaProperty\" &&\n node.object.meta.name === \"import\" &&\n node.object.property.name === \"meta\"\n );\n}\n\n// Build-time constants that bundlers (webpack/Vite) statically replace — there is\n// no runtime env value to route through the validated layer, so they are exempt.\nconst BUILD_TIME_CONSTANTS: ReadonlySet<string> = new Set([\n \"NODE_ENV\",\n \"MODE\",\n \"DEV\",\n \"PROD\",\n \"SSR\",\n]);\n\nconst PLATFORM_MARKERS: ReadonlySet<string> = new Set([\n \"NEXT_RUNTIME\",\n \"VERCEL\",\n \"VERCEL_ENV\",\n \"CI\",\n]);\n\n/** Match named bundler constants and host-owned platform markers. */\nfunction isExemptVariableAccess(node: TSESTree.MemberExpression): boolean {\n const parent = node.parent;\n return (\n parent.type === \"MemberExpression\" &&\n parent.object === node &&\n !parent.computed &&\n parent.property.type === \"Identifier\" &&\n (BUILD_TIME_CONSTANTS.has(parent.property.name) ||\n PLATFORM_MARKERS.has(parent.property.name))\n );\n}\n\n/** Match assignment and deletion targets, which do not read configuration. */\nfunction isWriteTarget(node: TSESTree.MemberExpression): boolean {\n const access = node.parent.type === \"MemberExpression\" && node.parent.object === node ? node.parent : node;\n const parent = access.parent;\n if (parent.type === \"AssignmentExpression\") {\n return parent.left === access;\n }\n if (parent.type === \"UnaryExpression\") {\n return parent.operator === \"delete\";\n }\n return false;\n}\n\n/** Match whole-environment pass-through such as `{ ...process.env }`. */\nfunction isWholeEnvSpread(node: TSESTree.MemberExpression): boolean {\n const parent = node.parent;\n return parent.type === \"SpreadElement\" && parent.argument === node;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-raw-env\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow direct `process.env` and `import.meta.env` reads outside validated boundaries.\",\n },\n schema: [],\n messages: {\n noRawEnv:\n \"Do not read raw environment values directly. Import the validated env module so values are typed and checked at startup.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (\n isTestFile(filename) ||\n isScriptFile(filename) ||\n CONFIG_FILE_RE.test(filename.replaceAll(\"\\\\\", \"/\")) ||\n isValidatedEnvBoundary(filename, context.sourceCode.text)\n ) {\n return {};\n }\n return {\n MemberExpression(node: TSESTree.MemberExpression): void {\n if (\n (isProcessEnv(node) || isImportMetaEnv(node)) &&\n !isExemptVariableAccess(node) &&\n !isWriteTarget(node) &&\n !isWholeEnvSpread(node)\n ) {\n context.report({\n node,\n messageId: \"noRawEnv\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-raw-fetch-outside-clients — a bare `fetch` outside the client layer opts out of retry, timeout and status handling, and cannot be stubbed.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-raw-fetch-outside-clients.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"rawFetch\";\n\nexport interface RuleOptions {\n /** Regular-expression sources matched against the filename. */\n readonly allow?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\n/** Client-layer paths that may own outbound HTTP; test files are exempt separately. */\nconst DEFAULT_ALLOW: readonly string[] = [\n \"[\\\\\\\\/]clients?[\\\\\\\\/]\",\n \"-client\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]http-client\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]api[\\\\\\\\/]\",\n \"[\\\\\\\\/]api\\\\.[cm]?[jt]sx?$\",\n \"[-.]api\\\\.[cm]?[jt]sx?$\",\n \"[\\\\\\\\/]services?[\\\\\\\\/]\",\n \"[\\\\\\\\/](connectors|providers|integrations|adapters|fetchers)[\\\\\\\\/]\",\n \"[\\\\\\\\/]notifications[\\\\\\\\/]\",\n \"[Ss]ervice\\\\.[cm]?[jt]sx?$\",\n \"-(service|connector|adapter|sdk|fetcher)\\\\.[cm]?[jt]sx?$\",\n];\n\n/** Additional non-production trees that may call `fetch` directly. */\nconst NON_PRODUCTION_TREE_RE =\n /[\\\\/](playwright|cypress|__testfixtures__)[\\\\/]/;\n\n/** Receivers on which `.fetch()` is the global, not some cache/query API. */\nconst GLOBAL_RECEIVERS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n]);\n\nconst PRESIGNED_URL_NAME_RE = /(?:pre-?signed|signed|upload|download)Url$/i;\n\nfunction isGlobalFetchCall(node: TSESTree.CallExpression): boolean {\n const callee = node.callee;\n\n if (callee.type === \"Identifier\") {\n return callee.name === \"fetch\";\n }\n\n if (\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === \"fetch\" &&\n callee.object.type === \"Identifier\"\n ) {\n return GLOBAL_RECEIVERS.has(callee.object.name);\n }\n\n return false;\n}\n\nfunction identifierLikeName(node: TSESTree.Node): string | null {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n if (\n node.type === \"MemberExpression\" &&\n !node.computed &&\n node.property.type === \"Identifier\"\n ) {\n return node.property.name;\n }\n return null;\n}\n\n/** True for a lone `fetch(new URL(...))` / `fetch(new Request(...))`. */\nfunction isConstructedArgumentHandoff(node: TSESTree.CallExpression): boolean {\n const [first] = node.arguments;\n return (\n node.arguments.length === 1 &&\n first !== undefined &&\n first.type === AST_NODE_TYPES.NewExpression\n );\n}\n\nfunction isPresignedUrlTransfer(node: TSESTree.CallExpression): boolean {\n const first = node.arguments[0];\n if (first === undefined) {\n return false;\n }\n const name = identifierLikeName(first);\n return name !== null && PRESIGNED_URL_NAME_RE.test(name);\n}\n\n/** Compile valid allow patterns; malformed entries fail closed. */\nfunction compile(patterns: readonly string[]): RegExp[] {\n const compiled: RegExp[] = [];\n for (const pattern of patterns) {\n try {\n compiled.push(new RegExp(pattern));\n } catch {\n // Skip the malformed entry; the remaining patterns still apply.\n }\n }\n return compiled;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-raw-fetch-outside-clients\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow calling the global `fetch` outside the client layer; route outbound HTTP through a client module that owns retry, timeout and status handling.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n allow: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Regular-expression sources matched against the filename. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n rawFetch:\n \"Raw `fetch()` outside a client module. Route the call through a client (e.g. `clients/*-client.ts`) so it inherits retry, timeout and status handling and stays stubbable in tests.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const filename = context.filename;\n\n if (isTestFile(filename) || NON_PRODUCTION_TREE_RE.test(filename)) {\n return {};\n }\n\n const patterns = options?.allow ?? DEFAULT_ALLOW;\n const allowed = compile(patterns);\n\n if (allowed.some((re) => re.test(filename))) {\n return {};\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (isPresignedUrlTransfer(node) || isConstructedArgumentHandoff(node)) {\n return;\n }\n if (isGlobalFetchCall(node)) {\n context.report({ node, messageId: \"rawFetch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restricted-library-load — literal runtime module loads must obey the same library policy as static imports.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restricted-library-load.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\nexport interface RestrictedLibrary {\n readonly id: string;\n readonly module: string;\n readonly replacement: string;\n readonly note?: string;\n}\n\ntype MessageIds = \"restrictedLibraryLoad\";\ntype Options = readonly [\n {\n libraries: readonly RestrictedLibrary[];\n },\n];\n\nfunction literalModule(node: TSESTree.Node | undefined): string | null {\n return node?.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\"\n ? node.value\n : null;\n}\n\nfunction matchesModule(source: string, module: string): boolean {\n return source === module || source.startsWith(`${module}/`);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restricted-library-load\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Apply a configured library-replacement policy to literal dynamic imports, CommonJS loads, and TypeScript import-equals declarations.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"libraries\"],\n properties: {\n libraries: {\n type: \"array\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"module\", \"replacement\"],\n properties: {\n id: { type: \"string\", minLength: 1 },\n module: { type: \"string\", minLength: 1 },\n replacement: { type: \"string\", minLength: 1 },\n note: { type: \"string\", minLength: 1 },\n },\n },\n },\n },\n },\n ],\n messages: {\n restrictedLibraryLoad:\n \"{{id}}: Replace runtime loading of {{module}} with {{replacement}}.{{note}}\",\n },\n },\n defaultOptions: [{ libraries: [] }],\n create(context, [options]) {\n const restrictions = options.libraries;\n\n function report(node: TSESTree.Node, source: string): void {\n const restriction = restrictions.find((entry) =>\n matchesModule(source, entry.module),\n );\n if (restriction === undefined) return;\n context.report({\n node,\n messageId: \"restrictedLibraryLoad\",\n data: {\n id: restriction.id,\n module: restriction.module,\n replacement: restriction.replacement,\n note: restriction.note === undefined ? \"\" : ` ${restriction.note}`,\n },\n });\n }\n\n function isUnshadowedRequire(node: TSESTree.Identifier): boolean {\n const variable = ASTUtils.findVariable(\n context.sourceCode.getScope(node),\n node.name,\n );\n return variable === null || variable.defs.length === 0;\n }\n\n return {\n ImportExpression(node: TSESTree.ImportExpression): void {\n const source = literalModule(node.source);\n if (source !== null) report(node.source, source);\n },\n CallExpression(node: TSESTree.CallExpression): void {\n let requireIdentifier: TSESTree.Identifier | null = null;\n if (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\"\n ) {\n requireIdentifier = node.callee;\n } else if (\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n node.callee.object.name === \"require\" &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n node.callee.property.name === \"resolve\"\n ) {\n requireIdentifier = node.callee.object;\n }\n if (requireIdentifier === null || !isUnshadowedRequire(requireIdentifier)) return;\n const source = literalModule(node.arguments[0]);\n if (source !== null) report(node.arguments[0] as TSESTree.Node, source);\n },\n TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void {\n if (node.moduleReference.type !== AST_NODE_TYPES.TSExternalModuleReference) return;\n const source = literalModule(node.moduleReference.expression);\n if (source !== null) report(node.moduleReference.expression, source);\n },\n };\n },\n});\n","/**\n * @fileoverview no-repeated-string-literal — the same structured literal in two functions drifts the moment one copy is edited.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-repeated-string-literal.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noRepeatedStringLiteral\";\ntype Options = readonly [];\n\nconst MIN_LENGTH = 40;\nconst MIN_DISTINCT_SCOPES = 2;\nconst PREVIEW_LENGTH = 40;\n\n/** Case-sensitive on purpose: uppercase keywords mean SQL, lowercase means prose. */\nconst SQL_KEYWORD_RE =\n /\\b(SELECT|INSERT|UPDATE|DELETE|FROM|WHERE|JOIN|VALUES|ON CONFLICT|RETURNING|GROUP BY|ORDER BY)\\b/;\nconst IDENTIFIER_RE = /^[a-z_][a-z0-9_.]*$/;\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** True when the literal carries structure that rules out coincidental equality. */\nfunction isStructured(value: string): boolean {\n return value.includes(\"\\n\") || SQL_KEYWORD_RE.test(value) || IDENTIFIER_RE.test(value);\n}\n\nfunction preview(value: string): string {\n const oneLine = value.replaceAll(\"\\n\", \" \").trim();\n return oneLine.length <= PREVIEW_LENGTH ? oneLine : `${oneLine.slice(0, PREVIEW_LENGTH)}...`;\n}\n\n/** The enclosing function node, or null when the literal sits at module/class scope. */\nfunction enclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n }\n return null;\n}\n\n/**\n * True when the literal is scaffolding rather than a reusable value: an\n * import/`require` source (repeating a module path is the point) or a JSX\n * attribute value (styling strings, handled by the styling rules).\n */\nfunction isScaffolding(node: TSESTree.Node): boolean {\n const parent = node.parent;\n if (parent === undefined) {\n return true;\n }\n const isRequireSource =\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee.type === AST_NODE_TYPES.Identifier &&\n parent.callee.name === \"require\";\n return (\n parent.type === AST_NODE_TYPES.ImportDeclaration ||\n parent.type === AST_NODE_TYPES.ImportExpression ||\n parent.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n parent.type === AST_NODE_TYPES.ExportAllDeclaration ||\n parent.type === AST_NODE_TYPES.TSImportType ||\n parent.type === AST_NODE_TYPES.JSXAttribute ||\n parent.type === AST_NODE_TYPES.TSLiteralType ||\n isRequireSource\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-repeated-string-literal\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow a long structured string literal repeated across functions; the copies drift when one is edited. Extract a module-level constant.\",\n },\n schema: [],\n messages: {\n noRepeatedStringLiteral:\n 'Structured string literal \"{{preview}}\" is repeated across functions (first use on line {{line}}) — extract a module-level constant so the copies cannot drift.',\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n const occurrences = new Map<string, TSESTree.Node[]>();\n const scopes = new WeakMap<TSESTree.Node, TSESTree.Node | null>();\n\n const record = (value: string, node: TSESTree.Node): void => {\n if (value.length < MIN_LENGTH || !isStructured(value) || isScaffolding(node)) {\n return;\n }\n const existing = occurrences.get(value);\n if (existing === undefined) {\n occurrences.set(value, [node]);\n } else {\n existing.push(node);\n }\n scopes.set(node, enclosingFunction(node));\n };\n\n return {\n Literal(node: TSESTree.Literal): void {\n if (typeof node.value === \"string\") {\n record(node.value, node);\n }\n },\n TemplateLiteral(node: TSESTree.TemplateLiteral): void {\n // A tagged template (`js`…``, `css`…``, `sql`…``) is a call, not a\n // string value — the tag, not this rule, decides what the text means.\n if (node.parent.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return;\n }\n const [only] = node.quasis;\n if (node.expressions.length === 0 && only !== undefined) {\n record(only.value.cooked ?? only.value.raw, node);\n }\n },\n \"Program:exit\": (): void => {\n for (const [value, nodes] of occurrences) {\n const distinctScopes = new Set(\n nodes.map((node) => scopes.get(node)).filter((scope) => scope != null),\n );\n if (distinctScopes.size < MIN_DISTINCT_SCOPES) {\n continue;\n }\n const [first, ...repeats] = nodes;\n if (first === undefined) {\n continue;\n }\n for (const node of repeats) {\n context.report({\n node,\n messageId: \"noRepeatedStringLiteral\",\n data: { preview: preview(value), line: String(first.loc.start.line) },\n });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restated-comment — a comment whose every content word is already on the line below can only go out of date silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restated-comment.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n codeTokens,\n contentTokens,\n isProtected,\n restatableStatementBelow,\n restates,\n restatesStatementHead,\n} from \"./_comments.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"restatesLineBelow\";\ntype Options = readonly [];\n\nconst MAX_WORDS = 8;\nconst MIN_CONTENT_TOKENS = 2;\n\nconst DIRECTIVE_RE =\n /^(eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier-ignore|prettier\\b|biome-|c8\\b|v8\\b|istanbul\\b|@type\\b|@vite|webpack|<reference|<amd|global\\b|noinspection|todo\\b|fixme\\b|hack\\b|xxx\\b)/i;\n\n// Commented-out code and section banners belong to `no-comment-cruft`.\nconst CODEY_RE = /^[\\w.$[\\]'\"]+\\s*[:=]\\s*\\S|^[\\w.$]+\\s*\\(|^(?:return|throw|await|import|export|const|let|var)\\b.*[=()[\\]{}]/;\nconst BANNERISH_RE = /[=\\-─-╿*#~_.]{3,}|^[A-Z0-9 _:-]+$/;\n\nconst MODALITY_RE = /\\b(?:can|could|should|shall|may|might|must|will|would|cannot)\\b/i;\nconst LEAD_IN_RE = /:$/;\nconst EMPHASIS_RE = /\\*\\w[^*]*\\*|`[^`]+`/;\nconst NEGATION_WORD_RE = /\\b(?:no|not|never|neither|nor|without|none|non)\\b/i;\n\nconst ACTION_STMT_RE = /[\\w.$\\])]\\s*\\(|^\\s*(?:return|throw|await|yield)\\b/;\n\nconst NON_ASCII_LETTER_RE = /[^\\p{ASCII}\\p{N}\\p{P}\\p{Z}]/u;\nconst WALL_NARRATION_RE =\n /^(?:(?:\\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;\nconst WALL_CLUSTER_MAX_LINE_GAP = 8;\nconst WALL_CLUSTER_MIN_COMMENTS = 3;\n\n/** True when `a` and `b` are `//` comments on consecutive lines. */\nfunction areAdjacentLineComments(\n a: TSESTree.Comment | undefined,\n b: TSESTree.Comment | undefined,\n): boolean {\n return (\n a !== undefined &&\n b !== undefined &&\n a.type === \"Line\" &&\n b.type === \"Line\" &&\n b.loc.start.line === a.loc.end.line + 1\n );\n}\n\n/**\n * True when the statement below the comment heads a run of siblings of the same\n * kind — `// register secrets` over eight `registerSecret(…)` calls. The label\n * provides the grouping, and deleting it loses that.\n */\nfunction headsSiblingRun(node: TSESTree.Node): boolean {\n const parent = node.parent;\n if (parent === undefined) return false;\n const body: readonly TSESTree.Node[] | undefined =\n \"body\" in parent && Array.isArray(parent.body)\n ? parent.body\n : undefined;\n if (body === undefined) return false;\n const index = body.indexOf(node);\n const next = index >= 0 ? body[index + 1] : undefined;\n return next !== undefined && next.type === node.type;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restated-comment\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a single-line comment whose every word already appears on the statement below it.\",\n },\n schema: [],\n messages: {\n restatesLineBelow:\n \"Comment restates the statement below it — delete it, or replace it with the *why*; the code already carries the *what*.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n const lines = sourceCode.lines;\n\n function isStandalone(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n return !before || before.loc.end.line < comment.loc.start.line;\n }\n\n function labelsASiblingRun(comment: TSESTree.Comment): boolean {\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null) return false;\n for (\n let node: TSESTree.Node | undefined | null = sourceCode.getNodeByRangeIndex(token.range[0]);\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n if (headsSiblingRun(node)) return true;\n }\n return false;\n }\n\n return {\n Program(): void {\n const comments = sourceCode.getAllComments();\n const wallMembers = new Set<TSESTree.Comment>();\n let cluster: TSESTree.Comment[] = [];\n for (const candidate of comments) {\n const body = candidate.value.replace(/^\\/*/, \"\").trim();\n if (\n candidate.type !== \"Line\" ||\n !isStandalone(candidate) ||\n isProtected(body) ||\n !WALL_NARRATION_RE.test(body)\n ) {\n continue;\n }\n const previous = cluster.at(-1);\n if (\n previous !== undefined &&\n candidate.loc.start.line - previous.loc.start.line > WALL_CLUSTER_MAX_LINE_GAP\n ) {\n if (cluster.length >= WALL_CLUSTER_MIN_COMMENTS) {\n for (const member of cluster) wallMembers.add(member);\n }\n cluster = [];\n }\n cluster.push(candidate);\n }\n if (cluster.length >= WALL_CLUSTER_MIN_COMMENTS) {\n for (const member of cluster) wallMembers.add(member);\n }\n for (let i = 0; i < comments.length; i++) {\n const comment = comments[i];\n if (comment === undefined || comment.type !== \"Line\") continue;\n if (wallMembers.has(comment)) continue;\n if (!isStandalone(comment)) continue;\n if (\n areAdjacentLineComments(comments[i - 1], comment) ||\n areAdjacentLineComments(comment, comments[i + 1])\n ) {\n continue; // one line of a paragraph, not a label for the next statement\n }\n const body = comment.value.replace(/^\\/*/, \"\").trim();\n if (body.length === 0 || body.endsWith(\"?\")) continue;\n if (DIRECTIVE_RE.test(body) || CODEY_RE.test(body) || BANNERISH_RE.test(body)) continue;\n if (NON_ASCII_LETTER_RE.test(body) || isProtected(body)) continue;\n if (MODALITY_RE.test(body) || LEAD_IN_RE.test(body) || EMPHASIS_RE.test(body)) continue;\n if (NEGATION_WORD_RE.test(body)) continue;\n if (body.split(/\\s+/).length > MAX_WORDS) continue;\n\n const tokens = contentTokens(body);\n if (tokens.length < MIN_CONTENT_TOKENS) continue;\n\n const statement = restatableStatementBelow(comment, sourceCode);\n if (statement === null) continue;\n if (restatesStatementHead(body, statement)) continue; // `no-comment-cruft` owns it\n\n const line = lines[comment.loc.start.line] ?? \"\";\n if (!ACTION_STMT_RE.test(line)) continue;\n\n if (labelsASiblingRun(comment)) continue;\n\n if (restates(tokens, codeTokens(line))) {\n context.report({ node: comment, messageId: \"restatesLineBelow\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-restated-jsdoc — a JSDoc block whose every word is already in the signature costs three lines and a review and says nothing.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-restated-jsdoc.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isProtected, splitIdentifier, stem } from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"restatesSignature\" | \"deleteBlock\";\ntype Options = readonly [];\n\n// Tags this rule models and can therefore judge. Anything else means the block\n// is doing something the rule does not understand, so it is left alone — which\n// includes every value-carrying tag (`@see`, `@example`, `@deprecated`,\n// `@throws`, …). A separate allowlist of those used to sit above this one; it\n// could be emptied with the whole suite green, because being outside this set\n// is already sufficient and the two sets were disjoint.\nconst MODELLED_TAGS: ReadonlySet<string> = new Set([\n \"arg\", \"argument\", \"async\", \"description\", \"param\", \"return\", \"returns\",\n]);\n\nconst PARAM_TAGS: ReadonlySet<string> = new Set([\"arg\", \"argument\", \"param\"]);\nconst RETURN_TAGS: ReadonlySet<string> = new Set([\"return\", \"returns\"]);\n\nconst DIRECTIVE_RE = /^\\s*(?:eslint\\b|eslint-|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|@vite|webpack|@jsx|@jest-environment|@vitest-environment|#__)/i;\n\n// Prose filler that says nothing about *which* thing is being described. Wider\n// than the comment tokenizer's list because JSDoc conventionally repeats the\n// vocabulary of the type system itself (\"the callback prop\", \"an optional\n// string\") without that being a claim about this declaration.\nconst STOPWORDS: ReadonlySet<string> = new Set(\n `the a an of to for in on with and or as at by is are was be been being\n this that it its if whether when where which what will would can could should\n must may into from over about not no does do done has have had used use uses\n using given provided specified current new existing all any each per via based\n function method component hook class instance object value values data item\n items element callback handler prop props param parameter argument arg return\n returns returning result optional required default true false null undefined\n string number boolean array list promise`.split(/\\s+/),\n);\n\nconst WORD_RE = /[A-Za-z]+/g;\n\ninterface JsDocTag {\n readonly name: string;\n readonly text: string;\n}\n\n/** Split a JSDoc block into its free description and its tags. */\nfunction parseJsDoc(value: string): { description: string; tags: JsDocTag[] } {\n const lines = value.replace(/^\\*/, \"\").split(\"\\n\").map((line) => line.replace(/^\\s*\\*?\\s?/, \"\"));\n const description: string[] = [];\n const tags: { name: string; text: string }[] = [];\n let current: { name: string; text: string } | null = null;\n for (const line of lines) {\n const match = /^\\s*@(\\w[\\w-]*)\\s*(.*)$/.exec(line);\n if (match) {\n current = { name: (match[1] ?? \"\").toLowerCase(), text: match[2] ?? \"\" };\n tags.push(current);\n } else if (current !== null) {\n current.text += ` ${line.trim()}`;\n } else {\n description.push(line);\n }\n }\n return { description: description.join(\"\\n\").trim(), tags };\n}\n\n/** Every content word of `text`, lowercased, with filler dropped. */\nfunction proseTokens(text: string): string[] {\n return (text.match(WORD_RE) ?? [])\n .map((word) => word.toLowerCase())\n .filter((word) => word.length > 1 && !STOPWORDS.has(word));\n}\n\n/** True when every content word of `text` already appears in `known`. */\nfunction covered(text: string, known: ReadonlySet<string>): boolean {\n const stems = new Set<string>();\n for (const token of known) stems.add(stem(token));\n return proseTokens(text).every((word) => known.has(word) || stems.has(stem(word)));\n}\n\n/** The declared name and parameter names of the node a JSDoc block sits above. */\nfunction declarationNames(node: TSESTree.Node): { name: string; params: string[] } | null {\n switch (node.type) {\n // `export function f()` — the JSDoc sits above the `export`, so the token\n // after it resolves to the wrapper, not to the thing being documented.\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n return node.declaration == null ? null : declarationNames(node.declaration);\n case AST_NODE_TYPES.FunctionDeclaration:\n case AST_NODE_TYPES.TSDeclareFunction:\n return node.id === null ? null : { name: node.id.name, params: paramNames(node.params) };\n case AST_NODE_TYPES.ClassDeclaration:\n case AST_NODE_TYPES.TSInterfaceDeclaration:\n case AST_NODE_TYPES.TSTypeAliasDeclaration:\n case AST_NODE_TYPES.TSEnumDeclaration:\n return node.id === null ? null : { name: node.id.name, params: [] };\n case AST_NODE_TYPES.VariableDeclaration: {\n const declarator = node.declarations[0];\n if (declarator === undefined || declarator.id.type !== AST_NODE_TYPES.Identifier) return null;\n const init = declarator.init;\n const params =\n init != null &&\n (init.type === AST_NODE_TYPES.ArrowFunctionExpression ||\n init.type === AST_NODE_TYPES.FunctionExpression)\n ? paramNames(init.params)\n : [];\n return { name: declarator.id.name, params };\n }\n case AST_NODE_TYPES.MethodDefinition:\n case AST_NODE_TYPES.PropertyDefinition:\n case AST_NODE_TYPES.TSMethodSignature:\n case AST_NODE_TYPES.TSPropertySignature: {\n if (node.key.type !== AST_NODE_TYPES.Identifier) return null;\n const params =\n node.type === AST_NODE_TYPES.MethodDefinition\n ? paramNames(node.value.params)\n : node.type === AST_NODE_TYPES.TSMethodSignature\n ? paramNames(node.params)\n : [];\n return { name: node.key.name, params };\n }\n default:\n return null;\n }\n}\n\nfunction paramNames(params: readonly TSESTree.Parameter[]): string[] {\n const names: string[] = [];\n for (const param of params) {\n const target = param.type === AST_NODE_TYPES.AssignmentPattern ? param.left : param;\n if (target.type === AST_NODE_TYPES.Identifier) names.push(target.name);\n else if (target.type === AST_NODE_TYPES.TSParameterProperty) continue;\n }\n return names;\n}\n\nfunction tokensOf(names: readonly string[]): Set<string> {\n const tokens = new Set<string>();\n for (const name of names) for (const part of splitIdentifier(name)) tokens.add(part);\n return tokens;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-restated-jsdoc\",\n meta: {\n type: \"suggestion\",\n hasSuggestions: true,\n docs: {\n description:\n \"Flag a JSDoc block whose description and tags only re-spell the signature they document.\",\n },\n schema: [],\n messages: {\n restatesSignature:\n \"JSDoc only re-spells the signature — delete it, or say what the caller cannot read off the name (what it throws, what it assumes, why it exists).\",\n deleteBlock: \"Delete the JSDoc block.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n if (comment.type !== \"Block\" || !comment.value.startsWith(\"*\")) continue;\n const { description, tags } = parseJsDoc(comment.value);\n if (DIRECTIVE_RE.test(description)) continue;\n const tagNames = new Set(tags.map((tag) => tag.name));\n if ([...tagNames].some((name) => !MODELLED_TAGS.has(name))) continue;\n if (isProtected(description)) continue;\n\n const token = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (token === null || token.loc.start.line !== comment.loc.end.line + 1) continue;\n let node = sourceCode.getNodeByRangeIndex(token.range[0]);\n let declaration: { name: string; params: string[] } | null = null;\n while (node != null && node.type !== AST_NODE_TYPES.Program) {\n declaration = declarationNames(node);\n if (declaration !== null) break;\n node = node.parent ?? null;\n }\n if (declaration === null) continue;\n\n const paramTags = tags.filter((tag) => PARAM_TAGS.has(tag.name));\n const returnTags = tags.filter((tag) => RETURN_TAGS.has(tag.name));\n if (description.length === 0 && paramTags.length === 0 && returnTags.length === 0) {\n continue;\n }\n\n const nameTokens = tokensOf([declaration.name]);\n const paramTokens = tokensOf(declaration.params);\n const known = new Set([...nameTokens, ...paramTokens]);\n\n let addsNothing = covered(description, known);\n for (const tag of paramTags) {\n const text = tag.text.replace(/^\\{[^}]*\\}\\s*/, \"\");\n const match = /^\\[?([A-Za-z_$][\\w.$]*)\\]?\\s*-?\\s*([\\s\\S]*)$/.exec(text);\n if (match === null) {\n addsNothing = false;\n break;\n }\n const own = new Set([...splitIdentifier(match[1]?.split(\".\").pop() ?? \"\"), ...nameTokens]);\n if (!covered(match[2] ?? \"\", own)) {\n addsNothing = false;\n break;\n }\n for (const part of splitIdentifier(match[1]?.split(\".\").pop() ?? \"\")) known.add(part);\n }\n if (addsNothing) {\n for (const tag of returnTags) {\n if (!covered(tag.text.replace(/^\\{[^}]*\\}\\s*/, \"\"), known)) {\n addsNothing = false;\n break;\n }\n }\n }\n if (!addsNothing) continue;\n\n context.report({\n node: comment,\n messageId: \"restatesSignature\",\n suggest: [\n {\n messageId: \"deleteBlock\",\n fix: (fixer) => fixer.removeRange([comment.range[0], token.range[0]]),\n },\n ],\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-secret-in-log — a secret passed to a logging call persists in log sinks far beyond its intended lifetime.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-secret-in-log.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport {\n FLAG_PREFIXES,\n INNOCUOUS_WORDS,\n isSecretName,\n leadingWord,\n tokenize,\n} from \"./_secret-names.js\";\n\ntype MessageIds = \"noSecretInLog\" | \"noRawBodyInLog\";\ntype Options = readonly [LoggingOptions?];\n\n/**\n * The shared metadata set plus the log-specific extras. Logging a secret's\n * label, expiry, ARN, URL, scope, or the DI component that holds it is metadata\n * ABOUT the credential, never the credential bytes, so it must not fire here —\n * `prefer-constant-time-secret-compare` uses the narrower shared set.\n */\nconst LOG_INNOCUOUS_WORDS: ReadonlySet<string> = new Set([\n ...INNOCUOUS_WORDS,\n \"name\",\n \"names\",\n \"label\",\n \"labels\",\n \"title\",\n \"expiry\",\n \"expiration\",\n \"expires\",\n \"ttl\",\n \"version\",\n \"versions\",\n \"policy\",\n \"rotation\",\n \"arn\",\n \"path\",\n \"paths\",\n \"issuer\",\n \"audience\",\n \"strength\",\n \"manager\",\n \"service\",\n \"services\",\n \"repository\",\n \"provider\",\n \"providers\",\n \"store\",\n \"factory\",\n \"handler\",\n \"controller\",\n \"bucket\",\n \"url\",\n \"uri\",\n \"endpoint\",\n \"endpoints\",\n \"scope\",\n \"scopes\",\n \"event\",\n \"events\",\n \"format\",\n \"at\",\n \"len\",\n \"length\",\n]);\n\nconst REDACTION_RE = /prefix|suffix|redact|mask|hash|hint|_len|length/i;\nconst WHOLE_TOKEN_REDACTION_MARKERS: ReadonlySet<string> = new Set([\"tag\"]);\n\n/** True if the name names a raw secret and is not a redacted derivative. */\nfunction isSecretKeyword(name: string): boolean {\n if (REDACTION_RE.test(name)) {\n return false;\n }\n if (tokenize(name).some((tok) => WHOLE_TOKEN_REDACTION_MARKERS.has(tok))) {\n return false;\n }\n return isSecretName(name, LOG_INNOCUOUS_WORDS);\n}\n\n/**\n * True if `prop`'s value is the raw secret rather than a redacted/derived form.\n * Shorthand (`{ token }`), a bare identifier (`{ apiKey: theKey }`), or a plain\n * member access (`{ apiKey: config.apiKey }`) all carry the secret verbatim. A\n * call (`token.slice(0, 6)`, `mask(token)`), template literal, ternary, concat,\n * or literal placeholder (`\"***\"`) is already redacted — logging it is safe.\n */\nfunction isRawSecretValue(prop: TSESTree.Property): boolean {\n if (prop.shorthand) {\n return true;\n }\n return prop.value.type === \"Identifier\" || prop.value.type === \"MemberExpression\";\n}\n\n/**\n * Trailing camel/snake words that name an un-redacted request/response blob. Kept\n * to an enumerated five: these are the containers whose *whole point* is \"the\n * bytes the client sent / the server returned\". Generic container words (`data`,\n * `input`, `args`, `event`, `result`, `payloadless` domain objects) are excluded\n * on purpose — see the `@fileoverview`.\n */\nconst RAW_BLOB_WORDS: ReadonlySet<string> = new Set([\n \"body\",\n \"bodies\",\n \"payload\",\n \"payloads\",\n \"params\",\n]);\n\n/**\n * Whole identifiers whose camelCase split ends in a word too generic to enumerate\n * (`formData` -> `data`) but which name a blob unambiguously on their own.\n */\nconst RAW_BLOB_IDENTIFIERS: ReadonlySet<string> = new Set([\"formdata\"]);\n\n/**\n * Substrings that mark a blob name as an already-derived, safe-to-log form:\n * `redactedBody`, `sanitizedPayload`, `truncatedBody`, `bodyPreview`.\n */\nconst BLOB_REDACTION_RE = /redact|sanit|scrub|mask|truncat|anonym|filtered|preview|summar/i;\n\n/**\n * Derivation markers that are only safe when matched as a WHOLE token — `safe` as\n * a substring would wrongly exempt `unsafeBody`.\n */\nconst BLOB_REDACTION_TOKENS: ReadonlySet<string> = new Set([\n \"safe\",\n \"clean\",\n \"shape\",\n \"keys\",\n \"public\",\n]);\n\n/** True if the name names a raw request/response blob and is not a derived form. */\nfunction isRawBlobName(name: string): boolean {\n if (REDACTION_RE.test(name) || BLOB_REDACTION_RE.test(name)) {\n return false;\n }\n const tokens = tokenize(name);\n if (tokens.some((tok) => BLOB_REDACTION_TOKENS.has(tok))) {\n return false;\n }\n // Same leading boolean-predicate words the secret arm uses: `hasBody` answers\n // \"is there one?\", it is not the blob.\n const first = leadingWord(name);\n if (first !== undefined && FLAG_PREFIXES.has(first)) {\n return false;\n }\n if (RAW_BLOB_IDENTIFIERS.has(name.toLowerCase())) {\n return true;\n }\n const last = tokens.at(-1);\n return last !== undefined && RAW_BLOB_WORDS.has(last);\n}\n\n/**\n * The blob name a logged value carries VERBATIM, or null when it does not carry\n * one. A bare identifier is the whole object; a non-computed member access is\n * judged by its PROPERTY, so `res.body` is the blob but `body.id` is a picked\n * field. Every other shape — call, template, literal, ternary, spread — has\n * already been through the author's hands and is left alone.\n */\nfunction rawBlobValueName(value: TSESTree.Node): string | null {\n if (value.type === \"Identifier\") {\n return isRawBlobName(value.name) ? value.name : null;\n }\n if (\n value.type === \"MemberExpression\" &&\n !value.computed &&\n value.property.type === \"Identifier\"\n ) {\n return isRawBlobName(value.property.name) ? value.property.name : null;\n }\n return null;\n}\n\n/** The static string name of an object-property key, or null when not statically named. */\nfunction propertyKeyName(prop: TSESTree.Property): string | null {\n if (prop.computed) {\n return null;\n }\n if (prop.key.type === \"Identifier\") {\n return prop.key.name;\n }\n if (prop.key.type === \"Literal\" && typeof prop.key.value === \"string\") {\n return prop.key.value;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-secret-in-log\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow passing a secret-named value or a raw request/response blob to a logging call; both leak to log sinks. Redact or omit.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noSecretInLog:\n \"Secret `{{name}}` passed to a logging call leaks it to log sinks. Redact (e.g. `{{name}}Prefix: {{name}}.slice(0, 6)`) or omit it.\",\n noRawBodyInLog:\n \"Raw `{{name}}` passed to a logging call. Request/response blobs carry PII and often echo credentials back, and log sinks have no retention policy. Log a derived value instead (a status, `{{name}}.id`, a length, a truncated issue list) or pass it through a redactor (`redact({{name}})`).\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n const matcher = createLogMatcher(loggingOptions);\n // Bodies in a test file are fixtures the author wrote, not production PII.\n const blobArmApplies = !isTestFile(context.filename);\n\n /** Reports a bare positional argument that IS the secret. Did it fire? */\n function reportSecretArgument(arg: TSESTree.Node): boolean {\n const name =\n arg.type === \"Identifier\"\n ? arg.name\n : arg.type === \"MemberExpression\" &&\n !arg.computed &&\n arg.property.type === \"Identifier\"\n ? arg.property.name\n : null;\n if (name === null || !isSecretKeyword(name)) {\n return false;\n }\n context.report({ node: arg, messageId: \"noSecretInLog\", data: { name } });\n return true;\n }\n\n /** Reports a meta-object property whose key names a secret it carries raw. Did it fire? */\n function reportSecretProperty(prop: TSESTree.Property): boolean {\n const keyName = propertyKeyName(prop);\n if (keyName === null || !isSecretKeyword(keyName) || !isRawSecretValue(prop)) {\n return false;\n }\n context.report({ node: prop, messageId: \"noSecretInLog\", data: { name: keyName } });\n return true;\n }\n\n /** Reports `node` when `value` carries an un-redacted request/response blob. */\n function reportRawBlob(node: TSESTree.Node, value: TSESTree.Node): void {\n if (!blobArmApplies) {\n return;\n }\n const name = rawBlobValueName(value);\n if (name !== null) {\n context.report({ node, messageId: \"noRawBodyInLog\", data: { name } });\n }\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!matcher.isLoggingCall(node)) {\n return;\n }\n\n for (const arg of node.arguments) {\n if (arg.type === \"ObjectExpression\") {\n for (const prop of arg.properties) {\n if (prop.type !== \"Property\") {\n continue;\n }\n if (!reportSecretProperty(prop)) {\n reportRawBlob(prop, prop.value);\n }\n }\n continue;\n }\n if (!reportSecretArgument(arg)) {\n reportRawBlob(arg, arg);\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview _secret-names — shared predicate for whether an identifier names secret material, rather than merely embedding a secret word.\n *\n */\n\nexport const SECRET_WORDS: ReadonlySet<string> = new Set([\n \"token\",\n \"secret\",\n \"password\",\n \"passwd\",\n \"jwt\",\n \"secrets\",\n \"passwords\",\n \"credential\",\n \"credentials\",\n \"authorization\",\n \"signature\",\n \"hmac\",\n \"digest\",\n \"hash\",\n \"apikey\",\n \"bearer\",\n]);\n\n/** A trailing word in this set makes the identifier metadata, not a credential. */\nexport const INNOCUOUS_WORDS: ReadonlySet<string> = new Set([\n \"count\",\n \"counts\",\n \"budget\",\n \"limit\",\n \"limits\",\n \"id\",\n \"ids\",\n \"enabled\",\n \"disabled\",\n \"flag\",\n \"flags\",\n \"present\",\n \"set\",\n \"unset\",\n \"configured\",\n \"missing\",\n \"required\",\n \"valid\",\n \"invalid\",\n \"exists\",\n \"type\",\n \"types\",\n]);\n\n/** Descriptors excluded from timing checks but retained for logging checks. */\nconst DESCRIPTOR_WORDS: ReadonlySet<string> = new Set([\n \"type\",\n \"types\",\n \"name\",\n \"names\",\n \"id\",\n \"ids\",\n \"kind\",\n \"kinds\",\n]);\n\n/** Category words identify credential discriminators rather than secret bytes. */\nconst CATEGORY_WORDS: ReadonlySet<string> = new Set([\"type\", \"types\", \"kind\", \"kinds\"]);\n\n\n/** A leading predicate makes the identifier a boolean flag, not a credential. */\nexport const FLAG_PREFIXES: ReadonlySet<string> = new Set([\n \"is\",\n \"has\",\n \"was\",\n \"are\",\n \"can\",\n \"should\",\n]);\n\n/** Auth words distinguish access-gating hashes from integrity-only hashes. */\nconst AUTH_WORDS: ReadonlySet<string> = new Set([\n \"token\",\n \"secret\",\n \"secrets\",\n \"password\",\n \"passwd\",\n \"passwords\",\n \"jwt\",\n \"credential\",\n \"credentials\",\n \"authorization\",\n \"signature\",\n \"hmac\",\n \"apikey\",\n \"bearer\",\n]);\n\n/**\n * camelCase / PascalCase / ALLCAPS / digit-run splitter, applied to each\n * snake/kebab segment. `APIKey` -> [\"API\", \"Key\"], `authToken` -> [\"auth\", \"Token\"].\n */\nconst CAMEL_RE = /[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|\\d+/g;\nconst SEGMENT_RE = /[^A-Za-z0-9]+/;\n\n/** Return lowercase whole segments and their camel-case words. */\nexport function tokenize(identifier: string): string[] {\n const tokens: string[] = [];\n for (const segment of identifier.split(SEGMENT_RE)) {\n if (!segment) {\n continue;\n }\n tokens.push(segment.toLowerCase());\n for (const part of segment.match(CAMEL_RE) ?? []) {\n tokens.push(part.toLowerCase());\n }\n }\n return tokens;\n}\n\n/** The first *word* of an identifier, from camelCase splitting. */\nexport function leadingWord(identifier: string): string | undefined {\n for (const segment of identifier.split(SEGMENT_RE)) {\n if (segment) {\n return (segment.match(CAMEL_RE) ?? [segment])[0]?.toLowerCase();\n }\n }\n return undefined;\n}\n\n/** True if an `api` token is immediately followed by a `key` token (`api_key`). */\nexport function hasApiKey(tokens: readonly string[]): boolean {\n for (let i = 0; i + 1 < tokens.length; i++) {\n if (tokens[i] === \"api\" && tokens[i + 1] === \"key\") {\n return true;\n }\n }\n return false;\n}\n\n/** True when an identifier names raw secret material rather than metadata. */\nexport function isSecretName(\n identifier: string,\n innocuous: ReadonlySet<string> = INNOCUOUS_WORDS,\n): boolean {\n const tokens = tokenize(identifier);\n const last = tokens.at(-1);\n if (last !== undefined && innocuous.has(last)) {\n return false;\n }\n const first = leadingWord(identifier);\n if (first !== undefined && FLAG_PREFIXES.has(first)) {\n return false;\n }\n if (tokens.some((tok) => SECRET_WORDS.has(tok))) {\n return true;\n }\n return hasApiKey(tokens);\n}\n\n/** True when an identifier names an access-gating secret. */\nexport function isAuthSecretName(identifier: string): boolean {\n if (!isSecretName(identifier)) {\n return false;\n }\n const tokens = tokenize(identifier);\n const last = tokens.at(-1);\n if (last !== undefined && DESCRIPTOR_WORDS.has(last)) {\n return false;\n }\n if (tokens.some((tok) => CATEGORY_WORDS.has(tok))) {\n return false;\n }\n if (tokens.some((tok) => AUTH_WORDS.has(tok))) {\n return true;\n }\n return hasApiKey(tokens);\n}\n","/**\n * @fileoverview no-select-star — `SELECT *` over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-select-star.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"noSelectStar\";\ntype Options = readonly [];\n\n/** A real SQL query shape, so prose containing the bare word \"from\" isn't matched. */\nconst QUERY_SHAPE = /\\bSELECT\\b[\\s\\S]*?\\bFROM\\b/i;\nconst SELECT_KEYWORD = /\\bSELECT\\b/gi;\nconst FROM_KEYWORD = /^FROM\\b/i;\nconst EXISTS_BEFORE = /\\bEXISTS\\s*\\(\\s*$/i;\n/** A `word.` immediately preceding a `*` marks a qualified star (`c.*`, `main.runs.*`). */\nconst QUALIFIED_PREFIX = /\\w\\.$/;\n\nconst SELECT_GATE = /select/i;\n\n/**\n * True when the `*` at `pos` is a column-projection star.\n *\n * A projection star expands columns: bare (`SELECT *`, `id, *`) or qualified\n * (`c.*`). It is NOT a `COUNT(*)` argument (parenthesised on both sides) nor an\n * `a * b` multiply (an operand follows rather than a terminator).\n */\nfunction isProjectionStar(sql: string, pos: number): boolean {\n if (QUALIFIED_PREFIX.test(sql.slice(0, pos))) {\n return true;\n }\n let before = pos - 1;\n while (before >= 0 && /\\s/.test(sql[before] ?? \"\")) {\n before -= 1;\n }\n let after = pos + 1;\n while (after < sql.length && /\\s/.test(sql[after] ?? \"\")) {\n after += 1;\n }\n const beforeChar = before >= 0 ? (sql[before] ?? \"\") : \"\";\n const afterChar = after < sql.length ? (sql[after] ?? \"\") : \"\";\n const terminates =\n afterChar === \"\" || afterChar === \",\" || afterChar === \")\" || FROM_KEYWORD.test(sql.slice(after));\n if (!terminates) {\n return false;\n }\n return !(beforeChar === \"(\" && afterChar === \")\");\n}\n\n/** True when the query projects a star that is not inside an `EXISTS (...)` subquery. */\nfunction hasRealSelectStar(sql: string): boolean {\n const selects = [...sql.matchAll(SELECT_KEYWORD)].map((m) => m.index);\n for (let pos = 0; pos < sql.length; pos++) {\n if (sql[pos] !== \"*\" || !isProjectionStar(sql, pos)) {\n continue;\n }\n const owning = selects.filter((start) => start < pos).at(-1);\n if (owning !== undefined && !EXISTS_BEFORE.test(sql.slice(0, owning))) {\n return true;\n }\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-select-star\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow SELECT * in embedded SQL; it over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently.\",\n },\n schema: [],\n messages: {\n noSelectStar:\n \"`SELECT *` over-fetches and leaves the row shape implicit — a new or reordered column silently changes what this query returns. List the columns explicitly.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !SELECT_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!QUERY_SHAPE.test(sql) || !hasRealSelectStar(sql)) {\n return;\n }\n context.report({ node, messageId: \"noSelectStar\" });\n });\n },\n});\n","/**\n * @fileoverview no-sentinel-return-on-catch — a `catch` returning `null` / `[]` / `{}` discards the error, so callers cannot tell empty from failed.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-sentinel-return-on-catch.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport {\n createLogMatcher,\n calleeName,\n LOGGING_OPTION_PROPERTIES,\n type LoggingOptions,\n REPORT_NAME_RE,\n} from \"./_logging.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noSentinelReturn\";\ntype Options = readonly [LoggingOptions?];\n\ntype SentinelKind = \"nullish\" | \"boolean\" | \"array\" | \"object\" | \"string\";\n\n/** The sentinel \"kind\" of a returned expression, or null if not a sentinel. */\nfunction sentinelKind(arg: TSESTree.Expression | null): SentinelKind | null {\n if (arg === null) {\n return null;\n }\n if (arg.type === AST_NODE_TYPES.Literal) {\n if (arg.value === null) {\n return \"nullish\";\n }\n if (typeof arg.value === \"boolean\") {\n return \"boolean\";\n }\n if (typeof arg.value === \"string\") {\n return \"string\";\n }\n return null;\n }\n if (arg.type === AST_NODE_TYPES.Identifier && arg.name === \"undefined\") {\n return \"nullish\";\n }\n if (arg.type === AST_NODE_TYPES.ArrayExpression) {\n return \"array\";\n }\n if (arg.type === AST_NODE_TYPES.ObjectExpression) {\n return \"object\";\n }\n return null;\n}\n\n/** Whether a returned expression is one of the swallowing sentinels we flag. */\nfunction isSentinelArgument(arg: TSESTree.Expression | null): boolean {\n if (arg === null) {\n return false;\n }\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === null) {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === false) {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.Identifier && arg.name === \"undefined\") {\n return true;\n }\n if (arg.type === AST_NODE_TYPES.ArrayExpression && arg.elements.length === 0) {\n return true;\n }\n if (\n arg.type === AST_NODE_TYPES.ObjectExpression &&\n arg.properties.length === 0\n ) {\n return true;\n }\n return false;\n}\n\nfunction isFunctionNode(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.FunctionDeclaration ||\n node.type === AST_NODE_TYPES.FunctionExpression ||\n node.type === AST_NODE_TYPES.ArrowFunctionExpression\n );\n}\n\nfunction isNode(value: unknown): value is TSESTree.Node {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\"\n );\n}\n\n/** Walk a subtree without entering nested functions, stopping on a match. */\nfunction walkWithinScope(\n node: TSESTree.Node,\n visit: (current: TSESTree.Node) => boolean,\n): boolean {\n let found = false;\n\n const recurse = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (visit(current)) {\n found = true;\n return;\n }\n if (isFunctionNode(current)) {\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n recurse(child);\n }\n }\n } else if (isNode(value)) {\n recurse(value);\n }\n }\n };\n\n recurse(node);\n return found;\n}\n\n/** Does this subtree throw (ignoring nested function scopes)? */\nfunction containsThrow(node: TSESTree.Node): boolean {\n return walkWithinScope(\n node,\n (current) => current.type === AST_NODE_TYPES.ThrowStatement,\n );\n}\n\n/** True when a parameter pattern binds `name` (plain, default, rest, or destructured). */\nfunction bindsName(param: TSESTree.Node, name: string): boolean {\n switch (param.type) {\n case AST_NODE_TYPES.Identifier:\n return param.name === name;\n case AST_NODE_TYPES.AssignmentPattern:\n return bindsName(param.left, name);\n case AST_NODE_TYPES.RestElement:\n return bindsName(param.argument, name);\n case AST_NODE_TYPES.ArrayPattern:\n return param.elements.some(\n (element) => element !== null && bindsName(element, name),\n );\n case AST_NODE_TYPES.ObjectPattern:\n return param.properties.some((property) =>\n property.type === AST_NODE_TYPES.RestElement\n ? bindsName(property.argument, name)\n : bindsName(property.value, name),\n );\n default:\n return false;\n }\n}\n\n/** Whether a subtree reads a binding in a value position without shadowing it. */\nfunction subtreeReadsName(node: TSESTree.Node, name: string): boolean {\n let found = false;\n\n /** Whether this function rebinds `name`. */\n const shadowsName = (fn: TSESTree.Node): boolean =>\n isFunctionNode(fn) &&\n (fn as unknown as { params: TSESTree.Parameter[] }).params.some((param) =>\n bindsName(param, name),\n );\n\n const recurse = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n if (current.type === AST_NODE_TYPES.Identifier && current.name === name) {\n found = true;\n return;\n }\n if (shadowsName(current)) {\n return;\n }\n for (const key of Object.keys(current)) {\n if (key === \"parent\") {\n continue;\n }\n // `{ error: 1 }` — the key names a field; it does not read the binding.\n if (\n key === \"key\" &&\n current.type === AST_NODE_TYPES.Property &&\n !current.computed\n ) {\n continue;\n }\n // `response.err` — the property names a field on some other object.\n if (\n key === \"property\" &&\n current.type === AST_NODE_TYPES.MemberExpression &&\n !current.computed\n ) {\n continue;\n }\n const value = (current as unknown as Record<string, unknown>)[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child)) {\n recurse(child);\n }\n }\n } else if (isNode(value)) {\n recurse(value);\n }\n }\n };\n\n recurse(node);\n return found;\n}\n\n/** Whether any call argument reads the caught-error binding. */\nfunction argsIncludeBinding(\n args: readonly TSESTree.CallExpressionArgument[],\n caughtName: string | null,\n): boolean {\n if (caughtName === null) {\n return false;\n }\n return args.some((arg) => subtreeReadsName(arg, caughtName));\n}\n\n/** The try block guarded by this catch. */\nfunction tryBlockOf(catchNode: TSESTree.CatchClause): TSESTree.BlockStatement {\n return catchNode.parent.block;\n}\n\n/** Constructors that throw on malformed input. */\nconst SAFE_PARSE_CONSTRUCTORS: ReadonlySet<string> = new Set([\n \"RegExp\",\n \"URL\",\n \"URLPattern\",\n]);\n\n/** Whether a node is a parse-style call or constructor that throws on bad input. */\nfunction isParseShapedNode(node: TSESTree.Node): boolean {\n if (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return node.callee.property.name === \"parse\";\n }\n if (\n node.type === AST_NODE_TYPES.NewExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier\n ) {\n return SAFE_PARSE_CONSTRUCTORS.has(node.callee.name);\n }\n return false;\n}\n\n/** Body-decoding methods of a `Request` / `Response` — they throw on bad input. */\nconst BODY_DECODE_METHODS: ReadonlySet<string> = new Set([\n \"json\",\n \"text\",\n \"arrayBuffer\",\n]);\n\nfunction isBodyDecodeNode(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n BODY_DECODE_METHODS.has(node.callee.property.name)\n );\n}\n\n/** Whether a return value contains a match outside nested function scopes. */\nfunction returnsMatching(\n stmt: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n): boolean {\n return (\n stmt.type === AST_NODE_TYPES.ReturnStatement &&\n stmt.argument !== null &&\n walkWithinScope(stmt.argument, predicate)\n );\n}\n\n/** The declared return type annotation of the nearest enclosing function, or null. */\nfunction enclosingReturnTypeNode(\n node: TSESTree.Node,\n): TSESTree.TypeNode | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (isFunctionNode(current) && \"returnType\" in current) {\n return current.returnType?.typeAnnotation ?? null;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Names that conventionally declare a boolean-returning function. */\nconst PREDICATE_NAME_RE = /^(is|has|can|should|must|does|did|was|were|are)[A-Z]/;\nconst PREDICATE_SUFFIX_RE = /(Exists?|Available|Enabled|Disabled)$/;\n\n/** The name of the nearest enclosing function, or null for an anonymous one. */\nfunction enclosingFunctionName(node: TSESTree.Node): string | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (isFunctionNode(current)) {\n if (\n \"id\" in current &&\n isNode(current.id) &&\n current.id.type === AST_NODE_TYPES.Identifier\n ) {\n return current.id.name;\n }\n const parent = current.parent;\n if (\n parent?.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.id.name;\n }\n return null;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Whether an enclosing predicate-named function returns `false` from its catch. */\nfunction isNamedBooleanPredicate(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n if (kind !== \"boolean\") {\n return false;\n }\n const name = enclosingFunctionName(catchNode);\n return (\n name !== null &&\n (PREDICATE_NAME_RE.test(name) || PREDICATE_SUFFIX_RE.test(name))\n );\n}\n\n/** Whether a boolean-returning function returns `false` from its catch. */\nfunction isDeclaredBooleanPredicate(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n if (kind !== \"boolean\") {\n return false;\n }\n let declared = enclosingReturnTypeNode(catchNode);\n if (\n declared?.type === AST_NODE_TYPES.TSTypeReference &&\n declared.typeName.type === AST_NODE_TYPES.Identifier &&\n declared.typeName.name === \"Promise\"\n ) {\n declared = declared.typeArguments?.params[0] ?? null;\n }\n return declared?.type === AST_NODE_TYPES.TSBooleanKeyword;\n}\n\n/** Does the try body return a safe-parse-style expression? */\nfunction tryReturnsSafeParse(catchNode: TSESTree.CatchClause): boolean {\n const tryBlock = tryBlockOf(catchNode);\n if (\n walkWithinScope(tryBlock, (current) =>\n returnsMatching(current, isParseShapedNode),\n )\n ) {\n return true;\n }\n const only = tryBlock.body.length === 1 ? tryBlock.body[0] : undefined;\n return only !== undefined && returnsMatching(only, isBodyDecodeNode);\n}\n\n/** The nearest enclosing function body, or null. */\nfunction enclosingFunctionBody(\n node: TSESTree.Node,\n): TSESTree.BlockStatement | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (\n isFunctionNode(current) &&\n \"body\" in current &&\n isNode(current.body) &&\n current.body.type === AST_NODE_TYPES.BlockStatement\n ) {\n return current.body;\n }\n current = current.parent;\n }\n return null;\n}\n\n/** Whether a normal path returns the same sentinel kind as the catch. */\nfunction functionReturnsSameSentinelKindElsewhere(\n catchNode: TSESTree.CatchClause,\n kind: SentinelKind,\n): boolean {\n const functionBody = enclosingFunctionBody(catchNode);\n if (functionBody === null) {\n return false;\n }\n return walkWithinScope(functionBody, (current) => {\n if (current.type !== AST_NODE_TYPES.ReturnStatement) {\n return false;\n }\n if (isWithin(current, catchNode.body)) {\n return false;\n }\n return returnedSentinelKinds(current.argument).has(kind);\n });\n}\n\n/** Sentinel kinds reachable through a direct, ternary, or fallback return. */\nfunction returnedSentinelKinds(\n arg: TSESTree.Expression | null,\n): ReadonlySet<SentinelKind> {\n const kinds = new Set<SentinelKind>();\n if (arg === null) {\n return kinds;\n }\n const direct = sentinelKind(arg);\n if (direct !== null) {\n kinds.add(direct);\n return kinds;\n }\n if (arg.type === AST_NODE_TYPES.ConditionalExpression) {\n for (const branch of [arg.consequent, arg.alternate]) {\n for (const nested of returnedSentinelKinds(branch)) {\n kinds.add(nested);\n }\n }\n } else if (\n arg.type === AST_NODE_TYPES.LogicalExpression &&\n (arg.operator === \"??\" || arg.operator === \"||\")\n ) {\n for (const nested of returnedSentinelKinds(arg.right)) {\n kinds.add(nested);\n }\n }\n return kinds;\n}\n\n/** Is `node` inside `ancestor`'s subtree? */\nfunction isWithin(node: TSESTree.Node, ancestor: TSESTree.Node): boolean {\n let current: TSESTree.Node | undefined | null = node;\n while (current !== undefined && current !== null) {\n if (current === ancestor) {\n return true;\n }\n current = current.parent;\n }\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-sentinel-return-on-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow swallowing a caught error by returning an empty sentinel (`null`, `undefined`, `false`, `[]`, `{}`) as the final statement of a `catch` block, unless the error is logged/reported or the sentinel is the declared safe-parse/predicate contract.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: { ...LOGGING_OPTION_PROPERTIES },\n },\n ],\n messages: {\n noSentinelReturn:\n \"This `catch` block swallows the error by returning an empty sentinel without logging it. Rethrow it, log/report it, or return a typed Result.\",\n },\n },\n defaultOptions: [{}],\n create(context, [loggingOptions]) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const matcher = createLogMatcher(loggingOptions);\n\n /** Whether the catch logs or reports its caught error. */\n function logsOrReportsError(\n catchBody: TSESTree.BlockStatement,\n caughtName: string | null,\n ): boolean {\n return walkWithinScope(catchBody, (current) => {\n if (current.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n if (matcher.isLoggingCall(current)) {\n return true;\n }\n const name = calleeName(current.callee);\n return (\n name !== null &&\n REPORT_NAME_RE.test(name) &&\n argsIncludeBinding(current.arguments, caughtName)\n );\n });\n }\n\n return {\n CatchClause(node: TSESTree.CatchClause): void {\n const body = node.body.body;\n if (body.length === 0) {\n return;\n }\n\n const last = body[body.length - 1];\n if (last === undefined || last.type !== AST_NODE_TYPES.ReturnStatement) {\n return;\n }\n\n if (!isSentinelArgument(last.argument)) {\n return;\n }\n\n if (containsThrow(node.body)) {\n return;\n }\n\n const caughtName =\n node.param?.type === AST_NODE_TYPES.Identifier\n ? node.param.name\n : null;\n\n if (logsOrReportsError(node.body, caughtName)) {\n return;\n }\n\n if (tryReturnsSafeParse(node)) {\n return;\n }\n\n const kind = sentinelKind(last.argument);\n if (kind !== null && isNamedBooleanPredicate(node, kind)) {\n return;\n }\n\n if (kind !== null && isDeclaredBooleanPredicate(node, kind)) {\n return;\n }\n\n if (\n kind !== null &&\n functionReturnsSameSentinelKindElsewhere(node, kind)\n ) {\n return;\n }\n\n context.report({\n node: last,\n messageId: \"noSentinelReturn\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-silent-promise-catch — `.catch(() => null)` deletes the rejection: no log, no metric, no rethrow, and a sentinel to the caller.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-silent-promise-catch.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"silentCatch\";\ntype Options = readonly [];\n\n/** True for `x.json()` / `x.text()` — the receiver of a body-parse-fallback catch. */\nfunction isBodyParseCall(node: TSESTree.Expression): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.arguments.length === 0 &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n (node.callee.property.name === \"json\" ||\n node.callee.property.name === \"text\")\n );\n}\n\n/**\n * Teardown methods that reject when the resource is already gone — which is the\n * state the caller was asking for. The rejection carries no signal, so silencing\n * it is correct, the same reasoning as the `res.json()` fallback above.\n */\nconst TEARDOWN_METHODS: ReadonlySet<string> = new Set([\n \"cancel\",\n \"close\",\n \"abort\",\n \"destroy\",\n \"dispose\",\n \"release\",\n \"unlock\",\n \"disconnect\",\n]);\n\n/**\n * Tooling directives are machinery, not an explanation of the swallow. An\n * `eslint-disable` already suppresses the report through the normal channel, so\n * counting it as documentation would turn every directive into an unused one.\n */\nconst DIRECTIVE_COMMENT_RE =\n /^\\s*(eslint-|@ts-|prettier-ignore|biome-ignore|c8 |v8 |istanbul )/;\n\nconst isExplanatory = (comment: { value: string }): boolean =>\n !DIRECTIVE_COMMENT_RE.test(comment.value);\n\n/** True for `reader.cancel(reason)` / `stream.close()` — a teardown receiver. */\nfunction isTeardownCall(node: TSESTree.Expression): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n TEARDOWN_METHODS.has(node.callee.property.name)\n );\n}\n\n/** True for expressions that provably discard the error: bare literals,\n * `undefined`, empty object/array literals. */\nfunction isSilentExpression(node: TSESTree.Expression): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n // null / number / string / boolean literals (regex literals excluded —\n // nobody writes `.catch(() => /x/)` and they are not sentinel values).\n return !(\"regex\" in node);\n case AST_NODE_TYPES.Identifier:\n return node.name === \"undefined\";\n case AST_NODE_TYPES.UnaryExpression:\n // `void 0` — the other spelling of undefined.\n return (\n node.operator === \"void\" &&\n node.argument.type === AST_NODE_TYPES.Literal\n );\n case AST_NODE_TYPES.ObjectExpression:\n return node.properties.length === 0;\n case AST_NODE_TYPES.ArrayExpression:\n return node.elements.length === 0;\n case AST_NODE_TYPES.TSAsExpression:\n // `.catch(() => null as Foo | null)` is still silent.\n return isSilentExpression(node.expression);\n default:\n return false;\n }\n}\n\n/** True when the handler's whole body provably does nothing with the error. */\nfunction isSilentHandler(\n handler: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n): boolean {\n const body = handler.body;\n\n if (body.type !== AST_NODE_TYPES.BlockStatement) {\n // Arrow expression body: `.catch(() => null)`\n return isSilentExpression(body);\n }\n\n if (body.body.length === 0) {\n // `.catch(() => {})` / `.catch(function () {})`\n return true;\n }\n\n if (body.body.length === 1) {\n const only = body.body[0];\n if (only !== undefined && only.type === AST_NODE_TYPES.ReturnStatement) {\n // `.catch(() => { return null; })`\n return only.argument === null || isSilentExpression(only.argument);\n }\n }\n\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-silent-promise-catch\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `.catch()` handlers that silently swallow the rejection (e.g. `.catch(() => null)`); log, rethrow, or handle the error.\",\n },\n schema: [],\n messages: {\n silentCatch:\n \"This `.catch()` swallows the rejection without logging, rethrowing, or handling it — failures become invisible and callers get an indistinguishable sentinel. Log the error (and only then map to a fallback), or let it propagate.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n\n /**\n * True when the suppression is DOCUMENTED: a comment inside the handler\n * body, trailing the call on the same line, or on the line(s) directly above\n * the statement the call belongs to. The rule's complaint is that the\n * decision to discard the error is invisible — a comment is precisely what\n * makes it visible, so there is nothing left to report.\n */\n const hasExplanatoryComment = (\n call: TSESTree.CallExpression,\n handler: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression,\n ): boolean => {\n const sourceCode = context.sourceCode;\n if (sourceCode.getCommentsInside(handler).some(isExplanatory)) {\n return true;\n }\n // Walk out to the enclosing statement so a comment above or beside\n // `lazyRoutePromise.catch(() => {});` is found rather than one sitting\n // between the receiver and `.catch`.\n let statement: TSESTree.Node = call;\n while (\n statement.parent !== undefined &&\n statement.parent !== null &&\n !statement.type.endsWith(\"Statement\") &&\n statement.type !== AST_NODE_TYPES.VariableDeclaration\n ) {\n statement = statement.parent;\n }\n if (sourceCode.getCommentsBefore(statement).some(isExplanatory)) {\n return true;\n }\n return sourceCode\n .getCommentsAfter(statement)\n .some(\n (c) => isExplanatory(c) && c.loc.start.line === statement.loc.end.line,\n );\n };\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (\n node.callee.type !== AST_NODE_TYPES.MemberExpression ||\n node.callee.computed ||\n node.callee.property.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.name !== \"catch\"\n ) {\n return;\n }\n\n if (isBodyParseCall(node.callee.object)) {\n return;\n }\n\n if (isTeardownCall(node.callee.object)) {\n return;\n }\n\n // `p.catch(() => null).then(...)` — the next link consumes the fallback,\n // so it is a recovery step, not a value handed back to an outside caller.\n if (\n node.parent.type === AST_NODE_TYPES.MemberExpression &&\n node.parent.object === node\n ) {\n return;\n }\n\n if (node.arguments.length !== 1) {\n return;\n }\n const handler = node.arguments[0];\n if (\n handler === undefined ||\n (handler.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n handler.type !== AST_NODE_TYPES.FunctionExpression)\n ) {\n return;\n }\n\n if (hasExplanatoryComment(node, handler)) {\n return;\n }\n\n if (isSilentHandler(handler)) {\n // Anchor on the CallExpression, not the handler: when the handler\n // sits on a later line than the call (multi-line `.catch(`), a\n // handler-anchored report escapes an `eslint-disable-next-line`\n // above the call AND marks that directive as unused.\n context.report({ node, messageId: \"silentCatch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-sleep-in-test-body — a fixed sleep asserts on wall-clock time rather than on the signal, so the test flakes under CI load.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-sleep-in-test-body.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"noSleepInTestBody\";\ntype Options = readonly [];\n\n/** Free-function sleep helpers. A `sleep(50)` reads as a sleep whatever its module. */\nconst SLEEP_HELPERS: ReadonlySet<string> = new Set([\"sleep\", \"delay\", \"wait\", \"pause\"]);\n\n/** Test-case and per-test-hook callers whose callback body is \"the test body\". */\nconst TEST_CALLERS: ReadonlySet<string> = new Set([\n \"it\",\n \"test\",\n \"beforeEach\",\n \"afterEach\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\n/** True for a nonzero numeric literal — the timing guess, as opposed to a `0` yield. */\nfunction isNonzeroNumericLiteral(node: TSESTree.Node | undefined): boolean {\n return node?.type === AST_NODE_TYPES.Literal && typeof node.value === \"number\" && node.value !== 0;\n}\n\n/** True when `node` is `setTimeout(<anything>, <nonzero literal>)`. */\nfunction isTimedSetTimeout(node: TSESTree.Node): boolean {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"setTimeout\" &&\n node.arguments.length >= 2 &&\n isNonzeroNumericLiteral(node.arguments[1])\n );\n}\n\n/**\n * True when `node` is `new Promise((r) => setTimeout(r, n))` — including the\n * block-bodied `{ setTimeout(r, n); }` spelling.\n */\nfunction isPromiseSleep(node: TSESTree.NewExpression): boolean {\n if (node.callee.type !== AST_NODE_TYPES.Identifier || node.callee.name !== \"Promise\") {\n return false;\n }\n const executor = node.arguments[0];\n if (\n executor?.type !== AST_NODE_TYPES.ArrowFunctionExpression &&\n executor?.type !== AST_NODE_TYPES.FunctionExpression\n ) {\n return false;\n }\n const body = executor.body;\n if (body.type !== AST_NODE_TYPES.BlockStatement) {\n return isTimedSetTimeout(body);\n }\n return body.body.some(\n (stmt) => stmt.type === AST_NODE_TYPES.ExpressionStatement && isTimedSetTimeout(stmt.expression),\n );\n}\n\n/** True when `node` is `sleep(n)` / `delay(n)` with a nonzero numeric literal. */\nfunction isHelperSleep(node: TSESTree.CallExpression): boolean {\n return (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n SLEEP_HELPERS.has(node.callee.name) &&\n node.arguments.length >= 1 &&\n isNonzeroNumericLiteral(node.arguments[0])\n );\n}\n\n/** The nearest enclosing function of `node`, skipping the `new Promise` executor. */\nfunction nearestEnclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n for (let current = node.parent; current != null; current = current.parent) {\n if (!FUNCTION_TYPES.has(current.type)) {\n continue;\n }\n const grandparent = current.parent;\n const isPromiseExecutor =\n grandparent?.type === AST_NODE_TYPES.NewExpression && isPromiseSleep(grandparent);\n if (!isPromiseExecutor) {\n return current;\n }\n }\n return null;\n}\n\n/** The base callee name of a call, unwrapping `.only` / `.skip` / `.each` chains. */\nfunction testCallerName(callee: TSESTree.Node): string | null {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name;\n }\n if (callee.type === AST_NODE_TYPES.MemberExpression) {\n return testCallerName(callee.object);\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n return testCallerName(callee.callee);\n }\n if (callee.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return testCallerName(callee.tag);\n }\n return null;\n}\n\n/** True when `fn` is the callback argument of an `it`/`test`/per-test-hook call. */\nfunction isTestBody(fn: TSESTree.Node): boolean {\n const call = fn.parent;\n if (\n call?.type !== AST_NODE_TYPES.CallExpression ||\n !call.arguments.some((argument) => argument === fn)\n ) {\n return false;\n }\n const name = testCallerName(call.callee);\n return name !== null && TEST_CALLERS.has(name);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-sleep-in-test-body\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow a fixed timed sleep directly in a test body; it flakes under CI load. Synchronize on the signal or use fake timers.\",\n },\n schema: [],\n messages: {\n noSleepInTestBody:\n \"A fixed sleep in a test body asserts on wall-clock time and flakes under CI load. Await the promise the code returns, or drive time with `vi.useFakeTimers()` + `await vi.advanceTimersByTimeAsync(ms)`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n const report = (node: TSESTree.Node): void => {\n const enclosing = nearestEnclosingFunction(node);\n if (enclosing === null || !isTestBody(enclosing)) {\n return;\n }\n context.report({ node, messageId: \"noSleepInTestBody\" });\n };\n return {\n NewExpression(node: TSESTree.NewExpression): void {\n if (isPromiseSleep(node)) {\n report(node);\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (isHelperSleep(node)) {\n report(node);\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-storage-in-stateless-modules — private storage inside a module a team declared stateless diverges from the system of record, silently.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-storage-in-stateless-modules.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"storageInStatelessModule\";\n\nexport interface RuleOptions {\n /** Regex sources matched against the filename. Empty means the rule is off. */\n readonly modules?: readonly string[];\n /** Storage method names to flag. Replaces the defaults. */\n readonly methods?: readonly string[];\n}\n\ntype Options = readonly [RuleOptions?];\n\nconst DEFAULT_METHODS: readonly string[] = [\n \"prepare\",\n \"put\",\n \"getWithMetadata\",\n];\n\n/**\n * Minimum argument count before a method call counts as storage access. `put`\n * needs a key AND a value; a single-argument `put` is usually something else.\n * Methods absent from this map need one argument.\n */\nconst MIN_ARGUMENTS: ReadonlyMap<string, number> = new Map([[\"put\", 2]]);\n\n/** Compile regex sources, skipping malformed entries rather than throwing. */\nfunction compile(patterns: readonly string[]): RegExp[] {\n const compiled: RegExp[] = [];\n for (const pattern of patterns) {\n try {\n compiled.push(new RegExp(pattern));\n } catch {\n // Skip the malformed entry; the remaining patterns still apply.\n }\n }\n return compiled;\n}\n\n/** The flagged storage method name of `receiver.method(...)`, or null. */\nfunction storageMethodName(\n node: TSESTree.CallExpression,\n methods: ReadonlySet<string>,\n): string | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const name = callee.property.name;\n if (!methods.has(name)) {\n return null;\n }\n if (node.arguments.length < (MIN_ARGUMENTS.get(name) ?? 1)) {\n return null;\n }\n return name;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-storage-in-stateless-modules\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow SQL or key/value access inside modules a team has declared stateless; derive state from the systems of record instead. No-op until `modules` is configured.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n modules: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Regex sources matched against the filename. Empty (the default) disables the rule.\",\n },\n methods: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Storage method names to flag. Replaces the defaults.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n storageInStatelessModule:\n \"`{{method}}()` reaches for private storage inside a module declared stateless. Derive the state from a read against the system of record, or from a marker in the artefact this feature already produces.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const modules = options?.modules ?? [];\n if (modules.length === 0) {\n return {};\n }\n\n const scoped = compile(modules);\n if (!scoped.some((re) => re.test(context.filename))) {\n return {};\n }\n\n const methods = new Set(options?.methods ?? DEFAULT_METHODS);\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const method = storageMethodName(node, methods);\n if (method !== null) {\n context.report({\n node,\n messageId: \"storageInStatelessModule\",\n data: { method },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-string-concat-in-loop — `+=` on a string inside a loop rebuilds the whole string every pass, which is O(n^2).\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-string-concat-in-loop.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\nimport type { Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"noStringConcatInLoop\";\ntype Options = readonly [];\n\nconst LOOP_NODE_TYPES = new Set<string>([\n \"ForStatement\",\n \"ForOfStatement\",\n \"ForInStatement\",\n \"WhileStatement\",\n \"DoWhileStatement\",\n]);\n\n/** Checks whether an initializer is a string or template literal. */\nfunction isStringLiteralInit(node: TSESTree.Expression | null): boolean {\n if (node === null) {\n return false;\n }\n if (node.type === \"TemplateLiteral\") {\n return true;\n }\n if (node.type === \"Literal\") {\n return typeof node.value === \"string\";\n }\n return false;\n}\n\n/** Resolves an identifier through its enclosing scopes. */\nfunction findVariable(\n scope: Scope.Scope,\n name: string,\n): Scope.Variable | undefined {\n let current: Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.variables.find((v) => v.name === name);\n if (variable !== undefined) {\n return variable;\n }\n current = current.upper;\n }\n return undefined;\n}\n\n/** Requires exactly one variable declaration with a string-literal initializer. */\nfunction isStringInitializedVariable(variable: Scope.Variable): boolean {\n if (variable.defs.length !== 1) {\n return false;\n }\n const def = variable.defs[0];\n if (def === undefined || def.type !== \"Variable\") {\n return false;\n }\n const declarator = def.node;\n if (declarator.type !== \"VariableDeclarator\") {\n return false;\n }\n return isStringLiteralInit(declarator.init);\n}\n\n/** Finds a target identifier in a chained `+` expression. */\nfunction isConcatOperand(\n node: TSESTree.Expression | TSESTree.PrivateIdentifier,\n target: string,\n): boolean {\n if (node.type === \"Identifier\") {\n return node.name === target;\n }\n if (node.type === \"BinaryExpression\" && node.operator === \"+\") {\n return (\n isConcatOperand(node.left, target) || isConcatOperand(node.right, target)\n );\n }\n return false;\n}\n\n/** Recognizes longhand accumulation such as `s = s + x`. */\nfunction isConcatOntoTarget(\n rhs: TSESTree.Expression,\n target: string,\n): boolean {\n if (rhs.type !== \"BinaryExpression\" || rhs.operator !== \"+\") {\n return false;\n }\n return isConcatOperand(rhs.left, target) || isConcatOperand(rhs.right, target);\n}\n\n/** Checks whether the loop creates a fresh accumulator on every iteration. */\nfunction isDeclaredInsideLoop(\n variable: Scope.Variable,\n loop: TSESTree.Node,\n): boolean {\n const def = variable.defs[0];\n if (def === undefined) {\n return false;\n }\n const body = (\n loop as\n | TSESTree.ForStatement\n | TSESTree.ForOfStatement\n | TSESTree.ForInStatement\n | TSESTree.WhileStatement\n | TSESTree.DoWhileStatement\n ).body;\n const [declStart, declEnd] = def.node.range;\n const [bodyStart, bodyEnd] = body.range;\n return declStart >= bodyStart && declEnd <= bodyEnd;\n}\n\n/** Finds the nearest loop whose body contains the assignment. */\nfunction enclosingLoop(node: TSESTree.Node): TSESTree.Node | null {\n let child: TSESTree.Node = node;\n let parent = node.parent;\n while (parent !== undefined && parent !== null) {\n if (LOOP_NODE_TYPES.has(parent.type)) {\n const loop = parent as\n | TSESTree.ForStatement\n | TSESTree.ForOfStatement\n | TSESTree.ForInStatement\n | TSESTree.WhileStatement\n | TSESTree.DoWhileStatement;\n if (loop.body === child) {\n return loop;\n }\n }\n child = parent;\n parent = parent.parent;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-string-concat-in-loop\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow O(n^2) string building via `+=` on a string variable inside a loop; push parts to an array and `join` instead.\",\n },\n schema: [],\n messages: {\n noStringConcatInLoop:\n \"Avoid building a string with `+=` inside a loop — this is O(n^2). Push the parts onto an array and use `arr.join(\\\"\\\")` after the loop.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n // Report each accumulator once per loop.\n const reported = new WeakMap<TSESTree.Node, Set<string>>();\n\n return {\n AssignmentExpression(node: TSESTree.AssignmentExpression): void {\n // The LHS must be a plain variable reference.\n if (node.left.type !== \"Identifier\") {\n return;\n }\n // Accept both the compound `s += x` and the longhand `s = s + x`; any\n // other operator/shape (`s = x + y`, `s -= x`, ...) is not accumulation.\n const isAccumulation =\n node.operator === \"+=\" ||\n (node.operator === \"=\" &&\n isConcatOntoTarget(node.right, node.left.name));\n if (!isAccumulation) {\n return;\n }\n // Must occur inside a loop body, else it's a one-shot append.\n const loop = enclosingLoop(node);\n if (loop === null) {\n return;\n }\n\n const scope = context.sourceCode.getScope(node);\n const variable = findVariable(scope, node.left.name);\n // Conservative: can't resolve the declaration -> don't flag.\n if (variable === undefined) {\n return;\n }\n if (!isStringInitializedVariable(variable)) {\n return;\n }\n if (isDeclaredInsideLoop(variable, loop)) {\n return;\n }\n\n let seen = reported.get(loop);\n if (seen === undefined) {\n seen = new Set<string>();\n reported.set(loop, seen);\n }\n if (seen.has(node.left.name)) {\n return;\n }\n seen.add(node.left.name);\n\n context.report({\n node,\n messageId: \"noStringConcatInLoop\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-tautological-expect — an assertion whose operands are all literals decided its outcome before the code ran, so it can never fail.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-tautological-expect.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"tautologicalComparison\" | \"tautologicalMatcher\";\ntype Options = readonly [];\n\n/** Matchers that take the expected value as their single argument. */\nconst EQUALITY_MATCHERS: ReadonlySet<string> = new Set([\"toBe\", \"toEqual\", \"toStrictEqual\"]);\n\n/** Matchers that take no argument, so the receiver alone fixes the outcome. */\nconst ZERO_ARG_MATCHERS: ReadonlySet<string> = new Set([\n \"toBeDefined\",\n \"toBeUndefined\",\n \"toBeNull\",\n \"toBeTruthy\",\n \"toBeFalsy\",\n \"toBeNaN\",\n]);\n\n/** Enough of the operand to identify it in the message without pasting a screenful. */\nconst OPERAND_PREVIEW_CHARS = 40;\n\n/** Sign prefixes: `-1` is a unary expression, not a literal, but it is constant. */\nconst NUMERIC_SIGNS: ReadonlySet<string> = new Set([\"-\", \"+\"]);\n\nfunction isLiteral(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0;\n case AST_NODE_TYPES.UnaryExpression:\n return NUMERIC_SIGNS.has(node.operator) && isLiteral(node.argument);\n case AST_NODE_TYPES.ArrayExpression:\n return node.elements.every((element) => element !== null && isLiteral(element));\n case AST_NODE_TYPES.ObjectExpression:\n return node.properties.every(\n (property) =>\n property.type === AST_NODE_TYPES.Property &&\n !property.computed &&\n isLiteral(property.value),\n );\n default:\n return false;\n }\n}\n\n/** The `expect(<single argument>)` call a matcher hangs directly off, if any. */\nfunction expectOperand(callee: TSESTree.MemberExpression): TSESTree.Node | null {\n const receiver = callee.object;\n if (\n receiver.type !== AST_NODE_TYPES.CallExpression ||\n receiver.callee.type !== AST_NODE_TYPES.Identifier ||\n receiver.callee.name !== \"expect\" ||\n receiver.arguments.length !== 1\n ) {\n return null;\n }\n return receiver.arguments[0] ?? null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-tautological-expect\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow an assertion whose operands are all literals; its outcome is fixed before the code runs, so it can never fail.\",\n },\n schema: [],\n messages: {\n tautologicalComparison:\n \"`expect({{operand}}).{{matcher}}({{operand}})` compares a literal with an identical literal — it passes even if the code under test is deleted. Assert on a value the code produced, or delete the test.\",\n tautologicalMatcher:\n \"`expect({{operand}}).{{matcher}}()` asserts on a literal, so its outcome is fixed before the code runs. Assert on a value the code produced, or delete the test.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename)) {\n return {};\n }\n /** The operand as written, collapsed to one line and elided for the message. */\n const preview = (node: TSESTree.Node): string => {\n const text = context.sourceCode.getText(node).replaceAll(/\\s+/gu, \" \");\n return text.length > OPERAND_PREVIEW_CHARS\n ? `${text.slice(0, OPERAND_PREVIEW_CHARS)}…`\n : text;\n };\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression || callee.computed) {\n return;\n }\n if (callee.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const matcher = callee.property.name;\n const operand = expectOperand(callee);\n if (operand === null || !isLiteral(operand)) {\n return;\n }\n if (ZERO_ARG_MATCHERS.has(matcher) && node.arguments.length === 0) {\n context.report({\n node,\n messageId: \"tautologicalMatcher\",\n data: { operand: preview(operand), matcher },\n });\n return;\n }\n const expected = node.arguments[0];\n if (\n !EQUALITY_MATCHERS.has(matcher) ||\n node.arguments.length !== 1 ||\n expected === undefined ||\n !isLiteral(expected)\n ) {\n return;\n }\n // Textual identity, not structural: `expect(1).toBe(1.0)` is a\n // deliberate statement about representation and is left alone.\n if (context.sourceCode.getText(operand) !== context.sourceCode.getText(expected)) {\n return;\n }\n context.report({\n node,\n messageId: \"tautologicalComparison\",\n data: { operand: preview(operand), matcher },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview no-typed-doc-sections — typed signatures do not need parameter or return tables.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-typed-doc-sections.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { documentsTypedFunction, proseGroups } from \"./_prose-budget.js\";\n\ntype MessageIds = \"typedSection\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"no-typed-doc-sections\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Reject typed-signature repetition while preserving behavior that types cannot express.\" },\n schema: [],\n messages: {\n typedSection: \"Typed JSDoc repeats parameters or returns — delete the tags and improve names or types instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode, true)) {\n if (group.hasTypedTags && documentsTypedFunction(context.sourceCode, group.comment)) {\n context.report({ node: group.comment, messageId: \"typedSection\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-trailing-value-narration — a trailing comment restating the literal beside it drifts the moment someone edits the arithmetic.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-trailing-value-narration.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { codeTokens, hasExternalReference, stem } from \"./_comments.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"narratesValue\";\ntype Options = readonly [];\n\n// A number that is not part of an identifier or a dotted member path.\nconst NUMBER_RE = /(?<![\\w.])(\\d+(?:\\.\\d+)?)(?![\\w.])/g;\nconst WORD_RE = /[A-Za-z]+(?:'[a-z]+)?|\\d+(?:\\.\\d+)?/g;\n\n// Words that name the unit rather than the quantity — the one thing the code\n// does not say, and the reason the fix is a *name*, not a deletion.\nconst UNIT_WORDS: ReadonlySet<string> = new Set([\n \"bytes\", \"characters\", \"chars\", \"day\", \"days\", \"gb\", \"hour\", \"hours\", \"hr\",\n \"hrs\", \"hz\", \"items\", \"k\", \"kb\", \"khz\", \"m\", \"mb\", \"milliseconds\", \"min\",\n \"mins\", \"minute\", \"minutes\", \"ms\", \"pct\", \"percent\", \"px\", \"retries\", \"rows\",\n \"s\", \"sec\", \"second\", \"seconds\", \"secs\", \"times\", \"tokens\",\n]);\n\nconst STOPWORDS: ReadonlySet<string> = new Set([\n \"a\", \"an\", \"and\", \"are\", \"as\", \"at\", \"be\", \"by\", \"for\", \"in\", \"is\", \"it\",\n \"of\", \"on\", \"or\", \"that\", \"the\", \"this\", \"we\", \"with\",\n]);\n\nconst DIRECTIVE_RE =\n /^\\s*(?:eslint\\b|eslint-|sarj-noqa\\b|@ts-|prettier|biome-|c8\\b|v8\\b|istanbul\\b|todo\\b|fixme\\b|hack\\b|xxx\\b)/i;\n\nfunction numbersIn(text: string): Set<string> {\n return new Set(text.match(NUMBER_RE) ?? []);\n}\n\nfunction narratesValue(body: string, code: string): boolean {\n if (body.length === 0 || DIRECTIVE_RE.test(body) || hasExternalReference(body)) return false;\n const codeNumbers = numbersIn(code);\n if (codeNumbers.size === 0) return false;\n const words = (body.match(WORD_RE) ?? []).map((word) => word.toLowerCase());\n if (words.length === 0) return false;\n const commentNumbers = numbersIn(body);\n if (commentNumbers.size === 0) return false;\n for (const number of commentNumbers) {\n if (!codeNumbers.has(number)) return false;\n }\n if (!words.some((word) => UNIT_WORDS.has(word))) return false;\n const identifiers = codeTokens(code);\n const stems = new Set<string>();\n for (const token of identifiers) stems.add(stem(token));\n return words.every(\n (word) =>\n STOPWORDS.has(word) ||\n UNIT_WORDS.has(word) ||\n commentNumbers.has(word) ||\n identifiers.has(word) ||\n stems.has(stem(word)),\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-trailing-value-narration\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a trailing comment that repeats the line's numeric value only to name its unit.\",\n },\n schema: [],\n messages: {\n narratesValue:\n \"Trailing comment restates the literal on this line — put the unit in the name (STALE_TIME_MS) so it cannot drift.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const sourceCode = context.sourceCode;\n\n function isTrailing(comment: TSESTree.Comment): boolean {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n return before !== null && before.loc.end.line === comment.loc.start.line;\n }\n\n function isInsideBrackets(comment: TSESTree.Comment): boolean {\n let node: TSESTree.Node | null | undefined = sourceCode.getNodeByRangeIndex(comment.range[0]);\n while (node != null) {\n if (node.type === \"BlockStatement\" || node.type === \"Program\") return false;\n if (\n node.type === \"ArrayExpression\" ||\n node.type === \"CallExpression\" ||\n node.type === \"NewExpression\"\n ) {\n return true;\n }\n node = node.parent;\n }\n return false;\n }\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n if (!isTrailing(comment) || isInsideBrackets(comment)) continue;\n const line = sourceCode.lines[comment.loc.start.line - 1] ?? \"\";\n const code = line.slice(0, comment.loc.start.column);\n const body = comment.value.replace(/^\\*+/, \"\").replace(/\\*+$/, \"\").trim();\n if (narratesValue(body, code)) {\n context.report({ node: comment, messageId: \"narratesValue\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-declaration-comment-wall — an enum body or class body whose member comments mostly re-spell the members is a wall the reader pays for by the block.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-declaration-comment-wall.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport {\n BARE_LABEL_RE,\n WALL_DEFAULTS,\n WALL_SCHEMA,\n type WallOptions,\n carriesValue,\n commentBody,\n declarationRange,\n isLabel,\n isTagsOnly,\n isWall,\n knownTokens,\n labelStems,\n novelWords,\n} from \"./_comment-wall.js\";\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"commentWall\";\n\ntype Options = readonly [Partial<WallOptions>?];\n\n/** A member this rule can judge: something with a name and a source range. */\ninterface Judged {\n readonly node: TSESTree.Node;\n readonly key: TSESTree.Node;\n}\n\nfunction named(node: TSESTree.Node): Judged | undefined {\n switch (node.type) {\n case AST_NODE_TYPES.TSEnumMember:\n return { node, key: node.id };\n case AST_NODE_TYPES.PropertyDefinition:\n case AST_NODE_TYPES.TSAbstractPropertyDefinition:\n case AST_NODE_TYPES.MethodDefinition:\n case AST_NODE_TYPES.TSAbstractMethodDefinition:\n return node.computed ? undefined : { node, key: node.key };\n default:\n return undefined;\n }\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-declaration-comment-wall\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag an enum body or class body whose member comments mostly re-spell the members' own names.\",\n },\n schema: [WALL_SCHEMA],\n messages: {\n commentWall:\n \"{{restated}} of this declaration's {{commented}} member comments only re-spell the member's own name — delete them, and keep the rows that say what the name cannot.\",\n },\n },\n defaultOptions: [WALL_DEFAULTS],\n create(context, [provided]) {\n const options: WallOptions = { ...WALL_DEFAULTS, ...provided };\n const sourceCode = context.sourceCode;\n // Generated or vendored, a test fixture, or a demo story: three kinds of\n // file whose member comments are output rather than commentary.\n if (\n isGeneratedFile(context.filename, sourceCode.text) ||\n isTestFile(context.filename) ||\n isStoryFile(context.filename)\n ) {\n return {};\n }\n\n // One pass over the file's comments, indexed by the line they end on (a\n // leading comment) and the line they start on (a trailing one).\n const endingOn = new Map<number, TSESTree.Comment>();\n const startingOn = new Map<number, TSESTree.Comment>();\n for (const comment of sourceCode.getAllComments()) {\n endingOn.set(comment.loc.end.line, comment);\n if (!startingOn.has(comment.loc.start.line)) startingOn.set(comment.loc.start.line, comment);\n }\n\n /**\n * The comment documenting `member`: the block or line comment on the row\n * above it, or the one trailing its last row.\n *\n * A leading comment counts only when the MEMBER starts its own line, and\n * only when the comment is alone on ITS line; a trailing comment counts only\n * when it sits after the member it is read against. The caller claims each\n * comment once because compact declarations can share a source line.\n */\n function documentingComment(member: TSESTree.Node): TSESTree.Comment | undefined {\n const beforeMember = sourceCode.getTokenBefore(member, { includeComments: false });\n const ownsItsLine =\n beforeMember === null || beforeMember.loc.end.line < member.loc.start.line;\n const lead = ownsItsLine ? endingOn.get(member.loc.start.line - 1) : undefined;\n if (lead !== undefined) {\n const before = sourceCode.getTokenBefore(lead, { includeComments: false });\n if (before === null || before.loc.end.line < lead.loc.start.line) return lead;\n }\n const trail = startingOn.get(member.loc.end.line);\n return trail !== undefined && trail.range[0] > member.range[0] ? trail : undefined;\n }\n\n /**\n * True when a comment heads a REGION instead of describing the member under\n * it. The body is ONE bare identifier word; it names something OTHER than\n * the member below it; and it shows region evidence, heading a run of\n * members of which only the first is commented, or set off by a blank line.\n */\n function isGroupLabel(comment: TSESTree.Comment, member: Judged, headsRun: boolean): boolean {\n if (comment.loc.end.line >= member.node.loc.start.line) return false;\n const body = commentBody(comment);\n if (!BARE_LABEL_RE.test(body)) return false;\n if (labelStems(body) === labelStems(sourceCode.getText(member.key))) return false;\n const lineAbove = sourceCode.lines[comment.loc.start.line - 2];\n return headsRun || (lineAbove !== undefined && lineAbove.trim().length === 0);\n }\n\n function check(node: TSESTree.Node, members: readonly TSESTree.Node[]): void {\n const judged = members.map(named).filter((member): member is Judged => member !== undefined);\n if (judged.length === 0) return;\n\n const documented = judged.map((member) => ({\n member,\n comment: documentingComment(member.node),\n }));\n let commented = 0;\n let restated = 0;\n const claimed = new Set<TSESTree.Comment>();\n for (const [index, { member, comment }] of documented.entries()) {\n if (comment === undefined || claimed.has(comment)) continue;\n const next = documented[index + 1];\n if (isGroupLabel(comment, member, next !== undefined && next.comment === undefined)) {\n continue;\n }\n claimed.add(comment);\n commented += 1;\n const body = commentBody(comment);\n // A tag block is a directive to a documentation generator, and one\n // content word is a label; neither is a re-spelling of the name.\n if (body.length === 0 || carriesValue(body) || isTagsOnly(body) || isLabel(body)) {\n continue;\n }\n const [start, end] = declarationRange(member.node);\n if (novelWords(body, knownTokens(sourceCode.text.slice(start, end))) <= options.maxNovelWords) {\n restated += 1;\n }\n }\n\n if (!isWall(judged.length, commented, restated, options)) return;\n context.report({\n node,\n loc: {\n start: node.loc.start,\n end: { line: node.loc.start.line, column: node.loc.start.column + 1 },\n },\n messageId: \"commentWall\",\n data: { restated: String(restated), commented: String(commented) },\n });\n }\n\n return {\n ClassBody: (node: TSESTree.ClassBody) => {\n check(node, node.body);\n },\n TSEnumDeclaration: (node: TSESTree.TSEnumDeclaration) => {\n check(node, node.body.members);\n },\n };\n },\n});\n","/**\n * @fileoverview _comment-wall — the shared judgement behind the comment-VOLUME rules: a run of member comments that mostly re-spell their members is a wall.\n *\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { isProtected, splitIdentifier, stem } from \"./_comments.js\";\n\n/** Every threshold the wall rules apply; each is documented at `WALL_DEFAULTS`. */\nexport interface WallOptions {\n readonly minCommentedMembers: number;\n readonly minCommentedRatio: number;\n readonly minRestatedRatio: number;\n readonly maxNovelWords: number;\n}\n\nexport const WALL_DEFAULTS: WallOptions = {\n // Below three rows \"a wall\" is not a fair description of what the reader sees.\n minCommentedMembers: 3,\n // A minority of commented members is a GROUP LABEL, not a wall.\n minCommentedRatio: 0.6,\n // Room for one substantive row in four; a declaration where a quarter of the\n // comments say something real is one someone was documenting, not decorating.\n minRestatedRatio: 0.75,\n // One word beyond the member's own text. Zero is `no-restated-jsdoc`'s test\n // and is already covered there; two admits definitions (\"Partial match\"\n // beside \"Exact match\").\n maxNovelWords: 1,\n};\n\n/** The `meta.schema` entry both wall rules expose, so the knobs cannot drift. */\nexport const WALL_SCHEMA = {\n type: \"object\",\n additionalProperties: false,\n properties: {\n minCommentedMembers: {\n type: \"integer\",\n minimum: 2,\n description: \"Fewest commented members that can count as a wall.\",\n },\n minCommentedRatio: {\n type: \"number\",\n minimum: 0,\n maximum: 1,\n description:\n \"Least share of the members that must be commented; below it the comments are group labels.\",\n },\n minRestatedRatio: {\n type: \"number\",\n minimum: 0,\n maximum: 1,\n description: \"Least share of the member comments that must be restatements.\",\n },\n maxNovelWords: {\n type: \"integer\",\n minimum: 0,\n description:\n \"Most content words a comment may add beyond its member's own source and still count as a restatement.\",\n },\n },\n} as const;\n\n// Tags that carry what the signature cannot. `no-restated-jsdoc` reaches the\n// same verdict by a different route — anything outside the small set of tags it\n// models leaves the block alone — so there is no shared list to drift against,\n// and this one stands on its own.\nconst VALUE_TAG_RE =\n /@(?:deprecated|see|example|throws|remarks|since|default|defaultvalue|link|internal|alpha|beta|experimental|template|typeparam|inheritdoc|todo|fixme|override)\\b/i;\n\n// A documented default. The default of an optional member is precisely the fact\n// its type cannot hold.\nconst DEFAULT_RE = /^\\s*@?default\\b|\\bdefaults? (?:to|:)/i;\n\n// A digit is a bound, a base, an index origin, a status code or a version — all\n// facts about the world rather than about the name. A unit word is the same fact\n// spelled without one.\nconst DIGIT_RE = /\\d/;\nconst UNIT_WORD_RE =\n /\\b(?:ms|milliseconds?|seconds?|minutes?|hours?|days?|weeks?|months?|years?|bytes?|kb|mb|gb|percent|pixels?|px|utc|epoch)\\b/i;\n\n// A quoted example value or an `e.g.` enumerates what the type only bounds.\nconst EXAMPLE_RE = /[\"'`]|\\be\\.g\\.|\\bi\\.e\\./;\n\n// Every word of the body belongs to a JSDoc tag, so the block is an instruction\n// to a documentation generator rather than a sentence about the member.\nconst TAG_TOKEN_RE = /@\\w+/g;\n\n// A rule of dashes is a banner; `no-comment-cruft` owns that shape.\nconst BANNER_RE = /[=\\-─-╿*#~_.]{3,}/;\n\n// Prose the tokenizer cannot read, so \"adds no new word\" is unmeasurable.\nconst NON_ASCII_LETTER_RE = /[^\\p{ASCII}\\p{N}\\p{P}\\p{Z}]/u;\n\n/**\n * Filler that says nothing about *which* member is being described. Wider than\n * `_comments.STOPWORDS` for the same reason `no-restated-jsdoc`'s list is:\n * member documentation conventionally repeats the vocabulary of the type system\n * itself (\"the optional callback value\") without that being a claim.\n *\n * Deliberately absent: `class`, `method`, `function`, `component`, `hook`,\n * `parameter`, `argument`. In a reflection or decorator type those words are the\n * whole claim — `Function` cannot say \"class\" and `number` cannot say\n * \"parameter\". The tag words `param` and `arg` stay: block punctuation, not\n * prose.\n */\nexport const WALL_STOPWORDS: ReadonlySet<string> = new Set(\n `the a an of to for in on with and or as at by is are was be been being\n this that it its if whether when where which what will would can could should\n must may into from over about not no does do done has have had used use uses\n using given provided specified current new existing all any each per via\n instance object value values data item\n items element callback handler prop props param arg return\n returns returning result optional required true false null undefined\n string number boolean array list promise set map record type name`.split(/\\s+/),\n);\n\nconst WORD_RE = /[A-Za-z][A-Za-z0-9]*/g;\n\n// A label is one bare identifier word: `// links`, `// clientMiddleware`. Two\n// words of prose is already a sentence about the member below it.\nexport const BARE_LABEL_RE = /^[A-Za-z][A-Za-z0-9]*$/;\n\n/** The identifier `body` spells, folded so `links` and `Links` are one word. */\nexport function labelStems(body: string): string {\n return splitIdentifier(body).map(stem).join(\" \");\n}\n\n/** Strip the `*` decoration off a block comment so JSDoc and `//` read alike. */\nexport function commentBody(comment: TSESTree.Comment): string {\n return comment.value\n .replace(/^\\*+/, \"\")\n .replace(/^[ \\t]*\\*[ \\t]?/gm, \"\")\n .trim();\n}\n\n/**\n * True when a member comment carries something a name and a type cannot — the\n * exemption floor shared by both wall rules. Counted as a comment, never as a\n * restatement.\n *\n * `isLabel` and `isTagsOnly` are deliberately NOT folded in here. On an object\n * TYPE a one-word comment really is a name restatement (`// links` over\n * `links`), which that rule's own group-label guard separates; the populations\n * that spell mapping tables that way belong to its sibling.\n */\nexport function carriesValue(body: string): boolean {\n return (\n isProtected(body) ||\n VALUE_TAG_RE.test(body) ||\n DEFAULT_RE.test(body) ||\n DIGIT_RE.test(body) ||\n UNIT_WORD_RE.test(body) ||\n EXAMPLE_RE.test(body) ||\n BANNER_RE.test(body) ||\n NON_ASCII_LETTER_RE.test(body)\n );\n}\n\n/**\n * True when `body` is one content word or fewer — a LABEL or a tag, never a\n * description of the member below it.\n *\n * With `maxNovelWords` at one, a single novel word scores as a restatement by\n * arithmetic rather than by meaning. One word beside a key is the opposite of a\n * re-spelling: it is the one thing the key does not say.\n */\nexport function isLabel(body: string): boolean {\n let content = 0;\n for (const word of body.match(WORD_RE) ?? []) {\n if (word.length >= 2 && !WALL_STOPWORDS.has(word.toLowerCase())) content += 1;\n }\n return content <= 1;\n}\n\n/** True when `body` carries no prose at all beyond its JSDoc tags. */\nexport function isTagsOnly(body: string): boolean {\n return body.length > 0 && body.replace(TAG_TOKEN_RE, \"\").trim().length === 0;\n}\n\n/** Every identifier part of a slice of source, plus its stem. */\nexport function knownTokens(source: string): ReadonlySet<string> {\n const tokens = new Set<string>();\n for (const identifier of source.match(/[A-Za-z_$][\\w$]*/g) ?? []) {\n for (const part of splitIdentifier(identifier)) {\n tokens.add(part);\n tokens.add(stem(part));\n }\n }\n return tokens;\n}\n\n/** Content words of `body` that do not already appear in `known`. */\nexport function novelWords(body: string, known: ReadonlySet<string>): number {\n let novel = 0;\n for (const word of body.match(WORD_RE) ?? []) {\n const lower = word.toLowerCase();\n if (lower.length < 2 || WALL_STOPWORDS.has(lower)) continue;\n if (!known.has(lower) && !known.has(stem(lower))) novel += 1;\n }\n return novel;\n}\n\n/**\n * True when a run of members carrying `commented` comments, `restated` of them\n * restatements, is a wall under `options`.\n */\nexport function isWall(\n members: number,\n commented: number,\n restated: number,\n options: WallOptions,\n): boolean {\n return (\n commented >= options.minCommentedMembers &&\n commented / members >= options.minCommentedRatio &&\n restated / commented >= options.minRestatedRatio\n );\n}\n\nconst OPAQUE_VALUE_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.ObjectExpression,\n AST_NODE_TYPES.ArrayExpression,\n]);\n\n/**\n * The part of a member a reader reads as its DECLARATION — the key, the type\n * annotation and, for a callable, the parameter list.\n *\n * A method body, an object value and an array value are all deliberately\n * excluded. Each names every identifier it touches, so reading a comment against\n * one makes almost any comment \"already said\": the token set stops being the\n * member's own words and becomes the value's. A label naming what a nested\n * object configures shares its vocabulary with that object and with nothing in\n * the name it labels.\n */\nexport function declarationRange(member: TSESTree.Node): [number, number] {\n const body = bodyOf(member);\n if (body === undefined) return [member.range[0], member.range[1]];\n return [member.range[0], body.range[0]];\n}\n\nfunction bodyOf(member: TSESTree.Node): TSESTree.Node | undefined {\n if (\n member.type === AST_NODE_TYPES.MethodDefinition ||\n member.type === AST_NODE_TYPES.TSAbstractMethodDefinition\n ) {\n return member.value.body ?? undefined;\n }\n if (member.type === AST_NODE_TYPES.Property || member.type === AST_NODE_TYPES.PropertyDefinition) {\n const value = member.value;\n if (value !== null && OPAQUE_VALUE_TYPES.has(value.type)) return value;\n }\n return undefined;\n}\n","/**\n * @fileoverview no-union-in-comment — a comment listing a field's allowed strings has written a union type the compiler never gets to enforce.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-union-in-comment.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"unionInComment\";\ntype Options = readonly [];\n\n// A literal long enough to be a sentence is an example, a message or a format\n// string — not an enum member.\nconst MAX_LITERAL_LENGTH = 28;\n\nconst LITERAL = String.raw`(?:'[^'\\n]*'|\"[^\"\\n]*\"|\\`[^\\`\\n]*\\`)`;\n\n// Anchored at BOTH ends on purpose: a literal list inside a sentence is prose\n// that happens to quote values, and the sentence is what carries the meaning.\n// Only a body that is nothing but the list is a type someone wrote down.\nconst LEAD_IN_RE =\n /^(?:one of|either|values?|allowed(?: values)?|options?|possible(?: values)?)\\s*[:=-]?\\s*/i;\nconst UNION_BODY_RE = new RegExp(String.raw`^${LITERAL}(?:\\s*[|,/]\\s*${LITERAL})+\\.?$`);\nconst LITERAL_G = new RegExp(LITERAL, \"g\");\n\n/**\n * Column builders whose call spells the stored type where TypeScript has no\n * annotation to read. A schema row is where a closed set is most often left as\n * `text` with the set in a comment beside it.\n */\nconst STRING_BUILDERS: ReadonlySet<string> = new Set([\n \"char\", \"citext\", \"longtext\", \"mediumtext\", \"string\", \"text\", \"tinytext\", \"varchar\",\n]);\n\n/** True when a type annotation is an unconstrained `string` after all. */\nfunction isBareString(node: TSESTree.TypeNode | undefined): boolean {\n if (node === undefined) return false;\n switch (node.type) {\n case AST_NODE_TYPES.TSStringKeyword:\n return true;\n // `string[]` holds members of the same closed set, one element at a time.\n case AST_NODE_TYPES.TSArrayType:\n return isBareString(node.elementType);\n // `string | null` is still an unconstrained string, and so is `string | \"a\"`\n // — the checker collapses that one to `string`.\n case AST_NODE_TYPES.TSUnionType:\n return node.types.some((member) => isBareString(member));\n default:\n return false;\n }\n}\n\n/** The identifier a call chain hangs off: `text(\"k\").notNull()` -> `text`. */\nfunction rootCallee(node: TSESTree.Node | null | undefined): string | null {\n let current: TSESTree.Node | null | undefined = node;\n for (let hops = 0; current != null && hops < 12; hops += 1) {\n switch (current.type) {\n case AST_NODE_TYPES.CallExpression:\n current = current.callee;\n break;\n case AST_NODE_TYPES.MemberExpression:\n current = current.object;\n break;\n case AST_NODE_TYPES.Identifier:\n return current.name;\n default:\n return null;\n }\n }\n return null;\n}\n\n/** A declaration this rule can judge: a named one that holds a bare string. */\ninterface Target {\n readonly node: TSESTree.Node;\n readonly name: string;\n}\n\nfunction nameOf(key: TSESTree.Node): string | null {\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") return key.value;\n return null;\n}\n\nfunction targetOf(node: TSESTree.Node): Target | null {\n switch (node.type) {\n case AST_NODE_TYPES.TSPropertySignature:\n case AST_NODE_TYPES.PropertyDefinition: {\n const name = node.computed ? null : nameOf(node.key);\n if (name === null || !isBareString(node.typeAnnotation?.typeAnnotation)) return null;\n return { node, name };\n }\n case AST_NODE_TYPES.Property: {\n const name = node.computed || node.shorthand ? null : nameOf(node.key);\n const callee = rootCallee(node.value);\n if (name === null || callee === null || !STRING_BUILDERS.has(callee)) return null;\n return { node, name };\n }\n case AST_NODE_TYPES.VariableDeclarator: {\n if (node.id.type !== AST_NODE_TYPES.Identifier) return null;\n if (!isBareString(node.id.typeAnnotation?.typeAnnotation)) return null;\n return { node, name: node.id.name };\n }\n default:\n return null;\n }\n}\n\n/** The literals a comment lists, or null when its body is not a bare list. */\nfunction unionLiterals(body: string): string[] | null {\n const list = body.replace(LEAD_IN_RE, \"\").trim();\n if (!UNION_BODY_RE.test(list)) return null;\n const literals = (list.match(LITERAL_G) ?? []).map((raw) => raw.slice(1, -1));\n if (literals.some((literal) => literal.length === 0 || literal.length > MAX_LITERAL_LENGTH)) {\n return null;\n }\n return literals;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-union-in-comment\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag a comment that lists a `string` field's allowed values instead of the type listing them.\",\n },\n schema: [],\n messages: {\n unionInComment:\n 'This comment is a type — `{{name}}` still accepts every string, so the set it lists is enforced by nobody. Make it a string-literal union (\"{{first}}\" | …) and delete the comment.',\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n if (isGeneratedFile(context.filename, sourceCode.text)) {\n return {};\n }\n\n /**\n * The declaration a comment annotates: the one it trails on its own line, or\n * the one starting on the line below when the comment has that line to\n * itself. Anything else annotates nothing this rule can read.\n */\n function annotated(comment: TSESTree.Comment): Target | null {\n const before = sourceCode.getTokenBefore(comment, { includeComments: false });\n let anchor: TSESTree.Node | null;\n if (before !== null && before.loc.end.line === comment.loc.start.line) {\n // The separator a member ends on belongs to the CONTAINER, so resolving\n // `,` or `;` lands on the object and never reaches the member itself.\n let token: TSESTree.Token | null = before;\n while (token !== null && (token.value === \",\" || token.value === \";\")) {\n token = sourceCode.getTokenBefore(token, { includeComments: false });\n }\n anchor = token === null ? null : sourceCode.getNodeByRangeIndex(token.range[0]);\n } else {\n const after = sourceCode.getTokenAfter(comment, { includeComments: false });\n if (after === null || after.loc.start.line !== comment.loc.end.line + 1) return null;\n anchor = sourceCode.getNodeByRangeIndex(after.range[0]);\n }\n for (\n let node: TSESTree.Node | undefined | null = anchor;\n node != null && node.type !== AST_NODE_TYPES.Program;\n node = node.parent\n ) {\n const target = targetOf(node);\n if (target !== null) return target;\n }\n return null;\n }\n\n return {\n Program(): void {\n for (const comment of sourceCode.getAllComments()) {\n const body = comment.value.replace(/^\\*+/, \"\").replace(/\\*+$/, \"\").trim();\n if (body.length === 0) continue;\n const literals = unionLiterals(body);\n if (literals === null) continue;\n const target = annotated(comment);\n if (target === null) continue;\n // A declaration that already spells every value HAS the type; the\n // comment beside it is a restatement, which is a different defect.\n const declaration = sourceCode.getText(target.node);\n if (literals.every((literal) => declaration.includes(literal))) continue;\n context.report({\n node: comment,\n messageId: \"unionInComment\",\n data: { name: target.name, first: literals[0] ?? \"\" },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-type-member-comment-wall — an object type whose member comments mostly re-spell the members is a wall the reader pays for by the block.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-type-member-comment-wall.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\nimport {\n BARE_LABEL_RE,\n WALL_DEFAULTS,\n WALL_SCHEMA,\n type WallOptions,\n carriesValue,\n commentBody,\n isWall,\n knownTokens,\n labelStems,\n novelWords,\n} from \"./_comment-wall.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"commentWall\";\n\ntype Options = readonly [Partial<WallOptions>?];\n\n/** A member the rule can judge: a named property or method signature. */\ntype NamedMember = TSESTree.TSPropertySignature | TSESTree.TSMethodSignature;\n\nfunction isNamedMember(node: TSESTree.TypeElement): node is NamedMember {\n return (\n (node.type === AST_NODE_TYPES.TSPropertySignature ||\n node.type === AST_NODE_TYPES.TSMethodSignature) &&\n !node.computed\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-type-member-comment-wall\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag an object type whose member comments mostly re-spell the members' own names and types.\",\n },\n schema: [WALL_SCHEMA],\n messages: {\n commentWall:\n \"{{restated}} of this type's {{commented}} member comments only re-spell the member's own name and type — delete them, and keep the rows that say what the name cannot.\",\n },\n },\n defaultOptions: [WALL_DEFAULTS],\n create(context, [provided]) {\n const options: WallOptions = { ...WALL_DEFAULTS, ...provided };\n const sourceCode = context.sourceCode;\n // Generated or vendored, a test fixture, or a demo story: three kinds of\n // file whose member comments are output rather than commentary.\n if (\n isGeneratedFile(context.filename, sourceCode.text, [\"externalTree\"]) ||\n isTestFile(context.filename, [\"fixtureTree\"]) ||\n isStoryFile(context.filename, [\"storyTree\"])\n ) {\n return {};\n }\n\n // One pass over the file's comments, indexed by the line they end on (a\n // leading comment) and the line they start on (a trailing one).\n const endingOn = new Map<number, TSESTree.Comment>();\n const startingOn = new Map<number, TSESTree.Comment>();\n for (const comment of sourceCode.getAllComments()) {\n endingOn.set(comment.loc.end.line, comment);\n if (!startingOn.has(comment.loc.start.line)) startingOn.set(comment.loc.start.line, comment);\n }\n\n /**\n * The comment documenting `member`: the block or line comment on the row\n * above it, or the one trailing its last row.\n *\n * A leading comment counts only when the MEMBER starts its own line, and\n * only when the comment is alone on ITS line; a trailing comment counts\n * only when it sits after the member it is read against. All three keep a\n * one-line type literal under a doc block from reading as three members\n * documented three times with the same words.\n */\n function documentingComment(member: NamedMember): TSESTree.Comment | undefined {\n const beforeMember = sourceCode.getTokenBefore(member, { includeComments: false });\n const ownsItsLine =\n beforeMember === null || beforeMember.loc.end.line < member.loc.start.line;\n const lead = ownsItsLine ? endingOn.get(member.loc.start.line - 1) : undefined;\n if (lead !== undefined) {\n const before = sourceCode.getTokenBefore(lead, { includeComments: false });\n if (before === null || before.loc.end.line < lead.loc.start.line) return lead;\n }\n const trail = startingOn.get(member.loc.end.line);\n return trail !== undefined && trail.range[0] > member.range[0] ? trail : undefined;\n }\n\n /**\n * True when a comment heads a REGION of the type instead of describing the\n * member under it — the exemption this rule documents and, before this\n * check, leaked on.\n *\n * Three conditions. The body is ONE bare identifier word; it names\n * something OTHER than the member below it (the decisive one — `// links`\n * over `LinkDescriptors` heads a group, `// links` over `links` restates a\n * name); and it shows region evidence, heading a run of members of which\n * only the first is commented, or set off by a blank line.\n */\n function isGroupLabel(\n comment: TSESTree.Comment,\n member: NamedMember,\n headsRun: boolean,\n ): boolean {\n if (comment.loc.end.line >= member.loc.start.line) return false;\n const body = commentBody(comment);\n if (!BARE_LABEL_RE.test(body)) return false;\n if (labelStems(body) === labelStems(sourceCode.getText(member.key))) return false;\n const lineAbove = sourceCode.lines[comment.loc.start.line - 2];\n return headsRun || (lineAbove !== undefined && lineAbove.trim().length === 0);\n }\n\n function check(node: TSESTree.TSInterfaceBody | TSESTree.TSTypeLiteral): void {\n const members = node.type === AST_NODE_TYPES.TSInterfaceBody ? node.body : node.members;\n const named = members.filter(isNamedMember);\n if (named.length === 0) return;\n\n const documented = named.map((member) => ({ member, comment: documentingComment(member) }));\n let commented = 0;\n let restated = 0;\n // A comment documents at most one member, so a shared block cannot be\n // counted once per member that happens to sit next to it.\n const claimed = new Set<TSESTree.Comment>();\n for (const [index, { member, comment }] of documented.entries()) {\n if (comment === undefined || claimed.has(comment)) continue;\n const next = documented[index + 1];\n if (isGroupLabel(comment, member, next !== undefined && next.comment === undefined)) {\n continue;\n }\n claimed.add(comment);\n commented += 1;\n const body = commentBody(comment);\n if (body.length === 0 || carriesValue(body)) continue;\n if (novelWords(body, knownTokens(sourceCode.getText(member))) <= options.maxNovelWords) {\n restated += 1;\n }\n }\n\n if (!isWall(named.length, commented, restated, options)) return;\n context.report({\n node,\n loc: {\n start: node.loc.start,\n end: { line: node.loc.start.line, column: node.loc.start.column + 1 },\n },\n messageId: \"commentWall\",\n data: { restated: String(restated), commented: String(commented) },\n });\n }\n\n return {\n TSInterfaceBody: check,\n TSTypeLiteral: check,\n };\n },\n});\n","/**\n * @fileoverview no-unnecessary-use-client — a `'use client'` file with no hooks, handlers or browser globals ships to the client for nothing.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-unnecessary-use-client.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"unnecessaryUseClient\";\ntype Options = readonly [];\n\nconst HOOK_REGEX = /^use([A-Z]|$)/;\nconst EVENT_PROP_REGEX = /^on[A-Z]/;\nconst ERROR_FILE_REGEX = /\\b(?:global-)?error\\.[jt]sx?$/;\n\nconst BROWSER_GLOBALS: ReadonlySet<string> = new Set([\n \"window\",\n \"document\",\n \"navigator\",\n \"localStorage\",\n \"sessionStorage\",\n \"location\",\n \"history\",\n \"screen\",\n \"requestAnimationFrame\",\n \"cancelAnimationFrame\",\n \"CustomEvent\",\n \"Event\",\n \"MouseEvent\",\n \"KeyboardEvent\",\n \"TouchEvent\",\n]);\n\n/** Modules whose import requires a client boundary. */\nconst CLIENT_REQUIRED_MODULES: ReadonlySet<string> = new Set([\"next/dynamic\"]);\n\nconst CLIENT_ONLY_PACKAGES_REGEX =\n /^(?:@radix-ui\\/|framer-motion|react-dom|react-day-picker|@floating-ui\\/|react-select|react-toastify|react-hook-form|recharts|react-dropzone|react-slick|react-swipeable|react-resizable|react-draggable|react-beautiful-dnd|@hello-pangea\\/dnd|react-virtualized|react-window|@tanstack\\/react-table|@tanstack\\/react-query|react-redux|recoil|jotai|zustand|@tippyjs\\/react|react-color|react-datepicker|next-themes|react-helmet|react-helmet-async|styled-components|@emotion\\/)/;\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** True for package specifiers whose implementation this rule cannot inspect. */\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith(\".\") && !source.startsWith(\"/\") && !source.startsWith(\"@/\") && !source.startsWith(\"~\");\n\n/** The leftmost identifier of a JSX element name: `Primitive.Tabs` -> `Primitive`. */\nconst jsxRootName = (name: TSESTree.JSXTagNameExpression): string => {\n let current: TSESTree.JSXTagNameExpression = name;\n while (current.type === AST_NODE_TYPES.JSXMemberExpression) {\n current = current.object;\n }\n return current.type === AST_NODE_TYPES.JSXIdentifier ? current.name : \"\";\n};\n\n/** True when any identifier in `node`'s subtree names an imported binding. */\nconst subtreeReadsImportedBinding = (\n node: TSESTree.Node,\n imported: ReadonlySet<string>,\n): boolean => {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return imported.has(node.name);\n }\n for (const key of Object.keys(node) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = node[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\" &&\n subtreeReadsImportedBinding(child as TSESTree.Node, imported)\n ) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isUseClientDirective = (\n node: TSESTree.Statement,\n): node is TSESTree.ExpressionStatement => {\n return (\n node.type === AST_NODE_TYPES.ExpressionStatement &&\n node.expression.type === AST_NODE_TYPES.Literal &&\n node.expression.value === \"use client\"\n );\n};\n\nconst isGlobalReference = (\n node: TSESTree.Identifier,\n context: Ctx,\n): boolean => {\n if (!BROWSER_GLOBALS.has(node.name)) return false;\n\n const parent = node.parent;\n if (parent !== undefined) {\n // `obj.window` — `window` is a property name, not a global reference.\n if (\n parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.property === node &&\n !parent.computed\n ) {\n return false;\n }\n // `{ window: ... }` — property key, not a global reference.\n if (\n parent.type === AST_NODE_TYPES.Property &&\n parent.key === node &&\n !parent.computed\n ) {\n return false;\n }\n // Type annotations / type-only positions are not runtime references.\n if (parent.type.startsWith(\"TS\")) {\n return false;\n }\n }\n\n // If there's a local binding for this name anywhere up the chain, it's not\n // a reference to the browser global.\n let scope: Scope.Scope | null = context.sourceCode.getScope(node);\n while (scope !== null) {\n const variable = scope.set.get(node.name);\n if (variable !== undefined && variable.defs.length > 0) {\n return false;\n }\n scope = scope.upper;\n }\n\n return true;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"no-unnecessary-use-client\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag `'use client'` files with no hooks or event handlers — they could be RSC.\",\n },\n schema: [],\n messages: {\n unnecessaryUseClient:\n \"'use client' directive but no hooks (use*), JSX event handlers (on*), browser globals, or client-only imports found. Consider removing the directive and serving as a React Server Component.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (ERROR_FILE_REGEX.test(filename)) {\n return {};\n }\n\n let directiveNode: TSESTree.ExpressionStatement | null = null;\n let hasClientIndicator = false;\n const importedLocals = new Set<string>();\n const externalLocals = new Set<string>();\n\n const markIfHookOrContext = (\n callee: TSESTree.CallExpression[\"callee\"],\n ): void => {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n if (HOOK_REGEX.test(callee.name) || callee.name === \"createContext\") {\n hasClientIndicator = true;\n }\n return;\n }\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n const name = callee.property.name;\n if (HOOK_REGEX.test(name) || name === \"createContext\") {\n hasClientIndicator = true;\n }\n }\n };\n\n return {\n Program(node): void {\n for (const stmt of node.body) {\n // Directives must be the first statements; once we see a non-\n // ExpressionStatement, stop scanning.\n if (stmt.type !== AST_NODE_TYPES.ExpressionStatement) break;\n if (isUseClientDirective(stmt)) {\n directiveNode = stmt;\n break;\n }\n }\n },\n CallExpression(node): void {\n // The `Program` visitor (entered first) has already determined whether\n // this file has a `'use client'` directive. If it doesn't, the result\n // can't change — skip all of the per-node indicator work, including the\n // hot scope-resolution in the `Identifier` visitor below.\n if (directiveNode === null) return;\n markIfHookOrContext(node.callee);\n },\n JSXAttribute(node): void {\n if (directiveNode === null) return;\n if (\n node.name.type === AST_NODE_TYPES.JSXIdentifier &&\n EVENT_PROP_REGEX.test(node.name.name)\n ) {\n hasClientIndicator = true;\n }\n },\n ImportDeclaration(node): void {\n if (directiveNode === null) return;\n if (typeof node.source.value !== \"string\") return;\n const source = node.source.value;\n if (\n CLIENT_ONLY_PACKAGES_REGEX.test(source) ||\n CLIENT_REQUIRED_MODULES.has(source)\n ) {\n hasClientIndicator = true;\n }\n for (const specifier of node.specifiers) {\n importedLocals.add(specifier.local.name);\n if (isBareSpecifier(source)) {\n externalLocals.add(specifier.local.name);\n }\n }\n },\n JSXOpeningElement(node): void {\n if (directiveNode === null) return;\n // Indicator 1: rendering a third-party component — this rule cannot see\n // whether the dependency itself needs a client boundary.\n if (externalLocals.has(jsxRootName(node.name))) {\n hasClientIndicator = true;\n }\n },\n ExportNamedDeclaration(node): void {\n if (directiveNode === null) return;\n if (node.source !== null) {\n hasClientIndicator = true;\n return;\n }\n // Indicator 2: `export const X = SomeImport.X` — a re-export written\n // the long way, so it must agree with the `export … from` branch above.\n if (\n node.declaration !== null &&\n subtreeReadsImportedBinding(node.declaration, importedLocals)\n ) {\n hasClientIndicator = true;\n }\n },\n ExportAllDeclaration(node): void {\n if (directiveNode === null) return;\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ClassDeclaration(): void {\n if (directiveNode === null) return;\n hasClientIndicator = true;\n },\n ClassExpression(): void {\n if (directiveNode === null) return;\n hasClientIndicator = true;\n },\n Identifier(node): void {\n if (directiveNode === null) return;\n if (isGlobalReference(node, context)) {\n hasClientIndicator = true;\n }\n },\n \"Program:exit\"(): void {\n if (directiveNode !== null && !hasClientIndicator) {\n context.report({\n node: directiveNode,\n messageId: \"unnecessaryUseClient\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview no-unsafe-mock-casting — a cast to `vi.Mock` / `jest.Mock` asserts a mock that may not exist; `vi.mocked()` checks it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-unsafe-mock-casting.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\nimport { AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile } from \"./_paths.js\";\n\ntype MessageIds = \"unsafeMockCast\";\n\nfunction isMockTypeReference(node: TSESTree.TypeNode): boolean {\n if (node.type !== AST_NODE_TYPES.TSTypeReference) {\n return false;\n }\n \n const typeName = node.typeName;\n \n if (typeName.type === AST_NODE_TYPES.Identifier) {\n const name = typeName.name;\n return name === \"Mock\" || name === \"MockInstance\" || name === \"SpyInstance\";\n }\n \n if (typeName.type === AST_NODE_TYPES.TSQualifiedName) {\n const rightName = typeName.right.name;\n return rightName === \"Mock\" || rightName === \"MockInstance\" || rightName === \"SpyInstance\";\n }\n \n return false;\n}\n\nexport default createRule<[], MessageIds>({\n name: \"no-unsafe-mock-casting\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow casting to mock types like `jest.Mock` or `vi.Mock`. Use `vi.mocked()` or `jest.mocked()` instead.\",\n },\n schema: [],\n messages: {\n unsafeMockCast:\n \"Do not cast to a Mock type. Use `vi.mocked(fn)` or `jest.mocked(fn)` instead to preserve type safety.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n function checkAssertion(\n node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion,\n ): void {\n if (isMockTypeReference(node.typeAnnotation)) {\n context.report({ node, messageId: \"unsafeMockCast\" });\n }\n }\n\n return {\n TSAsExpression: checkAssertion,\n TSTypeAssertion: checkAssertion,\n };\n },\n});\n","/**\n * @fileoverview no-zod-native-enum — `z.nativeEnum` exists to wrap a TypeScript `enum`, which `no-enum` already bans.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/no-zod-native-enum.test.ts\n */\n\nimport {\n ESLintUtils,\n type TSESLint,\n type TSESTree,\n type ParserServicesWithTypeInformation,\n AST_NODE_TYPES,\n} from \"@typescript-eslint/utils\";\nimport * as ts from \"typescript\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"nativeEnum\" | \"enumOfTsEnum\";\ntype Options = readonly [];\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/** `zod`, `zod/v4`, `zod/mini`, `@hono/zod-openapi`, `@/lib/zod`, ... */\nfunction isZodModule(source: string): boolean {\n return /(^|[/@-])zod([/-]|$)/.test(source);\n}\n\n/** Unwraps `x as const` / `x satisfies T` / `(x)` down to the inner expression. */\nfunction unwrap(node: TSESTree.Expression): TSESTree.Expression {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression\n ) {\n return unwrap(node.expression);\n }\n return node;\n}\n\n/** Returns unique string-literal values when the object can be safely rewritten. */\nfunction stringValueTexts(\n node: TSESTree.ObjectExpression,\n sourceCode: Readonly<TSESLint.SourceCode>,\n): string[] | null {\n const texts: string[] = [];\n for (const prop of node.properties) {\n if (prop.type !== AST_NODE_TYPES.Property) {\n return null;\n }\n if (prop.computed || prop.shorthand || prop.method || prop.kind !== \"init\") {\n return null;\n }\n const value = prop.value;\n if (\n value.type !== AST_NODE_TYPES.Literal ||\n typeof value.value !== \"string\"\n ) {\n return null;\n }\n const text = sourceCode.getText(value);\n if (!texts.includes(text)) {\n texts.push(text);\n }\n }\n return texts.length > 0 ? texts : null;\n}\n\n/** Resolves an identifier to a `TSEnumDeclaration` declared in this file. */\nfunction resolvesToLocalEnum(\n node: TSESTree.Identifier,\n scope: TSESLint.Scope.Scope,\n): boolean {\n let current: TSESLint.Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.variables.find((v) => v.name === node.name);\n if (variable !== undefined) {\n return variable.defs.some(\n (def) => def.node.type === AST_NODE_TYPES.TSEnumDeclaration,\n );\n }\n current = current.upper;\n }\n return false;\n}\n\nconst ENUM_SYMBOL_FLAGS =\n ts.SymbolFlags.RegularEnum | ts.SymbolFlags.ConstEnum | ts.SymbolFlags.Enum;\n\n/**\n * Whether the identifier's resolved symbol is a TypeScript enum, following\n * import aliases. Catches `import { Status } from \"./types\"; z.enum(Status)`,\n * which lexical resolution alone cannot see.\n */\nfunction resolvesToImportedEnum(\n node: TSESTree.Identifier,\n services: ParserServicesWithTypeInformation,\n): boolean {\n const checker = services.program.getTypeChecker();\n const tsNode = services.esTreeNodeToTSNodeMap.get(node);\n let symbol = checker.getSymbolAtLocation(tsNode);\n if (symbol === undefined) {\n return false;\n }\n if ((symbol.flags & ts.SymbolFlags.Alias) !== 0) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n return (symbol.flags & ENUM_SYMBOL_FLAGS) !== 0;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"no-zod-native-enum\",\n meta: {\n type: \"suggestion\",\n fixable: \"code\",\n docs: {\n description:\n \"Disallow `z.nativeEnum()` (and `z.enum()` over a TypeScript enum); use `z.enum([\\\"a\\\", \\\"b\\\"])` with a string-literal union instead.\",\n },\n schema: [],\n messages: {\n nativeEnum:\n '`z.nativeEnum()` exists to wrap a TypeScript `enum`, which `no-enum` bans. Use `z.enum([\"a\", \"b\"])` and derive the union with `z.infer<typeof Schema>`.',\n enumOfTsEnum:\n '`z.enum()` is being passed the TypeScript enum `{{name}}`, which `no-enum` bans. Pass a string-literal array instead: `z.enum([\"a\", \"b\"])`.',\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n if (isIgnoredFile(context.filename, sourceCode.getText())) {\n return {};\n }\n // A test that covers `z.nativeEnum` must call it; see @fileoverview.\n if (isTestFile(context.filename)) {\n return {};\n }\n\n let services: ParserServicesWithTypeInformation | null;\n try {\n services = ESLintUtils.getParserServices(context);\n } catch {\n services = null;\n }\n\n /** Local names imported from a zod module, e.g. `nativeEnum`, `enum_`. */\n const zodImportedNames = new Map<string, string>();\n\n function isZodMemberCall(node: TSESTree.CallExpression, api: string): boolean {\n const callee = node.callee;\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ) {\n return callee.property.name === api;\n }\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return zodImportedNames.get(callee.name) === api;\n }\n return false;\n }\n\n function buildFix(\n node: TSESTree.CallExpression,\n ): TSESLint.ReportFixFunction | null {\n // A bare `nativeEnum(...)` imported from zod cannot be renamed in place —\n // `enum` is a reserved word, so there is no bare callee to rewrite to.\n // Rewriting only the argument would leave a `nativeEnum` call taking an\n // array, so this shape is report-only.\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const arg = node.arguments[0];\n if (\n arg === undefined ||\n node.arguments.length !== 1 ||\n arg.type === AST_NODE_TYPES.SpreadElement\n ) {\n return null;\n }\n const inner = unwrap(arg);\n if (inner.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n const values = stringValueTexts(inner, sourceCode);\n if (values === null) {\n return null;\n }\n const property = callee.property;\n const replacementArg = `[${values.join(\", \")}]`;\n return (fixer) => [\n fixer.replaceText(property, \"enum\"),\n fixer.replaceText(arg, replacementArg),\n ];\n }\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const spec of node.specifiers) {\n if (\n spec.type === AST_NODE_TYPES.ImportSpecifier &&\n spec.imported.type === AST_NODE_TYPES.Identifier\n ) {\n zodImportedNames.set(spec.local.name, spec.imported.name);\n }\n }\n },\n\n CallExpression(node: TSESTree.CallExpression): void {\n if (isZodMemberCall(node, \"nativeEnum\")) {\n const fix = buildFix(node);\n context.report({\n node,\n messageId: \"nativeEnum\",\n ...(fix === null ? {} : { fix }),\n });\n return;\n }\n\n if (!isZodMemberCall(node, \"enum\")) {\n return;\n }\n const arg = node.arguments[0];\n if (arg === undefined || arg.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const isEnum =\n resolvesToLocalEnum(arg, sourceCode.getScope(arg)) ||\n (services !== null && resolvesToImportedEnum(arg, services));\n if (isEnum) {\n context.report({\n node,\n messageId: \"enumOfTsEnum\",\n data: { name: arg.name },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-constant-time-secret-compare — `===` on a secret short-circuits on the first differing byte, so the response time leaks the secret.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-constant-time-secret-compare.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isAuthSecretName } from \"./_secret-names.js\";\nimport { isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"preferConstantTimeSecretCompare\";\ntype Options = readonly [];\n\nconst EQUALITY_OPERATORS: ReadonlySet<string> = new Set([\"===\", \"!==\", \"==\", \"!=\"]);\n\n/**\n * Identifiers that are compile-time sentinels rather than runtime values.\n * `undefined`/`NaN` make the comparison a presence check; an ALL-CAPS name is a\n * named constant or enum member (`TOKEN_TYPE_SYSTEM`), and timing a compare\n * against a value the attacker already knows leaks nothing.\n */\nconst SENTINEL_IDENTIFIERS: ReadonlySet<string> = new Set([\"undefined\", \"NaN\"]);\n\n/**\n * Words that mark a secret-SHAPED name as a placeholder rather than a live\n * credential: `TOKEN_SENTINEL`, `EMPTY_SECRET`, `PLACEHOLDER_API_KEY`. Comparing\n * against one of these is a presence check, not an authentication check, so it\n * stays excluded even though the secret-name heuristics match it.\n */\nconst SENTINEL_WORDS = /(^|_)(SENTINEL|EMPTY|NONE|NULL|UNSET|MISSING|PLACEHOLDER|DUMMY|FAKE|EXAMPLE)(_|$)/;\n\n/**\n * The camelCase spelling of the same idea: a marker VALUE whose name happens to\n * end in a secret-shaped word. A library exports `skipToken` as a unique\n * `Symbol` and callers test identity against it — there are no bytes to compare\n * and nothing an attacker could learn from the timing.\n */\nconst SENTINEL_PREFIX_RE =\n /^(skip|sentinel|empty|none|missing|unset|placeholder|dummy|fake|example|noop)[A-Z]/;\nconst AST_NODE_TYPE_RE = /^(?:TS|JSX)?[A-Z][A-Za-z]*(?:Signature|Keyword|Expression|Declaration|Element|Literal|Identifier)$/;\n\n/**\n * True when every cased character is upper-case and at least one letter exists —\n * AND the name is not itself secret-shaped.\n *\n * The ALL-CAPS carve-out exists for public named constants (`TOKEN_TYPE_SYSTEM`).\n * But environment secrets are conventionally SCREAMING_SNAKE too\n * (`ADMIN_TOKEN`, `ASHBY_API_KEY`, `SLACK_SIGNING_SECRET`), so an unqualified\n * ALL-CAPS bail-out made this rule blind to essentially every real secret\n * compare: `env.ADMIN_TOKEN === supplied` was silent while the camelCase\n * `env.adminToken === supplied` fired. That is the exact comparison this rule\n * exists to catch. Defer to the shared secret-name heuristics first.\n */\nfunction isConstantReference(identifier: string): boolean {\n if (AST_NODE_TYPE_RE.test(identifier)) return true;\n if (isAuthSecretName(identifier) && !SENTINEL_WORDS.test(identifier)) return false;\n return identifier === identifier.toUpperCase() && /[A-Za-z]/.test(identifier);\n}\n\n/**\n * True when this operand makes the comparison a non-timing-attack surface:\n * any literal (string / number / boolean / null / regex), a template literal\n * with no substitutions, `undefined`/`NaN`, or an ALL-CAPS constant reference.\n */\nfunction isExcludedOperand(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return true;\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0;\n case AST_NODE_TYPES.Identifier:\n return (\n SENTINEL_IDENTIFIERS.has(node.name) ||\n SENTINEL_PREFIX_RE.test(node.name) ||\n isConstantReference(node.name)\n );\n case AST_NODE_TYPES.MemberExpression:\n return (\n !node.computed &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n (SENTINEL_PREFIX_RE.test(node.property.name) ||\n isConstantReference(node.property.name))\n );\n default:\n return false;\n }\n}\n\n/** The identifier a plain operand denotes, or null for anything else. */\nfunction operandName(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return node.name;\n }\n if (\n node.type === AST_NODE_TYPES.MemberExpression &&\n !node.computed &&\n node.property.type === AST_NODE_TYPES.Identifier\n ) {\n return node.property.name;\n }\n return null;\n}\n\n/**\n * True when the operand names an authenticator worth a constant-time compare.\n *\n * A template literal counts when it interpolates one: `header === \\`Bearer\n * ${adminToken}\\`` is the canonical Workers auth check and is exactly as\n * timing-leaky as comparing the bare token, since the constant prefix only makes\n * the first bytes free.\n */\nfunction isSecretOperand(node: TSESTree.Node): boolean {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n return node.expressions.some((expression) => isSecretOperand(expression));\n }\n const name = operandName(node);\n return name !== null && isAuthSecretName(name);\n}\n\n/** The secret identifier this comparison exposes, for the diagnostic message. */\nfunction secretNameOf(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.TemplateLiteral) {\n for (const expression of node.expressions) {\n const nested = secretNameOf(expression);\n if (nested !== null) {\n return nested;\n }\n }\n return null;\n }\n return operandName(node);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-constant-time-secret-compare\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow `===`/`!==` on a secret-like value; short-circuiting comparison leaks the secret through timing. Use a constant-time compare.\",\n },\n schema: [],\n messages: {\n preferConstantTimeSecretCompare:\n \"`{{operator}}` on secret `{{name}}` short-circuits on the first differing byte and leaks it through timing. Compare constant-time instead (`crypto.subtle.timingSafeEqual` over equal-length SHA-256 digests).\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename)) {\n return {};\n }\n return {\n BinaryExpression(node: TSESTree.BinaryExpression): void {\n if (!EQUALITY_OPERATORS.has(node.operator)) {\n return;\n }\n const { left, right } = node;\n if (isExcludedOperand(left) || isExcludedOperand(right)) {\n return;\n }\n const secret = [left, right].find((operand) => isSecretOperand(operand));\n if (secret === undefined) {\n return;\n }\n context.report({\n node,\n messageId: \"preferConstantTimeSecretCompare\",\n data: { operator: node.operator, name: secretNameOf(secret) ?? \"\" },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-discriminated-union — a boolean status flag beside many optionals makes illegal states representable.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-discriminated-union.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"preferDiscriminatedUnion\";\ntype Options = readonly [];\n\n/**\n * Boolean-typed member names that read as a success/error status discriminant.\n */\nconst STATUS_MEMBER_NAMES: ReadonlySet<string> = new Set([\n \"success\",\n \"ok\",\n \"error\",\n \"failed\",\n \"isError\",\n]);\n\nconst MIN_OPTIONAL_MEMBERS = 2;\n\n/**\n * Returns the property key name for a member if it is a plain identifier or\n * string-literal property signature, otherwise `null`.\n */\nfunction getMemberName(member: TSESTree.TypeElement): string | null {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) {\n return null;\n }\n const { key } = member;\n if (key.type === AST_NODE_TYPES.Identifier) {\n return key.name;\n }\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n}\n\n/**\n * Whether a property signature is annotated with `boolean`.\n */\nfunction isBooleanTyped(member: TSESTree.TSPropertySignature): boolean {\n return (\n member.typeAnnotation?.typeAnnotation.type ===\n AST_NODE_TYPES.TSBooleanKeyword\n );\n}\n\n/**\n * Returns true when the object type literal has BOTH a boolean-typed status\n * member AND at least `MIN_OPTIONAL_MEMBERS` optional members.\n */\nfunction looksLikeMutuallyExclusiveState(\n typeLiteral: TSESTree.TSTypeLiteral,\n): boolean {\n let hasStatusBoolean = false;\n let optionalCount = 0;\n let optionalPayloadCount = 0;\n\n for (const member of typeLiteral.members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) {\n continue;\n }\n\n if (member.optional) {\n optionalCount += 1;\n // A non-boolean optional can land in the wrong branch. All-boolean\n // records are independent flag sets, not state machines.\n if (!isBooleanTyped(member)) {\n optionalPayloadCount += 1;\n }\n }\n\n const name = getMemberName(member);\n if (\n name !== null &&\n STATUS_MEMBER_NAMES.has(name) &&\n isBooleanTyped(member)\n ) {\n hasStatusBoolean = true;\n }\n }\n\n return (\n hasStatusBoolean &&\n optionalCount >= MIN_OPTIONAL_MEMBERS &&\n optionalPayloadCount >= 1\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-discriminated-union\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag object types with a boolean status member and at least two optional members, including a non-boolean payload.\",\n },\n schema: [],\n messages: {\n preferDiscriminatedUnion:\n \"This object type uses a boolean status flag alongside several optional fields, which lets illegal states be representable. Model it as a `z.discriminatedUnion` / discriminated union (e.g. `{ ok: true; data: T } | { ok: false; error: E }`) to make illegal states unrepresentable.\",\n },\n },\n defaultOptions: [],\n create(context) {\n function checkTypeLiteral(\n typeLiteral: TSESTree.TSTypeLiteral,\n reportNode: TSESTree.Node,\n ): void {\n if (looksLikeMutuallyExclusiveState(typeLiteral)) {\n context.report({\n node: reportNode,\n messageId: \"preferDiscriminatedUnion\",\n });\n }\n }\n\n return {\n TSInterfaceDeclaration(\n node: TSESTree.TSInterfaceDeclaration,\n ): void {\n // An interface body is structurally an object type literal; reuse the\n // same membership analysis by treating its `body.body` as members.\n const synthetic: TSESTree.TSTypeLiteral = {\n ...node.body,\n type: AST_NODE_TYPES.TSTypeLiteral,\n members: node.body.body,\n };\n checkTypeLiteral(synthetic, node);\n },\n \"TSTypeAliasDeclaration > TSTypeLiteral\"(\n node: TSESTree.TSTypeLiteral,\n ): void {\n checkTypeLiteral(node, node.parent);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-input-group-search — search fields should use the shared input-group primitive.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-input-group-search.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"preferInputGroup\";\ntype Options = readonly [];\n\nconst INPUT_MODULE = /(?:^|\\/)components\\/ui\\/input$/u;\nconst INPUT_GROUP_MODULE = /(?:^|\\/)components\\/ui\\/input-group$/u;\nconst MAX_JSX_DISTANCE = 2;\n\ninterface Occurrence {\n ancestors: readonly TSESTree.Node[];\n node: TSESTree.JSXOpeningElement;\n}\n\nfunction localNamedImports(\n node: TSESTree.ImportDeclaration,\n importedName: string,\n): string[] {\n return node.specifiers\n .filter(\n (specifier): specifier is TSESTree.ImportSpecifier =>\n specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n (specifier.imported.type === AST_NODE_TYPES.Identifier\n ? specifier.imported.name\n : specifier.imported.value) === importedName,\n )\n .map((specifier) => specifier.local.name);\n}\n\nfunction elementName(node: TSESTree.JSXOpeningElement): string | null {\n return node.name.type === AST_NODE_TYPES.JSXIdentifier\n ? node.name.name\n : null;\n}\n\nfunction jsxAncestors(occurrence: Occurrence): TSESTree.JSXElement[] {\n return occurrence.ancestors.filter(\n (ancestor): ancestor is TSESTree.JSXElement =>\n ancestor.type === AST_NODE_TYPES.JSXElement,\n );\n}\n\nfunction isWithinInputGroup(\n occurrence: Occurrence,\n inputGroupNames: ReadonlySet<string>,\n): boolean {\n return jsxAncestors(occurrence).some((ancestor) =>\n inputGroupNames.has(elementName(ancestor.openingElement) ?? \"\"),\n );\n}\n\nfunction nearestEligibleCommonAncestor(\n search: Occurrence,\n input: Occurrence,\n inputGroupNames: ReadonlySet<string>,\n): TSESTree.JSXElement | null {\n const searchAncestors = jsxAncestors(search);\n const inputAncestorList = jsxAncestors(input);\n const inputAncestors = new Set(inputAncestorList);\n\n for (let index = searchAncestors.length - 1; index >= 0; index -= 1) {\n const ancestor = searchAncestors[index];\n if (ancestor === undefined) continue;\n if (!inputAncestors.has(ancestor)) continue;\n\n const searchDistance = searchAncestors.length - index - 1;\n const inputDistance =\n inputAncestorList.length - inputAncestorList.indexOf(ancestor) - 1;\n if (searchDistance > MAX_JSX_DISTANCE || inputDistance > MAX_JSX_DISTANCE) {\n return null;\n }\n\n if (inputGroupNames.has(elementName(ancestor.openingElement) ?? \"\")) {\n return null;\n }\n return ancestor;\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-input-group-search\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require search icons and shared Input controls in the same visual wrapper to use InputGroup.\",\n },\n schema: [],\n messages: {\n preferInputGroup:\n \"Use InputGroup with InputGroupAddon and InputGroupInput for this search field.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const inputNames = new Set<string>();\n const inputGroupNames = new Set<string>();\n const searchNames = new Set<string>();\n const inputs: Occurrence[] = [];\n const searches: Occurrence[] = [];\n\n return {\n ImportDeclaration(node): void {\n const source = String(node.source.value);\n if (source === \"lucide-react\") {\n localNamedImports(node, \"Search\").forEach((name) =>\n searchNames.add(name),\n );\n } else if (INPUT_MODULE.test(source)) {\n localNamedImports(node, \"Input\").forEach((name) =>\n inputNames.add(name),\n );\n } else if (INPUT_GROUP_MODULE.test(source)) {\n localNamedImports(node, \"InputGroup\").forEach((name) =>\n inputGroupNames.add(name),\n );\n }\n },\n JSXOpeningElement(node): void {\n const name = elementName(node);\n if (name === null) return;\n const occurrence = {\n ancestors: context.sourceCode.getAncestors(node),\n node,\n };\n if (searchNames.has(name)) searches.push(occurrence);\n if (inputNames.has(name)) inputs.push(occurrence);\n },\n \"Program:exit\"(): void {\n const reported = new Set<TSESTree.JSXElement>();\n for (const search of searches) {\n if (isWithinInputGroup(search, inputGroupNames)) continue;\n for (const input of inputs) {\n if (isWithinInputGroup(input, inputGroupNames)) continue;\n const wrapper = nearestEligibleCommonAncestor(\n search,\n input,\n inputGroupNames,\n );\n if (wrapper === null || reported.has(wrapper)) continue;\n reported.add(wrapper);\n context.report({\n node: wrapper.openingElement,\n messageId: \"preferInputGroup\",\n });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-shadcn-primitives — visible application UI should use shared shadcn primitives.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-shadcn-primitives.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"preferShadcnPrimitive\";\ntype Options = readonly [];\n\nconst SHADCN_PRIMITIVES = {\n button: \"Button\",\n dialog: \"Dialog or AlertDialog family\",\n input: \"Input\",\n label: \"Label\",\n progress: \"Progress\",\n select: \"Select family\",\n table: \"Table family\",\n textarea: \"Textarea\",\n} as const;\n\ntype RawPrimitive = keyof typeof SHADCN_PRIMITIVES;\n\nconst LABELABLE_ELEMENTS: ReadonlySet<string> = new Set([\n \"button\",\n \"input\",\n \"meter\",\n \"output\",\n \"progress\",\n \"select\",\n \"textarea\",\n]);\n\nfunction rawElementName(\n node: TSESTree.JSXOpeningElement,\n): RawPrimitive | null {\n if (node.name.type !== AST_NODE_TYPES.JSXIdentifier) return null;\n const name = node.name.name;\n return Object.hasOwn(SHADCN_PRIMITIVES, name)\n ? (name as RawPrimitive)\n : null;\n}\n\ntype StaticAttribute =\n | { readonly kind: \"known\"; readonly value: string }\n | { readonly kind: \"missing\" }\n | { readonly kind: \"unknown\" };\n\nfunction staticExpressionString(\n expression: TSESTree.Expression | TSESTree.JSXEmptyExpression,\n): string | null {\n if (expression.type === AST_NODE_TYPES.Literal) {\n return typeof expression.value === \"string\" ? expression.value : null;\n }\n if (expression.type === AST_NODE_TYPES.TemplateLiteral) {\n let value = expression.quasis[0]?.value.cooked ?? \"\";\n for (const [index, substitution] of expression.expressions.entries()) {\n const staticSubstitution = staticExpressionString(substitution);\n if (staticSubstitution === null) return null;\n value += staticSubstitution;\n value += expression.quasis[index + 1]?.value.cooked ?? \"\";\n }\n return value;\n }\n if (\n expression.type === AST_NODE_TYPES.TSAsExpression ||\n expression.type === AST_NODE_TYPES.TSNonNullExpression ||\n expression.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n expression.type === AST_NODE_TYPES.TSTypeAssertion\n ) {\n return staticExpressionString(expression.expression);\n }\n return null;\n}\n\nfunction staticString(value: TSESTree.JSXAttribute[\"value\"]): string | null {\n if (value?.type === AST_NODE_TYPES.Literal) {\n return typeof value.value === \"string\" ? value.value : null;\n }\n if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return null;\n return staticExpressionString(value.expression);\n}\n\nfunction effectiveAttribute(\n node: TSESTree.JSXOpeningElement,\n attributeName: string,\n): StaticAttribute {\n for (const attribute of node.attributes.toReversed()) {\n if (attribute.type === AST_NODE_TYPES.JSXSpreadAttribute) {\n return { kind: \"unknown\" };\n }\n if (\n attribute.name.type !== AST_NODE_TYPES.JSXIdentifier ||\n attribute.name.name !== attributeName\n ) {\n continue;\n }\n const value = staticString(attribute.value);\n return value === null\n ? { kind: \"unknown\" }\n : { kind: \"known\", value };\n }\n return { kind: \"missing\" };\n}\n\nfunction isLabelableElement(node: TSESTree.JSXElement): boolean {\n if (node.openingElement.name.type !== AST_NODE_TYPES.JSXIdentifier) {\n return false;\n }\n const name = node.openingElement.name.name;\n if (!LABELABLE_ELEMENTS.has(name)) return false;\n if (name !== \"input\") return true;\n const typeAttribute = effectiveAttribute(node.openingElement, \"type\");\n if (typeAttribute.kind === \"unknown\") return false;\n return !(\n typeAttribute.kind === \"known\" &&\n typeAttribute.value.toLowerCase() === \"hidden\"\n );\n}\n\nfunction containsLabelableElement(\n node: TSESTree.JSXElement | TSESTree.JSXFragment,\n): boolean {\n return node.children.some((child) => {\n if (child.type === AST_NODE_TYPES.JSXElement) {\n return isLabelableElement(child) || containsLabelableElement(child);\n }\n if (child.type === AST_NODE_TYPES.JSXFragment) {\n return containsLabelableElement(child);\n }\n return false;\n });\n}\n\nfunction isStaticallyAssociatedLabel(node: TSESTree.JSXOpeningElement): boolean {\n const htmlFor = effectiveAttribute(node, \"htmlFor\");\n if (htmlFor.kind === \"known\" && htmlFor.value.trim().length > 0) return true;\n return (\n node.parent.type === AST_NODE_TYPES.JSXElement &&\n containsLabelableElement(node.parent)\n );\n}\n\nfunction replacementFor(\n node: TSESTree.JSXOpeningElement,\n element: RawPrimitive,\n): string | null {\n if (element !== \"input\") return SHADCN_PRIMITIVES[element];\n const typeAttribute = effectiveAttribute(node, \"type\");\n if (typeAttribute.kind === \"unknown\") return null;\n const inputType =\n typeAttribute.kind === \"known\" ? typeAttribute.value.toLowerCase() : \"text\";\n if (inputType === \"hidden\" || inputType === \"file\") return null;\n if (inputType === \"checkbox\") return \"Checkbox\";\n if (inputType === \"radio\") return \"RadioGroup family\";\n return \"Input\";\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-shadcn-primitives\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require visible raw JSX controls to use the corresponding shared shadcn primitive.\",\n },\n schema: [],\n messages: {\n preferShadcnPrimitive:\n \"Use the shared {{ replacement }} shadcn primitive instead of raw <{{ element }}> markup.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node): void {\n const element = rawElementName(node);\n if (element === null) return;\n if (element === \"label\" && !isStaticallyAssociatedLabel(node)) return;\n const replacement = replacementFor(node, element);\n if (replacement === null) return;\n context.report({\n node,\n messageId: \"preferShadcnPrimitive\",\n data: { element, replacement },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-module-level-constant — a literal-only collection or regex declared inside a function is rebuilt on every call.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-module-level-constant.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"hoistCollection\" | \"hoistRegex\";\n\ntype Options = readonly [\n {\n minElements?: number;\n checkRegex?: boolean;\n ignoreTestFiles?: boolean;\n }?,\n];\n\nconst DEFAULT_MIN_ELEMENTS = 3;\n\n/** How deep a nested literal may go before we stop trying to prove it static. */\nconst MAX_LITERAL_DEPTH = 4;\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\n/**\n * Methods that mutate the receiver. A call to any of these on the binding is\n * proof the value is meant to be rebuilt per call.\n */\nconst MUTATING_METHODS: ReadonlySet<string> = new Set([\n // Array\n \"push\",\n \"pop\",\n \"shift\",\n \"unshift\",\n \"splice\",\n \"sort\",\n \"reverse\",\n \"fill\",\n \"copyWithin\",\n // Set / Map\n \"add\",\n \"set\",\n \"delete\",\n \"clear\",\n // Object-ish escape hatches\n \"assign\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n AST_NODE_TYPES.ArrowFunctionExpression,\n]);\n\nconst COLLECTION_CONSTRUCTORS: ReadonlySet<string> = new Set([\"Set\", \"Map\"]);\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/**\n * A test suite or a story: both keep their fixture tables next to the assertion\n * (or the story) that explains them. Delegated to `_paths` so this rule cannot\n * drift away from the other file-kind-scoped rules again.\n */\nfunction isLocalFixtureFile(filename: string): boolean {\n return isTestFile(filename) || isStoryFile(filename);\n}\n\n/** Unwraps `x as const` / `x satisfies T` down to the inner expression. */\nfunction unwrap(node: TSESTree.Node): TSESTree.Node {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n node.type === AST_NODE_TYPES.TSNonNullExpression\n ) {\n return unwrap(node.expression);\n }\n return node;\n}\n\n/** `g` and `y` carry `lastIndex` between calls, so hoisting changes behaviour. */\nconst HAS_STATEFUL_FLAG_RE = /[gy]/;\n\nfunction isRegexLiteral(node: TSESTree.Node): node is TSESTree.RegExpLiteral {\n return (\n node.type === AST_NODE_TYPES.Literal &&\n \"regex\" in node &&\n node.regex !== undefined\n );\n}\n\n/**\n * Whether the expression is built entirely out of literals — no identifier, no\n * call, no member access, no interpolation, no spread. This is the gate that\n * makes hoisting provably safe: a literal-only value cannot capture a\n * parameter, cannot observe call-time state, and cannot have side effects.\n */\nfunction isLiteralOnly(node: TSESTree.Node, depth: number): boolean {\n if (depth > MAX_LITERAL_DEPTH) {\n return false;\n }\n const inner = unwrap(node);\n switch (inner.type) {\n case AST_NODE_TYPES.Literal: {\n // A `RegExpLiteral` is an `AST_NODE_TYPES.Literal`, so without this a\n // stateful regex nested in a collection — `const patterns = [/a/g, /b/]`\n // — bypassed the top-level `g`/`y` check and the recommended hoist would\n // have carried `lastIndex` across calls.\n return !(isRegexLiteral(inner) && HAS_STATEFUL_FLAG_RE.test(inner.regex.flags));\n }\n case AST_NODE_TYPES.TemplateLiteral: {\n return inner.expressions.length === 0;\n }\n case AST_NODE_TYPES.UnaryExpression: {\n return (\n (inner.operator === \"-\" || inner.operator === \"+\") &&\n inner.argument.type === AST_NODE_TYPES.Literal &&\n typeof inner.argument.value === \"number\"\n );\n }\n case AST_NODE_TYPES.ArrayExpression: {\n return inner.elements.every(\n (el) =>\n el !== null &&\n el.type !== AST_NODE_TYPES.SpreadElement &&\n isLiteralOnly(el, depth + 1),\n );\n }\n case AST_NODE_TYPES.ObjectExpression: {\n return inner.properties.every((prop) => {\n if (prop.type !== AST_NODE_TYPES.Property) {\n return false;\n }\n if (prop.shorthand || prop.method || prop.kind !== \"init\") {\n return false;\n }\n if (prop.computed && prop.key.type !== AST_NODE_TYPES.Literal) {\n return false;\n }\n return isLiteralOnly(prop.value, depth + 1);\n });\n }\n default: {\n return false;\n }\n }\n}\n\n/** `Object.freeze(x)` → `x`; anything else is returned untouched. */\nfunction unwrapObjectFreeze(node: TSESTree.Node): TSESTree.Node {\n const inner = unwrap(node);\n if (\n inner.type === AST_NODE_TYPES.CallExpression &&\n inner.callee.type === AST_NODE_TYPES.MemberExpression &&\n !inner.callee.computed &&\n inner.callee.object.type === AST_NODE_TYPES.Identifier &&\n inner.callee.object.name === \"Object\" &&\n inner.callee.property.type === AST_NODE_TYPES.Identifier &&\n inner.callee.property.name === \"freeze\" &&\n inner.arguments.length === 1 &&\n inner.arguments[0] !== undefined &&\n inner.arguments[0].type !== AST_NODE_TYPES.SpreadElement\n ) {\n return unwrap(inner.arguments[0]);\n }\n return inner;\n}\n\ntype Candidate =\n | { kind: \"array\" | \"object\" | \"Set\" | \"Map\"; size: number }\n | { kind: \"regex\"; size: number };\n\n/**\n * Classifies the initializer, or returns null when it is not a hoistable\n * literal-only collection / regex.\n */\nfunction classify(init: TSESTree.Node, checkRegex: boolean): Candidate | null {\n const node = unwrapObjectFreeze(init);\n\n if (isRegexLiteral(node)) {\n if (!checkRegex) {\n return null;\n }\n if (HAS_STATEFUL_FLAG_RE.test(node.regex.flags)) {\n return null;\n }\n return { kind: \"regex\", size: 1 };\n }\n\n if (node.type === AST_NODE_TYPES.ArrayExpression) {\n return isLiteralOnly(node, 0)\n ? { kind: \"array\", size: node.elements.length }\n : null;\n }\n\n if (node.type === AST_NODE_TYPES.ObjectExpression) {\n return isLiteralOnly(node, 0)\n ? { kind: \"object\", size: node.properties.length }\n : null;\n }\n\n if (\n node.type === AST_NODE_TYPES.NewExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n COLLECTION_CONSTRUCTORS.has(node.callee.name)\n ) {\n const arg = node.arguments[0];\n if (\n node.arguments.length !== 1 ||\n arg === undefined ||\n arg.type === AST_NODE_TYPES.SpreadElement\n ) {\n return null;\n }\n const entries = unwrap(arg);\n if (entries.type !== AST_NODE_TYPES.ArrayExpression) {\n return null;\n }\n return isLiteralOnly(entries, 0)\n ? { kind: node.callee.name === \"Set\" ? \"Set\" : \"Map\", size: entries.elements.length }\n : null;\n }\n\n return null;\n}\n\n/** The nearest enclosing function, or null when the node is at module scope. */\nfunction enclosingFunction(node: TSESTree.Node): TSESTree.Node | null {\n let current: TSESTree.Node | undefined | null = node.parent;\n while (current !== undefined && current !== null) {\n if (FUNCTION_TYPES.has(current.type)) {\n return current;\n }\n current = current.parent;\n }\n return null;\n}\n\n/**\n * Built-ins that read their argument and return a fresh value without keeping\n * or mutating the original, so passing the binding to them is still a read.\n */\nconst NON_RETAINING_BUILTINS: ReadonlyMap<string, ReadonlySet<string>> = new Map(\n [\n [\n \"Object\",\n new Set([\"keys\", \"values\", \"entries\", \"freeze\", \"fromEntries\", \"assign\"]),\n ],\n [\"Array\", new Set([\"from\", \"isArray\"])],\n [\"JSON\", new Set([\"stringify\"])],\n ],\n);\n\nfunction isNonRetainingBuiltinCall(\n node: TSESTree.CallExpression,\n argument: TSESTree.Identifier,\n): boolean {\n const callee = node.callee;\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n callee.name === \"structuredClone\"\n ) {\n return true;\n }\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.object.type !== AST_NODE_TYPES.Identifier ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return false;\n }\n const members = NON_RETAINING_BUILTINS.get(callee.object.name);\n if (members === undefined || !members.has(callee.property.name)) {\n return false;\n }\n // `Object.assign(X, src)` mutates its FIRST argument; only later positions\n // (sources) are reads.\n if (callee.object.name === \"Object\" && callee.property.name === \"assign\") {\n return node.arguments[0] !== argument;\n }\n return true;\n}\n\n/**\n * Whether this single reference to the binding is a provably non-mutating,\n * non-escaping read. Anything not on the whitelist is treated as unsafe, so an\n * unrecognised usage suppresses the report rather than risking a bad hoist.\n */\nfunction isSafeRead(identifier: TSESTree.Identifier): boolean {\n const parent = identifier.parent;\n\n if (parent.type === AST_NODE_TYPES.MemberExpression) {\n if (parent.object !== identifier) {\n // `foo[X]` — the binding is used as a key, which is a plain read.\n return true;\n }\n const grandparent = parent.parent;\n // `X.a = 1`, `X[0] = 1`, `X.a += 1`\n if (\n grandparent.type === AST_NODE_TYPES.AssignmentExpression &&\n grandparent.left === parent\n ) {\n return false;\n }\n // `X.a++`\n if (grandparent.type === AST_NODE_TYPES.UpdateExpression) {\n return false;\n }\n // `delete X.a`\n if (\n grandparent.type === AST_NODE_TYPES.UnaryExpression &&\n grandparent.operator === \"delete\"\n ) {\n return false;\n }\n // `X.push(...)`, `X.sort()`, ...\n if (\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n MUTATING_METHODS.has(parent.property.name) &&\n grandparent.type === AST_NODE_TYPES.CallExpression &&\n grandparent.callee === parent\n ) {\n return false;\n }\n // Everything else through a member expression — `X.length`, `X.includes(v)`,\n // `X[i]`, `X.get(k)`, even `arr.map(X.has)` — reads a property of the\n // binding without handing the binding itself out, so it cannot mutate it.\n return true;\n }\n\n // `for (const x of X)` — iteration is a read.\n if (\n parent.type === AST_NODE_TYPES.ForOfStatement &&\n parent.right === identifier\n ) {\n return true;\n }\n\n // `[...X]`, `{...X}`, `f(...X)` — every spread copies, so the original is\n // never handed out and hoisting stays safe.\n if (parent.type === AST_NODE_TYPES.SpreadElement) {\n return true;\n }\n\n // `\"a\" in X`, `X instanceof Y`, `X === undefined`\n if (parent.type === AST_NODE_TYPES.BinaryExpression) {\n return true;\n }\n\n // A bare argument to a built-in that is known not to retain or mutate its\n // input: `Object.entries(X)`, `Array.from(X)`, `JSON.stringify(X)`. Any other\n // call receiving the binding bare is an escape.\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.arguments.includes(identifier) &&\n isNonRetainingBuiltinCall(parent, identifier)\n ) {\n return true;\n }\n\n // `typeof X`, `!X`\n if (\n parent.type === AST_NODE_TYPES.UnaryExpression &&\n parent.operator !== \"delete\"\n ) {\n return true;\n }\n\n return false;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-module-level-constant\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Hoist literal-only constant collections and regexes out of function bodies to module scope so they are allocated once.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n minElements: { type: \"number\", minimum: 1 },\n checkRegex: { type: \"boolean\" },\n ignoreTestFiles: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n hoistCollection:\n \"`{{name}}` is a literal-only {{kind}} rebuilt on every call. Hoist it to module scope so it is allocated once and can be reused, exported, and tested.\",\n hoistRegex:\n \"`{{name}}` is a constant regex recompiled on every call. Hoist it to module scope.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const options = optionsArg ?? {};\n const minElements = options.minElements ?? DEFAULT_MIN_ELEMENTS;\n const checkRegex = options.checkRegex ?? true;\n const ignoreTestFiles = options.ignoreTestFiles ?? true;\n\n const sourceCode = context.sourceCode;\n const filename = context.filename;\n\n if (isIgnoredFile(filename, sourceCode.getText())) {\n return {};\n }\n if (ignoreTestFiles && isLocalFixtureFile(filename)) {\n return {};\n }\n\n function allReferencesAreSafeReads(\n declarator: TSESTree.VariableDeclarator,\n ): boolean {\n const variables = sourceCode.getDeclaredVariables(declarator);\n const variable = variables[0];\n if (variable === undefined) {\n return false;\n }\n for (const reference of variable.references) {\n // The initializer write itself is not a usage.\n if (reference.init === true) {\n continue;\n }\n if (reference.isWrite()) {\n return false;\n }\n // A `JSXIdentifier` reference means the constant is rendered as a JSX\n // tag name — not something this rule reasons about, so bail.\n if (reference.identifier.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (!isSafeRead(reference.identifier)) {\n return false;\n }\n }\n return true;\n }\n\n return {\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n const declaration = node.parent;\n if (\n declaration.type !== AST_NODE_TYPES.VariableDeclaration ||\n declaration.kind !== \"const\" ||\n declaration.declare === true\n ) {\n return;\n }\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.init === null) {\n return;\n }\n if (enclosingFunction(node) === null) {\n return;\n }\n\n const candidate = classify(node.init, checkRegex);\n if (candidate === null) {\n return;\n }\n if (candidate.kind !== \"regex\" && candidate.size < minElements) {\n return;\n }\n if (!allReferencesAreSafeReads(node)) {\n return;\n }\n\n context.report({\n node: node.id,\n messageId:\n candidate.kind === \"regex\" ? \"hoistRegex\" : \"hoistCollection\",\n data: { name: node.id.name, kind: candidate.kind },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-module-level-schema — a Zod schema built inside a function is rebuilt on every call, every request, every render.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-module-level-schema.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"hoistSchema\";\n\ntype Options = readonly [\n {\n factories?: readonly string[];\n ignoreTestFiles?: boolean;\n minProperties?: number;\n }?,\n];\n\n/**\n * The object-like composites. Each builds a container plus one schema instance\n * per member, so the per-call cost is real rather than notional.\n */\nconst DEFAULT_FACTORIES: readonly string[] = [\n \"discriminatedUnion\",\n \"intersection\",\n \"looseObject\",\n \"object\",\n \"record\",\n \"strictObject\",\n \"tuple\",\n \"union\",\n];\n\n/**\n * Two, not one — the value the \"deliberately not flagged\" list has always\n * PROMISED and never delivered. The gate is `properties.length <\n * minProperties`, so a default of 1 excludes `z.object({})` and nothing else,\n * while the documented exemption is the one-key inline schema.\n */\nconst DEFAULT_MIN_PROPERTIES = 2;\n\n/** Wrappers that already pay the construction cost exactly once. */\nconst MEMO_CALLEES: ReadonlySet<string> = new Set([\n \"lazy\",\n \"memo\",\n \"once\",\n \"useMemo\",\n]);\n\n/**\n * Methods that CONSUME a value rather than extend the schema. The chain walk\n * stops before them: `z.object({...}).parse(raw)` closes over `raw`, but `raw`\n * is the input, not part of the schema, and the schema in front of it hoists\n * perfectly well.\n */\nconst TERMINAL_METHODS: ReadonlySet<string> = new Set([\n \"isNullable\",\n \"isOptional\",\n \"parse\",\n \"parseAsync\",\n \"safeParse\",\n \"safeParseAsync\",\n \"spa\",\n]);\n\n/**\n * Zod combinator methods that take a schema and return a schema. An enclosing\n * one means the reported factory is a FRAGMENT of a larger schema expression\n * rather than a schema in its own right — `AstroConfigSchema.extend({ … })`\n * is not a `z.*` call, so `isZodCall` cannot see it, and the fragment inside it\n * was reported on its own.\n */\nconst ZOD_COMBINATOR_METHODS: ReadonlySet<string> = new Set([\n \"and\",\n \"array\",\n \"catch\",\n \"catchall\",\n \"default\",\n \"extend\",\n \"merge\",\n \"or\",\n \"pipe\",\n \"refine\",\n \"superRefine\",\n \"transform\",\n]);\n\n/**\n * Callees that render text in the CURRENTLY ACTIVE locale.\n *\n * A zero-argument `() => z.object({ otp: z.string().length(6, t`…`) })` exists\n * PRECISELY so the Lingui macro runs after `i18n.activate(locale)`.\n * `closesOverNothing` skips `ImportBinding` defs, so `t` was invisible and the\n * rule advised a hoist that freezes every validation message in whatever locale\n * happened to be active at module-eval time — a correctness regression, not\n * noise. A tagged template is the macro spelling every i18n library uses.\n */\nconst I18N_CALLEE_NAMES: ReadonlySet<string> = new Set([\n \"$t\",\n \"defineMessage\",\n \"gettext\",\n \"msg\",\n \"ngettext\",\n \"t\",\n \"translate\",\n]);\n\n/** Receivers whose methods render locale-dependent text (`i18n._`, `intl.formatMessage`). */\nconst I18N_RECEIVER_NAMES: ReadonlySet<string> = new Set([\n \"$i18n\",\n \"i18n\",\n \"intl\",\n]);\n\nconst FUNCTION_TYPES: ReadonlySet<AST_NODE_TYPES> = new Set([\n AST_NODE_TYPES.ArrowFunctionExpression,\n AST_NODE_TYPES.FunctionDeclaration,\n AST_NODE_TYPES.FunctionExpression,\n]);\n\n/**\n * The whole schema EXPRESSION, not just the factory call: climb out through\n * `.refine(...)`, `.superRefine(...)`, `.transform(...)`, `.default(...)` and\n * every other builder method applied to it.\n */\nfunction schemaExpression(node: TSESTree.CallExpression): TSESTree.Node {\n let current: TSESTree.Node = node;\n for (;;) {\n const parent: TSESTree.Node | undefined = current.parent ?? undefined;\n if (parent === undefined) {\n return current;\n }\n if (\n parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === current &&\n !parent.computed &&\n parent.property.type === AST_NODE_TYPES.Identifier &&\n TERMINAL_METHODS.has(parent.property.name)\n ) {\n return current;\n }\n if (\n (parent.type === AST_NODE_TYPES.MemberExpression &&\n parent.object === current) ||\n (parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee === current) ||\n (parent.type === AST_NODE_TYPES.TSAsExpression &&\n parent.expression === current) ||\n (parent.type === AST_NODE_TYPES.TSNonNullExpression &&\n parent.expression === current)\n ) {\n current = parent;\n continue;\n }\n return current;\n }\n}\n\n/** The outermost function ancestor — hoisting targets module scope, not the nearest body. */\nfunction outermostEnclosingFunction(\n node: TSESTree.Node,\n): TSESTree.Node | undefined {\n let outermost: TSESTree.Node | undefined;\n let current: TSESTree.Node | undefined = node.parent ?? undefined;\n while (current !== undefined) {\n if (FUNCTION_TYPES.has(current.type)) {\n outermost = current;\n }\n current = current.parent ?? undefined;\n }\n return outermost;\n}\n\n/** Does any node in `root`'s subtree satisfy `predicate`? */\nfunction subtreeSome(\n root: TSESTree.Node,\n predicate: (node: TSESTree.Node) => boolean,\n): boolean {\n let found = false;\n const visit = (value: unknown): void => {\n if (found || value === null || typeof value !== \"object\") {\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item);\n }\n return;\n }\n const candidate = value as Partial<TSESTree.Node> & Record<string, unknown>;\n if (typeof candidate.type !== \"string\") {\n return;\n }\n if (predicate(candidate as TSESTree.Node)) {\n found = true;\n return;\n }\n for (const key of Object.keys(candidate)) {\n if (key === \"parent\" || key === \"loc\" || key === \"range\") {\n continue;\n }\n visit(candidate[key]);\n }\n };\n visit(root);\n return found;\n}\n\n/** `this` / `super` / `arguments` anywhere inside pins the schema to its receiver. */\nfunction readsReceiver(node: TSESTree.Node): boolean {\n return subtreeSome(\n node,\n (inner) =>\n inner.type === AST_NODE_TYPES.ThisExpression ||\n inner.type === AST_NODE_TYPES.Super ||\n (inner.type === AST_NODE_TYPES.Identifier && inner.name === \"arguments\"),\n );\n}\n\n/**\n * Does the schema build a string whose VALUE depends on when it is evaluated?\n *\n * See `I18N_CALLEE_NAMES`. Hoisting such a schema moves the render from\n * call time to module-eval time, which is a behaviour change, not a\n * refactor — so this is a hard bail rather than a heuristic penalty.\n */\nfunction buildsLocalizedText(node: TSESTree.Node): boolean {\n return subtreeSome(node, (inner) => {\n if (inner.type === AST_NODE_TYPES.TaggedTemplateExpression) {\n return true;\n }\n if (inner.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n const { callee } = inner;\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return I18N_CALLEE_NAMES.has(callee.name);\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n I18N_RECEIVER_NAMES.has(callee.object.name)\n );\n });\n}\n\nfunction collectReferences(\n scope: TSESLint.Scope.Scope,\n out: TSESLint.Scope.Reference[],\n): void {\n out.push(...scope.references);\n for (const child of scope.childScopes) {\n collectReferences(child, out);\n }\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-module-level-schema\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Declare a Zod schema at module scope when it closes over nothing in the enclosing function\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n factories: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Zod factory names to check. Defaults to the object-like composites; add `array` / `enum` to widen.\",\n },\n ignoreTestFiles: {\n type: \"boolean\",\n description:\n \"Skip test files, where a fixture schema belongs next to its assertion.\",\n },\n minProperties: {\n type: \"number\",\n minimum: 0,\n description:\n \"Minimum key count before an object-like schema is reported.\",\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n hoistSchema:\n \"Move this `{{factory}}` schema to module scope. It uses nothing from `{{owner}}`, so it is rebuilt on every call for no benefit and cannot be exported, reused, or `z.infer`-ed from where it is.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const factories = new Set(options?.factories ?? DEFAULT_FACTORIES);\n const ignoreTestFiles = options?.ignoreTestFiles ?? true;\n const minProperties = options?.minProperties ?? DEFAULT_MIN_PROPERTIES;\n\n const sourceCode = context.sourceCode;\n const filename = context.filename;\n if (isGeneratedFile(filename, sourceCode.getText())) {\n return {};\n }\n if (ignoreTestFiles && isTestFile(filename)) {\n return {};\n }\n\n const zodNamespaces = new Set<string>();\n\n function isZodCall(node: TSESTree.Node): node is TSESTree.CallExpression {\n return (\n node.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n !node.callee.computed &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n zodNamespaces.has(node.callee.object.name)\n );\n }\n\n function isCovered(node: TSESTree.CallExpression): boolean {\n let current: TSESTree.Node | undefined = node.parent ?? undefined;\n while (current !== undefined) {\n if (\n current !== node &&\n isZodCall(current) &&\n current.callee.type === AST_NODE_TYPES.MemberExpression &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n factories.has(current.callee.property.name)\n ) {\n return true;\n }\n if (\n current.type === AST_NODE_TYPES.CallExpression &&\n ((current.callee.type === AST_NODE_TYPES.Identifier &&\n MEMO_CALLEES.has(current.callee.name)) ||\n (current.callee.type === AST_NODE_TYPES.MemberExpression &&\n !current.callee.computed &&\n current.callee.property.type === AST_NODE_TYPES.Identifier &&\n MEMO_CALLEES.has(current.callee.property.name)))\n ) {\n return true;\n }\n current = current.parent ?? undefined;\n }\n return false;\n }\n\n /**\n * The OUTERMOST schema expression `expression` is a part of.\n *\n * `schemaExpression` climbs the builder chain hanging off the factory call;\n * this climbs the other axis — out of the shape object, the array, and the\n * argument list of whatever Zod construct encloses it. It exists because a\n * reported factory can be a FRAGMENT of a schema that does not itself move,\n * and prising one key's value out of an expression that is rebuilt per call\n * anyway saves nothing.\n */\n function outermostSchemaExpression(\n expression: TSESTree.Node,\n ): TSESTree.Node {\n // `confirmed` only advances past a Zod construct. Walking OUT of a shape\n // object is provisional until the call wrapping it turns out to be one:\n // `tool({ inputSchema: z.object({…}), execute })` also puts a schema in an\n // object literal, and treating that literal as the schema would inherit\n // `execute`'s free variables.\n let confirmed = expression;\n let current = expression;\n for (;;) {\n const parent: TSESTree.Node | undefined = current.parent ?? undefined;\n if (parent === undefined) {\n return confirmed;\n }\n if (\n (parent.type === AST_NODE_TYPES.Property && parent.value === current) ||\n parent.type === AST_NODE_TYPES.ObjectExpression ||\n parent.type === AST_NODE_TYPES.ArrayExpression\n ) {\n current = parent;\n continue;\n }\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.arguments.includes(current as TSESTree.CallExpressionArgument) &&\n isSchemaComposition(parent)\n ) {\n current = schemaExpression(parent);\n confirmed = current;\n continue;\n }\n return confirmed;\n }\n }\n\n /** A `z.*(…)` call, or a Zod combinator method applied to an existing schema. */\n function isSchemaComposition(node: TSESTree.CallExpression): boolean {\n // The combinator test runs FIRST: `isZodCall` is a type predicate, so\n // putting it on the left of `||` narrows `node` to `never` in the right\n // operand and the member access stops compiling.\n const { callee } = node;\n const isCombinator =\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n ZOD_COMBINATOR_METHODS.has(callee.property.name);\n return isCombinator || isZodCall(node);\n }\n\n /** No reference inside the schema resolves to a binding the function owns. */\n function closesOverNothing(\n node: TSESTree.Node,\n enclosing: TSESTree.Node,\n ): boolean {\n const references: TSESLint.Scope.Reference[] = [];\n collectReferences(sourceCode.getScope(node), references);\n const [schemaStart, schemaEnd] = node.range;\n const [functionStart, functionEnd] = enclosing.range;\n for (const reference of references) {\n const [identifierStart] = reference.identifier.range;\n if (identifierStart < schemaStart || identifierStart >= schemaEnd) {\n continue;\n }\n const resolved = reference.resolved;\n if (resolved === null) {\n continue;\n }\n for (const definition of resolved.defs) {\n if (definition.type === \"ImportBinding\") {\n continue;\n }\n const [defStart, defEnd] = definition.node.range;\n // A binding declared INSIDE the schema travels with it. The callback\n // parameters of `.refine((value) => …)` / `.superRefine((data, ctx) =>\n // …)` / `z.preprocess((value) => …, …)` are the whole class, and the\n // enclosing-range test alone answered \"this closes over the function\"\n // for every one of them — so any schema carrying a refinement was\n // silently unreportable. What the documented `documenso` case actually\n // needs is the callback reading an OUTER binding, and that still\n // resolves outside this range and still bails.\n if (defStart >= schemaStart && defEnd <= schemaEnd) {\n continue;\n }\n if (defStart >= functionStart && defEnd <= functionEnd) {\n return false;\n }\n }\n }\n return true;\n }\n\n /** How the enclosing function should be named in the message. */\n function ownerName(enclosing: TSESTree.Node): string {\n const parent = enclosing.parent ?? undefined;\n if (\n enclosing.type === AST_NODE_TYPES.FunctionDeclaration &&\n enclosing.id !== null\n ) {\n return enclosing.id.name;\n }\n if (\n parent !== undefined &&\n parent.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.id.name;\n }\n if (\n parent !== undefined &&\n (parent.type === AST_NODE_TYPES.MethodDefinition ||\n parent.type === AST_NODE_TYPES.Property) &&\n parent.key.type === AST_NODE_TYPES.Identifier\n ) {\n return parent.key.name;\n }\n return \"this function\";\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n CallExpression(node): void {\n if (zodNamespaces.size === 0 || !isZodCall(node)) {\n return;\n }\n const callee = node.callee as TSESTree.MemberExpression;\n if (callee.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n const factory = callee.property.name;\n if (!factories.has(factory)) {\n return;\n }\n const enclosing = outermostEnclosingFunction(node);\n if (enclosing === undefined) {\n return;\n }\n if (isCovered(node)) {\n return;\n }\n const shape = node.arguments[0];\n if (\n shape !== undefined &&\n shape.type === AST_NODE_TYPES.ObjectExpression &&\n shape.properties.length < minProperties\n ) {\n return;\n }\n const expression = schemaExpression(node);\n if (readsReceiver(expression)) {\n return;\n }\n if (buildsLocalizedText(expression)) {\n return;\n }\n // A fragment of a schema that cannot itself move is not reportable: the\n // enclosing expression is rebuilt on every call whatever we do to this\n // sub-schema. Only checked when an enclosing construct actually exists,\n // so `z.array(z.object({…}))` — where the whole expression IS hoistable\n // and `z.array` is not itself reportable — keeps reporting the inner\n // `z.object`, as the paired regression test requires.\n const outermost = outermostSchemaExpression(expression);\n if (\n outermost !== expression &&\n (readsReceiver(outermost) ||\n buildsLocalizedText(outermost) ||\n !closesOverNothing(outermost, enclosing))\n ) {\n return;\n }\n if (!closesOverNothing(expression, enclosing)) {\n return;\n }\n context.report({\n node,\n messageId: \"hoistSchema\",\n data: { factory: `z.${factory}`, owner: ownerName(enclosing) },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview _zod — the single source of truth for \"does this name read as a Zod schema?\".\n *\n */\n\n/** The `Z<Capital>` prefix convention: `ZUser`, `ZSubmitForm`. */\nexport const ZOD_PREFIX_RE = /^Z[A-Z]/;\n\n/** The `XxxSchema` suffix convention: `userSchema`, `SubmitFormDataSchema`. */\nexport const ZOD_SUFFIX_RE = /Schema$/;\n\n/** Either accepted convention. */\nexport const ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;\n\n/**\n * Whether an import specifier resolves to Zod — `zod`, `zod/v4`, `zod/mini`,\n * `@hono/zod-validator`-style re-exports. Shared by `prefer-zod-enum` and\n * `prefer-zod-infer` so the two cannot disagree about what \"imports Zod\" means.\n */\nexport function isZodModule(source: string): boolean {\n return /(^|[/@-])zod([/-]|$)/.test(source);\n}\n","/**\n * @fileoverview prefer-native-random-uuid — Node 22's native UUID generator makes the dependency unnecessary for UUID v4 calls.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-native-random-uuid.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"preferNative\" | \"replaceWithNative\";\ntype Options = readonly [];\n\ntype ScopeVariable = TSESLint.Scope.Variable;\n\nfunction requireUuid(node: TSESTree.Node | null): boolean {\n return (\n node?.type === AST_NODE_TYPES.CallExpression &&\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\" &&\n node.arguments.length === 1 &&\n node.arguments[0]?.type === AST_NODE_TYPES.Literal &&\n node.arguments[0].value === \"uuid\"\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-native-random-uuid\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.\",\n },\n hasSuggestions: true,\n schema: [],\n messages: {\n preferNative:\n \"Use the Node 22 native `globalThis.crypto.randomUUID()` instead of the `uuid` package for UUID v4.\",\n replaceWithNative: \"Replace this UUID v4 call with the native implementation.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const directBindings = new Set<ScopeVariable>();\n const namespaceBindings = new Set<ScopeVariable>();\n\n function resolve(identifier: TSESTree.Identifier): ScopeVariable | null {\n return ASTUtils.findVariable(context.sourceCode.getScope(identifier), identifier.name);\n }\n\n function record(identifier: TSESTree.Identifier, destination: Set<ScopeVariable>): void {\n const variable = resolve(identifier);\n if (variable !== null) destination.add(variable);\n }\n\n function report(node: TSESTree.CallExpression): void {\n context.report({\n node,\n messageId: \"preferNative\",\n suggest: [\n {\n messageId: \"replaceWithNative\",\n fix: (fixer) => fixer.replaceText(node, \"globalThis.crypto.randomUUID()\"),\n },\n ],\n });\n }\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration): void {\n if (node.source.value !== \"uuid\") return;\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n (specifier.imported.type === AST_NODE_TYPES.Identifier\n ? specifier.imported.name === \"v4\"\n : specifier.imported.value === \"v4\")\n ) {\n record(specifier.local, directBindings);\n } else if (specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier) {\n record(specifier.local, namespaceBindings);\n }\n }\n },\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n if (node.parent.kind !== \"const\" || !requireUuid(node.init)) return;\n if (\n node.init?.type !== AST_NODE_TYPES.CallExpression ||\n node.init.callee.type !== AST_NODE_TYPES.Identifier ||\n (resolve(node.init.callee)?.defs.length ?? 0) > 0\n ) {\n return;\n }\n if (node.id.type === AST_NODE_TYPES.Identifier) {\n record(node.id, namespaceBindings);\n return;\n }\n if (node.id.type !== AST_NODE_TYPES.ObjectPattern) return;\n for (const property of node.id.properties) {\n if (\n property.type === AST_NODE_TYPES.Property &&\n !property.computed &&\n ((property.key.type === AST_NODE_TYPES.Identifier && property.key.name === \"v4\") ||\n (property.key.type === AST_NODE_TYPES.Literal && property.key.value === \"v4\")) &&\n property.value.type === AST_NODE_TYPES.Identifier\n ) {\n record(property.value, directBindings);\n }\n }\n },\n \"CallExpression:exit\"(node: TSESTree.CallExpression): void {\n if (node.arguments.length !== 0) return;\n if (node.callee.type === AST_NODE_TYPES.Identifier) {\n const variable = resolve(node.callee);\n if (variable !== null && directBindings.has(variable)) report(node);\n return;\n }\n if (\n node.callee.type !== AST_NODE_TYPES.MemberExpression ||\n node.callee.computed ||\n node.callee.object.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.type !== AST_NODE_TYPES.Identifier ||\n node.callee.property.name !== \"v4\"\n ) {\n return;\n }\n const variable = resolve(node.callee.object);\n if (variable !== null && namespaceBindings.has(variable)) report(node);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-non-nullable-collection — `T[] | null` gives an empty collection two representations and a null check to every caller.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-non-nullable-collection.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"preferNonNullableCollection\";\ntype Options = readonly [];\n\nconst ARRAY_TYPE_NAMES: ReadonlySet<string> = new Set([\"Array\", \"ReadonlyArray\"]);\n\nfunction propertyName(node: TSESTree.TSPropertySignature | TSESTree.PropertyDefinition): string {\n const key = node.key;\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal) return String(key.value);\n return \"collection\";\n}\n\nfunction isArrayType(node: TSESTree.TypeNode): boolean {\n if (node.type === AST_NODE_TYPES.TSArrayType) return true;\n return (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.Identifier &&\n ARRAY_TYPE_NAMES.has(node.typeName.name)\n );\n}\n\nfunction isNullishType(node: TSESTree.TypeNode): boolean {\n return node.type === AST_NODE_TYPES.TSNullKeyword || node.type === AST_NODE_TYPES.TSUndefinedKeyword;\n}\n\nfunction isNullableArrayOnly(node: TSESTree.TSUnionType): boolean {\n const values = node.types.filter((member) => !isNullishType(member));\n return values.length > 0 && values.length < node.types.length && values.every(isArrayType);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-non-nullable-collection\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Require declared data-shape properties and direct aliases to use non-null arrays instead of explicit nullish unions.\",\n },\n schema: [],\n messages: {\n preferNonNullableCollection:\n \"`{{name}}` is a nullable array, so nullish and `[]` represent the same empty collection. Use a non-null array and default omitted values to `[]`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const normalizedFilename = context.filename.replaceAll(\"\\\\\", \"/\");\n if (\n isTestFile(context.filename) ||\n isGeneratedFile(context.filename, context.sourceCode.text) ||\n /\\/(?:vendor|vendored)\\//u.test(normalizedFilename)\n ) {\n return {};\n }\n\n function checkOptionalProperty(\n node: TSESTree.TSPropertySignature | TSESTree.PropertyDefinition,\n ): void {\n if (node.optional) return;\n const annotation = node.typeAnnotation?.typeAnnotation;\n if (annotation === undefined) return;\n if (annotation.type !== AST_NODE_TYPES.TSUnionType || !isNullableArrayOnly(annotation)) {\n return;\n }\n context.report({\n node,\n messageId: \"preferNonNullableCollection\",\n data: { name: propertyName(node) },\n });\n }\n\n return {\n TSPropertySignature: checkOptionalProperty,\n PropertyDefinition: checkOptionalProperty,\n TSTypeAliasDeclaration(node): void {\n if (node.typeAnnotation.type !== AST_NODE_TYPES.TSUnionType) return;\n if (!isNullableArrayOnly(node.typeAnnotation)) return;\n context.report({\n node,\n messageId: \"preferNonNullableCollection\",\n data: { name: node.id.name },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-schema-for-api-payload — reading a field off `response.json()` propagates `any` inward from the network boundary.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-schema-for-api-payload.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"unparsedJsonAccess\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** Peel TypeScript wrappers that do not affect the underlying value. */\nconst unwrap = (\n node: TSESTree.Node | null | undefined,\n): TSESTree.Node | null => {\n let current: TSESTree.Node | null | undefined = node;\n while (current !== null && current !== undefined) {\n if (\n current.type === AST_NODE_TYPES.TSAsExpression ||\n current.type === AST_NODE_TYPES.TSTypeAssertion ||\n current.type === AST_NODE_TYPES.TSNonNullExpression ||\n current.type === AST_NODE_TYPES.TSSatisfiesExpression\n ) {\n current = current.expression;\n } else if (current.type === AST_NODE_TYPES.ChainExpression) {\n current = current.expression;\n } else {\n break;\n }\n }\n return current ?? null;\n};\n\n/** Promise methods that preserve an unvalidated payload. */\nconst PROMISE_CHAIN_METHODS: ReadonlySet<string> = new Set([\n \"then\",\n \"catch\",\n \"finally\",\n]);\n\n/** True for `ZUser.parse` / `ZUser.safeParse` handed to a chain link as a callback. */\nconst isSchemaParseReference = (\n node: TSESTree.Node | null | undefined,\n): boolean => {\n const inner = unwrap(node);\n return (\n inner !== null &&\n inner.type === AST_NODE_TYPES.MemberExpression &&\n !inner.computed &&\n inner.property.type === AST_NODE_TYPES.Identifier &&\n (inner.property.name === \"parse\" || inner.property.name === \"safeParse\")\n );\n};\n\n/** Match optionally awaited `.json()` calls and non-local `JSON.parse()` calls. */\nconst isRawPayloadSource = (\n node: TSESTree.Node | null | undefined,\n): boolean => {\n let current = unwrap(node);\n if (current === null) return false;\n if (current.type === AST_NODE_TYPES.AwaitExpression) {\n current = unwrap(current.argument);\n }\n if (current === null || current.type !== AST_NODE_TYPES.CallExpression) {\n return false;\n }\n const callee = unwrap(current.callee);\n if (callee === null || callee.type !== AST_NODE_TYPES.MemberExpression) {\n return false;\n }\n const property = unwrap(callee.property);\n if (property === null || property.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n if (property.name === \"json\") {\n return true;\n }\n // Promise methods preserve taint unless their callback is a schema parser.\n if (PROMISE_CHAIN_METHODS.has(property.name)) {\n return (\n !current.arguments.some(isSchemaParseReference) &&\n isRawPayloadSource(callee.object)\n );\n }\n // Other `.parse()` calls may be the requested schema validation.\n const object = unwrap(callee.object);\n return (\n property.name === \"parse\" &&\n object !== null &&\n object.type === AST_NODE_TYPES.Identifier &&\n object.name === \"JSON\" &&\n !isLocalFileRead(current.arguments[0])\n );\n};\n\n/** Filesystem readers whose result is repo-local text, not a peer's payload. */\nconst FILE_READ_RE = /^(readFile|readFileSync|readJson|readJsonSync|readJSON)$/;\n\n/** Exempt repository-local JSON read through a recognized filesystem reader. */\nconst isLocalFileRead = (node: TSESTree.Node | null | undefined): boolean => {\n let found = false;\n const visit = (current: TSESTree.Node | null | undefined): void => {\n if (found || current === null || current === undefined) return;\n if (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = unwrap(current.callee);\n const name =\n callee?.type === AST_NODE_TYPES.Identifier\n ? callee.name\n : callee?.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : null;\n if (name !== null && FILE_READ_RE.test(name)) {\n found = true;\n return;\n }\n }\n for (const key of Object.keys(current) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = current[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n }\n };\n visit(node);\n return found;\n};\n\n/** Assertion helpers whose argument is being checked, not consumed. */\nconst ASSERTION_CALLEE_RE = /^(expect|assert|should|invariant)$/;\n\n/** Exempt reads consumed by an assertion such as `expect(value.id).toBe(1)`. */\nconst isInsideAssertion = (node: TSESTree.Node): boolean => {\n for (\n let current: TSESTree.Node | undefined | null = node.parent;\n current !== undefined && current !== null;\n current = current.parent\n ) {\n if (current.type !== AST_NODE_TYPES.CallExpression) continue;\n let callee: TSESTree.Node = current.callee;\n while (callee.type === AST_NODE_TYPES.MemberExpression) {\n callee = callee.object;\n }\n if (callee.type === AST_NODE_TYPES.CallExpression) {\n callee = callee.callee;\n }\n if (\n callee.type === AST_NODE_TYPES.Identifier &&\n ASSERTION_CALLEE_RE.test(callee.name)\n ) {\n return true;\n }\n }\n return false;\n};\n\nconst findVariable = (\n scope: Scope.Scope | null,\n name: string,\n): Scope.Variable | null => {\n let current: Scope.Scope | null = scope;\n while (current !== null) {\n const variable = current.set.get(name);\n if (variable !== undefined) return variable;\n current = current.upper;\n }\n return null;\n};\n\n/** Names that conventionally identify guards or validators. */\nconst GUARD_NAME_RE = /^(?:is|validate|parse|assert|decode|coerce)[A-Z]/;\n\n/** Exempt a field read used by `typeof`, `Array.isArray`, or a named validator. */\nconst isValidationRead = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | null | undefined = current.parent;\n while (\n parent !== null &&\n parent !== undefined &&\n (parent.type === AST_NODE_TYPES.TSAsExpression ||\n parent.type === AST_NODE_TYPES.TSTypeAssertion ||\n parent.type === AST_NODE_TYPES.TSNonNullExpression ||\n parent.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n parent.type === AST_NODE_TYPES.ChainExpression)\n ) {\n current = parent;\n parent = parent.parent;\n }\n if (parent === null || parent === undefined) return false;\n\n if (\n parent.type === AST_NODE_TYPES.UnaryExpression &&\n parent.operator === \"typeof\" &&\n parent.argument === current\n ) {\n return true;\n }\n if (\n parent.type !== AST_NODE_TYPES.CallExpression ||\n !parent.arguments.some((arg): boolean => arg === current)\n ) {\n return false;\n }\n const callee = parent.callee;\n if (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"Array\" &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"isArray\"\n ) {\n return parent.arguments.length === 1;\n }\n return (\n callee.type === AST_NODE_TYPES.Identifier && GUARD_NAME_RE.test(callee.name)\n );\n};\n\n/** Detect calls in boolean-test positions, including logical wrappers. */\nconst isGuardTestPosition = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n let parent: TSESTree.Node | null | undefined = current.parent;\n while (parent !== undefined && parent !== null) {\n switch (parent.type) {\n case AST_NODE_TYPES.UnaryExpression:\n case AST_NODE_TYPES.LogicalExpression:\n case AST_NODE_TYPES.ChainExpression:\n current = parent;\n parent = parent.parent;\n continue;\n case AST_NODE_TYPES.IfStatement:\n case AST_NODE_TYPES.ConditionalExpression:\n case AST_NODE_TYPES.WhileStatement:\n case AST_NODE_TYPES.DoWhileStatement:\n case AST_NODE_TYPES.ForStatement:\n return parent.test === current;\n default:\n return false;\n }\n }\n return false;\n};\n\nconst isUnvalidatedVariableRef = (\n node: TSESTree.Node | null | undefined,\n scope: Scope.Scope,\n tracked: ReadonlySet<Scope.Variable>,\n): boolean => {\n const unwrapped = unwrap(node);\n if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES.Identifier) {\n return false;\n }\n const variable = findVariable(scope, unwrapped.name);\n return variable !== null && tracked.has(variable);\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-schema-for-api-payload\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access.\",\n },\n schema: [],\n messages: {\n unparsedJsonAccess:\n \"Property access on an unvalidated payload (`response.json()` / `JSON.parse()`) without a schema parse. Pipe through `XSchema.parse(...)` (Zod) before reading fields.\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n // Fixtures and generated clients own validation at a different boundary.\n if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n\n const unvalidatedVariables = new Set<Scope.Variable>();\n\n /** Require every destructured binding to be validated. */\n const isFullyNarrowedPattern = (\n declarator: TSESTree.VariableDeclarator,\n ): boolean => {\n const declared = context.sourceCode.getDeclaredVariables(declarator);\n return (\n declared.length > 0 &&\n declared.every((variable) =>\n variable.references.some((reference) =>\n isValidationRead(reference.identifier),\n ),\n )\n );\n };\n\n const trackInitializer = (\n declarator: TSESTree.VariableDeclarator,\n ): void => {\n if (!isRawPayloadSource(declarator.init)) return;\n const declaredVars = context.sourceCode.getDeclaredVariables(declarator);\n const variable = declaredVars[0];\n if (variable !== undefined) {\n unvalidatedVariables.add(variable);\n }\n };\n\n return {\n VariableDeclarator(node): void {\n const scope = context.sourceCode.getScope(node);\n\n if (node.id.type === AST_NODE_TYPES.Identifier) {\n trackInitializer(node);\n return;\n }\n\n if (\n node.id.type === AST_NODE_TYPES.ObjectPattern ||\n node.id.type === AST_NODE_TYPES.ArrayPattern\n ) {\n if (isRawPayloadSource(node.init)) {\n if (!isFullyNarrowedPattern(node)) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\n }\n return;\n }\n if (\n isUnvalidatedVariableRef(node.init, scope, unvalidatedVariables)\n ) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\n }\n }\n },\n AssignmentExpression(node): void {\n const scope = context.sourceCode.getScope(node);\n\n if (node.left.type === AST_NODE_TYPES.Identifier) {\n const variable = findVariable(scope, node.left.name);\n if (variable === null) return;\n if (isRawPayloadSource(node.right)) {\n unvalidatedVariables.add(variable);\n } else {\n unvalidatedVariables.delete(variable);\n }\n return;\n }\n\n if (\n node.left.type === AST_NODE_TYPES.ObjectPattern ||\n node.left.type === AST_NODE_TYPES.ArrayPattern\n ) {\n if (isRawPayloadSource(node.right)) {\n context.report({\n node: node.left,\n messageId: \"unparsedJsonAccess\",\n });\n return;\n }\n if (\n isUnvalidatedVariableRef(node.right, scope, unvalidatedVariables)\n ) {\n context.report({\n node: node.left,\n messageId: \"unparsedJsonAccess\",\n });\n }\n }\n },\n CallExpression(node): void {\n if (node.callee.type !== AST_NODE_TYPES.Identifier) return;\n if (!GUARD_NAME_RE.test(node.callee.name) && !isGuardTestPosition(node)) {\n return;\n }\n const scope = context.sourceCode.getScope(node);\n for (const arg of node.arguments) {\n if (arg.type === AST_NODE_TYPES.SpreadElement) continue;\n const unwrapped = unwrap(arg);\n if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES.Identifier) {\n continue;\n }\n const variable = findVariable(scope, unwrapped.name);\n if (variable !== null) unvalidatedVariables.delete(variable);\n }\n },\n MemberExpression(node): void {\n if (isInsideAssertion(node)) return;\n if (isValidationRead(node)) return;\n const scope = context.sourceCode.getScope(node);\n const obj = unwrap(node.object);\n\n if (isRawPayloadSource(obj)) {\n // Validation and promise methods are calls, not payload field reads.\n const parent = node.parent;\n if (\n parent.type === AST_NODE_TYPES.CallExpression &&\n parent.callee === node &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n (node.property.name === \"parse\" ||\n node.property.name === \"safeParse\" ||\n PROMISE_CHAIN_METHODS.has(node.property.name))\n ) {\n return;\n }\n context.report({ node, messageId: \"unparsedJsonAccess\" });\n return;\n }\n\n if (\n obj !== null &&\n obj.type === AST_NODE_TYPES.Identifier &&\n isUnvalidatedVariableRef(obj, scope, unvalidatedVariables)\n ) {\n context.report({ node, messageId: \"unparsedJsonAccess\" });\n const variable = findVariable(scope, obj.name);\n if (variable !== null) {\n unvalidatedVariables.delete(variable);\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-semantic-colors — a raw palette class or hex literal pins a colour the design system can no longer retheme.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-semantic-colors.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\nimport { existsSync, readdirSync, readFileSync } from \"fs\";\nimport { dirname, join, parse } from \"path\";\n\nimport { createRule } from \"./_docs.js\";\nimport { classTokens, tailwindBase } from \"./_tailwind.js\";\n\ntype MessageIds = \"rawPalette\" | \"arbitraryColor\" | \"inlineColor\";\ntype Options = readonly [\n {\n requireSemanticTokens?: boolean;\n }?,\n];\n\nconst COLOR_PREFIXES =\n \"text|bg|border(?:-[trblxyse])?|ring(?:-offset)?|fill|stroke|from|via|to|divide|decoration|placeholder|accent|caret|shadow|outline\";\nconst PALETTE =\n \"red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone\";\nconst COLOR_FN = \"rgba?|hsla?|hwb|oklch|oklab|lab|lch|color\";\n\nconst PALETTE_STEP = \"50|[1-9]00|950\";\nconst RAW_PALETTE_RE = new RegExp(`^(?:${COLOR_PREFIXES})-(?:${PALETTE})-(?:${PALETTE_STEP})(?:/\\\\d{1,3})?$`);\nconst ARBITRARY_COLOR_RE = new RegExp(\n `^(?:${COLOR_PREFIXES})-\\\\[(?:#[0-9a-fA-F]{3,8}|(?:${COLOR_FN})\\\\([^\\\\]]*\\\\))\\\\]$`,\n \"i\",\n);\n\n/** Call expressions whose string args are className fragments. */\nconst CLASS_FNS = new Set<string>([\"cn\", \"clsx\", \"cva\", \"tv\", \"cx\", \"twMerge\", \"classnames\", \"classNames\"]);\nconst CLASS_NAME_RE = /class/i;\n\n/** CSS color-bearing properties, in their JSX (camelCase) and SVG-attribute forms. */\nconst STYLE_COLOR_PROPS = new Set<string>([\n \"color\",\n \"background\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"outlineColor\",\n \"caretColor\",\n \"textDecorationColor\",\n \"columnRuleColor\",\n \"fill\",\n \"stroke\",\n \"stopColor\",\n \"floodColor\",\n \"lightingColor\",\n]);\nconst RAW_COLOR_VALUE_RE = new RegExp(`#[0-9a-fA-F]{3,8}\\\\b|\\\\b(?:${COLOR_FN})\\\\s*\\\\(`, \"i\");\n\nconst CSS_VAR_REFERENCE_RE = /var\\(\\s*--/;\n\nconst STORIES_FILE_RE = /\\.stories\\.[cm]?[jt]sx?$/i;\n\n/** Broad token roles avoid silently disabling the rule for non-shadcn systems. */\nconst TOKEN_ROLES =\n \"background|foreground|primary|secondary|muted|accent|destructive|danger|success|warning|info|border|card|popover|surface|content|base|subtle|default|ring|input|fg|bg\";\nconst SEMANTIC_TOKEN_RE = new RegExp(\n `--(?:color-)?(?:${TOKEN_ROLES})\\\\b|(?:bg|text|border|ring|fill|stroke)-(?:ui-)?(?:${TOKEN_ROLES})\\\\b`,\n);\n\n/** Tailwind v4 declares its theme in CSS instead of a config file. */\nconst THEME_BLOCK_RE = /@theme\\b/;\n\n/** These files prove a token system exists even when its vocabulary comes from a preset. */\nconst PRESENCE_MARKERS = [\n \"components.json\",\n \"tailwind.config.js\",\n \"tailwind.config.cjs\",\n \"tailwind.config.mjs\",\n \"tailwind.config.ts\",\n \"tailwind.config.mts\",\n \"tailwind.config.cts\",\n];\n\n/** Stylesheets count only when their contents declare semantic tokens or an `@theme`. */\nconst CSS_DETECTION_FILES = [\n \"app/globals.css\",\n \"app/global.css\",\n \"app/styles/globals.css\",\n \"src/app/globals.css\",\n \"src/app/global.css\",\n \"src/global.css\",\n \"src/index.css\",\n \"src/styles/globals.css\",\n \"src/styles/index.css\",\n \"styles/globals.css\",\n \"styles/index.css\",\n];\n/** Workspace markers used when no `package.json#workspaces` declaration exists. */\nconst WORKSPACE_ROOT_FILES = [\n \"pnpm-workspace.yaml\",\n \"pnpm-workspace.yml\",\n \"turbo.json\",\n \"lerna.json\",\n];\n\n/** Where workspace packages live when the root declares no globs, or none parse. */\nconst DEFAULT_WORKSPACE_GLOBS = [\"packages/*\", \"apps/*\"];\n\n/** Upper bound on the sideways scan, so a huge monorepo cannot stall a lint run. */\nconst MAX_WORKSPACE_PACKAGES = 512;\n\n/** \"Is there a detection file at or above this directory?\" — a pure ancestry fact. */\nconst ancestryCache = new Map<string, boolean>();\n\n/** \"Does any package of this workspace carry a detection file?\", keyed by root. */\nconst workspaceScanCache = new Map<string, boolean>();\n\n/** Nearest workspace root at or above a directory, `null` if there is none. */\nconst workspaceRootCache = new Map<string, string | null>();\n\n/** SVG container elements whose children carry structural (not UI-token) colors. */\nconst SVG_DEFS_CONTAINERS = new Set<string>([\n \"mask\",\n \"clipPath\",\n \"defs\",\n \"pattern\",\n \"linearGradient\",\n \"radialGradient\",\n]);\n\n/** Neutral fill/stroke literals that are SVG drawing data, never a UI token. */\nconst SVG_EXEMPT_COLOR_VALUES = new Set<string>([\n \"#fff\",\n \"#ffffff\",\n \"#000\",\n \"#000000\",\n \"transparent\",\n \"none\",\n \"currentcolor\",\n \"inherit\",\n]);\n\n// SVG subtree colors are artwork data rather than reusable UI tokens.\nfunction jsxElementName(node: TSESTree.JSXElement): string | null {\n const name = node.openingElement.name;\n if (name.type === AST_NODE_TYPES.JSXIdentifier) return name.name;\n if (name.type === AST_NODE_TYPES.JSXMemberExpression && name.property.type === AST_NODE_TYPES.JSXIdentifier) {\n return name.property.name;\n }\n return null;\n}\n\nfunction isSvgLikeElementName(name: string): boolean {\n return name === \"svg\" || SVG_DEFS_CONTAINERS.has(name) || /svg$/i.test(name);\n}\n\n/** Intrinsic SVG shapes carry artwork colors; `className` and `style` remain checked. */\nconst SVG_SHAPE_PRIMITIVES = new Set<string>([\n \"circle\",\n \"ellipse\",\n \"g\",\n \"line\",\n \"path\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"text\",\n \"tspan\",\n \"use\",\n]);\n\n/** Email and PDF renderers cannot resolve CSS-variable-backed semantic tokens. */\nconst EMAIL_OR_PDF_MODULE_RE = /^@react-(?:email|pdf)\\//;\n\nconst isInsideSvg = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node | null | undefined = node.parent;\n while (current !== undefined && current !== null) {\n if (current.type === AST_NODE_TYPES.JSXElement) {\n const name = jsxElementName(current);\n if (name !== null && isSvgLikeElementName(name)) return true;\n }\n current = current.parent;\n }\n return false;\n};\n\nconst isInsideIconFactoryPath = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node | null | undefined = node.parent;\n while (current !== undefined && current !== null) {\n if (\n current.type === AST_NODE_TYPES.Property &&\n propName(current.key) === \"path\" &&\n current.parent.type === AST_NODE_TYPES.ObjectExpression &&\n current.parent.parent.type === AST_NODE_TYPES.CallExpression &&\n current.parent.parent.callee.type === AST_NODE_TYPES.Identifier &&\n current.parent.parent.callee.name === \"createIcon\"\n ) {\n return true;\n }\n current = current.parent;\n }\n return false;\n};\n\n/** Does this one directory carry a design-token marker? */\nconst hasMarkerAt = (dir: string): boolean => {\n if (PRESENCE_MARKERS.some((rel) => existsSync(join(dir, rel)))) return true;\n for (const rel of CSS_DETECTION_FILES) {\n const candidate = join(dir, rel);\n if (!existsSync(candidate)) continue;\n try {\n const css = readFileSync(candidate, \"utf8\");\n if (SEMANTIC_TOKEN_RE.test(css) || THEME_BLOCK_RE.test(css)) return true;\n } catch {\n // Ignore unreadable stylesheets; absence of evidence means no report.\n }\n }\n return false;\n};\n\n/** Walk to the filesystem root and cache the resolved ancestry answer. */\nconst hasMarkerAtOrAbove = (startDir: string): boolean => {\n let dir = startDir;\n const root = parse(dir).root;\n const visited: string[] = [];\n let answer: boolean;\n\n for (;;) {\n const cached = ancestryCache.get(dir);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n visited.push(dir);\n if (hasMarkerAt(dir)) {\n answer = true;\n break;\n }\n const parent = dirname(dir);\n if (dir === root || parent === dir) {\n answer = false;\n break;\n }\n dir = parent;\n }\n\n for (const seen of visited) ancestryCache.set(seen, answer);\n return answer;\n};\n\n/** Read workspace globs without adding a YAML dependency to the rule. */\nconst readWorkspaceGlobs = (dir: string): string[] => {\n const globs: string[] = [];\n\n const packageJson = join(dir, \"package.json\");\n if (existsSync(packageJson)) {\n try {\n const parsed: unknown = JSON.parse(readFileSync(packageJson, \"utf8\"));\n const declared =\n typeof parsed === \"object\" && parsed !== null && \"workspaces\" in parsed\n ? (parsed as { workspaces?: unknown }).workspaces\n : undefined;\n const list = Array.isArray(declared)\n ? declared\n : typeof declared === \"object\" &&\n declared !== null &&\n Array.isArray((declared as { packages?: unknown }).packages)\n ? (declared as { packages: unknown[] }).packages\n : [];\n for (const entry of list) if (typeof entry === \"string\") globs.push(entry);\n } catch {\n // A malformed package.json is not this rule's problem to report.\n }\n }\n\n for (const name of [\"pnpm-workspace.yaml\", \"pnpm-workspace.yml\"]) {\n const yaml = join(dir, name);\n if (!existsSync(yaml)) continue;\n try {\n for (const line of readFileSync(yaml, \"utf8\").split(\"\\n\")) {\n const match = /^\\s*-\\s*[\"']?([^\"'#\\s]+)[\"']?\\s*$/u.exec(line);\n if (match?.[1] !== undefined) globs.push(match[1]);\n }\n } catch {\n // Same.\n }\n }\n\n return globs;\n};\n\n/** Expand a workspace glob one level: `packages/*`, `packages/**`, or a literal path. */\nconst expandWorkspaceGlob = (root: string, glob: string): string[] => {\n const star = glob.indexOf(\"*\");\n if (star === -1) return [join(root, glob)];\n\n const prefix = glob.slice(0, star).replace(/\\/$/u, \"\");\n const parent = prefix === \"\" ? root : join(root, prefix);\n try {\n return readdirSync(parent, { withFileTypes: true })\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith(\".\"))\n .map((entry) => join(parent, entry.name));\n } catch {\n return [];\n }\n};\n\n/** Nearest directory at or above `startDir` that declares a multi-package workspace. */\nconst findWorkspaceRoot = (startDir: string): string | null => {\n let dir = startDir;\n const root = parse(dir).root;\n const visited: string[] = [];\n let answer: string | null;\n\n for (;;) {\n const cached = workspaceRootCache.get(dir);\n if (cached !== undefined) {\n answer = cached;\n break;\n }\n visited.push(dir);\n if (\n WORKSPACE_ROOT_FILES.some((name) => existsSync(join(dir, name))) ||\n readWorkspaceGlobs(dir).length > 0\n ) {\n answer = dir;\n break;\n }\n const parent = dirname(dir);\n if (dir === root || parent === dir) {\n answer = null;\n break;\n }\n dir = parent;\n }\n\n for (const seen of visited) workspaceRootCache.set(seen, answer);\n return answer;\n};\n\n/** Scan sibling packages because their token config is not on the source file's ancestry. */\nconst workspaceHasMarker = (root: string): boolean => {\n const cached = workspaceScanCache.get(root);\n if (cached !== undefined) return cached;\n\n const globs = readWorkspaceGlobs(root);\n const candidates = new Set<string>();\n for (const glob of globs.length > 0 ? globs : DEFAULT_WORKSPACE_GLOBS) {\n for (const dir of expandWorkspaceGlob(root, glob)) {\n candidates.add(dir);\n if (candidates.size >= MAX_WORKSPACE_PACKAGES) break;\n }\n if (candidates.size >= MAX_WORKSPACE_PACKAGES) break;\n }\n\n let found = false;\n for (const dir of candidates) {\n if (hasMarkerAt(dir)) {\n found = true;\n break;\n }\n }\n workspaceScanCache.set(root, found);\n return found;\n};\n\n/** Does a design-token system exist anywhere this file's project can see? */\nconst hasSemanticTokenSystem = (filename: string): boolean => {\n const dir = dirname(filename);\n if (hasMarkerAtOrAbove(dir)) return true;\n const root = findWorkspaceRoot(dir);\n return root !== null && workspaceHasMarker(root);\n};\n\nconst propName = (key: TSESTree.Property[\"key\"]): string | null => {\n if (key.type === AST_NODE_TYPES.Identifier) return key.name;\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") return key.value;\n return null;\n};\n\nconst staticallyImportsEmailOrPdfRenderer = (program: TSESTree.Program): boolean =>\n program.body.some((statement) => {\n if (\n statement.type !== AST_NODE_TYPES.ImportDeclaration &&\n statement.type !== AST_NODE_TYPES.ExportNamedDeclaration &&\n statement.type !== AST_NODE_TYPES.ExportAllDeclaration\n ) {\n return false;\n }\n return (\n statement.source !== null &&\n typeof statement.source.value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(statement.source.value)\n );\n });\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-semantic-colors\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce design-system semantic color tokens (bg-primary, text-destructive, …) over raw Tailwind palette classes (text-red-500), arbitrary color values (bg-[#fff]), and inline color literals.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n requireSemanticTokens: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n rawPalette:\n \"Raw palette class '{{class}}' — use a semantic token (e.g. text-foreground, bg-primary, text-destructive, bg-muted).\",\n arbitraryColor:\n \"Hardcoded color '{{class}}' — use a semantic token, or var(--…). For charts/brand add an eslint-disable with a reason.\",\n inlineColor:\n \"Hardcoded color '{{value}}' — use a semantic token / CSS variable. For charts/standalone pages add an eslint-disable with a reason.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n if (STORIES_FILE_RE.test(context.filename)) return {};\n if (staticallyImportsEmailOrPdfRenderer(context.sourceCode.ast)) return {};\n if (options?.requireSemanticTokens === true && !hasSemanticTokenSystem(context.filename)) {\n return {};\n }\n\n let importsEmailOrPdfRenderer = false;\n const pendingReports: Array<{\n node: TSESTree.Node;\n messageId: MessageIds;\n data: Record<string, string>;\n }> = [];\n const report = (\n node: TSESTree.Node,\n messageId: MessageIds,\n data: Record<string, string>,\n ): void => {\n pendingReports.push({ node, messageId, data });\n };\n\n const reportClasses = (value: string, node: TSESTree.Node): void => {\n for (const token of classTokens(value)) {\n const base = tailwindBase(token);\n if (RAW_PALETTE_RE.test(base)) {\n report(node, \"rawPalette\", { class: token });\n } else if (ARBITRARY_COLOR_RE.test(base) && !CSS_VAR_REFERENCE_RE.test(base)) {\n report(node, \"arbitraryColor\", { class: token });\n }\n }\n };\n\n // Recurse through class fragments but leave calls to the CallExpression visitor.\n const checkClassNode = (node: TSESTree.Node | null): void => {\n if (node === null) return;\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n if (typeof node.value === \"string\") reportClasses(node.value, node);\n break;\n case AST_NODE_TYPES.TemplateLiteral:\n for (const quasi of node.quasis) reportClasses(quasi.value.cooked ?? \"\", quasi);\n break;\n case AST_NODE_TYPES.ArrayExpression:\n for (const element of node.elements) {\n if (element !== null && element.type !== AST_NODE_TYPES.SpreadElement) checkClassNode(element);\n }\n break;\n case AST_NODE_TYPES.ObjectExpression:\n for (const property of node.properties) {\n if (property.type === AST_NODE_TYPES.Property) checkClassNode(property.value);\n }\n break;\n case AST_NODE_TYPES.ConditionalExpression:\n checkClassNode(node.consequent);\n checkClassNode(node.alternate);\n break;\n case AST_NODE_TYPES.LogicalExpression:\n checkClassNode(node.right);\n break;\n default:\n break;\n }\n };\n\n const checkColorValueNode = (node: TSESTree.Node): void => {\n if (\n node.type === AST_NODE_TYPES.Literal &&\n typeof node.value === \"string\" &&\n RAW_COLOR_VALUE_RE.test(node.value) &&\n !CSS_VAR_REFERENCE_RE.test(node.value)\n ) {\n report(node, \"inlineColor\", { value: node.value });\n }\n };\n\n return {\n \"JSXAttribute[name.name='className']\"(node: TSESTree.JSXAttribute): void {\n if (node.value === null) return;\n if (node.value.type === AST_NODE_TYPES.Literal) checkClassNode(node.value);\n else if (node.value.type === AST_NODE_TYPES.JSXExpressionContainer) {\n if (node.value.expression.type !== AST_NODE_TYPES.JSXEmptyExpression) {\n checkClassNode(node.value.expression);\n }\n }\n },\n CallExpression(node: TSESTree.CallExpression): void {\n if (\n node.callee.type === AST_NODE_TYPES.Identifier &&\n node.callee.name === \"require\" &&\n node.arguments[0]?.type === AST_NODE_TYPES.Literal &&\n typeof node.arguments[0].value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)\n ) {\n importsEmailOrPdfRenderer = true;\n }\n if (node.callee.type === AST_NODE_TYPES.Identifier && CLASS_FNS.has(node.callee.name)) {\n for (const arg of node.arguments) {\n if (arg.type !== AST_NODE_TYPES.SpreadElement) checkClassNode(arg);\n }\n }\n },\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n if (node.id.type === AST_NODE_TYPES.Identifier && CLASS_NAME_RE.test(node.id.name)) {\n checkClassNode(node.init);\n }\n },\n Property(node: TSESTree.Property): void {\n const name = propName(node.key);\n if (name !== null && CLASS_NAME_RE.test(name)) checkClassNode(node.value);\n },\n // SVG artwork colors are exempt; component presentation colors still report.\n \"JSXAttribute[name.name=/^(fill|stroke|color)$/]\"(node: TSESTree.JSXAttribute): void {\n if (node.value?.type !== AST_NODE_TYPES.Literal) return;\n const owner = node.parent.name;\n if (owner.type === AST_NODE_TYPES.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {\n return;\n }\n if (\n typeof node.value.value === \"string\" &&\n SVG_EXEMPT_COLOR_VALUES.has(node.value.value.toLowerCase())\n ) {\n return;\n }\n if (isInsideSvg(node) || isInsideIconFactoryPath(node)) return;\n checkColorValueNode(node.value);\n },\n \"JSXAttribute[name.name='style'] ObjectExpression > Property\"(node: TSESTree.Property): void {\n const name = propName(node.key);\n if (name !== null && STYLE_COLOR_PROPS.has(name)) checkColorValueNode(node.value);\n },\n ImportExpression(node: TSESTree.ImportExpression): void {\n if (\n node.source.type === AST_NODE_TYPES.Literal &&\n typeof node.source.value === \"string\" &&\n EMAIL_OR_PDF_MODULE_RE.test(node.source.value)\n ) {\n importsEmailOrPdfRenderer = true;\n }\n },\n \"Program:exit\"(): void {\n if (importsEmailOrPdfRenderer) return;\n for (const descriptor of pendingReports) context.report(descriptor);\n },\n };\n },\n});\n","/**\n * @fileoverview _tailwind — shared className-position helpers, so the Tailwind rules visit string literals and template quasis alike.\n *\n */\n\n/**\n * Strip Tailwind variant prefixes (`hover:`, `dark:`, `focus-visible:`, …) and a\n * leading `!` important marker, leaving the bare utility. Variants are\n * `[a-z0-9-]+:` runs at the start; a bracketed arbitrary value never starts a\n * token, so the `:` inside `[url(http://…)]` is not a variant separator.\n */\nexport const tailwindBase = (token: string): string =>\n token.replace(/^(?:[a-z0-9-]+:)+/i, \"\").replace(/^!/, \"\");\n\n/** Split a className string into its non-empty class tokens. */\nexport const classTokens = (value: string): readonly string[] =>\n value.split(/\\s+/).filter(Boolean);\n","/**\n * @fileoverview prefer-server-actions — an internal `/api/*` mutation hand-rolls the transport, types and error path a Server Action gets from the framework.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-server-actions.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"preferServerAction\";\ntype Options = readonly [];\n\nconst MUTATION_METHODS = new Set([\"POST\", \"PUT\", \"DELETE\", \"PATCH\"]);\nconst AXIOS_MUTATION_METHODS = new Set([\"post\", \"put\", \"delete\", \"patch\"]);\n\nconst SKIP_FILE_REGEX =\n /(?:\\.test\\.[jt]sx?$|\\.spec\\.[jt]sx?$|-(?:test|spec)\\.[jt]sx?$|\\/tests?\\/|\\/__tests__\\/|\\/__testfixtures__\\/|\\/scripts?\\/|\\/app\\/api\\/.*\\/route\\.[jt]sx?$|\\/pages\\/api\\/)/;\n\nconst NON_REACT_FRAMEWORK_RE =\n /^(?:@angular\\/|@nestjs\\/|vue$|vue\\/|svelte$|svelte\\/|solid-js$|solid-js\\/|@ember\\/|rxjs$|rxjs\\/)/;\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\nfunction getScope(\n context: Ctx,\n node: TSESTree.Node,\n): Scope.Scope {\n return context.sourceCode.getScope(node);\n}\n\n/**\n * Walk up the scope chain looking for a variable declared with a single\n * initializer; if found, return the initializer expression so we can analyze\n * it. Falls back to the original node when resolution is not possible.\n */\nfunction resolveNode(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): TSESTree.Node | null {\n if (!node) return null;\n if (node.type !== \"Identifier\") return node;\n\n let scope: Scope.Scope | null = getScope(context, node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (variable && variable.defs.length === 1) {\n const def = variable.defs[0];\n if (def && def.type === \"Variable\") {\n const declarator = def.node;\n if (\n declarator.type === \"VariableDeclarator\" &&\n declarator.init\n ) {\n return declarator.init;\n }\n }\n }\n scope = scope.upper;\n }\n return node;\n}\n\nfunction isApiUrl(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (!resolved) return false;\n\n if (resolved.type === \"Literal\" && typeof resolved.value === \"string\") {\n return resolved.value.startsWith(\"/api/\");\n }\n if (resolved.type === \"TemplateLiteral\") {\n const firstQuasi = resolved.quasis[0];\n const cooked = firstQuasi?.value.cooked;\n return typeof cooked === \"string\" && cooked.startsWith(\"/api/\");\n }\n if (resolved.type === \"BinaryExpression\" && resolved.operator === \"+\") {\n return isApiUrl(resolved.left, context);\n }\n return false;\n}\n\nfunction isMutationMethod(\n node: TSESTree.Node | null | undefined,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (!resolved) return false;\n\n if (resolved.type === \"Literal\" && typeof resolved.value === \"string\") {\n return MUTATION_METHODS.has(resolved.value.toUpperCase());\n }\n\n if (\n resolved.type === \"TemplateLiteral\" &&\n resolved.expressions.length === 0\n ) {\n const val = resolved.quasis.map((q) => q.value.cooked).join(\"\");\n return MUTATION_METHODS.has(val.toUpperCase());\n }\n\n if (resolved.type === \"ConditionalExpression\") {\n return (\n isMutationMethod(resolved.consequent, context) ||\n isMutationMethod(resolved.alternate, context)\n );\n }\n\n if (resolved.type === \"LogicalExpression\" && resolved.operator === \"||\") {\n return (\n isMutationMethod(resolved.left, context) ||\n isMutationMethod(resolved.right, context)\n );\n }\n\n return false;\n}\n\nfunction isFunctionArgument(\n node: TSESTree.CallExpressionArgument,\n context: Ctx,\n): boolean {\n const resolved = resolveNode(node, context);\n if (\n resolved?.type === \"ArrowFunctionExpression\" ||\n resolved?.type === \"FunctionExpression\"\n ) {\n return true;\n }\n if (node.type !== \"Identifier\") return false;\n\n let scope: Scope.Scope | null = getScope(context, node);\n while (scope) {\n const variable = scope.set.get(node.name);\n if (\n variable?.defs.some((definition) => definition.type === \"FunctionName\")\n ) {\n return true;\n }\n scope = scope.upper;\n }\n return false;\n}\n\nfunction getPropertyNode(\n objNode: TSESTree.Node | null | undefined,\n propName: string,\n): TSESTree.Node | null {\n if (!objNode || objNode.type !== \"ObjectExpression\") return null;\n for (const prop of objNode.properties) {\n if (prop.type !== \"Property\") continue;\n let keyName: string | null = null;\n if (prop.key.type === \"Identifier\" && !prop.computed) {\n keyName = prop.key.name;\n } else if (\n prop.key.type === \"Literal\" &&\n typeof prop.key.value === \"string\"\n ) {\n keyName = prop.key.value;\n }\n if (keyName === propName) {\n // Skip destructuring patterns — they're not valid as config values.\n if (\n prop.value.type === \"AssignmentPattern\" ||\n prop.value.type === \"ArrayPattern\" ||\n prop.value.type === \"ObjectPattern\"\n ) {\n return null;\n }\n return prop.value;\n }\n }\n return null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-server-actions\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Prefer Next.js Server Actions over /api/* mutations.\",\n },\n schema: [],\n messages: {\n preferServerAction:\n \"Mutation against /api/* — prefer a Next.js Server Action for type-safety and to avoid the JSON round-trip.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n if (SKIP_FILE_REGEX.test(filename)) {\n return {};\n }\n\n const isNonReactFramework = context.sourceCode.ast.body.some(\n (node) =>\n node.type === \"ImportDeclaration\" &&\n typeof node.source.value === \"string\" &&\n NON_REACT_FRAMEWORK_RE.test(node.source.value),\n );\n\n return {\n CallExpression(node) {\n if (isNonReactFramework) return;\n let isMutation = false;\n\n // 1. Standard fetch('/api/orders', { method: 'POST' })\n if (\n node.callee.type === \"Identifier\" &&\n node.callee.name === \"fetch\"\n ) {\n const urlArg = node.arguments[0];\n if (urlArg && urlArg.type !== \"SpreadElement\" && isApiUrl(urlArg, context)) {\n const initArg = node.arguments[1];\n if (initArg && initArg.type !== \"SpreadElement\") {\n const resolvedInit = resolveNode(initArg, context);\n const methodNode = getPropertyNode(resolvedInit, \"method\");\n if (methodNode && isMutationMethod(methodNode, context)) {\n isMutation = true;\n }\n }\n }\n }\n // 2. Custom wrappers or Axios: api.post('/api/orders') or axios.put('/api/orders')\n else if (\n node.callee.type === \"MemberExpression\" &&\n node.callee.property.type === \"Identifier\" &&\n !node.callee.computed\n ) {\n const methodName = node.callee.property.name.toLowerCase();\n if (AXIOS_MUTATION_METHODS.has(methodName)) {\n const urlArg = node.arguments[0];\n const hasHandlerArg = node.arguments.some(\n (arg) =>\n arg.type !== \"SpreadElement\" &&\n isFunctionArgument(arg, context),\n );\n if (\n urlArg &&\n urlArg.type !== \"SpreadElement\" &&\n !hasHandlerArg &&\n isApiUrl(urlArg, context)\n ) {\n isMutation = true;\n }\n }\n }\n // 3. Direct axios/request call: axios({ method: 'post', url: '/api/orders' })\n else if (\n node.callee.type === \"Identifier\" &&\n (node.callee.name === \"axios\" || node.callee.name === \"request\")\n ) {\n const firstArg = node.arguments[0];\n if (firstArg && firstArg.type !== \"SpreadElement\") {\n const configArg = resolveNode(firstArg, context);\n if (configArg && configArg.type === \"ObjectExpression\") {\n const urlNode = getPropertyNode(configArg, \"url\");\n const methodNode = getPropertyNode(configArg, \"method\");\n if (\n urlNode &&\n isApiUrl(urlNode, context) &&\n methodNode &&\n isMutationMethod(methodNode, context)\n ) {\n isMutation = true;\n }\n }\n }\n }\n\n if (isMutation) {\n context.report({ node, messageId: \"preferServerAction\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-single-sentence-comment — two sentences should be reduced to one.\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-single-sentence-comment.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport { proseGroups, sentenceUnits } from \"./_prose-budget.js\";\n\ntype MessageIds = \"preferOneSentence\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-single-sentence-comment\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Prefer one sentence and self-documenting code over a two-sentence comment.\" },\n schema: [],\n messages: {\n preferOneSentence: \"Two-sentence comment — prefer one sentence and self-documenting code.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(): void {\n for (const group of proseGroups(context.filename, context.sourceCode)) {\n if (!group.hasTypedTags && sentenceUnits(group.text) === 2) {\n context.report({ node: group.comment, messageId: \"preferOneSentence\" });\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-string-literal-union — a raw `string` field with a closed set of values accepts every value outside it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-string-literal-union.test.ts\n */\n\nimport { createRule } from \"./_docs.js\";\nimport {\n ESLintUtils,\n type TSESTree,\n type ParserServicesWithTypeInformation,\n AST_NODE_TYPES,\n} from \"@typescript-eslint/utils\";\nimport * as ts from \"typescript\";\n\ntype MessageIds = \"bareChoiceField\" | \"comparisonCluster\";\ntype Options = readonly [\n {\n ignoreFields?: readonly string[];\n }?,\n];\n\ntype FunctionNode =\n | TSESTree.FunctionDeclaration\n | TSESTree.FunctionExpression\n | TSESTree.ArrowFunctionExpression;\n\nconst CHOICE_TOKENS: ReadonlySet<string> = new Set([\n \"status\",\n \"state\",\n \"kind\",\n \"role\",\n \"priority\",\n \"severity\",\n \"direction\",\n \"tier\",\n \"stage\",\n \"type\",\n \"mode\",\n \"level\",\n]);\n\nconst LOWER_TOKEN_RE = /^[a-z][a-z0-9_-]{0,30}$/;\nconst MIN_CLUSTER_SIZE = 2;\n\nconst BOOLEANISH: ReadonlySet<string> = new Set([\"true\", \"false\"]);\n\n/**\n * An enum-shaped token worth a string-literal union: a short lowercase word of\n * 2+ chars that isn't a boolean-string. Single characters (`'a'`), file\n * paths/URLs/i18n keys (contain `/`, `:`, `.`), and `'true'`/`'false'` are NOT\n * closed-enum members — comparing against them is a flag/path/boolean guard.\n */\n\nfunction isEnumToken(lit: string): boolean {\n return LOWER_TOKEN_RE.test(lit) && lit.length >= 2 && !BOOLEANISH.has(lit);\n}\n\nconst IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\n /\\.d\\.ts$/,\n];\n\nfunction isIgnoredFile(filename: string, sourceText: string): boolean {\n if (IGNORE_PATTERNS.some((re) => re.test(filename))) {\n return true;\n }\n return /@generated\\b/.test(sourceText.slice(0, 1024));\n}\n\n/**\n * The trailing word of a camelCase / snake_case identifier, lowercased.\n * `callStatus` -> `status`, `user_role` -> `role`, `estate` -> `estate`.\n */\nfunction lastWord(name: string): string {\n const words = name\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .split(/[_\\s]+/)\n .filter((w) => w.length > 0);\n const last = words[words.length - 1] ?? name;\n return last.toLowerCase();\n}\n\nfunction isChoiceLikeName(name: string): boolean {\n return CHOICE_TOKENS.has(lastWord(name));\n}\n\nfunction keyName(\n key: TSESTree.PropertyDefinition[\"key\"] | TSESTree.PropertyName,\n): string | null {\n if (key.type === AST_NODE_TYPES.Identifier) {\n return key.name;\n }\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n}\n\nfunction isStringLiteralMember(t: TSESTree.TypeNode): boolean {\n return (\n t.type === AST_NODE_TYPES.TSLiteralType &&\n t.literal.type === AST_NODE_TYPES.Literal &&\n typeof t.literal.value === \"string\"\n );\n}\n\n/** Whether a type node is a union of 2+ string-literal types. */\nfunction isStringLiteralUnion(node: TSESTree.TypeNode | undefined): boolean {\n if (node?.type !== AST_NODE_TYPES.TSUnionType) {\n return false;\n }\n return node.types.filter(isStringLiteralMember).length >= MIN_CLUSTER_SIZE;\n}\n\n/**\n * Whether a resolved TS type includes the general `string` type — as opposed to\n * being (a union of) string-literal types. `CallStatus = \"a\" | \"b\"` has no\n * general-string member and is already the target state; a raw `string` (or\n * `string | undefined`) does, and a comparison cluster on it should become a\n * union. Requires type information; the comparison-cluster path is inert\n * without it.\n */\nfunction typeHasRawString(type: ts.Type): boolean {\n const parts = type.isUnion() ? type.types : [type];\n return parts.some((t) => (t.flags & ts.TypeFlags.String) !== 0);\n}\n\nfunction isExternalSourceFile(sf: ts.SourceFile | undefined): boolean {\n if (sf === undefined) {\n return false;\n }\n return sf.isDeclarationFile || sf.fileName.includes(\"/node_modules/\");\n}\n\nfunction symbolIsExternallyDeclared(sym: ts.Symbol | undefined): boolean {\n return (\n sym?.declarations?.some((d) => isExternalSourceFile(d.getSourceFile())) ??\n false\n );\n}\n\n/**\n * The iterable expression a destructuring binding element draws its value from,\n * e.g. `Object.entries(x)` for `key` in `for (const [key] of Object.entries(x))`\n * or the RHS of `const { a } = rhs`.\n */\nfunction bindingSourceExpression(\n decl: ts.BindingElement,\n): ts.Expression | undefined {\n let node: ts.Node = decl.parent;\n while (\n !ts.isForOfStatement(node) &&\n !(ts.isVariableDeclaration(node) && node.initializer !== undefined)\n ) {\n if (node.parent === undefined) {\n return undefined;\n }\n node = node.parent;\n }\n return ts.isForOfStatement(node) ? node.expression : node.initializer;\n}\n\n/** A stable key for a plain identifier or non-computed member chain, else null. */\nfunction refKey(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Identifier) {\n return node.name;\n }\n if (node.type === AST_NODE_TYPES.MemberExpression && !node.computed) {\n const inner = refKey(node.object);\n if (inner === null || node.property.type !== AST_NODE_TYPES.Identifier) {\n return null;\n }\n return `${inner}.${node.property.name}`;\n }\n return null;\n}\n\nfunction strLiteral(node: TSESTree.Node): string | null {\n if (node.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\") {\n return node.value;\n }\n return null;\n}\n\ninterface ClusterEntry {\n node: TSESTree.Node;\n literals: Set<string>;\n allTokens: boolean;\n}\n\ninterface Scope {\n clusters: Map<string, ClusterEntry>;\n /** The function this scope belongs to; null at file scope. */\n fn: FunctionNode | null;\n}\n\ninterface CollectedProperty {\n name: string;\n container: TSESTree.Node;\n node: TSESTree.Node;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-string-literal-union\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag raw `string` choice fields and string-literal comparison clusters; prefer a string-literal union type.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreFields: {\n type: \"array\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n bareChoiceField:\n '`{{name}}: string` looks like a choice field — prefer a string-literal union type (e.g. `type X = \"a\" | \"b\"`). Enums are banned by `no-enum`; use a union.',\n comparisonCluster:\n '`{{key}}` is compared against a closed set of string literals — define a string-literal union type (e.g. `type X = \"a\" | \"b\"`).',\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const filename = context.filename;\n const sourceText = context.sourceCode.getText();\n if (isIgnoredFile(filename, sourceText)) {\n return {};\n }\n\n const ignoredFields = new Set(\n (optionsArg?.ignoreFields ?? []).map((name) => name.toLowerCase()),\n );\n\n let services: ParserServicesWithTypeInformation | null;\n try {\n services = ESLintUtils.getParserServices(context);\n } catch {\n services = null;\n }\n\n const scopeStack: Scope[] = [];\n const validClusters: TSESTree.Node[] = [];\n const bareChoiceProps: CollectedProperty[] = [];\n const containersWithUnion = new Set<TSESTree.Node>();\n\n function operandIsRawString(node: TSESTree.Node): boolean {\n if (services === null) {\n return false;\n }\n return typeHasRawString(services.getTypeAtLocation(node));\n }\n\n /**\n * Whether the compared value provably originates from a type we don't own —\n * a property of a `.d.ts` / node_modules type (DOM `getComputedStyle().overflowY`,\n * `Task.status` from another package), the return of such a method\n * (`URLSearchParams.get()`, `str.toLowerCase()`), or a destructuring of one\n * (`Object.entries()` keys). A string-literal union is not an available fix\n * for these, so the cluster shape must not flag them.\n */\n function originIsExternal(node: ts.Node | undefined, depth: number): boolean {\n if (node === undefined || services === null || depth > 6) {\n return false;\n }\n const checker = services.program.getTypeChecker();\n if (\n ts.isParenthesizedExpression(node) ||\n ts.isNonNullExpression(node) ||\n ts.isAsExpression(node)\n ) {\n return originIsExternal(node.expression, depth + 1);\n }\n if (ts.isPropertyAccessExpression(node)) {\n return symbolIsExternallyDeclared(checker.getSymbolAtLocation(node.name));\n }\n if (ts.isCallExpression(node)) {\n return originIsExternal(node.expression, depth + 1);\n }\n if (ts.isIdentifier(node)) {\n const decl = checker.getSymbolAtLocation(node)?.valueDeclaration;\n if (decl === undefined) {\n return false;\n }\n if (ts.isVariableDeclaration(decl) && decl.initializer !== undefined) {\n return originIsExternal(decl.initializer, depth + 1);\n }\n if (ts.isBindingElement(decl)) {\n return originIsExternal(bindingSourceExpression(decl), depth + 1);\n }\n }\n return false;\n }\n\n function operandIsFlaggable(node: TSESTree.Node): boolean {\n return (\n operandIsRawString(node) &&\n !originIsExternal(services?.esTreeNodeToTSNodeMap.get(node), 0)\n );\n }\n\n /**\n * The string-literal members of a function's DECLARED return type, resolved\n * through named aliases and `Promise<...>`. Null when the function has no\n * annotation, type information is unavailable, or the type is not a\n * string-literal union. Computed lazily — only for a function that actually\n * accumulated a cluster — since it costs a type resolution.\n */\n function declaredReturnLiterals(fn: FunctionNode): ReadonlySet<string> | null {\n const annotation = fn.returnType?.typeAnnotation;\n if (annotation === undefined || services === null) {\n return null;\n }\n const tsNode = services.esTreeNodeToTSNodeMap.get(annotation);\n if (!ts.isTypeNode(tsNode)) {\n return null;\n }\n const checker = services.program.getTypeChecker();\n const declared = checker.getTypeFromTypeNode(tsNode);\n const type = checker.getAwaitedType(declared) ?? declared;\n const literals = new Set<string>();\n for (const part of type.isUnion() ? type.types : [type]) {\n if (part.isStringLiteral()) {\n literals.add(part.value);\n }\n }\n return literals.size >= MIN_CLUSTER_SIZE ? literals : null;\n }\n\n function pushScope(node: FunctionNode): void {\n scopeStack.push({ clusters: new Map(), fn: node });\n }\n\n function popScope(): void {\n const scope = scopeStack.pop();\n if (scope === undefined) {\n return;\n }\n const candidates = [...scope.clusters.values()].filter(\n (entry) => entry.allTokens && entry.literals.size >= MIN_CLUSTER_SIZE,\n );\n if (candidates.length === 0) {\n return;\n }\n const returnLiterals =\n scope.fn === null ? null : declaredReturnLiterals(scope.fn);\n for (const entry of candidates) {\n // The enclosing function declares the very union being compared against:\n // this is the narrowing boundary that produces it, so the `string`\n // operand is required, not a defect.\n if (\n returnLiterals !== null &&\n [...entry.literals].every((lit) => returnLiterals.has(lit))\n ) {\n continue;\n }\n validClusters.push(entry.node);\n }\n }\n\n function accumulate(\n key: string,\n literals: string[],\n node: TSESTree.Node,\n ): void {\n const scope = scopeStack[scopeStack.length - 1];\n if (scope === undefined) {\n return;\n }\n const allTokens = literals.every((lit) => isEnumToken(lit));\n const existing = scope.clusters.get(key);\n if (existing === undefined) {\n scope.clusters.set(key, {\n node,\n literals: new Set(literals),\n allTokens,\n });\n return;\n }\n for (const lit of literals) {\n existing.literals.add(lit);\n }\n existing.allTokens = existing.allTokens && allTokens;\n }\n\n function collectProperty(\n key: TSESTree.PropertyDefinition[\"key\"] | TSESTree.PropertyName,\n typeNode: TSESTree.TypeNode | undefined,\n container: TSESTree.Node,\n node: TSESTree.Node,\n ): void {\n if (isStringLiteralUnion(typeNode)) {\n containersWithUnion.add(container);\n return;\n }\n if (typeNode?.type !== AST_NODE_TYPES.TSStringKeyword) {\n return;\n }\n const name = keyName(key);\n if (\n name === null ||\n !isChoiceLikeName(name) ||\n ignoredFields.has(name.toLowerCase())\n ) {\n return;\n }\n bareChoiceProps.push({ name, container, node });\n }\n\n return {\n FunctionDeclaration: pushScope,\n \"FunctionDeclaration:exit\": popScope,\n FunctionExpression: pushScope,\n \"FunctionExpression:exit\": popScope,\n ArrowFunctionExpression: pushScope,\n \"ArrowFunctionExpression:exit\": popScope,\n\n BinaryExpression(node: TSESTree.BinaryExpression): void {\n if (\n node.operator !== \"===\" &&\n node.operator !== \"!==\" &&\n node.operator !== \"==\" &&\n node.operator !== \"!=\"\n ) {\n return;\n }\n const leftKey = refKey(node.left);\n const rightLit = strLiteral(node.right);\n const rightKey = refKey(node.right);\n const leftLit = strLiteral(node.left);\n if (leftKey !== null && rightLit !== null) {\n if (operandIsFlaggable(node.left)) {\n accumulate(leftKey, [rightLit], node);\n }\n } else if (rightKey !== null && leftLit !== null) {\n if (operandIsFlaggable(node.right)) {\n accumulate(rightKey, [leftLit], node);\n }\n }\n },\n\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const key = refKey(node.discriminant);\n if (key === null || !operandIsFlaggable(node.discriminant)) {\n return;\n }\n const literals: string[] = [];\n for (const c of node.cases) {\n if (c.test !== null) {\n const lit = strLiteral(c.test);\n if (lit !== null) {\n literals.push(lit);\n }\n }\n }\n if (literals.length > 0) {\n accumulate(key, literals, node);\n }\n },\n\n TSPropertySignature(node: TSESTree.TSPropertySignature): void {\n collectProperty(\n node.key,\n node.typeAnnotation?.typeAnnotation,\n node.parent,\n node,\n );\n },\n\n PropertyDefinition(node: TSESTree.PropertyDefinition): void {\n collectProperty(\n node.key,\n node.typeAnnotation?.typeAnnotation,\n node.parent,\n node,\n );\n },\n\n \"Program:exit\"(): void {\n for (const clusterNode of validClusters) {\n context.report({\n node: clusterNode,\n messageId: \"comparisonCluster\",\n data: { key: refKeyText(clusterNode) },\n });\n }\n for (const prop of bareChoiceProps) {\n if (containersWithUnion.has(prop.container)) {\n context.report({\n node: prop.node,\n messageId: \"bareChoiceField\",\n data: { name: prop.name },\n });\n }\n }\n },\n };\n\n function refKeyText(node: TSESTree.Node): string {\n if (node.type === AST_NODE_TYPES.BinaryExpression) {\n return refKey(node.left) ?? refKey(node.right) ?? \"value\";\n }\n if (node.type === AST_NODE_TYPES.SwitchStatement) {\n return refKey(node.discriminant) ?? \"value\";\n }\n return \"value\";\n }\n },\n});\n","/**\n * @fileoverview prefer-whole-object-assertion — a run of `expect`s on one receiver fails on the first mismatch and says nothing about the rest of the value.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-whole-object-assertion.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"combineAssertions\" | \"assertArrayOnce\";\ntype Options = readonly [];\n\n/**\n * Matchers whose per-key meaning `toMatchObject` reproduces exactly — but only\n * against a primitive literal, where `Object.is`, deep equality and strict deep\n * equality all coincide. See `literalText` for the other half of that pair.\n */\nconst MERGEABLE_MATCHERS: ReadonlySet<string> = new Set([\"toBe\", \"toEqual\", \"toStrictEqual\"]);\n\n/**\n * Matchers whose whole-array form (`expect(a).toEqual([...])`) preserves the\n * per-element comparison. `toBe` is excluded: element-wise identity is not what\n * `toEqual` on the array would check.\n */\nconst ARRAY_MATCHERS: ReadonlySet<string> = new Set([\"toEqual\", \"toStrictEqual\"]);\n\n/**\n * Properties whose receiver is a collection rather than a record. A run keyed on\n * `length` or `size` describes an array / Map / Set, and `toMatchObject` cannot\n * state a collection's size — this is the `.length`-mixed-with-elements class.\n */\nconst COLLECTION_PROPERTIES: ReadonlySet<string> = new Set([\"length\", \"size\"]);\n\n/**\n * Property names whose meaning as an OBJECT-LITERAL KEY is not \"a property of\n * this name\". There is exactly one in JavaScript.\n *\n * `__proto__: v` in a literal is the prototype SETTER, so the key never exists\n * and `toMatchObject` never checks it — the fix would DELETE the assertion it\n * claims to be merging. Quoting does not help: `\"__proto__\": v` is the same\n * production. The whole run is dropped rather than the one key, because there\n * is no `toMatchObject` literal that says what the run says.\n *\n * Audited for siblings: `constructor`, `toString`, `valueOf` and every other\n * inherited name ARE plain own keys in a literal, and jest's `subsetEquality`\n * walks the prototype chain when reading them off the received value, so those\n * merge faithfully. `get x() {}` / `async x() {}` are different PRODUCTIONS,\n * not different key names, and this fixer only ever emits `key: value`.\n */\nconst LITERAL_KEY_HAZARDS: ReadonlySet<string> = new Set([\"__proto__\"]);\n\n/** `-1` parses as a unary expression, not a literal, but it is still constant. */\nconst NUMERIC_SIGNS: ReadonlySet<string> = new Set([\"-\", \"+\"]);\n\n/** A run shorter than this is a single assertion; there is nothing to combine. */\nconst MIN_RUN_LENGTH = 2;\n\n/** How a run reaches into its receiver: `o.name`, or `xs[0]`. */\ntype AssertionKey =\n | { readonly kind: \"property\"; readonly name: string }\n | { readonly kind: \"index\"; readonly index: number };\n\ninterface Assertion {\n readonly statement: TSESTree.ExpressionStatement;\n /** The object the asserted member expression hangs off — the run's grouping key. */\n readonly receiver: TSESTree.Expression;\n readonly key: AssertionKey;\n readonly matcher: string;\n /** Source text of the expected value; `\"null\"` synthesised for `toBeNull()`. */\n readonly expectedText: string;\n /** False when the expected value is not a primitive literal, so cannot be merged. */\n readonly expectedIsLiteral: boolean;\n}\n\n/**\n * Source text of `node` when it is a primitive literal, otherwise `null`.\n * Regular expressions are excluded: `toBe(/x/)` is an identity check that\n * `toEqual` and `toMatchObject` do not reproduce.\n */\nfunction literalText(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string | null {\n switch (node.type) {\n case AST_NODE_TYPES.Literal:\n return \"regex\" in node ? null : getText(node);\n case AST_NODE_TYPES.TemplateLiteral:\n return node.expressions.length === 0 ? getText(node) : null;\n case AST_NODE_TYPES.UnaryExpression:\n return NUMERIC_SIGNS.has(node.operator) && literalText(node.argument, getText) !== null\n ? getText(node)\n : null;\n default:\n return null;\n }\n}\n\n/**\n * True for a receiver that can be evaluated twice with the same effect: an\n * identifier, `this`, or a member chain over one. A call anywhere in the chain\n * makes the merged form invoke it fewer times than the run did.\n *\n * The `node.optional` guard below — and its twin on `actual` in\n * `parseAssertion` — cannot be reached by any input, and no test pins them:\n * every optional link wraps the whole expression in a `ChainExpression`, which\n * `parseAssertion` has already rejected, and a parenthesised `(a?.b).c` leaves a\n * `ChainExpression` in the object position where this function's `default` arm\n * catches it. They are kept as belt and braces against a parser that stops\n * emitting `ChainExpression`, not because anything currently depends on them —\n * recorded here so the next reader does not spend an afternoon writing the test\n * that would prove them live.\n */\nfunction isPureReceiver(node: TSESTree.Node): boolean {\n switch (node.type) {\n case AST_NODE_TYPES.Identifier:\n case AST_NODE_TYPES.ThisExpression:\n return true;\n case AST_NODE_TYPES.MemberExpression:\n if (node.optional) {\n return false;\n }\n if (node.computed) {\n return node.property.type === AST_NODE_TYPES.Literal && isPureReceiver(node.object);\n }\n return isPureReceiver(node.object);\n default:\n return false;\n }\n}\n\n/** A non-negative integer array index written as a literal, else `null`. */\nfunction literalIndex(node: TSESTree.Node): number | null {\n if (node.type !== AST_NODE_TYPES.Literal || typeof node.value !== \"number\") {\n return null;\n }\n return Number.isInteger(node.value) && node.value >= 0 ? node.value : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-whole-object-assertion\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Collapse a run of consecutive assertions on the same object into one assertion about the whole object, so every mismatch is reported and nothing outside the asserted keys goes unchecked.\",\n },\n fixable: \"code\",\n messages: {\n combineAssertions:\n \"These {{count}} assertions each check one property of `{{receiver}}` against a literal, so the first mismatch hides the rest. Assert the object once: `expect({{receiver}}).toMatchObject({ … })`.\",\n assertArrayOnce:\n \"These {{count}} assertions check `{{receiver}}[0]`…`{{receiver}}[{{last}}]` one at a time, which never checks how long `{{receiver}}` is — extra elements pass unnoticed. Assert the array once: `expect({{receiver}}).{{matcher}}([ … ])`.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n if (!isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) {\n return {};\n }\n const { sourceCode } = context;\n\n function parseAssertion(statement: TSESTree.Statement): Assertion | null {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n return null;\n }\n const call = statement.expression;\n if (call.type !== AST_NODE_TYPES.CallExpression) {\n return null;\n }\n const callee = call.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n const matcher = callee.property.name;\n const expectCall = callee.object;\n if (\n expectCall.type !== AST_NODE_TYPES.CallExpression ||\n expectCall.callee.type !== AST_NODE_TYPES.Identifier ||\n expectCall.callee.name !== \"expect\" ||\n expectCall.arguments.length !== 1\n ) {\n return null;\n }\n const actual = expectCall.arguments[0];\n if (actual === undefined || actual.type !== AST_NODE_TYPES.MemberExpression || actual.optional) {\n return null;\n }\n if (!isPureReceiver(actual.object)) {\n return null;\n }\n\n let key: AssertionKey;\n if (actual.computed) {\n const index = literalIndex(actual.property);\n if (index === null) {\n return null;\n }\n key = { kind: \"index\", index };\n } else {\n if (\n actual.property.type !== AST_NODE_TYPES.Identifier ||\n COLLECTION_PROPERTIES.has(actual.property.name) ||\n LITERAL_KEY_HAZARDS.has(actual.property.name)\n ) {\n return null;\n }\n key = { kind: \"property\", name: actual.property.name };\n }\n\n if (matcher === \"toBeNull\" && call.arguments.length === 0) {\n return { statement, receiver: actual.object, key, matcher, expectedText: \"null\", expectedIsLiteral: true };\n }\n if (!MERGEABLE_MATCHERS.has(matcher)) {\n return null;\n }\n const expected = call.arguments[0];\n if (call.arguments.length !== 1 || expected === undefined || expected.type === AST_NODE_TYPES.SpreadElement) {\n return null;\n }\n const literal = literalText(expected, (node) => sourceCode.getText(node));\n return {\n statement,\n receiver: actual.object,\n key,\n matcher,\n expectedText: literal ?? sourceCode.getText(expected),\n expectedIsLiteral: literal !== null,\n };\n }\n\n /**\n * True when a comment sits inside the span the fix rewrites — between two\n * statements of the run, or inside one of them.\n *\n * Such a comment cannot survive: the statements after the first are DELETED,\n * so their leading comments are left dangling above the merged assertion,\n * describing a statement that no longer exists. Worst case the dangling line\n * is an `eslint-disable-next-line`, which then becomes a fresh unused-directive\n * error the author did not write. Dropping a comment is also not \"exactly\n * equivalent to the code it replaces\", so the report stands and the fix is\n * withheld for a human.\n */\n function hasInterveningComment(run: readonly Assertion[]): boolean {\n return run.some(\n (assertion, index) =>\n sourceCode.getCommentsInside(assertion.statement).length > 0 ||\n (index > 0 && sourceCode.getCommentsBefore(assertion.statement).length > 0),\n );\n }\n\n /**\n * A property run is reportable only when the merged `toMatchObject` says\n * exactly what the run says: every matcher mergeable, every expected value a\n * primitive literal, and every key distinct so nothing is lost to a\n * duplicate object property.\n */\n function reportPropertyRun(run: readonly Assertion[]): void {\n const names = new Set<string>();\n for (const assertion of run) {\n if (assertion.key.kind !== \"property\" || !assertion.expectedIsLiteral) {\n return;\n }\n if (!MERGEABLE_MATCHERS.has(assertion.matcher) && assertion.matcher !== \"toBeNull\") {\n return;\n }\n if (names.has(assertion.key.name)) {\n return;\n }\n names.add(assertion.key.name);\n }\n const first = run[0];\n if (first === undefined) {\n return;\n }\n const receiverText = sourceCode.getText(first.receiver);\n const properties = run\n .map((assertion) =>\n assertion.key.kind === \"property\" ? `${assertion.key.name}: ${assertion.expectedText}` : \"\",\n )\n .join(\", \");\n context.report({\n node: first.statement,\n messageId: \"combineAssertions\",\n data: { count: String(run.length), receiver: receiverText },\n fix: hasInterveningComment(run)\n ? null\n : (fixer) => [\n fixer.replaceText(first.statement, `expect(${receiverText}).toMatchObject({ ${properties} });`),\n ...run.slice(1).map((assertion) => fixer.remove(assertion.statement)),\n ],\n });\n }\n\n /**\n * An indexed run is reportable when the indices cover `0..n-1` exactly and\n * one `toEqual` / `toStrictEqual` runs throughout, so `expect(xs).toEqual([…])`\n * makes the same per-element comparisons plus the length check the run is\n * missing. No fix: that added length check can turn a passing test red.\n */\n function reportIndexRun(run: readonly Assertion[]): void {\n const first = run[0];\n if (first === undefined || !ARRAY_MATCHERS.has(first.matcher)) {\n return;\n }\n const indices = new Set<number>();\n for (const assertion of run) {\n if (assertion.key.kind !== \"index\" || assertion.matcher !== first.matcher) {\n return;\n }\n indices.add(assertion.key.index);\n }\n if (indices.size !== run.length || Math.max(...indices) !== run.length - 1) {\n return;\n }\n context.report({\n node: first.statement,\n messageId: \"assertArrayOnce\",\n data: {\n count: String(run.length),\n receiver: sourceCode.getText(first.receiver),\n last: String(run.length - 1),\n matcher: first.matcher,\n },\n });\n }\n\n function checkBody(body: readonly TSESTree.Statement[]): void {\n let run: Assertion[] = [];\n\n const flush = (): void => {\n const first = run[0];\n if (first !== undefined && run.length >= MIN_RUN_LENGTH) {\n if (first.key.kind === \"property\") {\n reportPropertyRun(run);\n } else {\n reportIndexRun(run);\n }\n }\n run = [];\n };\n\n for (const statement of body) {\n const assertion = parseAssertion(statement);\n const previous = run.at(-1);\n if (\n assertion !== null &&\n previous !== undefined &&\n previous.key.kind === assertion.key.kind &&\n sourceCode.getText(previous.receiver) === sourceCode.getText(assertion.receiver)\n ) {\n run.push(assertion);\n continue;\n }\n flush();\n if (assertion !== null) {\n run = [assertion];\n }\n }\n flush();\n }\n\n return {\n BlockStatement: (node: TSESTree.BlockStatement): void => {\n checkBody(node.body);\n },\n Program: (node: TSESTree.Program): void => {\n checkBody(node.body);\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-zod-enum — a union of `z.literal` strings infers exactly what `z.enum` does, in more syntax that hides the permitted values.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-zod-enum.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"preferEnum\";\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-zod-enum\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer z.enum([...]) over z.union([z.literal(...), ...]) for string choices\",\n },\n fixable: \"code\",\n schema: [],\n messages: {\n preferEnum:\n \"Use `z.enum([...])` instead of a union of string-literal schemas.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n const zodNamespaces = new Set<string>();\n\n function enumValues(\n node: TSESTree.CallExpression,\n ): readonly TSESTree.StringLiteral[] | undefined | null {\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.object.type !== AST_NODE_TYPES.Identifier ||\n !zodNamespaces.has(callee.object.name) ||\n callee.property.type !== AST_NODE_TYPES.Identifier ||\n callee.property.name !== \"union\" ||\n node.arguments.length !== 1\n ) {\n return null;\n }\n const argument = node.arguments[0];\n if (\n argument === undefined ||\n argument.type !== AST_NODE_TYPES.ArrayExpression ||\n argument.elements.length === 0\n ) {\n return null;\n }\n\n const values: TSESTree.StringLiteral[] = [];\n let canFix = true;\n for (const element of argument.elements) {\n if (element?.type === AST_NODE_TYPES.SpreadElement) {\n canFix = false;\n continue;\n }\n if (\n element === null ||\n element.type !== AST_NODE_TYPES.CallExpression ||\n element.callee.type !== AST_NODE_TYPES.MemberExpression ||\n element.callee.computed ||\n element.callee.object.type !== AST_NODE_TYPES.Identifier ||\n !zodNamespaces.has(element.callee.object.name) ||\n element.callee.property.type !== AST_NODE_TYPES.Identifier ||\n element.callee.property.name !== \"literal\"\n ) {\n return null;\n }\n const value = element.arguments[0];\n if (\n element.arguments.length !== 1 ||\n value === undefined ||\n value.type !== AST_NODE_TYPES.Literal ||\n typeof value.value !== \"string\"\n ) {\n canFix = false;\n continue;\n }\n values.push(value);\n }\n return canFix ? values : undefined;\n }\n\n function buildFix(\n node: TSESTree.CallExpression,\n values: readonly TSESTree.StringLiteral[],\n ): TSESLint.ReportFixFunction | undefined {\n const argument = node.arguments[0];\n if (\n argument === undefined ||\n argument.type !== AST_NODE_TYPES.ArrayExpression ||\n sourceCode.getCommentsInside(argument).length > 0\n ) {\n return undefined;\n }\n const callee = node.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return undefined;\n }\n return (fixer) => [\n fixer.replaceText(callee.property, \"enum\"),\n fixer.replaceText(\n argument,\n `[${values.map((value) => sourceCode.getText(value)).join(\", \")}]`,\n ),\n ];\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n CallExpression(node): void {\n const values = enumValues(node);\n if (values === null) {\n return;\n }\n const fix = values === undefined ? undefined : buildFix(node, values);\n context.report({\n node,\n messageId: \"preferEnum\",\n ...(fix === undefined ? {} : { fix }),\n });\n },\n };\n },\n});\n","/**\n * @fileoverview prefer-zod-infer — a hand-written type beside a Zod schema drifts silently the moment the schema gains a field.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/prefer-zod-infer.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isStoryFile, isTestFile } from \"./_paths.js\";\nimport { isZodModule } from \"./_zod.js\";\n\ntype MessageIds = \"handWrittenTwin\";\ntype Options = readonly [\n {\n ignoreTypeNames?: readonly string[];\n requireIdenticalShape?: boolean;\n }?,\n];\n\n/** Chained methods that preserve a schema's inferred shape. */\nconst SHAPE_PRESERVING_METHODS: ReadonlySet<string> = new Set([\n \"describe\",\n \"refine\",\n \"superRefine\",\n \"check\",\n \"meta\",\n \"register\",\n]);\n\n/** Modifiers that make a member optional in the inferred type. */\nconst OPTIONAL_MODIFIERS: ReadonlySet<string> = new Set([\n \"optional\",\n \"nullish\",\n \"default\",\n \"prefault\",\n \"catch\",\n]);\n\n/** Modifiers that admit `null`. */\nconst NULLABLE_MODIFIERS: ReadonlySet<string> = new Set([\"nullable\", \"nullish\"]);\n\n/** Modifiers that replace the member's type outright. */\nconst RESHAPING_MODIFIERS: ReadonlySet<string> = new Set([\n \"transform\",\n \"pipe\",\n \"preprocess\",\n \"brand\",\n \"overwrite\",\n]);\n\n/** Methods that reshape their receiver schema. */\nconst MODULE_LEVEL_RESHAPERS: ReadonlySet<string> = new Set([\n \"transform\",\n \"pipe\",\n \"preprocess\",\n]);\n\n/** Type names whose type arguments are hand-written types by construction. */\nconst ZOD_TYPE_CONSTRAINTS: ReadonlySet<string> = new Set([\n \"ZodType\",\n \"ZodSchema\",\n \"ZodTypeAny\",\n \"ZodMiniType\",\n \"Schema\",\n]);\n\n/** Zod leaf constructors and the TS AST node their inferred type is written as. */\nconst LEAF_NODE_TYPES: Readonly<Record<string, readonly AST_NODE_TYPES[]>> = {\n string: [AST_NODE_TYPES.TSStringKeyword],\n email: [AST_NODE_TYPES.TSStringKeyword],\n url: [AST_NODE_TYPES.TSStringKeyword],\n uuid: [AST_NODE_TYPES.TSStringKeyword],\n ulid: [AST_NODE_TYPES.TSStringKeyword],\n cuid: [AST_NODE_TYPES.TSStringKeyword],\n cuid2: [AST_NODE_TYPES.TSStringKeyword],\n nanoid: [AST_NODE_TYPES.TSStringKeyword],\n iso: [AST_NODE_TYPES.TSStringKeyword],\n number: [AST_NODE_TYPES.TSNumberKeyword],\n int: [AST_NODE_TYPES.TSNumberKeyword],\n float32: [AST_NODE_TYPES.TSNumberKeyword],\n float64: [AST_NODE_TYPES.TSNumberKeyword],\n boolean: [AST_NODE_TYPES.TSBooleanKeyword],\n bigint: [AST_NODE_TYPES.TSBigIntKeyword],\n symbol: [AST_NODE_TYPES.TSSymbolKeyword],\n any: [AST_NODE_TYPES.TSAnyKeyword],\n unknown: [AST_NODE_TYPES.TSUnknownKeyword],\n never: [AST_NODE_TYPES.TSNeverKeyword],\n void: [AST_NODE_TYPES.TSVoidKeyword],\n null: [AST_NODE_TYPES.TSNullKeyword],\n undefined: [AST_NODE_TYPES.TSUndefinedKeyword],\n literal: [AST_NODE_TYPES.TSLiteralType],\n date: [AST_NODE_TYPES.TSTypeReference],\n array: [AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSTypeReference],\n tuple: [AST_NODE_TYPES.TSTupleType],\n object: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n strictObject: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n looseObject: [AST_NODE_TYPES.TSTypeLiteral, AST_NODE_TYPES.TSTypeReference],\n record: [AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSTypeLiteral],\n map: [AST_NODE_TYPES.TSTypeReference],\n set: [AST_NODE_TYPES.TSTypeReference],\n promise: [AST_NODE_TYPES.TSTypeReference],\n enum: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType],\n nativeEnum: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSLiteralType],\n union: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference],\n discriminatedUnion: [AST_NODE_TYPES.TSUnionType, AST_NODE_TYPES.TSTypeReference],\n intersection: [AST_NODE_TYPES.TSIntersectionType, AST_NODE_TYPES.TSTypeReference],\n};\n\ninterface SchemaField {\n readonly optional: boolean;\n readonly nullable: boolean;\n /** The `z.<leaf>` constructor, or `null` when the member references another schema. */\n readonly leaf: string | null;\n readonly reshaped: boolean;\n}\n\ninterface SchemaInfo {\n readonly name: string;\n readonly fields: ReadonlyMap<string, SchemaField>;\n}\n\ninterface TypeMember {\n readonly optional: boolean;\n readonly nullable: boolean;\n readonly annotation: TSESTree.TypeNode | null;\n}\n\ninterface TypeDeclaration {\n readonly name: string;\n readonly node: TSESTree.Node;\n readonly members: ReadonlyMap<string, TypeMember>;\n}\n\n/** `ZUserSchema` / `userSchema` / `ZUser` all describe the thing named `User`. */\nfunction normalizeSchemaName(name: string): string {\n return name\n .replace(/Schema$/i, \"\")\n .replace(/^Z(?=[A-Z])/, \"\")\n .toLowerCase();\n}\n\n/** `UserType` is the same claim as `User`; nothing else is stripped. */\nfunction normalizeTypeName(name: string): string {\n return name.replace(/Type$/, \"\").toLowerCase();\n}\n\n/** Strips `| null` / `| undefined` from a union and reports what it removed. */\nfunction unwrapNullish(annotation: TSESTree.TypeNode): {\n readonly core: TSESTree.TypeNode | null;\n readonly nullable: boolean;\n} {\n if (annotation.type !== AST_NODE_TYPES.TSUnionType) {\n return {\n core: annotation,\n nullable: annotation.type === AST_NODE_TYPES.TSNullKeyword,\n };\n }\n const rest: TSESTree.TypeNode[] = [];\n let nullable = false;\n for (const member of annotation.types) {\n if (member.type === AST_NODE_TYPES.TSNullKeyword) {\n nullable = true;\n continue;\n }\n if (member.type === AST_NODE_TYPES.TSUndefinedKeyword) {\n continue;\n }\n rest.push(member);\n }\n if (rest.length === 1) {\n return { core: rest[0] ?? null, nullable };\n }\n // A genuine union of two or more non-nullish members stays a union.\n return { core: rest.length === 0 ? null : annotation, nullable };\n}\n\n/** Compares a TypeScript annotation with a known Zod leaf; `null` means unknown. */\nfunction leafAgrees(\n leaf: string | null,\n annotation: TSESTree.TypeNode | null,\n): boolean | null {\n if (leaf === null || annotation === null) {\n return null;\n }\n const expected = LEAF_NODE_TYPES[leaf];\n if (expected === undefined) {\n return null;\n }\n const { core } = unwrapNullish(annotation);\n if (core === null) {\n return null;\n }\n return expected.includes(core.type);\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"prefer-zod-infer\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n ignoreTypeNames: {\n type: \"array\",\n items: { type: \"string\" },\n },\n requireIdenticalShape: { type: \"boolean\" },\n },\n },\n ],\n messages: {\n handWrittenTwin:\n \"`{{typeName}}` restates the shape of the Zod schema `{{schemaName}}` declared in this module. Derive it instead — `type {{typeName}} = z.infer<typeof {{schemaName}}>` — so a field added to the schema cannot silently leave the type behind.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const ignorePatterns = (optionsArg?.ignoreTypeNames ?? []).map(\n (source) => new RegExp(source, \"u\"),\n );\n const requireIdenticalShape = optionsArg?.requireIdenticalShape ?? true;\n\n if (\n isTestFile(context.filename) ||\n isStoryFile(context.filename) ||\n isGeneratedFile(context.filename, context.sourceCode.text)\n ) {\n return {};\n }\n\n const zodNamespaces = new Set<string>();\n const schemas: SchemaInfo[] = [];\n const typeDeclarations: TypeDeclaration[] = [];\n /** Names intentionally constraining a `z.ZodType<...>`. */\n const constrainedTypeNames = new Set<string>();\n /** Schemas reshaped elsewhere in this module. */\n const reshapedSchemaNames = new Set<string>();\n\n /** The `z.…` call chain of `node`, base call first, or `null`. */\n function zodCallChain(\n node: TSESTree.Node,\n ): readonly TSESTree.CallExpression[] | null {\n const chain: TSESTree.CallExpression[] = [];\n let current: TSESTree.Node = node;\n while (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = current.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n chain.push(current);\n const receiver = callee.object;\n if (receiver.type === AST_NODE_TYPES.Identifier) {\n return zodNamespaces.has(receiver.name) ? chain.reverse() : null;\n }\n current = receiver;\n }\n return null;\n }\n\n /** The method name of a `z.foo()` / `.foo()` link in a chain. */\n function methodName(call: TSESTree.CallExpression): string {\n const callee = call.callee;\n return callee.type === AST_NODE_TYPES.MemberExpression &&\n callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : \"\";\n }\n\n /** Modifier/leaf analysis of one `z.object({ key: <here> })` value. */\n function schemaField(node: TSESTree.Node): SchemaField {\n const modifiers: string[] = [];\n let current: TSESTree.Node = node;\n let leaf: string | null = null;\n\n while (current.type === AST_NODE_TYPES.CallExpression) {\n const callee = current.callee;\n if (\n callee.type !== AST_NODE_TYPES.MemberExpression ||\n callee.computed ||\n callee.property.type !== AST_NODE_TYPES.Identifier\n ) {\n break;\n }\n const receiver = callee.object;\n if (\n receiver.type === AST_NODE_TYPES.Identifier &&\n zodNamespaces.has(receiver.name)\n ) {\n leaf = callee.property.name;\n break;\n }\n modifiers.push(callee.property.name);\n current = receiver;\n }\n\n return {\n leaf,\n optional: modifiers.some((name) => OPTIONAL_MODIFIERS.has(name)),\n nullable: modifiers.some((name) => NULLABLE_MODIFIERS.has(name)),\n reshaped: modifiers.some((name) => RESHAPING_MODIFIERS.has(name)),\n };\n }\n\n /** Extracts fields only from plain object literals with shape-preserving chains. */\n function schemaFields(\n init: TSESTree.Node,\n ): ReadonlyMap<string, SchemaField> | null {\n const chain = zodCallChain(init);\n if (chain === null || chain.length === 0) {\n return null;\n }\n const [base, ...rest] = chain;\n if (base === undefined) {\n return null;\n }\n const baseMethod = methodName(base);\n if (baseMethod !== \"object\" && baseMethod !== \"strictObject\") {\n return null;\n }\n if (rest.some((call) => !SHAPE_PRESERVING_METHODS.has(methodName(call)))) {\n return null;\n }\n const shape = base.arguments[0];\n if (shape === undefined || shape.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n\n const fields = new Map<string, SchemaField>();\n for (const property of shape.properties) {\n if (property.type !== AST_NODE_TYPES.Property || property.computed) {\n return null; // a spread or computed key hides members from us\n }\n const { key } = property;\n const name =\n key.type === AST_NODE_TYPES.Identifier\n ? key.name\n : key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\"\n ? key.value\n : null;\n if (name === null) {\n return null;\n }\n fields.set(name, schemaField(property.value));\n }\n return fields.size === 0 ? null : fields;\n }\n\n /** The property signatures of an object type, or `null` if any member is exotic. */\n function typeMembers(\n members: readonly TSESTree.TypeElement[],\n ): ReadonlyMap<string, TypeMember> | null {\n const result = new Map<string, TypeMember>();\n for (const member of members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature || member.computed) {\n return null;\n }\n const { key } = member;\n const name =\n key.type === AST_NODE_TYPES.Identifier\n ? key.name\n : key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\"\n ? key.value\n : null;\n if (name === null) {\n return null;\n }\n const annotation = member.typeAnnotation?.typeAnnotation ?? null;\n result.set(name, {\n optional: member.optional === true,\n nullable: annotation !== null && unwrapNullish(annotation).nullable,\n annotation,\n });\n }\n return result.size === 0 ? null : result;\n }\n\n function collectConstrainedNames(node: TSESTree.TypeNode): void {\n if (node.type === AST_NODE_TYPES.TSTypeReference) {\n if (node.typeName.type === AST_NODE_TYPES.Identifier) {\n constrainedTypeNames.add(node.typeName.name);\n }\n for (const argument of node.typeArguments?.params ?? []) {\n collectConstrainedNames(argument);\n }\n return;\n }\n if (node.type === AST_NODE_TYPES.TSArrayType) {\n collectConstrainedNames(node.elementType);\n return;\n }\n if (\n node.type === AST_NODE_TYPES.TSUnionType ||\n node.type === AST_NODE_TYPES.TSIntersectionType\n ) {\n for (const member of node.types) {\n collectConstrainedNames(member);\n }\n }\n }\n\n /** True when the pair is close enough to call one a restatement of the other. */\n function isTwin(\n fields: ReadonlyMap<string, SchemaField>,\n members: ReadonlyMap<string, TypeMember>,\n ): boolean {\n if (!requireIdenticalShape) {\n return true;\n }\n if (fields.size !== members.size) {\n return false;\n }\n let agreements = 0;\n for (const [name, field] of fields) {\n const member = members.get(name);\n if (member === undefined) {\n return false;\n }\n // A reshaped member's inferred type is not what is written.\n if (field.reshaped) {\n return false;\n }\n if (field.optional !== member.optional) {\n return false;\n }\n if (field.nullable !== member.nullable) {\n return false;\n }\n const agrees = leafAgrees(field.leaf, member.annotation);\n if (agrees === false) {\n return false;\n }\n if (agrees === true) {\n agreements += 1;\n }\n }\n // At least one member has to positively agree; a pair of types whose\n // members are all references to other symbols is a name coincidence.\n return agreements > 0;\n }\n\n return {\n ImportDeclaration(node): void {\n if (!isZodModule(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier ||\n specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||\n (specifier.type === AST_NODE_TYPES.ImportSpecifier &&\n specifier.imported.type === AST_NODE_TYPES.Identifier &&\n specifier.imported.name === \"z\")\n ) {\n zodNamespaces.add(specifier.local.name);\n }\n }\n },\n\n VariableDeclarator(node): void {\n if (node.id.type !== AST_NODE_TYPES.Identifier || node.init == null) {\n return;\n }\n const fields = schemaFields(node.init);\n if (fields !== null) {\n schemas.push({ name: node.id.name, fields });\n }\n },\n\n /** Records `XSchema.transform(...)` and equivalent module-level reshaping. */\n \"MemberExpression[computed=false]\"(node: TSESTree.MemberExpression): void {\n if (\n node.object.type === AST_NODE_TYPES.Identifier &&\n node.property.type === AST_NODE_TYPES.Identifier &&\n MODULE_LEVEL_RESHAPERS.has(node.property.name)\n ) {\n reshapedSchemaNames.add(node.object.name);\n }\n },\n\n /** Records every type argument carried by a Zod constraint. */\n TSTypeReference(node): void {\n const { typeName } = node;\n const referenced =\n typeName.type === AST_NODE_TYPES.Identifier\n ? typeName.name\n : typeName.type === AST_NODE_TYPES.TSQualifiedName &&\n typeName.right.type === AST_NODE_TYPES.Identifier\n ? typeName.right.name\n : null;\n if (referenced === null || !ZOD_TYPE_CONSTRAINTS.has(referenced)) {\n return;\n }\n for (const argument of node.typeArguments?.params ?? []) {\n collectConstrainedNames(argument);\n }\n },\n\n TSInterfaceDeclaration(node): void {\n // Generics and `extends` cannot be replaced by direct schema inference.\n if (node.typeParameters !== undefined || (node.extends?.length ?? 0) > 0) {\n return;\n }\n const members = typeMembers(node.body.body);\n if (members !== null) {\n typeDeclarations.push({ name: node.id.name, node: node.id, members });\n }\n },\n\n TSTypeAliasDeclaration(node): void {\n if (\n node.typeParameters !== undefined ||\n node.typeAnnotation.type !== AST_NODE_TYPES.TSTypeLiteral\n ) {\n return;\n }\n const members = typeMembers(node.typeAnnotation.members);\n if (members !== null) {\n typeDeclarations.push({ name: node.id.name, node: node.id, members });\n }\n },\n\n \"Program:exit\"(): void {\n if (schemas.length === 0 || typeDeclarations.length === 0) {\n return;\n }\n const byName = new Map<string, SchemaInfo>();\n for (const schema of schemas) {\n const key = normalizeSchemaName(schema.name);\n if (key !== \"\" && !byName.has(key)) {\n byName.set(key, schema);\n }\n }\n\n for (const declaration of typeDeclarations) {\n if (constrainedTypeNames.has(declaration.name)) {\n continue;\n }\n if (ignorePatterns.some((pattern) => pattern.test(declaration.name))) {\n continue;\n }\n const schema = byName.get(normalizeTypeName(declaration.name));\n if (schema === undefined || reshapedSchemaNames.has(schema.name)) {\n continue;\n }\n if (!isTwin(schema.fields, declaration.members)) {\n continue;\n }\n context.report({\n node: declaration.node,\n messageId: \"handWrittenTwin\",\n data: { typeName: declaration.name, schemaName: schema.name },\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-assert-never — a switch over a union whose `default` does no runtime work stops being exhaustive the day the union grows.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-assert-never.test.ts\n */\n\nimport { type TSESLint, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"missingAssertNever\";\ntype Options = readonly [];\n\n/** Empty statements and empty blocks are not runtime handling. */\nconst isRuntimeHandlingStatement = (statement: TSESTree.Statement): boolean => {\n if (statement.type === AST_NODE_TYPES.EmptyStatement) return false;\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.some(isRuntimeHandlingStatement);\n }\n return true;\n};\n\n/** An empty non-final default falls through to a case that handles it. */\nconst isFallthroughDefault = (\n node: TSESTree.SwitchStatement,\n defaultIndex: number,\n): boolean => {\n const defaultCase = node.cases[defaultIndex];\n return (\n defaultCase !== undefined &&\n defaultCase.consequent.length === 0 &&\n defaultIndex < node.cases.length - 1\n );\n};\n\n/** Honor a comment that makes an empty default an intentional no-op. */\nconst isCommentOnlyNoopDefault = (\n defaultCase: TSESTree.SwitchCase,\n sourceCode: Readonly<TSESLint.SourceCode>,\n): boolean => {\n if (defaultCase.consequent.length === 0) {\n const defaultToken = sourceCode.getFirstToken(defaultCase);\n const colonToken = defaultToken\n ? sourceCode.getTokenAfter(defaultToken)\n : null;\n return (\n colonToken !== null && sourceCode.getCommentsAfter(colonToken).length > 0\n );\n }\n const only = defaultCase.consequent[0];\n if (\n only !== undefined &&\n defaultCase.consequent.length === 1 &&\n only.type === AST_NODE_TYPES.BlockStatement &&\n only.body.length === 0\n ) {\n return sourceCode.getCommentsInside(only).length > 0;\n }\n return false;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-assert-never\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an exhaustive-style switch whose `default` case does no runtime work to call `assertNever(_)` so that discriminated unions are exhaustively checked at compile time. Switches with a legitimate runtime default (a reducer's `return state`, an HTTP-status `return fallback()`, a `break`, a `throw`, etc.) are left alone.\",\n },\n schema: [],\n messages: {\n missingAssertNever:\n \"Empty switch `default` case — add runtime handling or call `assertNever()` so the discriminated union is exhaustively checked at compile time.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const defaultIndex = node.cases.findIndex(\n (caseNode) => caseNode.test === null,\n );\n // Only present no-op defaults opt into this syntactic check.\n if (defaultIndex === -1) return;\n const defaultCase = node.cases[defaultIndex];\n if (defaultCase === undefined) return;\n\n // Any runtime work, including assertNever(), handles the default.\n if (defaultCase.consequent.some(isRuntimeHandlingStatement)) return;\n\n // A non-final empty default is handled by its following case.\n if (isFallthroughDefault(node, defaultIndex)) return;\n\n // Comments distinguish deliberate no-ops without requiring type info.\n if (isCommentOnlyNoopDefault(defaultCase, context.sourceCode)) return;\n\n context.report({\n node: defaultCase,\n messageId: \"missingAssertNever\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview require-fetch-timeout — a `fetch` with no signal hangs for as long as the upstream stalls, holding the caller open with it.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-fetch-timeout.test.ts\n */\n\nimport { AST_NODE_TYPES, ASTUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isScriptFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"missingSignal\";\ntype Options = readonly [\n {\n allowIn?: readonly string[];\n }?,\n];\n\n/** The explicit-global receivers of `<obj>.fetch(...)`. */\nconst GLOBAL_OBJECTS: ReadonlySet<string> = new Set([\n \"globalThis\",\n \"window\",\n \"self\",\n]);\n\nfunction matchesAnyPattern(\n filename: string,\n patterns: readonly string[],\n): boolean {\n for (const pattern of patterns) {\n // Convert minimatch-ish globs to regex: ** -> .*, * -> [^/\\\\]*\n const regexSource = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*\\*/g, \"::DOUBLESTAR::\")\n .replace(/\\*/g, \"[^/\\\\\\\\]*\")\n .replace(/::DOUBLESTAR::/g, \".*\");\n if (new RegExp(`^${regexSource}$`).test(filename)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * True when the init argument provably lacks an abort signal: it is an object\n * literal with no `signal` property and no spread element. Any other shape\n * (identifier, call, spread, conditional, ...) may carry a signal, so it is\n * treated as safe.\n */\nfunction initProvablyLacksSignal(init: TSESTree.CallExpressionArgument): boolean {\n if (init.type !== AST_NODE_TYPES.ObjectExpression) {\n return false;\n }\n for (const prop of init.properties) {\n if (prop.type === AST_NODE_TYPES.SpreadElement) {\n return false;\n }\n if (\n (prop.key.type === AST_NODE_TYPES.Identifier &&\n prop.key.name === \"signal\") ||\n (prop.key.type === AST_NODE_TYPES.Literal && prop.key.value === \"signal\")\n ) {\n return false;\n }\n // A computed key could be \"signal\" at runtime; assume it is.\n if (prop.computed) {\n return false;\n }\n }\n return true;\n}\n\n/** True for a string or template literal — a URL spelled inline. */\nfunction isStringish(node: TSESTree.CallExpressionArgument): boolean {\n return (\n (node.type === AST_NODE_TYPES.Literal && typeof node.value === \"string\") ||\n node.type === AST_NODE_TYPES.TemplateLiteral\n );\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"require-fetch-timeout\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an abort `signal` (e.g. `AbortSignal.timeout(ms)`) on global `fetch()` calls so stalled upstreams cannot hang the caller forever.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n allowIn: {\n description:\n \"Glob patterns for wrapper modules exempt from the rule. Matched against the ABSOLUTE file path, so anchor with a `**/` prefix (e.g. `**/http-client.ts`).\",\n type: \"array\",\n items: { type: \"string\" },\n },\n },\n },\n ],\n messages: {\n missingSignal:\n \"This `fetch()` has no abort `signal` — a stalled upstream will hang it forever. Pass `{ signal: AbortSignal.timeout(ms) }` or a signal from an AbortController.\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n // `isTestFile` knows jscodeshift's `__testfixtures__/` spelling, so the\n // local pattern this rule used to keep for it decided nothing.\n if (isTestFile(context.filename) || isScriptFile(context.filename)) {\n return {};\n }\n const allowIn = optionsArg?.allowIn ?? [];\n if (allowIn.length > 0 && matchesAnyPattern(context.filename, allowIn)) {\n return {};\n }\n\n /** True when `identifier` resolves to the global (no local binding shadows it). */\n function resolvesToGlobal(identifier: TSESTree.Identifier): boolean {\n const scope = context.sourceCode.getScope(identifier);\n const variable = ASTUtils.findVariable(scope, identifier.name);\n // Unresolved → implicit global. Resolved with zero defs → declared\n // global (languageOptions.globals). Any def is a local shadow.\n return variable === null || variable.defs.length === 0;\n }\n\n /** True for `fetch(...)` / `globalThis.fetch(...)` / `window.fetch(...)` /\n * `self.fetch(...)` where the receiver resolves to the global scope. */\n function isGlobalFetchCall(callee: TSESTree.Expression): boolean {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"fetch\" && resolvesToGlobal(callee);\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"fetch\" &&\n callee.object.type === AST_NODE_TYPES.Identifier &&\n GLOBAL_OBJECTS.has(callee.object.name) &&\n resolvesToGlobal(callee.object)\n );\n }\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isGlobalFetchCall(node.callee)) {\n return;\n }\n\n // Proxy passthrough: a lone non-string argument is a Request (or\n // equivalent) being forwarded — the inbound request owns the\n // lifetime, and a fresh signal cannot be attached without an init.\n const [first, init] = node.arguments;\n if (node.arguments.length === 1 && first !== undefined && !isStringish(first)) {\n return;\n }\n\n if (init === undefined || initProvablyLacksSignal(init)) {\n context.report({ node, messageId: \"missingSignal\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-interface-for-injected-service — an exported class with injected collaborators and no port above it can only be tested by mocking the class.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-interface-for-injected-service.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isScriptFile, isStoryFile, isTestFile } from \"./_paths.js\";\n\ntype MessageIds = \"requireInterface\";\ntype Options = readonly [];\n\nconst CONFIGISH_TYPE_RE =\n /(?:Options|Opts|Config|Configuration|Settings|Params|Props|Args|Env|Environment|Callbacks|Flags)$/;\n\n/** Configuration names plus logger and clock, which alone do not establish a service seam. */\nconst CONFIGISH_NAME_RE =\n /^(?:options|opts|config|configuration|settings|params|props|args|env|environment|callbacks|flags|logger|log|clock)$/i;\n\n/** Third-party transports commonly replaced below a thin client wrapper. */\nconst HTTP_TRANSPORT_TYPE_RE = /^(?:KyInstance|AxiosInstance|Session)$/;\n\n/** Containers and mapped helpers describe data rather than substitutable implementations. */\nconst BUILTIN_CONTAINER_TYPE_RE =\n /^(?:Record|Map|WeakMap|Set|WeakSet|Array|ReadonlyArray|ReadonlyMap|ReadonlySet|Promise|Partial|Required|Readonly|Pick|Omit|Exclude|Extract|NonNullable|Awaited|Parameters|ReturnType|InstanceType)$/;\n\nconst TRANSPORT_WRAPPER_NAME_RE = /Client$/;\n\n/** Router-factory call that marks HTTP wiring. */\nconst ROUTER_FACTORY_NAME = \"Router\";\n\n/** Namespaced framework HTTP types; unqualified DOM globals do not match. */\nconst FRAMEWORK_HTTP_TYPES: ReadonlySet<string> = new Set([\"Request\", \"Response\", \"NextFunction\"]);\n\ninterface Collaborator {\n readonly name: string;\n /** Rightmost segment of the type name — what the config-ish guards test. */\n readonly typeName: string;\n /** Full source spelling, including any namespace qualifier, for the message. */\n readonly display: string;\n}\n\n/** The class's own declaration is what `export`s it; anonymous defaults have no name to report. */\nconst isExportedClass = (node: TSESTree.ClassDeclaration): boolean =>\n node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration ||\n node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration;\n\n/** `catalog.Client` -> `\"catalog.Client\"`; a nested qualifier is flattened the same way. */\nconst qualifiedName = (name: TSESTree.EntityName): string =>\n name.type === AST_NODE_TYPES.Identifier\n ? name.name\n : name.type === AST_NODE_TYPES.TSQualifiedName\n ? `${qualifiedName(name.left)}.${name.right.name}`\n : \"\";\n\n/** The rightmost segment plus the full spelling of a bare type reference, or null for anything else. */\nconst readTypeReference = (\n annotation: TSESTree.TypeNode | undefined,\n): { readonly typeName: string; readonly display: string } | null => {\n // A bare type reference is the only shape that names a nominal collaborator.\n // A union, an array, or a function type is data or a callback, never something\n // a consumer would want to swap wholesale.\n if (annotation === undefined || annotation.type !== AST_NODE_TYPES.TSTypeReference) return null;\n const { typeName } = annotation;\n const rightmost =\n typeName.type === AST_NODE_TYPES.Identifier\n ? typeName.name\n : typeName.type === AST_NODE_TYPES.TSQualifiedName\n ? typeName.right.name\n : null;\n if (rightmost === null) return null;\n return { typeName: rightmost, display: qualifiedName(typeName) };\n};\n\nconst namedParameterCollaborator = (annotated: TSESTree.Parameter): Collaborator | null => {\n let target: TSESTree.Node = annotated;\n if (target.type === AST_NODE_TYPES.TSParameterProperty) target = target.parameter;\n if (target.type === AST_NODE_TYPES.AssignmentPattern) target = target.left;\n if (target.type !== AST_NODE_TYPES.Identifier) return null;\n // An inline `{ a: string }` on a NAMED parameter stays out: the bindings the\n // options-object walk below reads do not exist, so there is no collaborator to\n // name. `deps: SomeDeps` is covered by the bare-reference path.\n const reference = readTypeReference(target.typeAnnotation?.typeAnnotation);\n if (reference === null) return null;\n return { name: target.name, ...reference };\n};\n\ntype TypeReference = { readonly typeName: string; readonly display: string };\ntype MemberTypes = ReadonlyMap<string, TypeReference>;\n\n/** Property signatures of a `{ a: A; b: B }` body, keyed by property name. */\nconst propertySignatureTypes = (\n members: readonly TSESTree.TypeElement[],\n): Map<string, TypeReference> => {\n const types = new Map<string, TypeReference>();\n for (const member of members) {\n if (member.type !== AST_NODE_TYPES.TSPropertySignature) continue;\n if (member.computed || member.key.type !== AST_NODE_TYPES.Identifier) continue;\n const reference = readTypeReference(member.typeAnnotation?.typeAnnotation);\n if (reference === null) continue;\n types.set(member.key.name, reference);\n }\n return types;\n};\n\n/** Locally declared object shapes and function aliases used to resolve constructor bags. */\ninterface FileTypeIndex {\n /** `interface Deps { … }` / `type Deps = { … }`, by name. */\n readonly objects: ReadonlyMap<string, MemberTypes>;\n /** `type Replayer = (e: Event) => void` — a callback with a nominal name. */\n readonly functionAliases: ReadonlySet<string>;\n}\n\nconst fileTypeIndex = (program: TSESTree.Program): FileTypeIndex => {\n const objects = new Map<string, MemberTypes>();\n const functionAliases = new Set<string>();\n for (const statement of program.body) {\n const declaration =\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;\n if (declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration) {\n objects.set(declaration.id.name, propertySignatureTypes(declaration.body.body));\n continue;\n }\n if (declaration?.type !== AST_NODE_TYPES.TSTypeAliasDeclaration) continue;\n const aliased = declaration.typeAnnotation;\n if (\n aliased.type === AST_NODE_TYPES.TSFunctionType ||\n aliased.type === AST_NODE_TYPES.TSConstructorType\n ) {\n functionAliases.add(declaration.id.name);\n continue;\n }\n // `type Deps = { … }` and `type Deps = Base & { … }` both resolve; the\n // intersection form is how a bag is usually extended.\n const literals =\n aliased.type === AST_NODE_TYPES.TSTypeLiteral\n ? [aliased]\n : aliased.type === AST_NODE_TYPES.TSIntersectionType\n ? aliased.types.filter((part) => part.type === AST_NODE_TYPES.TSTypeLiteral)\n : [];\n if (literals.length === 0) continue;\n const merged = new Map<string, TypeReference>();\n for (const literal of literals) {\n for (const [name, reference] of propertySignatureTypes(literal.members)) {\n merged.set(name, reference);\n }\n }\n objects.set(declaration.id.name, merged);\n }\n return { objects, functionAliases };\n};\n\n/**\n * Member types of an options-object parameter's annotation: the annotation's own\n * body when it is written inline, otherwise the declaration it names, resolved\n * in this file only.\n */\nconst bagMemberTypes = (\n annotation: TSESTree.TypeNode,\n declared: () => FileTypeIndex,\n): MemberTypes | null => {\n if (annotation.type === AST_NODE_TYPES.TSTypeLiteral) {\n return propertySignatureTypes(annotation.members);\n }\n // A qualified `catalog.Deps` names another module by construction.\n if (\n annotation.type !== AST_NODE_TYPES.TSTypeReference ||\n annotation.typeName.type !== AST_NODE_TYPES.Identifier\n ) {\n return null;\n }\n return declared().objects.get(annotation.typeName.name) ?? null;\n};\n\n/** Resolve separately stored collaborators from a locally typed constructor bag. */\nconst objectPatternCollaborators = (\n pattern: TSESTree.ObjectPattern,\n declared: () => FileTypeIndex,\n): Collaborator[] => {\n const annotation = pattern.typeAnnotation?.typeAnnotation;\n if (annotation === undefined) return [];\n const members = bagMemberTypes(annotation, declared);\n if (members === null) return [];\n\n const collaborators: Collaborator[] = [];\n for (const property of pattern.properties) {\n if (property.type !== AST_NODE_TYPES.Property || property.computed) continue;\n if (property.key.type !== AST_NODE_TYPES.Identifier) continue;\n const key = property.key.name;\n const bound =\n property.value.type === AST_NODE_TYPES.AssignmentPattern\n ? property.value.left\n : property.value;\n if (bound.type !== AST_NODE_TYPES.Identifier) continue;\n // A renamed binding (`{ repo: userRepo }`) offers two names; either one\n // reading as config-ish is enough to drop it, on the same reasoning that\n // drops a config-ish parameter name.\n if (CONFIGISH_NAME_RE.test(key)) continue;\n const reference = members.get(key);\n if (reference === undefined) continue;\n collaborators.push({ name: bound.name, ...reference });\n }\n return collaborators;\n};\n\n/** Every collaborator a single constructor parameter contributes: 0, 1, or (destructured) many. */\nconst parameterCollaborators = (\n parameter: TSESTree.Parameter,\n declared: () => FileTypeIndex,\n): readonly Collaborator[] => {\n let target: TSESTree.Node = parameter;\n if (target.type === AST_NODE_TYPES.AssignmentPattern) target = target.left;\n if (target.type === AST_NODE_TYPES.ObjectPattern) {\n return objectPatternCollaborators(target, declared);\n }\n const named = namedParameterCollaborator(parameter);\n return named === null ? [] : [named];\n};\n\ninterface ConstructorFacts {\n /** Parameters assigned to an instance field, either as a parameter property or in the body. */\n readonly collaborators: readonly Collaborator[];\n /** How many instance fields the constructor fills with a `new` expression. */\n readonly constructedFields: number;\n}\n\n/** Names bound by `class Foo<T>` / `constructor<T>()` — placeholders, not implementations. */\nconst typeParameterNames = (\n ...declarations: readonly (TSESTree.TSTypeParameterDeclaration | undefined)[]\n): ReadonlySet<string> => {\n const names = new Set<string>();\n for (const declaration of declarations) {\n for (const parameter of declaration?.params ?? []) names.add(parameter.name.name);\n }\n return names;\n};\n\nconst readConstructor = (\n ctor: TSESTree.MethodDefinition,\n declared: () => FileTypeIndex,\n typeParameters: ReadonlySet<string>,\n): ConstructorFacts => {\n const body = ctor.value.body;\n const storedFrom = new Set<string>();\n let constructedFields = 0;\n\n if (body !== null && body !== undefined) {\n for (const statement of body.body) {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) continue;\n const expression = statement.expression;\n if (\n expression.type !== AST_NODE_TYPES.AssignmentExpression ||\n expression.operator !== \"=\" ||\n expression.left.type !== AST_NODE_TYPES.MemberExpression ||\n expression.left.object.type !== AST_NODE_TYPES.ThisExpression\n ) {\n continue;\n }\n const source = expression.right;\n if (source.type === AST_NODE_TYPES.NewExpression) {\n constructedFields += 1;\n } else if (source.type === AST_NODE_TYPES.Identifier) {\n // `this.svc = svc`\n storedFrom.add(source.name);\n } else if (\n source.type === AST_NODE_TYPES.MemberExpression &&\n source.object.type === AST_NODE_TYPES.Identifier\n ) {\n // `this.slack = deps.slack` — a dependency bag spread onto fields.\n storedFrom.add(source.object.name);\n }\n }\n }\n\n const collaborators: Collaborator[] = [];\n for (const parameter of ctor.value.params) {\n for (const reference of parameterCollaborators(parameter, declared)) {\n const stored =\n parameter.type === AST_NODE_TYPES.TSParameterProperty || storedFrom.has(reference.name);\n if (!stored) continue;\n if (CONFIGISH_TYPE_RE.test(reference.typeName)) continue;\n if (CONFIGISH_NAME_RE.test(reference.name)) continue;\n // A bare type reference can still be one of three things a port would\n // protect nothing about, each of them the inline shape this rule already\n // rejects wearing a nominal name.\n if (typeParameters.has(reference.typeName)) continue;\n if (BUILTIN_CONTAINER_TYPE_RE.test(reference.typeName)) continue;\n if (declared().functionAliases.has(reference.typeName)) continue;\n collaborators.push(reference);\n }\n }\n\n return { collaborators, constructedFields };\n};\n\n/** Walk every descendant node, `parent` links excluded, until `found` returns true. */\nconst subtreeHas = (root: TSESTree.Node, found: (node: TSESTree.Node) => boolean): boolean => {\n let hit = false;\n const visit = (current: TSESTree.Node): void => {\n if (hit) return;\n if (found(current)) {\n hit = true;\n return;\n }\n for (const key of Object.keys(current) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") continue;\n const value = current[key];\n for (const child of (Array.isArray(value) ? value : [value]) as unknown[]) {\n if (\n child !== null &&\n typeof child === \"object\" &&\n typeof (child as { type?: unknown }).type === \"string\"\n ) {\n visit(child as TSESTree.Node);\n }\n }\n }\n };\n visit(root);\n return hit;\n};\n\n/** Framework router wiring is mounted at bootstrap rather than injected into consumers. */\nconst isFrameworkWiring = (body: TSESTree.ClassBody): boolean =>\n subtreeHas(body, (node) => {\n if (node.type === AST_NODE_TYPES.CallExpression) {\n const { callee } = node;\n if (callee.type === AST_NODE_TYPES.Identifier) return callee.name === ROUTER_FACTORY_NAME;\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === ROUTER_FACTORY_NAME\n );\n }\n // `express.Request` — qualified on purpose, so the DOM `Request`/`Response`\n // globals a Workers `fetch` handler names do not read as express wiring.\n return (\n node.type === AST_NODE_TYPES.TSTypeReference &&\n node.typeName.type === AST_NODE_TYPES.TSQualifiedName &&\n FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name)\n );\n });\n\nconst stem = (name: string): string => name.replace(/^I(?=[A-Z])/, \"\").replace(/Impl$/, \"\");\n\n/** Interface declarations at the top level of this module, exported or not. */\nconst fileInterfaceNames = (program: TSESTree.Program): string[] => {\n const names: string[] = [];\n for (const statement of program.body) {\n const declaration =\n statement.type === AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;\n if (declaration?.type === AST_NODE_TYPES.TSInterfaceDeclaration) names.push(declaration.id.name);\n }\n return names;\n};\n\n/** Report whether the class is a thin wrapper over somebody else's HTTP transport. */\nconst isTransportWrapper = (\n className: string,\n collaborators: readonly Collaborator[],\n program: TSESTree.Program,\n): boolean => {\n const [only] = collaborators;\n if (collaborators.length !== 1 || only === undefined) return false;\n if (!HTTP_TRANSPORT_TYPE_RE.test(only.typeName)) return false;\n if (!TRANSPORT_WRAPPER_NAME_RE.test(className)) return false;\n const target = stem(className);\n return !fileInterfaceNames(program).some((name) => {\n const other = stem(name);\n return target.endsWith(other) || other.endsWith(target);\n });\n};\n\n/**\n * Public instance methods only. `kind === \"method\"` excludes getters and setters\n * on purpose: a class that exposes only accessors is a value object, and the\n * constructor is not a seam worth porting.\n */\nconst publicMethodNames = (body: TSESTree.ClassBody): string[] => {\n const names: string[] = [];\n for (const member of body.body) {\n if (member.type !== AST_NODE_TYPES.MethodDefinition) continue;\n if (member.kind !== \"method\" || member.static) continue;\n if (member.accessibility === \"private\" || member.accessibility === \"protected\") continue;\n if (member.key.type === AST_NODE_TYPES.PrivateIdentifier) continue;\n if (member.key.type === AST_NODE_TYPES.Identifier) names.push(member.key.name);\n else names.push(\"…\");\n }\n return names;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-interface-for-injected-service\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"An exported service class with constructor-injected collaborators must implement an interface, so consumers depend on a port they can substitute instead of mocking the class.\",\n },\n schema: [],\n messages: {\n requireInterface:\n \"`{{name}}` stores injected collaborator(s) ({{deps}}) but implements no interface, so every consumer depends on this concrete class and can only be tested by mocking it. Declare an interface with its public method signature(s) ({{methods}}) and `class {{name}} implements <Interface>`.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const { filename } = context;\n if (isTestFile(filename) || isStoryFile(filename) || isScriptFile(filename)) return {};\n if (isGeneratedFile(filename, context.sourceCode.getText())) return {};\n\n // One pass over the module's top level, and only for a file that actually\n // has an options-object constructor to read.\n let declaredTypes: FileTypeIndex | null = null;\n const objectTypes = (): FileTypeIndex =>\n (declaredTypes ??= fileTypeIndex(context.sourceCode.ast));\n\n return {\n ClassDeclaration(node: TSESTree.ClassDeclaration): void {\n if (node.id === null) return;\n if (!isExportedClass(node)) return;\n // The port itself must never fire, and a class that extends anything —\n // an abstract base, a framework class, `Error` — already has one.\n if (node.abstract === true) return;\n if (node.superClass !== null) return;\n if (node.implements.length > 0) return;\n // A framework that instantiates by class token (NestJS `@Injectable()`)\n // makes the class its own contract.\n if (node.decorators.length > 0) return;\n\n const ctor = node.body.body.find(\n (member): member is TSESTree.MethodDefinition =>\n member.type === AST_NODE_TYPES.MethodDefinition && member.kind === \"constructor\",\n );\n if (ctor === undefined) return;\n\n const { collaborators, constructedFields } = readConstructor(\n ctor,\n objectTypes,\n typeParameterNames(node.typeParameters, ctor.value.typeParameters),\n );\n if (collaborators.length === 0) return;\n // A composition root BUILDS more than it RECEIVES — that is where\n // concrete types are supposed to be named, and a port above it protects\n // nobody. Constructing one internal helper while receiving a real\n // collaborator is an ordinary service, not a wiring class, so the test\n // is a ratio rather than the mere presence of a `new`.\n if (constructedFields > collaborators.length) return;\n // HTTP wiring: a router factory is mounted by the bootstrap, not injected.\n if (isFrameworkWiring(node.body)) return;\n // A lone third-party transport is not a seam a port could protect.\n if (isTransportWrapper(node.id.name, collaborators, context.sourceCode.ast)) return;\n\n const methods = publicMethodNames(node.body);\n if (methods.length === 0) return;\n\n context.report({\n node: node.id,\n messageId: \"requireInterface\",\n data: {\n name: node.id.name,\n deps: collaborators.map((c) => `${c.name}: ${c.display}`).join(\", \"),\n methods: methods.join(\", \"),\n },\n });\n },\n };\n },\n});\n","/**\n * @fileoverview require-static-next-matcher — Next.js matcher configuration must be statically analyzable at build time.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-static-next-matcher.test.ts\n */\n\nimport { AST_NODE_TYPES, type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\n\ntype MessageIds = \"dynamicMatcher\";\ntype Options = readonly [];\n\nconst NEXT_ENTRY_FILE = /(?:^|[/\\\\])(?:middleware|proxy)\\.[cm]?[jt]sx?$/u;\n\nfunction unwrapExpression(node: TSESTree.Node): TSESTree.Node {\n if (\n node.type === AST_NODE_TYPES.TSAsExpression ||\n node.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n node.type === AST_NODE_TYPES.TSNonNullExpression ||\n node.type === AST_NODE_TYPES.TSTypeAssertion\n ) {\n return unwrapExpression(node.expression);\n }\n return node;\n}\n\nfunction isStaticValue(node: TSESTree.Node): boolean {\n const value = unwrapExpression(node);\n if (value.type === AST_NODE_TYPES.Literal) {\n return true;\n }\n if (value.type === AST_NODE_TYPES.TemplateLiteral) {\n return value.expressions.length === 0;\n }\n if (value.type === AST_NODE_TYPES.ArrayExpression) {\n return value.elements.every(\n (element) =>\n element !== null &&\n element.type !== AST_NODE_TYPES.SpreadElement &&\n isStaticValue(element),\n );\n }\n if (value.type === AST_NODE_TYPES.ObjectExpression) {\n return value.properties.every(\n (property) =>\n property.type === AST_NODE_TYPES.Property &&\n property.kind === \"init\" &&\n !property.computed &&\n property.value.type !== AST_NODE_TYPES.AssignmentPattern &&\n isStaticValue(property.value),\n );\n }\n return false;\n}\n\nfunction propertyName(property: TSESTree.Property): string | null {\n if (property.computed) return null;\n if (property.key.type === AST_NODE_TYPES.Identifier) return property.key.name;\n return typeof property.key.value === \"string\" ? property.key.value : null;\n}\n\nexport default createRule<Options, MessageIds>({\n name: \"require-static-next-matcher\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Next.js middleware and proxy matcher configuration to contain only build-time literals.\",\n },\n schema: [],\n messages: {\n dynamicMatcher:\n \"Next.js matcher values must contain only literal arrays and objects. Calls, identifiers, concatenation, interpolated templates, and spreads are not statically analyzable and fail the production build.\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (!NEXT_ENTRY_FILE.test(context.filename)) {\n return {};\n }\n\n return {\n ExportNamedDeclaration(node): void {\n if (node.declaration?.type !== AST_NODE_TYPES.VariableDeclaration) {\n return;\n }\n for (const declaration of node.declaration.declarations) {\n if (\n declaration.id.type !== AST_NODE_TYPES.Identifier ||\n declaration.id.name !== \"config\" ||\n declaration.init === null\n ) {\n continue;\n }\n const config = unwrapExpression(declaration.init);\n if (config.type !== AST_NODE_TYPES.ObjectExpression) {\n continue;\n }\n for (const property of config.properties) {\n if (\n property.type !== AST_NODE_TYPES.Property ||\n propertyName(property) !== \"matcher\" ||\n property.value.type === AST_NODE_TYPES.AssignmentPattern\n ) {\n continue;\n }\n if (!isStaticValue(property.value)) {\n context.report({ node: property.value, messageId: \"dynamicMatcher\" });\n }\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview require-zod-form-validation — `formData.get(k)` hands back an attacker-controlled `FormDataEntryValue | null`.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/require-zod-form-validation.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { ZOD_SCHEMA_NAME_RE } from \"./_zod.js\";\n\ntype MessageIds = \"missingZodValidation\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/** Recognize the supported Zod receiver naming conventions. */\nconst looksLikeZodSchema = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n while (true) {\n if (current.type === AST_NODE_TYPES.Identifier) {\n return current.name === \"z\" || ZOD_SCHEMA_NAME_RE.test(current.name);\n }\n if (current.type === AST_NODE_TYPES.CallExpression) {\n current = current.callee;\n continue;\n }\n if (current.type === AST_NODE_TYPES.MemberExpression) {\n current = current.object;\n continue;\n }\n return false;\n }\n};\n\n/** Match `parse` and `safeParse` only on Zod-shaped receivers. */\nconst isZodParseCall = (node: TSESTree.Node): boolean => {\n if (node.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return false;\n if (callee.computed) return false;\n if (callee.property.type !== AST_NODE_TYPES.Identifier) return false;\n const method = callee.property.name;\n if (method !== \"parse\" && method !== \"safeParse\") return false;\n return looksLikeZodSchema(callee.object);\n};\n\n/** Match an optionally awaited `<x>.formData()` call. */\nconst isFormDataMethodCall = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n if (current.type === AST_NODE_TYPES.AwaitExpression) {\n current = current.argument;\n }\n if (current.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = current.callee;\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"formData\"\n );\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"require-zod-form-validation\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.\",\n },\n schema: [],\n messages: {\n missingZodValidation:\n \"FormData parsing must use Zod schema validation (e.g., Schema.parse() / Schema.safeParse())\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n if (isTestFile(context.filename)) {\n return {};\n }\n\n // Recognize conventional names and bindings initialized by `.formData()`.\n const isFormSourceIdentifier = (node: TSESTree.Node): boolean => {\n if (node.type !== AST_NODE_TYPES.Identifier) return false;\n if (/formdata/i.test(node.name)) return true;\n\n let scope: Scope.Scope | null = context.sourceCode.getScope(node);\n while (scope !== null) {\n const variable = scope.set.get(node.name);\n if (variable !== undefined && variable.defs.length === 1) {\n const def = variable.defs[0];\n if (\n def !== undefined &&\n def.type === \"Variable\" &&\n def.node.type === AST_NODE_TYPES.VariableDeclarator &&\n def.node.init !== null\n ) {\n return isFormDataMethodCall(def.node.init);\n }\n return false;\n }\n scope = scope.upper;\n }\n return false;\n };\n\n const isFormDataGetCall = (node: TSESTree.CallExpression): boolean => {\n const callee = node.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return false;\n if (\n callee.property.type !== AST_NODE_TYPES.Identifier ||\n callee.property.name !== \"get\"\n ) {\n return false;\n }\n return isFormSourceIdentifier(callee.object);\n };\n\n const hasZodParseAncestor = (node: TSESTree.Node): boolean => {\n let parent: TSESTree.Node | null | undefined = node.parent;\n while (parent !== null && parent !== undefined) {\n if (isZodParseCall(parent)) return true;\n parent = parent.parent;\n }\n return false;\n };\n\n const isInstanceofNarrowing = (node: TSESTree.Node): boolean => {\n const parent: TSESTree.Node | null | undefined = node.parent;\n return (\n parent !== null &&\n parent !== undefined &&\n parent.type === AST_NODE_TYPES.BinaryExpression &&\n parent.operator === \"instanceof\" &&\n parent.left === node &&\n parent.right.type === AST_NODE_TYPES.Identifier &&\n (parent.right.name === \"File\" || parent.right.name === \"Blob\")\n );\n };\n\n /** The identifier this `.get(...)` call is bound to, or null. */\n const boundDeclarator = (\n node: TSESTree.CallExpression,\n ): TSESTree.VariableDeclarator | null => {\n const parent = node.parent;\n if (\n parent.type === AST_NODE_TYPES.VariableDeclarator &&\n parent.init === node &&\n parent.id.type === AST_NODE_TYPES.Identifier\n ) {\n return parent;\n }\n return null;\n };\n\n /** Is any read of this binding validated (Zod parse, or `instanceof File`)? */\n const bindingIsValidated = (\n declarator: TSESTree.VariableDeclarator,\n ): boolean => {\n const variable = context.sourceCode.getDeclaredVariables(declarator)[0];\n if (variable === undefined) return false;\n return variable.references.some(\n (ref) =>\n hasZodParseAncestor(ref.identifier) ||\n isInstanceofNarrowing(ref.identifier),\n );\n };\n\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isFormDataGetCall(node)) return;\n\n if (hasZodParseAncestor(node) || isInstanceofNarrowing(node)) return;\n\n const declarator = boundDeclarator(node);\n if (declarator !== null && bindingIsValidated(declarator)) return;\n\n context.report({\n node,\n messageId: \"missingZodValidation\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview store-insert-requires-on-conflict — a bare `INSERT` duplicates rows or throws under cron re-runs and queue redelivery.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/store-insert-requires-on-conflict.test.ts\n */\n\nimport { type TSESTree } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isTestFile } from \"./_paths.js\";\nimport { createSqlListener } from \"./_sql.js\";\n\ntype MessageIds = \"storeInsertRequiresOnConflict\";\ntype Options = readonly [];\n\n/** Matches INSERT writes only when their SQL keywords are adjacent. */\nconst INSERT_WRITE =\n /\\bINSERT\\s+(?:OR\\s+\\w+\\s+)?INTO\\s+[\\w.\"'`?$:@-]+\\s*(?:\\([^)]*\\)\\s*)?(?:VALUES|SELECT|DEFAULT\\s+VALUES)\\b/i;\n\n/** Matches supported replay-safe insert forms. */\nconst CONFLICT_HANDLED = /\\bON\\s+CONFLICT\\b|\\bON\\s+DUPLICATE\\s+KEY\\b|\\bINSERT\\s+OR\\s+(?:IGNORE|REPLACE)\\b/i;\n\nconst INSERT_GATE = /insert/i;\n\nexport default createRule<Options, MessageIds>({\n name: \"store-insert-requires-on-conflict\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require an embedded SQL INSERT to carry ON CONFLICT; store writes replay under cron re-runs and queue redelivery and must be idempotent upserts.\",\n },\n schema: [],\n messages: {\n storeInsertRequiresOnConflict:\n \"This INSERT is not replay-safe: a cron re-run or queue redelivery duplicates the row (or fails the handler on a unique-constraint violation). Add `ON CONFLICT (...) DO UPDATE` / `DO NOTHING` (or `INSERT OR IGNORE`).\",\n },\n },\n defaultOptions: [],\n create(context) {\n if (isTestFile(context.filename) || !INSERT_GATE.test(context.sourceCode.text)) {\n return {};\n }\n return createSqlListener((sql: string, node: TSESTree.Node): void => {\n if (!INSERT_WRITE.test(sql) || CONFLICT_HANDLED.test(sql)) {\n return;\n }\n context.report({ node, messageId: \"storeInsertRequiresOnConflict\" });\n });\n },\n});\n","/**\n * @fileoverview zod-naming-convention — a schema you cannot recognise at its use site sends every reader back to the declaration.\n *\n * Examples: https://github.com/sarj-ai/standards/blob/main/packages/typescript/tests/rules/zod-naming-convention.test.ts\n */\n\nimport { type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\nimport { createRule } from \"./_docs.js\";\nimport { isGeneratedFile, isTestFile } from \"./_paths.js\";\nimport { ZOD_PREFIX_RE, ZOD_SCHEMA_NAME_RE, ZOD_SUFFIX_RE } from \"./_zod.js\";\n\ntype MessageIds = \"zPrefix\" | \"schemaSuffix\" | \"zodSchemaName\";\ntype Convention = \"prefix\" | \"suffix\" | \"either\";\ntype Options = readonly [\n {\n convention?: Convention;\n }?,\n];\n\nconst CONVENTIONS: Record<\n Convention,\n { readonly test: RegExp; readonly messageId: MessageIds }\n> = {\n prefix: { test: ZOD_PREFIX_RE, messageId: \"zPrefix\" },\n suffix: { test: ZOD_SUFFIX_RE, messageId: \"schemaSuffix\" },\n either: { test: ZOD_SCHEMA_NAME_RE, messageId: \"zodSchemaName\" },\n};\n\n/** Names containing \"schema\" are already recognisable at the use site. */\nconst CONTAINS_SCHEMA_RE = /schema/i;\n\n/** Benchmark-local schemas are fixtures; require a complete path segment. */\nconst BENCHMARK_PATH_RE = /(^|[\\\\/])(?:benchmarks?|bench)[\\\\/]/;\n\n/**\n * Terminal methods whose results are values, result envelopes, registries,\n * JSON objects, or functions rather than schemas.\n */\nconst NON_SCHEMA_TERMINALS: ReadonlySet<string> = new Set([\n \"parse\",\n \"parseAsync\",\n \"safeParse\",\n \"safeParseAsync\",\n \"encode\",\n \"decode\",\n \"encodeAsync\",\n \"decodeAsync\",\n \"safeEncode\",\n \"safeDecode\",\n \"safeEncodeAsync\",\n \"safeDecodeAsync\",\n \"toJSONSchema\",\n \"registry\",\n \"implement\",\n]);\n\n/** Return the final method name in a call chain. */\nconst terminalMethodName = (callee: TSESTree.MemberExpression): string | null =>\n !callee.computed && callee.property.type === AST_NODE_TYPES.Identifier\n ? callee.property.name\n : null;\n\n/** Return whether a call chain originates from the bare `z` identifier. */\nconst calleeChainStartsWithZ = (node: TSESTree.Node): boolean => {\n let current: TSESTree.Node = node;\n\n while (current.type === AST_NODE_TYPES.MemberExpression) {\n const receiver: TSESTree.Node = current.object;\n if (receiver.type === AST_NODE_TYPES.Identifier && receiver.name === \"z\") {\n return true;\n }\n if (receiver.type === AST_NODE_TYPES.CallExpression) {\n current = receiver.callee;\n continue;\n }\n return false;\n }\n\n return false;\n};\n\nexport default createRule<Options, MessageIds>({\n name: \"zod-naming-convention\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce a consistent Zod schema naming convention — a `Z` prefix (`ZUser`) or a `Schema` suffix (`userSchema`); both are accepted by default.\",\n },\n schema: [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n convention: {\n type: \"string\",\n enum: [\"prefix\", \"suffix\", \"either\"],\n },\n },\n },\n ],\n messages: {\n zPrefix: \"Zod schema names should start with Z (e.g. `ZUser`)\",\n schemaSuffix: \"Zod schema names should end with Schema (e.g. `userSchema`)\",\n zodSchemaName:\n \"Zod schema names should start with Z (`ZUser`) or end with Schema (`userSchema`)\",\n },\n },\n defaultOptions: [{}],\n create(context, [optionsArg]) {\n const convention = optionsArg?.convention ?? \"either\";\n const { test, messageId } = CONVENTIONS[convention];\n // A schema-containing name does not satisfy an explicitly prefix-only policy.\n const acceptsSchemaWord = convention !== \"prefix\";\n\n // Test and benchmark schemas are local fixtures rather than APIs.\n if (\n isTestFile(context.filename) ||\n BENCHMARK_PATH_RE.test(context.filename.replaceAll(\"\\\\\", \"/\")) ||\n isGeneratedFile(context.filename, context.sourceCode.text)\n ) {\n return {};\n }\n\n return {\n VariableDeclarator(node: TSESTree.VariableDeclarator): void {\n const init = node.init;\n if (init === null || init === undefined) return;\n if (init.type !== AST_NODE_TYPES.CallExpression) return;\n\n const callee = init.callee;\n if (callee.type !== AST_NODE_TYPES.MemberExpression) return;\n\n if (!calleeChainStartsWithZ(callee)) return;\n\n // Do not apply schema naming to calls that return non-schema values.\n const terminal = terminalMethodName(callee);\n if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;\n\n if (node.id.type !== AST_NODE_TYPES.Identifier) return;\n if (test.test(node.id.name)) return;\n // The name already identifies a schema in any casing.\n if (acceptsSchemaWord && CONTAINS_SCHEMA_RE.test(node.id.name)) return;\n\n context.report({\n node: node.id,\n messageId,\n });\n },\n };\n },\n});\n","/**\n * @fileoverview _renames — every rule this plugin has renamed, old name to new; the old names no longer resolve, so this map is what says what to write instead.\n *\n * `sarj-standards repo sync-ledger` turns each entry into the consumer-facing ledger row.\n *\n */\n\nexport const renamedRules = {\n \"jsdoc-restates-signature\": \"no-restated-jsdoc\",\n \"no-async-callback-in-waitfor\": \"no-async-callback-in-wait-for\",\n \"strict-test-assertions\": \"prefer-whole-object-assertion\",\n \"trailing-value-narration\": \"no-trailing-value-narration\",\n} as const;\n\nexport type RenamedFrom = keyof typeof renamedRules;\nexport type RenamedTo = (typeof renamedRules)[RenamedFrom];\n","/** @fileoverview _retired — burned rule names and their migration action. */\n\n/** Why a name was withdrawn, and in which release. */\nexport interface RetiredRule {\n /** The plugin version whose release removed the rule. */\n readonly removedIn: string;\n /** One line a consumer can act on: why it went, and what (if anything) replaced it. */\n readonly reason: string;\n}\n\nexport const retiredRules: Readonly<Record<string, RetiredRule>> = {\n \"ban-loose-type-guards-in-tests\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-implicit-attribute-access\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-sequential-await\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; core `no-await-in-loop` covers it.\",\n },\n \"no-template-literal-in-log\": {\n removedIn: \"2.3.1\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"no-unsafe-cast\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; keep `@typescript-eslint/consistent-type-assertions` enabled.\",\n },\n \"prefer-setup-file-mocks\": {\n removedIn: \"5.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"prefer-shadcn\": {\n removedIn: \"3.0.0\",\n reason:\n \"Delete the retired entry; application-profile consumers can separately adopt `@sarj/prefer-shadcn-primitives`.\",\n },\n \"primary-export-file-name\": {\n removedIn: \"4.0.0\",\n reason: \"Delete the config entry and suppressions; there is no replacement.\",\n },\n \"require-parameterized-tests\": {\n removedIn: \"4.0.0\",\n reason: \"Delete stale references; the rule was never registered.\",\n },\n \"require-schema-validate-search\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the entry; use `@typescript-eslint/consistent-type-assertions`.\",\n },\n \"single-public-export\": {\n removedIn: \"3.0.0\",\n reason: \"Delete the config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AAAA,EAC3B,OAAO;AACT;AAEA,IAAO,gBAAQ;","names":["import_utils","body","import_utils","import_utils","import_utils","import_utils","body","body","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","isNode","subtreeMatches","body","import_utils","matchesAnyPattern","import_utils","import_utils","import_utils","propName","body","import_utils","import_utils","calleeName","FUNCTION_TYPES","body","import_utils","DIRECTIVE_RE","LICENSE_RE","import_utils","import_utils","import_utils","import_utils","import_utils","module","import_utils","FUNCTION_TYPES","import_utils","DIRECTIVE_RE","WALL_NARRATION_RE","areAdjacentLineComments","body","import_utils","DIRECTIVE_RE","STOPWORDS","WORD_RE","import_utils","propertyKeyName","keyName","import_utils","import_utils","isNode","calleeName","body","import_utils","body","import_utils","TEST_CALLERS","FUNCTION_TYPES","body","nearestEnclosingFunction","testCallerName","isTestBody","import_utils","DEFAULT_METHODS","compile","import_utils","body","import_utils","preview","import_utils","WORD_RE","STOPWORDS","DIRECTIVE_RE","body","import_utils","import_utils","VALUE_TAG_RE","NON_ASCII_LETTER_RE","WORD_RE","body","body","import_utils","LEAD_IN_RE","body","import_utils","body","named","import_utils","import_utils","import_utils","unwrap","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","IGNORE_PATTERNS","FUNCTION_TYPES","isIgnoredFile","unwrap","enclosingFunction","import_utils","isZodModule","FUNCTION_TYPES","isZodModule","import_utils","variable","import_utils","import_utils","unwrap","findVariable","import_utils","import_utils","propName","keyName","import_utils","ts","IGNORE_PATTERNS","isIgnoredFile","import_utils","NUMERIC_SIGNS","body","import_utils","isZodModule","import_utils","isZodModule","import_utils","import_utils","GLOBAL_OBJECTS","matchesAnyPattern","isGlobalFetchCall","import_utils","named","body","stem","import_utils","propertyName","import_utils","import_utils","import_utils"]}
|