Skip to content

ENGINE / ESLINT

TypeScript rules

65 deterministic checks, ordered by canonical rule ID.

65 rules

Rule Engine Category Default
duplicate-test-body Disallow substantial sibling tests with the same body shape; express their differing inputs as a parameterized case table. TypeScript testing error
enforce-file-structure Require imports before body statements and require `use server` to be the first statement. TypeScript correctness error
no-async-callback-in-wait-for Disallow async callbacks in `waitFor` to prevent swallowed promise rejections. TypeScript testing error
no-client-side-data-fetching Disallow direct data fetching inside `useEffect` or `useLayoutEffect`. TypeScript performance error
no-comment-cruft Flag commented-out code, section-banner comments, and leading file-header comment preambles. TypeScript maintainability error
no-conditional-in-test Disallow test conditionals that can skip a runtime assertion or exit the test before one runs. TypeScript testing error
no-cors-wildcard-with-credentials Disallow wildcard CORS origins when credentials are enabled. TypeScript security error
no-declaration-comment-wall Flag an enum body or class body whose member comments mostly re-spell the members' own names. TypeScript maintainability error
no-dynamic-sql Disallow runtime interpolation or concatenation in SQL passed to statement-execution methods. TypeScript security error
no-enum Disallow TypeScript `enum`; use string-literal unions or `as const` objects instead. TypeScript maintainability error
no-fat-try-blocks Disallow `try` blocks containing more than three top-level operations that can throw. TypeScript correctness error
no-generic-single-export-module Disallow generic module stems when one runtime export already names the responsibility. TypeScript maintainability error
no-hand-rolled-sleep Disallow uncancellable promisified timers and timeout arms. TypeScript correctness error
no-hand-rolled-spinner Disallow intrinsic elements styled as Tailwind border-ring spinners outside the design-system implementation. TypeScript maintainability error
no-impossible-zod-literal-bounds Disallow same-chain literal Zod bounds whose accepted set is mathematically empty. TypeScript correctness error
no-insecure-random-id Disallow using `Math.random()` to generate identifiers, tokens, or secrets; use `crypto.randomUUID()` or `crypto.getRandomValues(...)` instead. TypeScript security error
no-json-stringify-error Disallow `JSON.stringify` on an Error value; it yields `{}` because `message`/`stack` are non-enumerable. TypeScript correctness error
no-log-only-catch Disallow `catch` clauses that only log (or silently do nothing) and then swallow the error; rethrow or handle it instead. TypeScript correctness error
no-long-comment Flag unusually large unstructured prose blocks in implementation code. TypeScript maintainability error
no-offset-pagination Disallow OFFSET pagination in embedded SQL; it is O(N) per page and drops or repeats rows under concurrent writes. Use a keyset cursor. TypeScript performance error
no-positional-tuple-return Disallow returning a multi-field tuple from an exported function; return a named object so call sites cannot mismatch slots. TypeScript maintainability error
no-raw-env Disallow direct `process.env` and `import.meta.env` reads outside validated boundaries. TypeScript correctness error
no-raw-fetch-outside-clients Disallow calling the global `fetch` outside the client layer; route outbound HTTP through a client module that owns retry, timeout and status handling. TypeScript architecture error
no-repeated-string-literal Disallow a long structured string literal repeated across functions; the copies drift when one is edited. Extract a module-level constant. TypeScript maintainability error
no-restated-comment Flag a single-line comment whose every word already appears on the statement below it. TypeScript maintainability error
no-restated-jsdoc Flag a JSDoc block whose description and tags only re-spell the signature they document. TypeScript maintainability error
no-restricted-library-load Apply a configured library-replacement policy to literal dynamic imports, CommonJS loads, and TypeScript import-equals declarations. TypeScript architecture error
no-secret-in-log Disallow passing a secret-named value or a raw request/response blob to a logging call; both leak to log sinks. Redact or omit. TypeScript security error
no-select-star Disallow SELECT * in embedded SQL; it over-fetches and leaves the row contract implicit, so a schema change breaks row parsing silently. TypeScript correctness error
no-sentinel-return-on-catch Disallow swallowing a caught error by returning an empty sentinel unless the error is handled or the sentinel is part of the function contract. TypeScript correctness error
no-silent-promise-catch Disallow `.catch()` and second-argument `.then()` handlers that silently swallow a rejection; log, rethrow, or handle the error. TypeScript correctness error
no-sleep-in-test-body Disallow a fixed timed sleep directly in a test body; it flakes under CI load. Synchronize on the signal or use fake timers. TypeScript testing error
no-storage-in-stateless-modules Disallow SQL or key/value access inside configured stateless modules; derive state from a system of record instead. TypeScript architecture error
no-string-concat-in-loop Disallow O(n^2) string building via `+=` on a string variable inside a loop; push parts to an array and `join` instead. TypeScript performance error
no-tautological-expect Disallow an assertion whose operands are all literals; its outcome is fixed before the code runs, so it can never fail. TypeScript testing error
no-trailing-value-narration Flag a trailing comment that repeats the line's numeric value only to name its unit. TypeScript maintainability error
no-type-member-comment-wall Flag an object type whose member comments mostly re-spell the members' own names and types. TypeScript maintainability error
no-typed-doc-sections Reject typed-signature repetition while preserving behavior that types cannot express. TypeScript maintainability error
no-union-in-comment Flag a comment that lists a `string` field's allowed values instead of the type listing them. TypeScript correctness error
no-unnecessary-use-client Flag `'use client'` files with no hooks or event handlers — they could be RSC. TypeScript performance error
no-unsafe-mock-casting Disallow casting to mock types like `jest.Mock` or `vi.Mock`. Use `vi.mocked()` or `jest.mocked()` instead. TypeScript testing error
no-zod-native-enum Disallow `z.nativeEnum()` (and `z.enum()` over a TypeScript enum); use `z.enum(["a", "b"])` with a string-literal union instead. TypeScript maintainability error
prefer-constant-time-secret-compare Disallow `===`/`!==` on a secret-like value; short-circuiting comparison leaks the secret through timing. Use a constant-time compare. TypeScript security error
prefer-discriminated-union Flag flat result objects with a required positive boolean status and optional success/failure payloads. TypeScript correctness error
prefer-immutable-module-constant Require module-level constant collections to expose readonly state. TypeScript correctness error
prefer-input-group-search Require search icons and shared Input controls in the same visual wrapper to use InputGroup. TypeScript style error
prefer-module-level-constant Hoist literal-only constant collections and regexes out of function bodies to module scope so they are allocated once. TypeScript performance error
prefer-module-level-schema Declare a Zod schema at module scope when it closes over nothing in the enclosing function TypeScript performance error
prefer-native-random-uuid Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package. TypeScript maintainability error
prefer-non-nullable-collection Suggest non-null arrays only when local control flow proves the nullish state is equivalent to an empty collection. TypeScript maintainability error
prefer-schema-for-api-payload Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access. TypeScript correctness error
prefer-semantic-colors Enforce semantic color tokens over raw Tailwind palette classes, arbitrary color values, and inline color literals. TypeScript style error
prefer-server-actions Prefer Next.js Server Actions over /api/* mutations. TypeScript architecture error
prefer-shadcn-primitives Require visible raw JSX controls to use the corresponding shared shadcn primitive. TypeScript style error
prefer-whole-object-assertion Collapse consecutive assertions on one object into a whole-object assertion so related mismatches are reported together. TypeScript testing error
prefer-zod-infer Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it. TypeScript correctness error
require-assert-never Require an empty switch default to call `assertNever` so discriminated unions remain exhaustive at compile time. TypeScript correctness error
require-fetch-timeout Require an abort `signal` (e.g. `AbortSignal.timeout(ms)`) on global `fetch()` calls so stalled upstreams cannot hang the caller forever. TypeScript correctness error
require-port-for-service Advise when an exported service with injected collaborators has public methods not covered by its declared ports. TypeScript architecture error
require-static-next-matcher Require Next.js middleware and proxy matcher configuration to contain only build-time literals. TypeScript correctness error
require-zod-form-validation Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object. TypeScript security error
stepdown Place a private helper below its sole direct same-scope caller. TypeScript maintainability error
store-insert-requires-on-conflict Require an embedded SQL INSERT to carry ON CONFLICT; store writes replay under cron re-runs and queue redelivery and must be idempotent upserts. TypeScript correctness error
test-loops-over-literal-cases Disallow assertions over an inline literal case loop in a test; parameterization reports and names every case independently. TypeScript testing error
zod-naming-convention Enforce a consistent Zod schema naming convention — a `Z` prefix (`ZUser`) or a `Schema` suffix (`userSchema`); both are accepted by default. TypeScript style error