File tree Expand file tree Collapse file tree 5 files changed +30
-11
lines changed
packages/vite-plugin-checker/src Expand file tree Collapse file tree 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'
77import {
88 composeCheckerSummary ,
99 consoleLog ,
10+ diagnosticToConsoleLevel ,
1011 diagnosticToRuntimeError ,
1112 diagnosticToTerminalLog ,
1213 filterLogLevel ,
@@ -58,7 +59,10 @@ const createDiagnostic: CreateDiagnostic<'biome'> = (pluginConfig) => {
5859
5960 if ( terminal ) {
6061 for ( const d of diagnostics ) {
61- consoleLog ( diagnosticToTerminalLog ( d , 'Biome' ) , 'info' )
62+ consoleLog (
63+ diagnosticToTerminalLog ( d , 'Biome' ) ,
64+ diagnosticToConsoleLevel ( d ) ,
65+ )
6266 }
6367
6468 const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { createIgnore } from '../../glob.js'
1212import {
1313 composeCheckerSummary ,
1414 consoleLog ,
15+ diagnosticToConsoleLevel ,
1516 diagnosticToRuntimeError ,
1617 diagnosticToTerminalLog ,
1718 filterLogLevel ,
@@ -88,10 +89,12 @@ const createDiagnostic: CreateDiagnostic<'eslint'> = (pluginConfig) => {
8889
8990 const dispatchDiagnostics = ( ) => {
9091 const diagnostics = filterLogLevel ( manager . getDiagnostics ( ) , logLevel )
91-
9292 if ( terminal ) {
9393 for ( const d of diagnostics ) {
94- consoleLog ( diagnosticToTerminalLog ( d , 'ESLint' ) , 'info' )
94+ consoleLog (
95+ diagnosticToTerminalLog ( d , 'ESLint' ) ,
96+ diagnosticToConsoleLevel ( d ) ,
97+ )
9598 }
9699
97100 const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { createIgnore } from '../../glob.js'
1111import {
1212 composeCheckerSummary ,
1313 consoleLog ,
14+ diagnosticToConsoleLevel ,
1415 diagnosticToRuntimeError ,
1516 diagnosticToTerminalLog ,
1617 filterLogLevel ,
@@ -63,7 +64,10 @@ const createDiagnostic: CreateDiagnostic<'stylelint'> = (pluginConfig) => {
6364
6465 if ( terminal ) {
6566 for ( const d of diagnostics ) {
66- consoleLog ( diagnosticToTerminalLog ( d , 'Stylelint' ) , 'info' )
67+ consoleLog (
68+ diagnosticToTerminalLog ( d , 'Stylelint' ) ,
69+ diagnosticToConsoleLevel ( d ) ,
70+ )
6771 }
6872
6973 const errorCount = diagnostics . filter (
Original file line number Diff line number Diff line change 1- import os from 'node:os'
21import { fileURLToPath } from 'node:url'
32import { parentPort } from 'node:worker_threads'
43
54import { Checker } from '../../Checker.js'
65import {
76 composeCheckerSummary ,
87 consoleLog ,
8+ diagnosticToConsoleLevel ,
99 diagnosticToRuntimeError ,
1010 diagnosticToTerminalLog ,
1111 toClientPayload ,
@@ -57,12 +57,12 @@ export const createDiagnostic: CreateDiagnostic<'vls'> = (pluginConfig) => {
5757 }
5858
5959 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+ }
6666 }
6767 }
6868
Original file line number Diff line number Diff line change @@ -128,6 +128,14 @@ export function diagnosticToTerminalLog(
128128 . join ( os . EOL )
129129}
130130
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+
131139export function diagnosticToRuntimeError (
132140 d : NormalizedDiagnostic ,
133141) : DiagnosticToRuntime
You can’t perform that action at this time.
0 commit comments