/** * Returns true if the function body slice contains at least one top-level * call to a function named `use…`. Filters out: * - member-access calls (`obj.useThing(`) * - calls nested inside an inner function/arrow declaration * * The body slice should start at the OPENING brace of the function body * (or just after) so the nesting heuristic can attribute braces correctly. */ export declare function bodyCallsHook(body: string): boolean; /** * Returns true if the body slice contains a JSX-returning expression. * * Handles: * - `return
` → true (HTML tag) * - `return ` → true (Component) * - `return <>` → true (fragment) * - `return ( )` → true (parenthesized) * - `return useMemo(...)` → false (generic at return) * - body containing `Array` or `dynamic(…)` elsewhere → false (no return prefix) */ export declare function bodyReturnsJsx(body: string): boolean; /** * Extracts the body of a function declaration starting at `declStart` via * naive brace matching. Returns the slice from just AFTER the opening `{` * up to (but not including) the matching closing `}`. * * Defensive fallbacks: * - If no `{` is found at/after `declStart`, returns `source.slice(declStart)` * (matches prior naive behavior for declaration-only forms). * - If EOF is reached before depth returns to zero, returns everything from * just after the opening `{` to end-of-source. * * Future improvement: braces inside string/template literals or comments are * NOT tracked. Current heuristic is sufficient for the rule surface that * consumes this helper (component/hook naming detection on real React * sources). Switch to a TS-AST extraction if FP/FN evidence emerges. */ export declare function extractFunctionBody(source: string, declStart: number): string; /** * Returns true if `source` at `declStart` declares an implicit-return arrow * function whose body is a JSX expression: `export const X = (...) => `. * * `declStart` should point at the start of the export declaration (the same * index `EXPORT_FUNC_RE` reports). We walk past `export … = (` and the param * list, expect `=>`, and then check that the first non-whitespace char opens * JSX (via the shared `looksLikeJsxOpenAt` disambiguator). * * Returns false for: * - block-body arrows (`=> {`) — caller should use `bodyReturnsJsx` instead * - non-JSX implicit returns (`=> text.toUpperCase()`) * - implicit returns whose JSX is inside a nested expression * (`xs => xs.map(x =>
  • )`) */ export declare function arrowImplicitReturnsJsx(source: string, declStart: number): boolean; /** * Filename / path evidence: a function is more likely to be a hook when it * lives under `**\/hooks\/**` or in a file named `use-*.{ts,tsx,js,jsx}`. */ export declare function fileIsInHooksDir(filePath: string): boolean; /** * Filename-as-evidence refinement (issue #166). * * Returns true ONLY when the file is named `use-.{ts,tsx,js,jsx}` AND * `funcName` is the camelCase form of `` — i.e. the function name * literally matches what the filename advertises as the hook target * (minus the `use` prefix). * * Examples: * use-toggle.ts + "toggle" → true * use-combine-ref.ts + "combineRef" → true * use-combine-ref.ts + "composeRefs" → false (co-located helper) * use-toggle.ts + "useToggle" → false (already prefixed) * hooks/index.ts + anything → false (no use-X filename) * lib/helpers.ts + anything → false (not a use-X file) * * Used by `naming/hook-prefix` to gate path-evidence: a function in a * `hooks/` directory is flagged via path alone only when its name matches * the filename's advertised target. Unrelated co-located utilities are not * flagged via path-evidence and must show body-call evidence to fire. */ export declare function filenameMatchesFunction(filePath: string, funcName: string): boolean;