lintScratch

tcmts.cli.lint.lintScratch · #6z4z546s · term · runs on the server

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

used by