Files
hyperframes/packages/lint/src/projectIgnore.ts
T
Miguel Ángel 80e02e74a0 fix(lint): compositions in .hyperframesignore no longer count as the project's (#7239)
* fix(lint): compositions in .hyperframesignore no longer count as the project's

* fix(lint): keep the ignore helper under the package's comment share
2026-11-05 13:18:42 +00:00

14 lines
572 B
TypeScript

import { existsSync, readFileSync } from "node:fs";
import { join } from "node:path";
import ignore, { type Ignore } from "ignore";
const DEFAULT_PROJECT_IGNORE = ["/renders/", "/snapshots/", ".*"];
/** What the project leaves out; ask with a relative `/` path, a folder with a trailing `/`. */
export function projectIgnore(projectDir: string): Ignore {
const matcher = ignore().add(DEFAULT_PROJECT_IGNORE);
const ignorePath = join(projectDir, ".hyperframesignore");
if (existsSync(ignorePath)) matcher.add(readFileSync(ignorePath, "utf-8"));
return matcher;
}