lintScratch
uses node:path
Lint a scratch file as written (an editor's buffer, say). Offsets are in text.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { lintTexts, traitsOfText } from "#codebase/tcmts/cli/lint"; import type { LintIssue } from "#codebase/tcmts/cli/lint"; import path from "node:path"; export function lintScratch(cb: Codebase, file: string, text: string): LintIssue[] { return lintTexts( cb, [{ text, ext: path.extname(file) || ".ts" }], traitsOfText(file, text), )[0]!; }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.lint.LintIssue
- tcmts.cli.lint.lintTexts
- tcmts.cli.lint.traitsOfText