/** * Lints a bulb's code block for environment-specific issues — patterns that are * valid TypeScript but break in the Typebulb runtime. Shared by typebulb.com and * the CLI (`typebulb check`) so both enforce the same rules with the same * AI-facing messages. * * Target-aware: `code.tsx` runs in the browser under an import map and a sandboxed * iframe, `server.ts` runs in Node. The import-map / browser rules (dynamic * import, URL / version / `.js`-deep-path imports, CSS imports, navigation) apply * only to the client; the Sucrase / ESM core (require, `const enum`, `namespace`, * `export =` / `import =`, `module {}`, redundant `tb`) applies to both. */ export type LintTarget = 'client' | 'server'; export type LintIssueType = 'DYNAMIC_IMPORT' | 'COMMONJS_REQUIRE' | 'JS_EXTENSION_IMPORT' | 'URL_IMPORT' | 'VERSION_SPECIFIER_IMPORT' | 'REDUNDANT_TB_DECLARATION' | 'CONST_ENUM' | 'NAMESPACE_DECLARATION' | 'COMMONJS_EXPORT_EQUALS' | 'COMMONJS_IMPORT_EQUALS' | 'MODULE_DECLARATION' | 'CSS_FILE_IMPORT' | 'NAVIGATION' | 'UNDECLARED_IMPORT'; export type LintIssue = { type: LintIssueType; severity: 'error'; message: string; lineNumber?: number; lineContent?: string; }; /** * The unique root package names of every bare import in a client code block, first-seen order * (`react`, `@scope/pkg`, `react-dom` from `react-dom/client`). Relative / absolute / URL / `node:` * specifiers are excluded (not packages). */ export declare function bareImportRoots(source: string): string[]; /** * Lint a bulb code block. `target` selects the ruleset: `client` (`code.tsx`, * the browser superset) or `server` (`server.ts`, the Sucrase / ESM core only). * * `dependencies` opts a caller into the UNDECLARED_IMPORT rule: every bare client * import must appear in this set (config.json's `dependencies`). It is the CLI's * **authored-config** contract — the CLI always asks the model for config.json and * passes the declared set here, so a config-less or under-declared bulb fails the * lint instead of silently CDN-resolving "latest" (the resolver is import-driven and * would otherwise resolve undeclared imports anyway). typebulb.com omits it: the web * *derives* config.json from the imports, so there's nothing to enforce. Pass `{}` to * enforce against an empty/absent dependencies block (every bare import then fails). * * `lineOffset` is the block's first line **in its containing `.bulb.md`**, so issues report the * coordinates of the file the caller actually edits. It must be an input rather than a rewrite of * the output: the number is baked into the AI-facing message prose ("Found on line N"), and a * header disagreeing with the body is worse than the offset it fixes. typebulb.com omits it — the * editor's coordinate space *is* the block (TB-Lint-Transpile.md Invariant 8). */ export declare function lint(source: string, options: { target: LintTarget; dependencies?: Record; lineOffset?: number; }): LintIssue[]; //# sourceMappingURL=index.d.ts.map