@sarj/eslint-plugin 2.0.2 → 2.1.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/rules/enforce-file-structure.ts","../src/rules/no-client-side-data-fetching.ts","../src/rules/no-enum.ts","../src/rules/no-raw-env.ts","../src/rules/no-unnecessary-use-client.ts","../src/rules/prefer-schema-for-api-payload.ts","../src/rules/prefer-server-actions.ts","../src/rules/prefer-shadcn.ts","../src/rules/require-assert-never.ts","../src/rules/require-zod-form-validation.ts","../src/rules/zod-naming-convention.ts"],"sourcesContent":["import enforceFileStructure from \"./rules/enforce-file-structure.js\";\nimport noClientSideDataFetching from \"./rules/no-client-side-data-fetching.js\";\nimport noEnum from \"./rules/no-enum.js\";\nimport noRawEnv from \"./rules/no-raw-env.js\";\nimport noUnnecessaryUseClient from \"./rules/no-unnecessary-use-client.js\";\nimport preferSchemaForApiPayload from \"./rules/prefer-schema-for-api-payload.js\";\nimport preferServerActions from \"./rules/prefer-server-actions.js\";\nimport preferShadcn from \"./rules/prefer-shadcn.js\";\nimport requireAssertNever from \"./rules/require-assert-never.js\";\nimport requireZodFormValidation from \"./rules/require-zod-form-validation.js\";\nimport zodNamingConvention from \"./rules/zod-naming-convention.js\";\n\nconst rules = {\n \"enforce-file-structure\": enforceFileStructure,\n \"no-client-side-data-fetching\": noClientSideDataFetching,\n \"no-enum\": noEnum,\n \"no-raw-env\": noRawEnv,\n \"no-unnecessary-use-client\": noUnnecessaryUseClient,\n \"prefer-schema-for-api-payload\": preferSchemaForApiPayload,\n \"prefer-server-actions\": preferServerActions,\n \"prefer-shadcn\": preferShadcn,\n \"require-assert-never\": requireAssertNever,\n \"require-zod-form-validation\": requireZodFormValidation,\n \"zod-naming-convention\": zodNamingConvention,\n};\n\nconst plugin = {\n meta: {\n name: \"@sarj/eslint-plugin\",\n version: \"2.0.0\",\n },\n rules,\n configs: {\n recommended: {\n plugins: [\"@sarj\"],\n rules: {\n \"@sarj/zod-naming-convention\": \"warn\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/enforce-file-structure\": \"warn\",\n \"@sarj/no-client-side-data-fetching\": \"warn\",\n \"@sarj/prefer-server-actions\": \"warn\",\n \"@sarj/no-unnecessary-use-client\": \"warn\",\n \"@sarj/prefer-schema-for-api-payload\": \"warn\",\n },\n },\n strict: {\n plugins: [\"@sarj\"],\n rules: {\n \"@sarj/zod-naming-convention\": \"error\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/enforce-file-structure\": \"error\",\n \"@sarj/no-raw-env\": \"error\",\n \"@sarj/prefer-shadcn\": \"error\",\n \"@sarj/no-enum\": \"error\",\n \"@sarj/no-client-side-data-fetching\": \"error\",\n \"@sarj/prefer-server-actions\": \"error\",\n \"@sarj/no-unnecessary-use-client\": \"error\",\n \"@sarj/prefer-schema-for-api-payload\": \"error\",\n },\n },\n },\n};\n\nexport default plugin;\nexport { rules };\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"incorrectOrder\" | \"useServerDirective\";\ntype Options = readonly [];\n\n/** Section ordinals — lower numbers must appear before higher numbers. */\nconst SECTION = {\n imports: 0,\n types: 1,\n constants: 2,\n functions: 3,\n exports: 4,\n} as const;\n\nconst SECTION_NAMES = [\n \"imports\",\n \"types\",\n \"constants\",\n \"functions\",\n \"exports\",\n] as const;\n\ntype SectionOrdinal = (typeof SECTION)[keyof typeof SECTION];\n\nconst sectionName = (ordinal: SectionOrdinal): string => {\n const name = SECTION_NAMES[ordinal];\n // SECTION_NAMES is indexed by SectionOrdinal which is a numeric literal union of 0..4 — this is always defined.\n // But noUncheckedIndexedAccess widens this to `string | undefined`, so we fall back defensively.\n return name ?? \"unknown\";\n};\n\nconst isConstantNamed = (declarator: TSESTree.VariableDeclarator): boolean => {\n if (declarator.id.type !== AST_NODE_TYPES.Identifier) return false;\n const name = declarator.id.name;\n // Treat as constant if the binding is ALL_CAPS (allowing underscores/digits).\n return name.length > 0 && name === name.toUpperCase();\n};\n\nconst getStatementSection = (\n statement: TSESTree.ProgramStatement,\n): SectionOrdinal => {\n switch (statement.type) {\n case AST_NODE_TYPES.ImportDeclaration:\n return SECTION.imports;\n case AST_NODE_TYPES.TSTypeAliasDeclaration:\n case AST_NODE_TYPES.TSInterfaceDeclaration:\n case AST_NODE_TYPES.TSEnumDeclaration:\n return SECTION.types;\n case AST_NODE_TYPES.VariableDeclaration: {\n if (statement.kind === \"const\") {\n const firstDeclarator = statement.declarations[0];\n if (firstDeclarator !== undefined && isConstantNamed(firstDeclarator)) {\n return SECTION.constants;\n }\n }\n return SECTION.functions;\n }\n case AST_NODE_TYPES.FunctionDeclaration:\n return SECTION.functions;\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n case AST_NODE_TYPES.ExportAllDeclaration:\n return SECTION.exports;\n default:\n return SECTION.functions;\n }\n};\n\nconst isUseServerDirective = (\n statement: TSESTree.ProgramStatement | undefined,\n): boolean => {\n if (statement === undefined) return false;\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"enforce-file-structure\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce a canonical top-of-file ordering: imports -> types -> constants -> functions -> exports. Server-action files (under `/actions/` or with `action` in the path) must also begin with a `use server` directive.\",\n },\n schema: [],\n messages: {\n incorrectOrder:\n \"File structure violation: {{current}} should come before {{expected}}\",\n useServerDirective:\n \"Server action files must start with 'use server' directive\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n const isServerAction =\n filename.includes(\"/actions/\") || filename.includes(\"action\");\n\n return {\n Program(node: TSESTree.Program): void {\n const body = node.body;\n\n if (isServerAction) {\n const firstNode = body[0];\n if (!isUseServerDirective(firstNode)) {\n context.report({\n node,\n messageId: \"useServerDirective\",\n });\n }\n }\n\n let currentSection: SectionOrdinal = SECTION.imports;\n\n for (const statement of body) {\n // Skip top-of-file string directives ('use server', 'use client',\n // 'use strict', ...) so they don't get classified as a section.\n if (isUseServerDirective(statement)) continue;\n if (\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 ) {\n continue;\n }\n\n const statementSection = getStatementSection(statement);\n\n if (statementSection < currentSection) {\n context.report({\n node: statement,\n messageId: \"incorrectOrder\",\n data: {\n current: sectionName(statementSection),\n expected: sectionName(currentSection),\n },\n });\n } else if (statementSection > currentSection) {\n currentSection = statementSection;\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow data fetching inside `useEffect` / `useLayoutEffect`.\n *\n * Anti-pattern:\n *\n * useEffect(() => { fetch('/data').then(setData); }, []);\n *\n * Causes a client-side waterfall (render → effect → fetch → re-render),\n * forfeits server-side caching, and produces layout shift. In Next.js App\n * Router, prefer:\n * - a React Server Component that fetches at render time, or\n * - a Server Action invoked from a form / onClick handler, or\n * - client-side caching libraries like SWR or React Query.\n *\n * Detection covers:\n * - `fetch(...)` (default + when explicit `method: \"GET\"`)\n * - `axios.<method>(...)` for actual HTTP verbs only:\n * get / post / put / delete / patch / request / head / options\n * (i.e. NOT `axios.create` / `axios.defaults`)\n * - `ky.<method>(...)` / `superagent.<method>(...)` (same verbs)\n * - bare `axios(...)` / `ky(...)` calls (when treated as a GET)\n *\n * Analytics / telemetry endpoints (`*track*`, `*log*`, `*ping*`, ...) are\n * intentionally exempt because they aren't render-blocking data fetches.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/data-fetching\n * - https://react.dev/reference/react/useEffect#fetching-data-with-effects\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\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\nconst ANALYTICS_KEYWORDS: readonly string[] = [\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 // fetch(url, options?)\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 return ANALYTICS_KEYWORDS.some((keyword) => url.includes(keyword));\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 Disallow TypeScript `enum` declarations. Use string-literal\n * union types (e.g. `type Status = \"active\" | \"inactive\"`) or `as const`\n * objects instead — enums generate runtime code, have unintuitive numeric\n * defaults, and don't tree-shake cleanly.\n *\n * Generated files can opt out either by living under a path matched by\n * `ignoreFiles` (default: `**\\/generated/**`, `**\\/*.gen.ts`, `**\\/*.generated.ts`)\n * or by including a `@generated` marker comment near the top of the file.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noEnum\";\ntype Options = readonly [\n {\n ignoreFiles?: readonly string[];\n }?,\n];\n\nconst DEFAULT_IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\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\nfunction hasGeneratedMarker(sourceText: string): boolean {\n // Look only in the first 1KB to keep this cheap.\n const head = sourceText.slice(0, 1024);\n return /@generated\\b/.test(head);\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 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 const isIgnoredByDefault = DEFAULT_IGNORE_PATTERNS.some((re) =>\n re.test(filename),\n );\n const isIgnoredByOption =\n ignoreFiles.length > 0 && matchesAnyPattern(filename, ignoreFiles);\n const isGenerated = hasGeneratedMarker(sourceText);\n\n if (isIgnoredByDefault || isIgnoredByOption || isGenerated) {\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 Disallow direct `process.env` access. Force all env reads\n * through a Zod-validated env module so configuration is typed and validated\n * at startup.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noRawEnv\";\ntype Options = readonly [];\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"no-raw-env\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow direct `process.env` access; use a Zod-validated env module instead.\",\n },\n schema: [],\n messages: {\n noRawEnv:\n \"Do not read from `process.env` directly. Import the Zod-validated env module instead so values are typed and validated at startup.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n MemberExpression(node: TSESTree.MemberExpression): void {\n if (node.computed) {\n // Skip dynamic accesses like process[\"env\"] — extremely rare and out of scope.\n return;\n }\n if (\n node.object.type === \"Identifier\" &&\n node.object.name === \"process\" &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\"\n ) {\n context.report({\n node,\n messageId: \"noRawEnv\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Flag `'use client'` files with no hooks or event handlers.\n *\n * If a file is marked `'use client'` but contains no hook calls\n * (`useState`/`useEffect`/etc.), no JSX event handlers (`onClick`,\n * `onChange`, etc.), no browser globals, no client-only imports, and no\n * other client-side indicators (classes, re-exports), the directive is\n * likely unnecessary and the file could be a React Server Component —\n * improving cold-start, bundle size, and SEO.\n *\n * False-positive watch: components that only use client-side context\n * (e.g. theme providers) without hooks or events still need `'use client'`.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/rendering/client-components\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\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\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\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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\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 markIfHookOrContext(node.callee);\n },\n JSXAttribute(node): void {\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 (\n typeof node.source.value === \"string\" &&\n CLIENT_ONLY_PACKAGES_REGEX.test(node.source.value)\n ) {\n hasClientIndicator = true;\n }\n },\n ExportNamedDeclaration(node): void {\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ExportAllDeclaration(node): void {\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ClassDeclaration(): void {\n hasClientIndicator = true;\n },\n ClassExpression(): void {\n hasClientIndicator = true;\n },\n Identifier(node): void {\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 Don't access `response.json()` fields without a Zod parse first.\n *\n * Pattern flagged:\n * const data = await response.json();\n * doSomething(data.foo); // <-- unvalidated property access\n *\n * Encouraged:\n * const data = MySchema.parse(await response.json());\n * doSomething(data.foo); // typed + validated\n *\n * Heuristic:\n * - Track variables initialized to `await someCall.json()` using ESLint's scope manager.\n * - Untrack if reassigned to anything other than another raw `json()` call.\n * - Flag MemberExpression reads and destructuring off tracked variables.\n * - `.parse()` / `.safeParse()` chained directly on the json call are legit\n * and never produce a tracked binding in the first place.\n *\n * References:\n * - https://zod.dev/?id=parse\n * - https://www.totaltypescript.com/parse-don-t-validate\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"unparsedJsonAccess\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/**\n * Peel TypeScript wrapper nodes that don't affect the underlying value\n * (`as Foo`, `<Foo>x`, `x!`, `x satisfies Foo`, parentheses, optional chain\n * wrappers). Returns the inner expression we actually care about.\n */\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/**\n * Returns true if the expression is (optionally awaited) `<x>.json()`.\n */\nconst isJsonCall = (\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 return (\n property !== null &&\n property.type === AST_NODE_TYPES.Identifier &&\n property.name === \"json\"\n );\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\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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()` before property access.\",\n },\n schema: [],\n messages: {\n unparsedJsonAccess:\n \"Property access on the result of `response.json()` without a schema parse. Pipe through `XSchema.parse(...)` (Zod) before reading fields.\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n const unvalidatedVariables = new Set<Scope.Variable>();\n\n const trackInitializer = (\n declarator: TSESTree.VariableDeclarator,\n ): void => {\n if (!isJsonCall(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 (isJsonCall(node.init)) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\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 (isJsonCall(node.right)) {\n unvalidatedVariables.add(variable);\n } else {\n // Reassigned to a parse call or something else: drop tracking.\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 (isJsonCall(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 MemberExpression(node): void {\n const scope = context.sourceCode.getScope(node);\n const obj = unwrap(node.object);\n\n if (isJsonCall(obj)) {\n // Direct `.foo` access on `(await r.json()).foo` is always bad,\n // unless the parent call is a `.parse()`/`.safeParse()` — in which\n // case it's a validation, not an unvalidated read.\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 ) {\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 Next.js Server Actions over /api/* mutations.\n *\n * Flags mutations against internal `/api/*` URLs (POST/PUT/DELETE/PATCH) via\n * `fetch`, axios-style helpers, or direct axios/request calls. GET requests\n * and external URLs are ignored. Tests, scripts, and Next.js route handlers\n * are skipped because Server Actions don't apply there.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\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?$|\\/tests?\\/|\\/__tests__\\/|\\/scripts?\\/|\\/app\\/api\\/.*\\/route\\.[jt]sx?$|\\/pages\\/api\\/)/;\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 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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 return {\n CallExpression(node) {\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 if (urlArg && urlArg.type !== \"SpreadElement\" && isApiUrl(urlArg, context)) {\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 shadcn/ui form primitives over their native HTML\n * counterparts. Limited to form/dialog elements — `<button>` and `<table>`\n * have been removed from the forbid list because they produced 100% false\n * positives during bulbul validation (icon buttons, layout tables).\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"preferShadcn\";\ntype Options = readonly [];\n\nconst REPLACEMENTS: Readonly<Record<string, string>> = {\n input: \"Input\",\n select: \"Select\",\n textarea: \"Textarea\",\n dialog: \"Dialog\",\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"prefer-shadcn\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer shadcn/ui form primitives over native `<input>`, `<select>`, `<textarea>`, and `<dialog>` elements.\",\n },\n schema: [],\n messages: {\n preferShadcn:\n \"Use the shadcn <{{replacement}}> component from @/components/ui/{{lowercase}} instead of native <{{element}}>.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node: TSESTree.JSXOpeningElement): void {\n // Only lowercase JSXIdentifier names represent native HTML elements.\n // Member expressions (`Foo.Bar`) and namespaces (`svg:path`) are skipped.\n if (node.name.type !== \"JSXIdentifier\") {\n return;\n }\n\n const elementName = node.name.name;\n const replacement = REPLACEMENTS[elementName];\n\n if (replacement === undefined) {\n return;\n }\n\n context.report({\n node,\n messageId: \"preferShadcn\",\n data: {\n element: elementName,\n replacement,\n lowercase: elementName,\n },\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"missingAssertNever\";\ntype Options = readonly [];\n\nconst isAssertNeverCall = (expression: TSESTree.Expression): boolean => {\n if (expression.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = expression.callee;\n return (\n callee.type === AST_NODE_TYPES.Identifier && callee.name === \"assertNever\"\n );\n};\n\nconst statementContainsAssertNever = (\n statement: TSESTree.Statement,\n): boolean => {\n if (statement.type === AST_NODE_TYPES.ExpressionStatement) {\n return isAssertNeverCall(statement.expression);\n }\n if (statement.type === AST_NODE_TYPES.ThrowStatement) {\n return isAssertNeverCall(statement.argument);\n }\n // Recurse into block-scoped default bodies like `default: { ... }`\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.some(statementContainsAssertNever);\n }\n return false;\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"require-assert-never\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require switch statements to end with `assertNever(_)` in their default case so that discriminated unions are exhaustively checked at compile time.\",\n },\n schema: [],\n messages: {\n missingAssertNever:\n \"Switch statement default case must call assertNever() for exhaustive type checking\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const defaultCase = node.cases.find(\n (caseNode): caseNode is TSESTree.SwitchCase => caseNode.test === null,\n );\n if (!defaultCase) return;\n\n const hasAssertNever = defaultCase.consequent.some(\n statementContainsAssertNever,\n );\n if (hasAssertNever) return;\n\n context.report({\n node: defaultCase,\n messageId: \"missingAssertNever\",\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"missingZodValidation\";\ntype Options = readonly [];\n\nconst 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 // Match `formData.get(...)` specifically — same convention as the original rule.\n return (\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"formData\"\n );\n};\n\nconst isParseCallExpression = (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 return (\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"parse\"\n );\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"require-zod-form-validation\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod validation (`Schema.parse(...)`) 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())\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isFormDataGetCall(node)) return;\n\n // Walk up the parent chain to find a surrounding `.parse(...)` call.\n // `.parent` is `null` at the Program root, so we must guard for both\n // null and undefined.\n let parent: TSESTree.Node | null | undefined = node.parent;\n while (parent !== null && parent !== undefined) {\n if (isParseCallExpression(parent)) return;\n parent = parent.parent;\n }\n\n context.report({\n node,\n messageId: \"missingZodValidation\",\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"zPrefix\";\ntype Options = readonly [];\n\n/**\n * Walks down a (possibly chained) callee like `z.object().extend().refine()` and\n * returns `true` if the chain originates from a bare `z` identifier — i.e. the\n * outermost MemberExpression on the chain has `z` as its receiver.\n */\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"zod-naming-convention\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce Zod schemas to be named with a Z prefix (e.g. `ZUser = z.object({...})`).\",\n },\n schema: [],\n messages: {\n zPrefix: \"Zod schema names should start with Z\",\n },\n },\n defaultOptions: [],\n create(context) {\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 if (node.id.type !== AST_NODE_TYPES.Identifier) return;\n const variableName = node.id.name;\n if (variableName.startsWith(\"Z\")) return;\n\n context.report({\n node: node.id,\n messageId: \"zPrefix\",\n });\n },\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2D;AAM3D,IAAM,UAAU;AAAA,EACd,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,cAAc,CAAC,YAAoC;AACvD,QAAM,OAAO,cAAc,OAAO;AAGlC,SAAO,QAAQ;AACjB;AAEA,IAAM,kBAAkB,CAAC,eAAqD;AAC5E,MAAI,WAAW,GAAG,SAAS,4BAAe,WAAY,QAAO;AAC7D,QAAM,OAAO,WAAW,GAAG;AAE3B,SAAO,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY;AACtD;AAEA,IAAM,sBAAsB,CAC1B,cACmB;AACnB,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK,4BAAe;AAClB,aAAO,QAAQ;AAAA,IACjB,KAAK,4BAAe;AAAA,IACpB,KAAK,4BAAe;AAAA,IACpB,KAAK,4BAAe;AAClB,aAAO,QAAQ;AAAA,IACjB,KAAK,4BAAe,qBAAqB;AACvC,UAAI,UAAU,SAAS,SAAS;AAC9B,cAAM,kBAAkB,U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AY;AAChD,cAAM,eAAe,KAAK,GAAG;AAC7B,YAAI,aAAa,WAAW,GAAG,EAAG;AAElC,gBAAQ,OAAO;AAAA,UACb,MAAM,KAAK;AAAA,UACX,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AXxDD,IAAM,QAAQ;AAAA,EACZ,0BAA0B;AAAA,EAC1B,gCAAgC;AAAA,EAChC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,yBAAyB;AAAA,EACzB,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,EACxB,+BAA+B;AAAA,EAC/B,yBAAyB;AAC3B;AAEA,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,EACA,SAAS;AAAA,IACP,aAAa;AAAA,MACX,SAAS,CAAC,OAAO;AAAA,MACjB,OAAO;AAAA,QACL,+BAA+B;AAAA,QAC/B,8BAA8B;AAAA,QAC9B,qCAAqC;AAAA,QACrC,gCAAgC;AAAA,QAChC,sCAAsC;AAAA,QACtC,+BAA+B;AAAA,QAC/B,mCAAmC;AAAA,QACnC,uCAAuC;AAAA,MACzC;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC,OAAO;AAAA,MACjB,OAAO;AAAA,QACL,+BAA+B;AAAA,QAC/B,8BAA8B;AAAA,QAC9B,qCAAqC;AAAA,QACrC,gCAAgC;AAAA,QAChC,oBAAoB;AAAA,QACpB,uBAAuB;AAAA,QACvB,iBAAiB;AAAA,QACjB,sCAAsC;AAAA,QACtC,+BAA+B;AAAA,QAC/B,mCAAmC;AAAA,QACnC,uCAAuC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils","import_utils"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/rules/enforce-file-structure.ts","../src/rules/no-client-side-data-fetching.ts","../src/rules/no-enum.ts","../src/rules/no-insecure-random-id.ts","../src/rules/no-json-stringify-error.ts","../src/rules/no-log-only-catch.ts","../src/rules/no-raw-env.ts","../src/rules/no-sentinel-return-on-catch.ts","../src/rules/no-sequential-await.ts","../src/rules/no-string-concat-in-loop.ts","../src/rules/no-unnecessary-use-client.ts","../src/rules/prefer-discriminated-union.ts","../src/rules/prefer-schema-for-api-payload.ts","../src/rules/prefer-server-actions.ts","../src/rules/prefer-shadcn.ts","../src/rules/require-assert-never.ts","../src/rules/require-zod-form-validation.ts","../src/rules/zod-naming-convention.ts"],"sourcesContent":["import enforceFileStructure from \"./rules/enforce-file-structure.js\";\nimport noClientSideDataFetching from \"./rules/no-client-side-data-fetching.js\";\nimport noEnum from \"./rules/no-enum.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 noRawEnv from \"./rules/no-raw-env.js\";\nimport noSentinelReturnOnCatch from \"./rules/no-sentinel-return-on-catch.js\";\nimport noSequentialAwait from \"./rules/no-sequential-await.js\";\nimport noStringConcatInLoop from \"./rules/no-string-concat-in-loop.js\";\nimport noUnnecessaryUseClient from \"./rules/no-unnecessary-use-client.js\";\nimport preferDiscriminatedUnion from \"./rules/prefer-discriminated-union.js\";\nimport preferSchemaForApiPayload from \"./rules/prefer-schema-for-api-payload.js\";\nimport preferServerActions from \"./rules/prefer-server-actions.js\";\nimport preferShadcn from \"./rules/prefer-shadcn.js\";\nimport requireAssertNever from \"./rules/require-assert-never.js\";\nimport requireZodFormValidation from \"./rules/require-zod-form-validation.js\";\nimport zodNamingConvention from \"./rules/zod-naming-convention.js\";\n\nconst rules = {\n \"enforce-file-structure\": enforceFileStructure,\n \"no-client-side-data-fetching\": noClientSideDataFetching,\n \"no-enum\": noEnum,\n \"no-insecure-random-id\": noInsecureRandomId,\n \"no-json-stringify-error\": noJsonStringifyError,\n \"no-log-only-catch\": noLogOnlyCatch,\n \"no-raw-env\": noRawEnv,\n \"no-sentinel-return-on-catch\": noSentinelReturnOnCatch,\n \"no-sequential-await\": noSequentialAwait,\n \"no-string-concat-in-loop\": noStringConcatInLoop,\n \"no-unnecessary-use-client\": noUnnecessaryUseClient,\n \"prefer-discriminated-union\": preferDiscriminatedUnion,\n \"prefer-schema-for-api-payload\": preferSchemaForApiPayload,\n \"prefer-server-actions\": preferServerActions,\n \"prefer-shadcn\": preferShadcn,\n \"require-assert-never\": requireAssertNever,\n \"require-zod-form-validation\": requireZodFormValidation,\n \"zod-naming-convention\": zodNamingConvention,\n};\n\nconst plugin = {\n meta: {\n name: \"@sarj/eslint-plugin\",\n version: \"2.1.1\",\n },\n rules,\n configs: {\n recommended: {\n plugins: [\"@sarj\"],\n rules: {\n \"@sarj/zod-naming-convention\": \"warn\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/enforce-file-structure\": \"warn\",\n \"@sarj/no-client-side-data-fetching\": \"warn\",\n \"@sarj/prefer-server-actions\": \"warn\",\n \"@sarj/no-unnecessary-use-client\": \"warn\",\n \"@sarj/prefer-schema-for-api-payload\": \"warn\",\n // Distilled from sarj-audit skills — warn in recommended, error in strict.\n \"@sarj/no-sequential-await\": \"warn\",\n \"@sarj/no-sentinel-return-on-catch\": \"warn\",\n \"@sarj/no-log-only-catch\": \"warn\",\n \"@sarj/no-insecure-random-id\": \"warn\",\n \"@sarj/no-json-stringify-error\": \"warn\",\n \"@sarj/no-string-concat-in-loop\": \"warn\",\n \"@sarj/prefer-discriminated-union\": \"warn\",\n },\n },\n strict: {\n plugins: [\"@sarj\"],\n rules: {\n \"@sarj/zod-naming-convention\": \"error\",\n \"@sarj/require-assert-never\": \"error\",\n \"@sarj/require-zod-form-validation\": \"error\",\n \"@sarj/enforce-file-structure\": \"error\",\n \"@sarj/no-raw-env\": \"error\",\n \"@sarj/prefer-shadcn\": \"error\",\n \"@sarj/no-enum\": \"error\",\n \"@sarj/no-client-side-data-fetching\": \"error\",\n \"@sarj/prefer-server-actions\": \"error\",\n \"@sarj/no-unnecessary-use-client\": \"error\",\n \"@sarj/prefer-schema-for-api-payload\": \"error\",\n // Distilled from sarj-audit skills.\n \"@sarj/no-sequential-await\": \"error\",\n \"@sarj/no-sentinel-return-on-catch\": \"error\",\n \"@sarj/no-log-only-catch\": \"error\",\n \"@sarj/no-insecure-random-id\": \"error\",\n \"@sarj/no-json-stringify-error\": \"error\",\n \"@sarj/no-string-concat-in-loop\": \"error\",\n \"@sarj/prefer-discriminated-union\": \"error\",\n },\n },\n },\n};\n\nexport default plugin;\nexport { rules };\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"incorrectOrder\" | \"useServerDirective\";\ntype Options = readonly [];\n\n/** Section ordinals — lower numbers must appear before higher numbers. */\nconst SECTION = {\n imports: 0,\n types: 1,\n constants: 2,\n functions: 3,\n exports: 4,\n} as const;\n\nconst SECTION_NAMES = [\n \"imports\",\n \"types\",\n \"constants\",\n \"functions\",\n \"exports\",\n] as const;\n\ntype SectionOrdinal = (typeof SECTION)[keyof typeof SECTION];\n\nconst sectionName = (ordinal: SectionOrdinal): string => {\n const name = SECTION_NAMES[ordinal];\n // SECTION_NAMES is indexed by SectionOrdinal which is a numeric literal union of 0..4 — this is always defined.\n // But noUncheckedIndexedAccess widens this to `string | undefined`, so we fall back defensively.\n return name ?? \"unknown\";\n};\n\nconst isConstantNamed = (declarator: TSESTree.VariableDeclarator): boolean => {\n if (declarator.id.type !== AST_NODE_TYPES.Identifier) return false;\n const name = declarator.id.name;\n // Treat as constant if the binding is ALL_CAPS (allowing underscores/digits).\n return name.length > 0 && name === name.toUpperCase();\n};\n\nconst getStatementSection = (\n statement: TSESTree.ProgramStatement,\n): SectionOrdinal => {\n switch (statement.type) {\n case AST_NODE_TYPES.ImportDeclaration:\n return SECTION.imports;\n case AST_NODE_TYPES.TSTypeAliasDeclaration:\n case AST_NODE_TYPES.TSInterfaceDeclaration:\n case AST_NODE_TYPES.TSEnumDeclaration:\n return SECTION.types;\n case AST_NODE_TYPES.VariableDeclaration: {\n if (statement.kind === \"const\") {\n const firstDeclarator = statement.declarations[0];\n if (firstDeclarator !== undefined && isConstantNamed(firstDeclarator)) {\n return SECTION.constants;\n }\n }\n return SECTION.functions;\n }\n case AST_NODE_TYPES.FunctionDeclaration:\n return SECTION.functions;\n case AST_NODE_TYPES.ExportNamedDeclaration:\n case AST_NODE_TYPES.ExportDefaultDeclaration:\n case AST_NODE_TYPES.ExportAllDeclaration:\n return SECTION.exports;\n default:\n return SECTION.functions;\n }\n};\n\nconst isUseServerDirective = (\n statement: TSESTree.ProgramStatement | undefined,\n): boolean => {\n if (statement === undefined) return false;\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"enforce-file-structure\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce a canonical top-of-file ordering: imports -> types -> constants -> functions -> exports. Server-action files (under `/actions/` or with `action` in the path) must also begin with a `use server` directive.\",\n },\n schema: [],\n messages: {\n incorrectOrder:\n \"File structure violation: {{current}} should come before {{expected}}\",\n useServerDirective:\n \"Server action files must start with 'use server' directive\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n const isServerAction =\n filename.includes(\"/actions/\") || filename.includes(\"action\");\n\n return {\n Program(node: TSESTree.Program): void {\n const body = node.body;\n\n if (isServerAction) {\n const firstNode = body[0];\n if (!isUseServerDirective(firstNode)) {\n context.report({\n node,\n messageId: \"useServerDirective\",\n });\n }\n }\n\n let currentSection: SectionOrdinal = SECTION.imports;\n\n for (const statement of body) {\n // Skip top-of-file string directives ('use server', 'use client',\n // 'use strict', ...) so they don't get classified as a section.\n if (isUseServerDirective(statement)) continue;\n if (\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 ) {\n continue;\n }\n\n const statementSection = getStatementSection(statement);\n\n if (statementSection < currentSection) {\n context.report({\n node: statement,\n messageId: \"incorrectOrder\",\n data: {\n current: sectionName(statementSection),\n expected: sectionName(currentSection),\n },\n });\n } else if (statementSection > currentSection) {\n currentSection = statementSection;\n }\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow data fetching inside `useEffect` / `useLayoutEffect`.\n *\n * Anti-pattern:\n *\n * useEffect(() => { fetch('/data').then(setData); }, []);\n *\n * Causes a client-side waterfall (render → effect → fetch → re-render),\n * forfeits server-side caching, and produces layout shift. In Next.js App\n * Router, prefer:\n * - a React Server Component that fetches at render time, or\n * - a Server Action invoked from a form / onClick handler, or\n * - client-side caching libraries like SWR or React Query.\n *\n * Detection covers:\n * - `fetch(...)` (default + when explicit `method: \"GET\"`)\n * - `axios.<method>(...)` for actual HTTP verbs only:\n * get / post / put / delete / patch / request / head / options\n * (i.e. NOT `axios.create` / `axios.defaults`)\n * - `ky.<method>(...)` / `superagent.<method>(...)` (same verbs)\n * - bare `axios(...)` / `ky(...)` calls (when treated as a GET)\n *\n * Analytics / telemetry endpoints (`*track*`, `*log*`, `*ping*`, ...) are\n * intentionally exempt because they aren't render-blocking data fetches.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/data-fetching\n * - https://react.dev/reference/react/useEffect#fetching-data-with-effects\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\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\nconst ANALYTICS_KEYWORDS: readonly string[] = [\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 // fetch(url, options?)\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 return ANALYTICS_KEYWORDS.some((keyword) => url.includes(keyword));\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 Disallow TypeScript `enum` declarations. Use string-literal\n * union types (e.g. `type Status = \"active\" | \"inactive\"`) or `as const`\n * objects instead — enums generate runtime code, have unintuitive numeric\n * defaults, and don't tree-shake cleanly.\n *\n * Generated files can opt out either by living under a path matched by\n * `ignoreFiles` (default: `**\\/generated/**`, `**\\/*.gen.ts`, `**\\/*.generated.ts`)\n * or by including a `@generated` marker comment near the top of the file.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noEnum\";\ntype Options = readonly [\n {\n ignoreFiles?: readonly string[];\n }?,\n];\n\nconst DEFAULT_IGNORE_PATTERNS: readonly RegExp[] = [\n /[\\\\/]generated[\\\\/]/,\n /\\.gen\\.tsx?$/,\n /\\.generated\\.tsx?$/,\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\nfunction hasGeneratedMarker(sourceText: string): boolean {\n // Look only in the first 1KB to keep this cheap.\n const head = sourceText.slice(0, 1024);\n return /@generated\\b/.test(head);\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 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 const isIgnoredByDefault = DEFAULT_IGNORE_PATTERNS.some((re) =>\n re.test(filename),\n );\n const isIgnoredByOption =\n ignoreFiles.length > 0 && matchesAnyPattern(filename, ignoreFiles);\n const isGenerated = hasGeneratedMarker(sourceText);\n\n if (isIgnoredByDefault || isIgnoredByOption || isGenerated) {\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 Disallow using `Math.random()` to generate identifiers,\n * tokens, keys, or other security-sensitive values. `Math.random()` is not\n * cryptographically secure and is predictable — using it for IDs/tokens/secrets\n * can lead to collisions and trivially guessable values. Prefer\n * `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead.\n *\n * The rule is intentionally conservative and only flags two precise patterns:\n * 1. A `Math.random()` result fed into a `.toString(36)` chain — the classic\n * insecure random-id idiom (e.g. `Math.random().toString(36).slice(2)`).\n * 2. A `Math.random()` call whose nearest enclosing binding or property NAME\n * looks identifier/secret-like (matches `/id|token|key|secret|uuid|nonce|\n * session|password|salt/i`).\n *\n * Bare `Math.random()` used for non-identifier purposes (jitter, sampling,\n * rolls, etc.) is NOT flagged.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"insecureRandomId\";\ntype Options = readonly [];\n\nconst NAME_PATTERN = /id|token|key|secret|uuid|nonce|session|password|salt/i;\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 * 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 // The MemberExpression `<current>.toString` should be called with a\n // radix argument of `36`.\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 (\n firstArg &&\n firstArg.type === \"Literal\" &&\n firstArg.value === 36\n ) {\n return true;\n }\n }\n }\n\n // Keep walking up only while we remain the \"object\" of a member/call\n // chain. If we are anything other than the object end of the chain, the\n // `.toString(36)` (if any) does not apply to this `Math.random()`.\n if (\n parent.type === \"MemberExpression\" &&\n parent.object === current\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 false;\n}\n\n/**\n * Walks up from `node` to find the name of the nearest enclosing binding\n * (VariableDeclarator id) or property (Property / PropertyDefinition key),\n * and returns it. Returns `undefined` if no such name is found before leaving\n * the enclosing initializer/value context.\n */\nfunction findEnclosingName(node: TSESTree.Node): string | undefined {\n let current: TSESTree.Node = node;\n let parent = current.parent;\n\n while (parent) {\n // const sessionToken = Math.random()...\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 // { sessionToken: Math.random()... }\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 // class { sessionToken = Math.random()...; }\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 // Stop walking once we cross a boundary where the name no longer reflects\n // a binding/property whose value is being initialized.\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\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isMathRandomCall(node)) {\n return;\n }\n\n // Trigger 1: classic `.toString(36)` insecure id idiom.\n if (isPartOfToString36Chain(node)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n return;\n }\n\n // Trigger 2: enclosing binding/property name looks id/secret-like.\n const name = findEnclosingName(node);\n if (name !== undefined && NAME_PATTERN.test(name)) {\n context.report({ node, messageId: \"insecureRandomId\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow `JSON.stringify(err)` on a (heuristically detected)\n * Error value. `JSON.stringify` on an Error produces `\"{}\"` because the\n * `message` and `stack` properties are non-enumerable, silently throwing away\n * the very information you were trying to log.\n *\n * This is a purely syntactic rule (no type information). It flags\n * `JSON.stringify(x)` only when the first argument is an Identifier whose name\n * either:\n * 1. is the binding of an enclosing `catch (x)` clause in scope, OR\n * 2. matches the conventional error-name pattern /^(e|err|error|ex|exc)$/i.\n *\n * It is deliberately conservative: member expressions (`JSON.stringify(err.message)`),\n * object literals, and arbitrary identifiers (`JSON.stringify(user)`) are not flagged.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\nimport type { Scope } 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/**\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\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 || firstArg.type !== \"Identifier\") {\n return;\n }\n\n const name = firstArg.name;\n const scope = context.sourceCode.getScope(firstArg);\n\n if (ERROR_NAME_PATTERN.test(name) || isCatchBinding(scope, name)) {\n context.report({\n node,\n messageId: \"noJsonStringifyError\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow `catch` clauses that only log (via `console.*`) or do\n * nothing and then swallow the error. A catch that logs and falls through —\n * with no `throw`, no `return`, and no real recovery — hides failures: the\n * program keeps running in a broken state while the only signal is a log line\n * that is easy to miss. Either rethrow the error or handle it for real.\n *\n * This rule is deliberately conservative: it flags ONLY catches whose body is\n * empty or consists exclusively of `console.log/error/warn/info/debug` call\n * statements. Any other statement (a `throw`, a `return`, a fallback\n * assignment, a non-console call, etc.) means the catch is doing something and\n * is left alone — we prefer a false negative over a false positive.\n *\n * Test files opt out by default (filenames containing `.test.`, `.spec.`, or a\n * `__tests__/` path segment) since swallow-and-log is common and acceptable in\n * test scaffolding.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noLogOnlyCatch\";\ntype Options = readonly [];\n\nconst DEFAULT_IGNORE_PATTERNS: readonly RegExp[] = [\n /\\.test\\./,\n /\\.spec\\./,\n /[\\\\/]__tests__[\\\\/]/,\n];\n\nconst CONSOLE_METHODS: ReadonlySet<string> = new Set([\n \"log\",\n \"error\",\n \"warn\",\n \"info\",\n \"debug\",\n]);\n\n/**\n * True when a statement is exactly a bare `console.<method>(...)` call, e.g.\n * `console.error(err);`. Anything else (other objects, optional chaining on a\n * non-`console` base, awaited/returned calls, etc.) returns false so the catch\n * is treated as doing real work.\n */\nfunction isConsoleCallStatement(statement: TSESTree.Statement): boolean {\n if (statement.type !== \"ExpressionStatement\") {\n return false;\n }\n const expr = statement.expression;\n if (expr.type !== \"CallExpression\") {\n return false;\n }\n const callee = expr.callee;\n if (callee.type !== \"MemberExpression\") {\n return false;\n }\n const { object, property } = callee;\n if (object.type !== \"Identifier\" || object.name !== \"console\") {\n return false;\n }\n if (callee.computed) {\n // console[\"log\"](...) — not a plain identifier method; be conservative.\n return false;\n }\n if (property.type !== \"Identifier\") {\n return false;\n }\n return CONSOLE_METHODS.has(property.name);\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 do nothing) and then swallow the error; rethrow or handle it instead.\",\n },\n schema: [],\n messages: {\n noLogOnlyCatch:\n \"Logging then swallowing the error hides failures. Rethrow the error or handle it for real.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename;\n\n const isIgnoredByDefault = DEFAULT_IGNORE_PATTERNS.some((re) =>\n re.test(filename),\n );\n\n if (isIgnoredByDefault) {\n return {};\n }\n\n return {\n CatchClause(node: TSESTree.CatchClause): void {\n const statements = node.body.body;\n\n // Empty catch: swallows the error silently.\n if (statements.length === 0) {\n context.report({ node, messageId: \"noLogOnlyCatch\" });\n return;\n }\n\n // Flag only if EVERY statement is a bare console.* call. Any other\n // statement (throw, return, fallback, real handler, etc.) means the\n // catch is doing something — leave it alone.\n const everyStatementIsConsoleLog = statements.every((statement) =>\n isConsoleCallStatement(statement),\n );\n\n if (everyStatementIsConsoleLog) {\n context.report({ node, messageId: \"noLogOnlyCatch\" });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow direct `process.env` access. Force all env reads\n * through a Zod-validated env module so configuration is typed and validated\n * at startup.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noRawEnv\";\ntype Options = readonly [];\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"no-raw-env\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow direct `process.env` access; use a Zod-validated env module instead.\",\n },\n schema: [],\n messages: {\n noRawEnv:\n \"Do not read from `process.env` directly. Import the Zod-validated env module instead so values are typed and validated at startup.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n MemberExpression(node: TSESTree.MemberExpression): void {\n if (node.computed) {\n // Skip dynamic accesses like process[\"env\"] — extremely rare and out of scope.\n return;\n }\n if (\n node.object.type === \"Identifier\" &&\n node.object.name === \"process\" &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"env\"\n ) {\n context.report({\n node,\n messageId: \"noRawEnv\",\n });\n }\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow silently swallowing an error in a `catch` clause by\n * returning a \"sentinel\" empty value as the final/only statement.\n *\n * A `catch` block whose last statement is `return null` / `return undefined` /\n * `return false` / `return []` / `return {}` (and which never `throw`s) discards\n * the caught error entirely. Downstream callers can't distinguish a genuine\n * empty result from a failure, which is a frequent source of silent data loss\n * and broken idempotency decisions.\n *\n * This rule is deliberately conservative — it prefers false negatives over\n * false positives. It does NOT flag:\n * - catch blocks that `throw`/rethrow anywhere in their body,\n * - returns of a computed/meaningful value (calls, identifiers, member\n * expressions, non-empty literals),\n * - `return 0` / `return \"\"`, which are often legitimate results.\n */\n\nimport {\n ESLintUtils,\n type TSESTree,\n AST_NODE_TYPES,\n} from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noSentinelReturn\";\ntype Options = readonly [];\n\n/** Whether a returned expression is one of the swallowing sentinels. */\nfunction isSentinelArgument(arg: TSESTree.Expression | null): boolean {\n if (arg === null) {\n // `return;` — bare return is not in scope (no value-shaped sentinel).\n return false;\n }\n\n // `return null`\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === null) {\n return true;\n }\n\n // `return false`\n if (arg.type === AST_NODE_TYPES.Literal && arg.value === false) {\n return true;\n }\n\n // `return undefined`\n if (arg.type === AST_NODE_TYPES.Identifier && arg.name === \"undefined\") {\n return true;\n }\n\n // `return []` — empty array literal only.\n if (arg.type === AST_NODE_TYPES.ArrayExpression && arg.elements.length === 0) {\n return true;\n }\n\n // `return {}` — empty object literal only.\n if (\n arg.type === AST_NODE_TYPES.ObjectExpression &&\n arg.properties.length === 0\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Does this subtree contain a `throw` statement, ignoring nested functions\n * (a throw inside a nested function/arrow doesn't rethrow for *this* catch)?\n */\nfunction containsThrow(node: TSESTree.Node): boolean {\n let found = false;\n\n const visit = (current: TSESTree.Node): void => {\n if (found) {\n return;\n }\n\n if (current.type === AST_NODE_TYPES.ThrowStatement) {\n found = true;\n return;\n }\n\n // Do not descend into nested function scopes — a throw there does not\n // propagate out of the current catch synchronously.\n if (\n current.type === AST_NODE_TYPES.FunctionDeclaration ||\n current.type === AST_NODE_TYPES.FunctionExpression ||\n current.type === AST_NODE_TYPES.ArrowFunctionExpression\n ) {\n return;\n }\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 visit(child);\n }\n }\n } else if (isNode(value)) {\n visit(value);\n }\n }\n };\n\n visit(node);\n return found;\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\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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.\",\n },\n schema: [],\n messages: {\n noSentinelReturn:\n \"This `catch` block swallows the error by returning an empty sentinel. Rethrow it, return a typed Result, or handle the error explicitly.\",\n },\n },\n defaultOptions: [],\n create(context) {\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 // Conservative: if the catch body throws/rethrows anywhere, it's not\n // silently swallowing the error.\n if (containsThrow(node.body)) {\n return;\n }\n\n context.report({\n node: last,\n messageId: \"noSentinelReturn\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow `await` expressions located directly inside the body\n * of a `for` / `for-of` / `for-in` / `while` loop within the same function\n * scope. Awaiting serially inside a loop serializes I/O that is often better\n * expressed as `await Promise.all(xs.map(async (x) => ...))`, letting the\n * operations run concurrently.\n *\n * This rule is intentionally conservative — it prefers a false negative over a\n * false positive:\n * - `for await...of` is NOT flagged (async iteration is the correct tool).\n * - awaits inside a function/arrow defined within the loop are NOT flagged\n * (they belong to a different function scope).\n * - awaits not inside any loop are NOT flagged.\n * At most one report is emitted per offending loop.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"noSequentialAwait\";\ntype Options = readonly [];\n\n/**\n * Node types that introduce a new function scope. We never descend across one\n * of these when looking for awaits belonging to a loop, because an `await`\n * inside a nested function/arrow is awaited by *that* function, not by the loop.\n */\nfunction isFunctionLike(node: TSESTree.Node): boolean {\n return (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n );\n}\n\n/**\n * Loop node types whose bodies we scan. `ForOfStatement` is handled specially\n * by the caller so that `for await...of` is excluded.\n */\ntype LoopNode =\n | TSESTree.ForStatement\n | TSESTree.ForOfStatement\n | TSESTree.ForInStatement\n | TSESTree.WhileStatement\n | TSESTree.DoWhileStatement;\n\n/**\n * Statement node types that introduce a nested loop. When scanning a loop's\n * body we must NOT descend into another loop — that inner loop's awaits belong\n * to it and are reported when the inner loop is visited. This keeps reporting\n * at one-per-loop and avoids double-flagging an outer loop for an await that\n * only appears inside a nested loop.\n */\nfunction isLoop(node: TSESTree.Node): boolean {\n return (\n node.type === \"ForStatement\" ||\n node.type === \"ForOfStatement\" ||\n node.type === \"ForInStatement\" ||\n node.type === \"WhileStatement\" ||\n node.type === \"DoWhileStatement\"\n );\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"no-sequential-await\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow serial `await` inside a loop; use `await Promise.all(...)` to run the operations concurrently.\",\n },\n schema: [],\n messages: {\n noSequentialAwait:\n \"Avoid `await` inside a loop — it serializes I/O. Collect the promises and `await Promise.all(xs.map(async (x) => ...))` instead.\",\n },\n },\n defaultOptions: [],\n create(context) {\n /**\n * Walks the subtree rooted at `node`, returning the first `AwaitExpression`\n * that belongs to *this* loop's scope — i.e. reachable without crossing a\n * nested function/arrow boundary or descending into a nested loop. Returns\n * `null` if none.\n *\n * Stopping at function boundaries excludes awaits in nested functions\n * (awaited by that function, not the loop). Stopping at nested-loop\n * boundaries means each loop only \"owns\" its own direct awaits, so an outer\n * loop isn't flagged for an await that lives solely in an inner loop, and\n * every report stays one-per-loop.\n */\n function findAwaitInScope(\n node: TSESTree.Node,\n ): TSESTree.AwaitExpression | null {\n if (node.type === \"AwaitExpression\") {\n return node;\n }\n if (isFunctionLike(node)) {\n // Crossing into a different function scope — its awaits aren't ours.\n return null;\n }\n\n for (const key of Object.keys(node) as (keyof TSESTree.Node)[]) {\n if (key === \"parent\") {\n continue;\n }\n const value = node[key];\n if (Array.isArray(value)) {\n for (const child of value) {\n if (isNode(child) && !isLoop(child)) {\n const found = findAwaitInScope(child);\n if (found) {\n return found;\n }\n }\n }\n } else if (isNode(value) && !isLoop(value)) {\n const found = findAwaitInScope(value);\n if (found) {\n return found;\n }\n }\n }\n\n return null;\n }\n\n function 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 * Reports the loop if its body contains an `await` belonging to the same\n * function scope. The loop's `body` (and, for the C-style `for`, its init /\n * test / update expressions) are the only places an \"await in this loop\"\n * can live; awaits in a *nested* loop are caught when that nested loop is\n * itself visited, keeping reports at one-per-loop.\n */\n function checkLoop(node: LoopNode): void {\n const parts: (TSESTree.Node | null)[] = [node.body];\n\n if (node.type === \"ForStatement\") {\n parts.push(node.init, node.test, node.update);\n } else if (\n node.type === \"ForOfStatement\" ||\n node.type === \"ForInStatement\"\n ) {\n parts.push(node.right);\n } else {\n // While / DoWhile.\n parts.push(node.test);\n }\n\n for (const part of parts) {\n // A part that is itself a loop (e.g. `for (...) for (...) await f()`)\n // is owned by that inner loop and checked when it is visited.\n if (part && !isLoop(part) && findAwaitInScope(part)) {\n context.report({ node, messageId: \"noSequentialAwait\" });\n return;\n }\n }\n }\n\n return {\n ForStatement: checkLoop,\n ForInStatement: checkLoop,\n WhileStatement: checkLoop,\n DoWhileStatement: checkLoop,\n ForOfStatement(node: TSESTree.ForOfStatement): void {\n // `for await...of` is correct async iteration — never flag it.\n if (node.await) {\n return;\n }\n checkLoop(node);\n },\n };\n },\n});\n","/**\n * @fileoverview Disallow string accumulation via `+=` inside a loop, which is\n * the classic O(n^2) string-building antipattern: each `+=` rebuilds the whole\n * string. Push the parts onto an array and `arr.join(\"\")` after the loop\n * instead.\n *\n * This is a purely SYNTACTIC rule — it uses scope analysis (not the type\n * service) to confirm the left-hand side was declared with a string-literal\n * initializer (`let s = \"\"`, `= \"...\"`, or a template literal). It is\n * deliberately conservative: when the initializer type cannot be determined\n * (no initializer, a non-literal expression, a parameter, etc.) the `+=` is\n * NOT flagged. This mirrors the Python rule SARJ002.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\nimport type { Scope } from \"@typescript-eslint/utils/ts-eslint\";\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/**\n * Returns true if the given expression node is a string-producing literal:\n * a string `Literal` (`\"\"`, `\"...\"`, `'...'`) or a `TemplateLiteral`.\n */\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/**\n * Walk the chain of enclosing scopes to find the variable definition for the\n * given identifier name. Returns the resolved `Variable`, or `undefined` if it\n * cannot be found (e.g. an undeclared global or an out-of-scope reference).\n */\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/**\n * Returns true if the variable was declared with a string-literal initializer.\n * Conservative: if the variable has no single string-initialized declarator\n * (no init, non-literal init, multiple conflicting declarators), returns false.\n */\nfunction isStringInitializedVariable(variable: Scope.Variable): boolean {\n // A variable can technically have multiple declarators (e.g. via `var`\n // hoisting / redeclaration). Only treat it as string-initialized when there\n // is exactly one declarator and it has a string-literal initializer.\n if (variable.defs.length !== 1) {\n return false;\n }\n const def = variable.defs[0];\n if (def === undefined || def.type !== \"Variable\") {\n // Parameters, function names, imports, etc. — type unknown, don't flag.\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/**\n * Returns true if `node` is contained within the body of a loop statement.\n * Walks ancestors and, for each loop, ensures the node is inside the loop's\n * BODY (not its test/init/update clauses, which run a bounded number of times\n * relative to the body and aren't the antipattern we target).\n */\nfunction isInsideLoopBody(node: TSESTree.Node): boolean {\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 // `body` is the property that holds the looped statements for every\n // loop variant we care about.\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 true;\n }\n }\n child = parent;\n parent = parent.parent;\n }\n return false;\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 return {\n AssignmentExpression(node: TSESTree.AssignmentExpression): void {\n // Only the compound `+=` operator builds up a value.\n if (node.operator !== \"+=\") {\n return;\n }\n // The LHS must be a plain variable reference.\n if (node.left.type !== \"Identifier\") {\n return;\n }\n // Must occur inside a loop body, else it's a one-shot append.\n if (!isInsideLoopBody(node)) {\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 // Only flag when we can confirm the LHS was string-initialized; a\n // numeric initializer (or anything non-string) is intentionally\n // excluded to avoid false positives.\n if (!isStringInitializedVariable(variable)) {\n return;\n }\n\n context.report({\n node,\n messageId: \"noStringConcatInLoop\",\n });\n },\n };\n },\n});\n","/**\n * @fileoverview Flag `'use client'` files with no hooks or event handlers.\n *\n * If a file is marked `'use client'` but contains no hook calls\n * (`useState`/`useEffect`/etc.), no JSX event handlers (`onClick`,\n * `onChange`, etc.), no browser globals, no client-only imports, and no\n * other client-side indicators (classes, re-exports), the directive is\n * likely unnecessary and the file could be a React Server Component —\n * improving cold-start, bundle size, and SEO.\n *\n * False-positive watch: components that only use client-side context\n * (e.g. theme providers) without hooks or events still need `'use client'`.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/rendering/client-components\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\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\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\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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\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 markIfHookOrContext(node.callee);\n },\n JSXAttribute(node): void {\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 (\n typeof node.source.value === \"string\" &&\n CLIENT_ONLY_PACKAGES_REGEX.test(node.source.value)\n ) {\n hasClientIndicator = true;\n }\n },\n ExportNamedDeclaration(node): void {\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ExportAllDeclaration(node): void {\n if (node.source !== null) {\n hasClientIndicator = true;\n }\n },\n ClassDeclaration(): void {\n hasClientIndicator = true;\n },\n ClassExpression(): void {\n hasClientIndicator = true;\n },\n Identifier(node): void {\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 Flag object types that model mutually-exclusive states with a\n * boolean status flag plus many optional members. A shape like\n * `{ success: boolean; data?: T; error?: E; code?: number }` encodes \"success\n * vs. error\" implicitly and lets illegal states (e.g. `success: true` with an\n * `error`) be representable.\n *\n * Such shapes should be modelled as a discriminated union, e.g.\n * `{ ok: true; data: T } | { ok: false; error: E }`, so the compiler enforces\n * that exactly one branch's fields are present.\n *\n * This is the TypeScript mirror of the Python rule SARJ005.\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\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\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 }\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 hasStatusBoolean && optionalCount >= MIN_OPTIONAL_MEMBERS;\n}\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"prefer-discriminated-union\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Flag object types with a boolean status flag and many optionals; model them as a discriminated union instead.\",\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 } as TSESTree.TSTypeLiteral;\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 Don't access `response.json()` fields without a Zod parse first.\n *\n * Pattern flagged:\n * const data = await response.json();\n * doSomething(data.foo); // <-- unvalidated property access\n *\n * Encouraged:\n * const data = MySchema.parse(await response.json());\n * doSomething(data.foo); // typed + validated\n *\n * Heuristic:\n * - Track variables initialized to `await someCall.json()` using ESLint's scope manager.\n * - Untrack if reassigned to anything other than another raw `json()` call.\n * - Flag MemberExpression reads and destructuring off tracked variables.\n * - `.parse()` / `.safeParse()` chained directly on the json call are legit\n * and never produce a tracked binding in the first place.\n *\n * References:\n * - https://zod.dev/?id=parse\n * - https://www.totaltypescript.com/parse-don-t-validate\n */\n\nimport {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\nimport type { RuleContext, Scope } from \"@typescript-eslint/utils/ts-eslint\";\n\ntype MessageIds = \"unparsedJsonAccess\";\ntype Options = readonly [];\n\ntype Ctx = Readonly<RuleContext<MessageIds, Options>>;\n\n/**\n * Peel TypeScript wrapper nodes that don't affect the underlying value\n * (`as Foo`, `<Foo>x`, `x!`, `x satisfies Foo`, parentheses, optional chain\n * wrappers). Returns the inner expression we actually care about.\n */\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/**\n * Returns true if the expression is (optionally awaited) `<x>.json()`.\n */\nconst isJsonCall = (\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 return (\n property !== null &&\n property.type === AST_NODE_TYPES.Identifier &&\n property.name === \"json\"\n );\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\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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()` before property access.\",\n },\n schema: [],\n messages: {\n unparsedJsonAccess:\n \"Property access on the result of `response.json()` without a schema parse. Pipe through `XSchema.parse(...)` (Zod) before reading fields.\",\n },\n },\n defaultOptions: [],\n create(context: Ctx) {\n const unvalidatedVariables = new Set<Scope.Variable>();\n\n const trackInitializer = (\n declarator: TSESTree.VariableDeclarator,\n ): void => {\n if (!isJsonCall(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 (isJsonCall(node.init)) {\n context.report({ node: node.id, messageId: \"unparsedJsonAccess\" });\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 (isJsonCall(node.right)) {\n unvalidatedVariables.add(variable);\n } else {\n // Reassigned to a parse call or something else: drop tracking.\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 (isJsonCall(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 MemberExpression(node): void {\n const scope = context.sourceCode.getScope(node);\n const obj = unwrap(node.object);\n\n if (isJsonCall(obj)) {\n // Direct `.foo` access on `(await r.json()).foo` is always bad,\n // unless the parent call is a `.parse()`/`.safeParse()` — in which\n // case it's a validation, not an unvalidated read.\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 ) {\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 Next.js Server Actions over /api/* mutations.\n *\n * Flags mutations against internal `/api/*` URLs (POST/PUT/DELETE/PATCH) via\n * `fetch`, axios-style helpers, or direct axios/request calls. GET requests\n * and external URLs are ignored. Tests, scripts, and Next.js route handlers\n * are skipped because Server Actions don't apply there.\n *\n * References:\n * - https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\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?$|\\/tests?\\/|\\/__tests__\\/|\\/scripts?\\/|\\/app\\/api\\/.*\\/route\\.[jt]sx?$|\\/pages\\/api\\/)/;\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 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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<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 return {\n CallExpression(node) {\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 if (urlArg && urlArg.type !== \"SpreadElement\" && isApiUrl(urlArg, context)) {\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 shadcn/ui form primitives over their native HTML\n * counterparts. Limited to form/dialog elements — `<button>` and `<table>`\n * have been removed from the forbid list because they produced 100% false\n * positives during bulbul validation (icon buttons, layout tables).\n */\n\nimport { ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"preferShadcn\";\ntype Options = readonly [];\n\nconst REPLACEMENTS: Readonly<Record<string, string>> = {\n input: \"Input\",\n select: \"Select\",\n textarea: \"Textarea\",\n dialog: \"Dialog\",\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"prefer-shadcn\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefer shadcn/ui form primitives over native `<input>`, `<select>`, `<textarea>`, and `<dialog>` elements.\",\n },\n schema: [],\n messages: {\n preferShadcn:\n \"Use the shadcn <{{replacement}}> component from @/components/ui/{{lowercase}} instead of native <{{element}}>.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node: TSESTree.JSXOpeningElement): void {\n // Only lowercase JSXIdentifier names represent native HTML elements.\n // Member expressions (`Foo.Bar`) and namespaces (`svg:path`) are skipped.\n if (node.name.type !== \"JSXIdentifier\") {\n return;\n }\n\n const elementName = node.name.name;\n const replacement = REPLACEMENTS[elementName];\n\n if (replacement === undefined) {\n return;\n }\n\n context.report({\n node,\n messageId: \"preferShadcn\",\n data: {\n element: elementName,\n replacement,\n lowercase: elementName,\n },\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"missingAssertNever\";\ntype Options = readonly [];\n\nconst isAssertNeverCall = (expression: TSESTree.Expression): boolean => {\n if (expression.type !== AST_NODE_TYPES.CallExpression) return false;\n const callee = expression.callee;\n return (\n callee.type === AST_NODE_TYPES.Identifier && callee.name === \"assertNever\"\n );\n};\n\nconst statementContainsAssertNever = (\n statement: TSESTree.Statement,\n): boolean => {\n if (statement.type === AST_NODE_TYPES.ExpressionStatement) {\n return isAssertNeverCall(statement.expression);\n }\n if (statement.type === AST_NODE_TYPES.ThrowStatement) {\n return isAssertNeverCall(statement.argument);\n }\n // Recurse into block-scoped default bodies like `default: { ... }`\n if (statement.type === AST_NODE_TYPES.BlockStatement) {\n return statement.body.some(statementContainsAssertNever);\n }\n return false;\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"require-assert-never\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require switch statements to end with `assertNever(_)` in their default case so that discriminated unions are exhaustively checked at compile time.\",\n },\n schema: [],\n messages: {\n missingAssertNever:\n \"Switch statement default case must call assertNever() for exhaustive type checking\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n SwitchStatement(node: TSESTree.SwitchStatement): void {\n const defaultCase = node.cases.find(\n (caseNode): caseNode is TSESTree.SwitchCase => caseNode.test === null,\n );\n if (!defaultCase) return;\n\n const hasAssertNever = defaultCase.consequent.some(\n statementContainsAssertNever,\n );\n if (hasAssertNever) return;\n\n context.report({\n node: defaultCase,\n messageId: \"missingAssertNever\",\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"missingZodValidation\";\ntype Options = readonly [];\n\nconst 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 // Match `formData.get(...)` specifically — same convention as the original rule.\n return (\n callee.object.type === AST_NODE_TYPES.Identifier &&\n callee.object.name === \"formData\"\n );\n};\n\nconst isParseCallExpression = (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 return (\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"parse\"\n );\n};\n\nexport default ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"require-zod-form-validation\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require Zod validation (`Schema.parse(...)`) 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())\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node: TSESTree.CallExpression): void {\n if (!isFormDataGetCall(node)) return;\n\n // Walk up the parent chain to find a surrounding `.parse(...)` call.\n // `.parent` is `null` at the Program root, so we must guard for both\n // null and undefined.\n let parent: TSESTree.Node | null | undefined = node.parent;\n while (parent !== null && parent !== undefined) {\n if (isParseCallExpression(parent)) return;\n parent = parent.parent;\n }\n\n context.report({\n node,\n messageId: \"missingZodValidation\",\n });\n },\n };\n },\n});\n","import { ESLintUtils, type TSESTree, AST_NODE_TYPES } from \"@typescript-eslint/utils\";\n\ntype MessageIds = \"zPrefix\";\ntype Options = readonly [];\n\n/**\n * Walks down a (possibly chained) callee like `z.object().extend().refine()` and\n * returns `true` if the chain originates from a bare `z` identifier — i.e. the\n * outermost MemberExpression on the chain has `z` as its receiver.\n */\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 ESLintUtils.RuleCreator(\n (name) =>\n `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`,\n)<Options, MessageIds>({\n name: \"zod-naming-convention\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce Zod schemas to be named with a Z prefix (e.g. `ZUser = z.object({...})`).\",\n },\n schema: [],\n messages: {\n zPrefix: \"Zod schema names should start with Z\",\n },\n },\n defaultOptions: [],\n create(context) {\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 if (node.id.type !== AST_NODE_TYPES.Identifier) return;\n const variableName = node.id.name;\n if (variableName.startsWith(\"Z\")) return;\n\n context.report({\n node: node.id,\n messageId: \"zPrefix\",\n });\n },\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2D;AAM3D,IAAM,UAAU;AAAA,EACd,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AACX;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,cAAc,CAAC,YAAoC;AACvD,QAAM,OAAO,cAAc,OAAO;AAGlC,SAAO,QAAQ;AACjB;AAEA,IAAM,kBAAkB,CAAC,eAAqD;AAC5E,MAAI,WAAW,GAAG,SAAS,4BAAe,WAAY,QAAO;AAC7D,QAAM,OAAO,WAAW,GAAG;AAE3B,SAAO,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY;AACtD;AAEA,IAAM,sBAAsB,CAC1B,cACmB;AACnB,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK,4BAAe;AAClB,aAAO,QAAQ;AAAA,IACjB,KAAK,4BAAe;AAAA,IACpB,KAAK,4BAAe;AAAA,IACpB,KAAK,4BAAe;AAClB,aAAO,QAAQ;AAAA,IACjB,KAAK,4BAAe,qBAAqB;AACvC,UAAI,UAAU,SAAS,SAAS;AAC9B,cAAM,kBAAkB,UAAU,aAAa,CAAC;AAChD,YAAI,oBAAoB,UAAa,gBAAgB,eAAe,GAAG;AACrE,iBAAO,QAAQ;AAAA,QACjB;AAAA,MACF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AAyB;AAC3B;AAEA,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AAAA,EACA;AAAA,EACA,SAAS;AAAA,IACP,aAAa;AAAA,MACX,SAAS,CAAC,OAAO;AAAA,MACjB,OAAO;AAAA,QACL,+BAA+B;AAAA,QAC/B,8BAA8B;AAAA,QAC9B,qCAAqC;AAAA,QACrC,gCAAgC;AAAA,QAChC,sCAAsC;AAAA,QACtC,+BAA+B;AAAA,QAC/B,mCAAmC;AAAA,QACnC,uCAAuC;AAAA;AAAA,QAEvC,6BAA6B;AAAA,QAC7B,qCAAqC;AAAA,QACrC,2BAA2B;AAAA,QAC3B,+BAA+B;AAAA,QAC/B,iCAAiC;AAAA,QACjC,kCAAkC;AAAA,QAClC,oCAAoC;AAAA,MACtC;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC,OAAO;AAAA,MACjB,OAAO;AAAA,QACL,+BAA+B;AAAA,QAC/B,8BAA8B;AAAA,QAC9B,qCAAqC;AAAA,QACrC,gCAAgC;AAAA,QAChC,oBAAoB;AAAA,QACpB,uBAAuB;AAAA,QACvB,iBAAiB;AAAA,QACjB,sCAAsC;AAAA,QACtC,+BAA+B;AAAA,QAC/B,mCAAmC;AAAA,QACnC,uCAAuC;AAAA;AAAA,QAEvC,6BAA6B;AAAA,QAC7B,qCAAqC;AAAA,QACrC,2BAA2B;AAAA,QAC3B,+BAA+B;AAAA,QAC/B,iCAAiC;AAAA,QACjC,kCAAkC;AAAA,QAClC,oCAAoC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["import_utils","import_utils","import_utils","import_utils","import_utils","DEFAULT_IGNORE_PATTERNS","import_utils","import_utils","import_utils","isNode","import_utils","import_utils","import_utils","import_utils","findVariable","import_utils","import_utils","import_utils","import_utils","import_utils"]}
package/dist/index.d.cts CHANGED
@@ -12,12 +12,33 @@ declare const rules: {
12
12
  }?], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
