-
Notifications
You must be signed in to change notification settings - Fork 0
Fix picomatch basename option, add NO_COLOR support, bump engine to >… #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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); | ||||||||||||||||||||||||||
|
Comment on lines
+8
to
+10
|
||||||||||||||||||||||||||
| const colorEnabled = | |
| !('NO_COLOR' in process.env) && | |
| (process.stdout.isTTY === true || process.env.FORCE_COLOR !== undefined); | |
| const noColor = 'NO_COLOR' in process.env; | |
| const forceColor = process.env.FORCE_COLOR; | |
| const colorEnabled = !noColor && ( | |
| forceColor === '0' | |
| ? false | |
| : forceColor !== undefined | |
| ? true | |
| : process.stdout.isTTY === true | |
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FORCE_COLORis treated as an enable flag whenever it is present, which meansFORCE_COLOR=0will still enable ANSI output (and also won’t disable colors on TTY). If you want to supportFORCE_COLOR, it should interpret the value and treat0as disabling colors (and optionally allow1+to force-enable), otherwise redirected output can unexpectedly contain ANSI sequences.