diff --git a/package.json b/package.json index bea0bcd..c720bdc 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "author": "Maciej Mensfeld ", "license": "MIT", "engines": { - "node": ">=18.0.0" + "node": ">=18.3.0" }, "dependencies": { "fast-glob": "^3.3.2", diff --git a/src/output/text.ts b/src/output/text.ts index fef896e..8be3d02 100644 --- a/src/output/text.ts +++ b/src/output/text.ts @@ -5,7 +5,11 @@ import type { ValidationResult, Finding, StaleReason } from '../core/types.js'; /** Inline ANSI color helpers (replaces chalk) */ -const ansi = (code: number, close: number) => (s: string) => `\x1b[${code}m${s}\x1b[${close}m`; +const colorEnabled = + !('NO_COLOR' in process.env) && + (process.stdout.isTTY === true || process.env.FORCE_COLOR !== undefined); +const ansi = (code: number, close: number) => + colorEnabled ? (s: string) => `\x1b[${code}m${s}\x1b[${close}m` : (s: string) => s; const gray = ansi(90, 39); const yellow = ansi(33, 39); const red = ansi(31, 39); diff --git a/src/validator/glob.ts b/src/validator/glob.ts index 70bf93d..92a8ab6 100644 --- a/src/validator/glob.ts +++ b/src/validator/glob.ts @@ -35,7 +35,7 @@ export function globMatches( try { const isMatch = picomatch(normalizedPattern, { dot, - matchBase: !normalizedPattern.includes('/') + basename: !normalizedPattern.includes('/') }); return files.filter((file) => isMatch(file)); } catch {