13
13
  name: string;
14
14
  };
15
+ "no-insecure-random-id": _typescript_eslint_utils_ts_eslint.RuleModule<"insecureRandomId", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
16
+ name: string;
17
+ };
18
+ "no-json-stringify-error": _typescript_eslint_utils_ts_eslint.RuleModule<"noJsonStringifyError", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
19
+ name: string;
20
+ };
21
+ "no-log-only-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"noLogOnlyCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
22
+ name: string;
23
+ };
15
24
  "no-raw-env": _typescript_eslint_utils_ts_eslint.RuleModule<"noRawEnv", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
16
25
  name: string;
17
26
  };
27
+ "no-sentinel-return-on-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"noSentinelReturn", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
28
+ name: string;
29
+ };
30
+ "no-sequential-await": _typescript_eslint_utils_ts_eslint.RuleModule<"noSequentialAwait", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
31
+ name: string;
32
+ };
33
+ "no-string-concat-in-loop": _typescript_eslint_utils_ts_eslint.RuleModule<"noStringConcatInLoop", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
34
+ name: string;
35
+ };
18
36
  "no-unnecessary-use-client": _typescript_eslint_utils_ts_eslint.RuleModule<"unnecessaryUseClient", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
19
37
  name: string;
20
38
  };
39
+ "prefer-discriminated-union": _typescript_eslint_utils_ts_eslint.RuleModule<"preferDiscriminatedUnion", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
40
+ name: string;
41
+ };
21
42
  "prefer-schema-for-api-payload": _typescript_eslint_utils_ts_eslint.RuleModule<"unparsedJsonAccess", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
