File tree 5 files changed +30
-11
lines changed
packages/vite-plugin-checker/src
5 files changed +30
-11
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { FileDiagnosticManager } from '../../FileDiagnosticManager.js'
7
7
import {
8
8
composeCheckerSummary ,
9
9
consoleLog ,
10
+ diagnosticToConsoleLevel ,
10
11
diagnosticToRuntimeError ,
11
12
diagnosticToTerminalLog ,
12
13
filterLogLevel ,
@@ -58,7 +59,10 @@ const createDiagnostic: CreateDiagnostic<'biome'> = (pluginConfig) => {
58
59
59
60
if ( terminal ) {
60
61
for ( const d of diagnostics ) {
61
- consoleLog ( diagnosticToTerminalLog ( d , 'Biome' ) , 'info' )
62
+ consoleLog (
63
+ diagnosticToTerminalLog ( d , 'Biome' ) ,
64
+ diagnosticToConsoleLevel ( d ) ,
65
+ )
62
66
}
63
67
64
68
const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { createIgnore } from '../../glob.js'
12
12
import {
13
13
composeCheckerSummary ,
14
14
consoleLog ,
15
+ diagnosticToConsoleLevel ,
15
16
diagnosticToRuntimeError ,
16
17
diagnosticToTerminalLog ,
17
18
filterLogLevel ,
@@ -88,10 +89,12 @@ const createDiagnostic: CreateDiagnostic<'eslint'> = (pluginConfig) => {
88
89
89
90
const dispatchDiagnostics = ( ) => {
90
91
const diagnostics = filterLogLevel ( manager . getDiagnostics ( ) , logLevel )
91
-
92
92
if ( terminal ) {
93
93
for ( const d of diagnostics ) {
94
- consoleLog ( diagnosticToTerminalLog ( d , 'ESLint' ) , 'info' )
94
+ consoleLog (
95
+ diagnosticToTerminalLog ( d , 'ESLint' ) ,
96
+ diagnosticToConsoleLevel ( d ) ,
97
+ )
95
98
}
96
99
97
100
const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { createIgnore } from '../../glob.js'
11
11
import {
12
12
composeCheckerSummary ,
13
13
consoleLog ,
14
+ diagnosticToConsoleLevel ,
14
15
diagnosticToRuntimeError ,
15
16
diagnosticToTerminalLog ,
16
17
filterLogLevel ,
@@ -63,7 +64,10 @@ const createDiagnostic: CreateDiagnostic<'stylelint'> = (pluginConfig) => {
63
64
64
65
if ( terminal ) {
65
66
for ( const d of diagnostics ) {
66
- consoleLog ( diagnosticToTerminalLog ( d , 'Stylelint' ) , 'info' )
67
+ consoleLog (
68
+ diagnosticToTerminalLog ( d , 'Stylelint' ) ,
69
+ diagnosticToConsoleLevel ( d ) ,
70
+ )
67
71
}
68
72
69
73
const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change 1
- import os from 'node:os'
2
1
import { fileURLToPath } from 'node:url'
3
2
import { parentPort } from 'node:worker_threads'
4
3
5
4
import { Checker } from '../../Checker.js'
6
5
import {
7
6
composeCheckerSummary ,
8
7
consoleLog ,
8
+ diagnosticToConsoleLevel ,
9
9
diagnosticToRuntimeError ,
10
10
diagnosticToTerminalLog ,
11
11
toClientPayload ,
@@ -57,12 +57,12 @@ export const createDiagnostic: CreateDiagnostic<'vls'> = (pluginConfig) => {
57
57
}
58
58
59
59
if ( terminal ) {
60
- consoleLog (
61
- normalized
62
- . map ( ( d ) => diagnosticToTerminalLog ( d , 'VLS' ) )
63
- . join ( os . EOL ) ,
64
- 'info' ,
65
- )
60
+ for ( const d of normalized ) {
61
+ consoleLog (
62
+ diagnosticToTerminalLog ( d , 'VLS' ) ,
63
+ diagnosticToConsoleLevel ( d ) ,
64
+ )
65
+ }
66
66
}
67
67
}
68
68
Original file line number Diff line number Diff line change @@ -128,6 +128,14 @@ export function diagnosticToTerminalLog(
128
128
. join ( os . EOL )
129
129
}
130
130
131
+ export function diagnosticToConsoleLevel ( d : NormalizedDiagnostic ) {
132
+ if ( ! d ) return 'error'
133
+ if ( d . level === DiagnosticLevel . Message ) return 'info'
134
+ if ( d . level === DiagnosticLevel . Suggestion ) return 'info'
135
+ if ( d . level === DiagnosticLevel . Warning ) return 'warn'
136
+ return 'error'
137
+ }
138
+
131
139
export function diagnosticToRuntimeError (
132
140
d : NormalizedDiagnostic ,
133
141
) : DiagnosticToRuntime
You can’t perform that action at this time.
0 commit comments