@@ -7,6 +7,7 @@ import { mergeResults, overrideConfig } from "./eslint";
7
7
import pkgJson from "../package.json" assert { type : "json " } ;
8
8
import yargs from "yargs" ;
9
9
import { hideBin } from "yargs/helpers" ;
10
+ import { performance } from "node:perf_hooks" ;
10
11
11
12
const instance = yargs ( hideBin ( process . argv ) )
12
13
. scriptName ( "@nivalis/linter" )
@@ -57,8 +58,16 @@ const instance = yargs(hideBin(process.argv))
57
58
overrideConfig : eslintOnly ? [ ] : overrideConfig ,
58
59
} ) ;
59
60
61
+ if ( debug ) {
62
+ performance . mark ( "eslint-start" ) ;
63
+ }
60
64
const eslintResults = await eslint . lintFiles ( files ) ;
61
65
66
+ if ( debug ) {
67
+ performance . mark ( "eslint-end" ) ;
68
+ performance . measure ( "eslint" , "eslint-start" , "eslint-end" ) ;
69
+ }
70
+
62
71
if ( fix && eslintResults . length > 0 ) {
63
72
await ESLint . outputFixes ( eslintResults ) ;
64
73
}
@@ -84,12 +93,28 @@ const instance = yargs(hideBin(process.argv))
84
93
85
94
biome . applyConfiguration ( getBiomeConfig ( ) ) ;
86
95
87
- const biomeResults = biomeLintFiles ( biome , allFiles , fix , debug ) ;
96
+ if ( debug ) {
97
+ performance . mark ( "biome-start" ) ;
98
+ }
99
+
100
+ const biomeResults = biomeLintFiles ( biome , allFiles , fix ) ;
101
+
102
+ if ( debug ) {
103
+ performance . mark ( "biome-end" ) ;
104
+ performance . measure ( "biome" , "biome-start" , "biome-end" ) ;
105
+ }
88
106
89
107
const resultText = await formatter . format (
90
108
mergeResults ( [ ...biomeResults , ...eslintResults ] ) ,
91
109
) ;
92
110
111
+ if ( debug ) {
112
+ const measurements = performance . getEntriesByType ( "measure" ) ;
113
+ for ( const measurement of measurements ) {
114
+ console . log ( `${ measurement . name } : ${ measurement . duration } ms` ) ;
115
+ }
116
+ }
117
+
93
118
console . log ( resultText ? resultText : "No issues found" ) ;
94
119
} catch ( error ) {
95
120
console . error ( error ) ;
0 commit comments