22
43
  name: string;
23
44
  };
@@ -54,12 +75,33 @@ declare const plugin: {
54
75
  }?], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
55
76
  name: string;
56
77
  };
78
+ "no-insecure-random-id": _typescript_eslint_utils_ts_eslint.RuleModule<"insecureRandomId", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
79
+ name: string;
80
+ };
81
+ "no-json-stringify-error": _typescript_eslint_utils_ts_eslint.RuleModule<"noJsonStringifyError", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
82
+ name: string;
83
+ };
84
+ "no-log-only-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"noLogOnlyCatch", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
85
+ name: string;
86
+ };
57
87
  "no-raw-env": _typescript_eslint_utils_ts_eslint.RuleModule<"noRawEnv", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
58
88
  name: string;
59
89
  };
90
+ "no-sentinel-return-on-catch": _typescript_eslint_utils_ts_eslint.RuleModule<"noSentinelReturn", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
91
+ name: string;
92
+ };
93
+ "no-sequential-await": _typescript_eslint_utils_ts_eslint.RuleModule<"noSequentialAwait", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
94
+ name: string;
95
+ };
96
+ "no-string-concat-in-loop": _typescript_eslint_utils_ts_eslint.RuleModule<"noStringConcatInLoop", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
97
+ name: string;
98
+ };
60
99
  "no-unnecessary-use-client": _typescript_eslint_utils_ts_eslint.RuleModule<"unnecessaryUseClient", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
