Skip to content

Commit d415d4e

Browse files
authored
fix: update display colors for zero errors and warnings (#1034)
1 parent c33dc7c commit d415d4e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/cool-beers-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/check': patch
3+
---
4+
5+
When no errors or warnings are detected, display "0 errors" or "0 warnings" in a dimmed color on the console instead of red or yellow.

packages/astro-check/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ export async function check(flags: Partial<Flags>): Promise<boolean | void> {
8282
[
8383
bold(`Result (${result.fileChecked} file${result.fileChecked === 1 ? '' : 's'}): `),
8484
['error', 'warning', 'hint'].includes(minimumSeverity)
85-
? bold(red(`${result.errors} ${result.errors === 1 ? 'error' : 'errors'}`))
85+
? result.errors > 0
86+
? bold(red(`${result.errors} ${result.errors === 1 ? 'error' : 'errors'}`))
87+
: dim('0 errors')
8688
: undefined,
8789
['warning', 'hint'].includes(minimumSeverity)
88-
? bold(yellow(`${result.warnings} ${result.warnings === 1 ? 'warning' : 'warnings'}`))
90+
? result.warnings > 0
91+
? bold(yellow(`${result.warnings} ${result.warnings === 1 ? 'warning' : 'warnings'}`))
92+
: dim('0 warnings')
8993
: undefined,
9094
['hint'].includes(minimumSeverity)
9195
? dim(`${result.hints} ${result.hints === 1 ? 'hint' : 'hints'}\n`)

0 commit comments

Comments
 (0)