61
100
  name: string;
62
101
  };
102
+ "prefer-discriminated-union": _typescript_eslint_utils_ts_eslint.RuleModule<"preferDiscriminatedUnion", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
103
+ name: string;
104
+ };
63
105
  "prefer-schema-for-api-payload": _typescript_eslint_utils_ts_eslint.RuleModule<"unparsedJsonAccess", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
64
106
  name: string;
65
107
  };
@@ -91,6 +133,13 @@ declare const plugin: {
91
133
  "@sarj/prefer-server-actions": string;
92
134
  "@sarj/no-unnecessary-use-client": string;
93
135
  "@sarj/prefer-schema-for-api-payload": string;
136
+ "@sarj/no-sequential-await": string;
137
+ "@sarj/no-sentinel-return-on-catch": string;
138
+ "@sarj/no-log-only-catch": string;
139
+ "@sarj/no-insecure-random-id": string;
140
+ "@sarj/no-json-stringify-error": string;
141
+ "@sarj/no-string-concat-in-loop": string;
142
+ "@sarj/prefer-discriminated-union": string;
94
143
  };
95
144
  };
96
145
  strict: {
@@ -107,6 +156,13 @@ declare const plugin: {
107
156
  "@sarj/prefer-server-actions": string;
108
157
  "@sarj/no-unnecessary-use-client": string;
109
158
  "@sarj/prefer-schema-for-api-payload": string;
159
+ "@sarj/no-sequential-await": string;
160
+ "@sarj/no-sentinel-return-on-catch": string;
161
+ "@sarj/no-log-only-catch": string;
162
+ "@sarj/no-insecure-random-id": string;
163
+ "@sarj/no-json-stringify-error": string;
164
+ "@sarj/no-string-concat-in-loop": string;
165
+ "@sarj/prefer-discriminated-union": string;
110
166
  };
111
167
  };
112
168
  };