@@ -82,7 +82,7 @@ function filterLintableFiles(files) {
8282}
8383
8484/**
85- * Run ESLint on specific files.
85+ * Run linters on specific files.
8686 */
8787async function runLintOnFiles ( files , options = { } ) {
8888 const { fix = false , quiet = false } = options
@@ -96,36 +96,61 @@ async function runLintOnFiles(files, options = {}) {
9696 logger . progress ( `Linting ${ files . length } file(s)` )
9797 }
9898
99- const args = [
100- 'exec' ,
101- 'eslint' ,
102- '-c' ,
103- '.config/eslint.config.mjs' ,
104- '--report-unused-disable-directives' ,
105- ...( fix ? [ '--fix' ] : [ ] ) ,
106- ...files ,
99+ // Build the linter configurations.
100+ const linters = [
101+ {
102+ args : [
103+ 'exec' ,
104+ 'biome' ,
105+ 'check' ,
106+ '--log-level=none' ,
107+ ...( fix ? [ '--write' , '--unsafe' ] : [ ] ) ,
108+ ...files ,
109+ ] ,
110+ name : 'biome' ,
111+ enabled : true ,
112+ } ,
113+ {
114+ args : [
115+ 'exec' ,
116+ 'eslint' ,
117+ '-c' ,
118+ '.config/eslint.config.mjs' ,
119+ '--report-unused-disable-directives' ,
120+ ...( fix ? [ '--fix' ] : [ ] ) ,
121+ ...files ,
122+ ] ,
123+ name : 'eslint' ,
124+ enabled : true ,
125+ } ,
107126 ]
108127
109- const result = await runCommandQuiet ( 'pnpm' , args )
128+ for ( const { args, enabled } of linters ) {
129+ if ( ! enabled ) {
130+ continue
131+ }
110132
111- if ( result . exitCode !== 0 ) {
112- // When fixing, non-zero exit codes are normal if fixes were applied
113- if ( ! fix || ( result . stderr && result . stderr . trim ( ) . length > 0 ) ) {
114- if ( ! quiet ) {
115- logger . error ( `Linting failed` )
116- }
117- if ( result . stderr ) {
118- console . error ( result . stderr )
119- }
120- if ( result . stdout && ! fix ) {
121- console . log ( result . stdout )
133+ const result = await runCommandQuiet ( 'pnpm' , args )
134+
135+ if ( result . exitCode !== 0 ) {
136+ // When fixing, non-zero exit codes are normal if fixes were applied.
137+ if ( ! fix || ( result . stderr && result . stderr . trim ( ) . length > 0 ) ) {
138+ if ( ! quiet ) {
139+ logger . error ( 'Linting failed' )
140+ }
141+ if ( result . stderr ) {
142+ console . error ( result . stderr )
143+ }
144+ if ( result . stdout && ! fix ) {
145+ console . log ( result . stdout )
146+ }
147+ return result . exitCode
122148 }
123- return result . exitCode
124149 }
125150 }
126151
127152 if ( ! quiet ) {
128- logger . clearLine ( ) . done ( ` Linting passed` )
153+ logger . clearLine ( ) . done ( ' Linting passed' )
129154 // Add newline after message (use error to write to same stream)
130155 logger . error ( '' )
131156 }
@@ -134,7 +159,7 @@ async function runLintOnFiles(files, options = {}) {
134159}
135160
136161/**
137- * Run ESLint on all files.
162+ * Run linters on all files.
138163 */
139164async function runLintOnAll ( options = { } ) {
140165 const { fix = false , quiet = false } = options
@@ -143,31 +168,48 @@ async function runLintOnAll(options = {}) {
143168 logger . progress ( 'Linting all files' )
144169 }
145170
146- const args = [
147- 'exec' ,
148- 'eslint' ,
149- '-c' ,
150- '.config/eslint.config.mjs' ,
151- '--report-unused-disable-directives' ,
152- ...( fix ? [ '--fix' ] : [ ] ) ,
153- '.' ,
171+ const linters = [
172+ {
173+ args : [
174+ 'exec' ,
175+ 'biome' ,
176+ 'check' ,
177+ ...( fix ? [ '--write' , '--unsafe' ] : [ ] ) ,
178+ '.' ,
179+ ] ,
180+ name : 'biome' ,
181+ } ,
182+ {
183+ args : [
184+ 'exec' ,
185+ 'eslint' ,
186+ '-c' ,
187+ '.config/eslint.config.mjs' ,
188+ '--report-unused-disable-directives' ,
189+ ...( fix ? [ '--fix' ] : [ ] ) ,
190+ '.' ,
191+ ] ,
192+ name : 'eslint' ,
193+ } ,
154194 ]
155195
156- const result = await runCommandQuiet ( 'pnpm' , args )
196+ for ( const { args } of linters ) {
197+ const result = await runCommandQuiet ( 'pnpm' , args )
157198
158- if ( result . exitCode !== 0 ) {
159- // When fixing, non-zero exit codes are normal if fixes were applied
160- if ( ! fix || ( result . stderr && result . stderr . trim ( ) . length > 0 ) ) {
161- if ( ! quiet ) {
162- logger . error ( 'Linting failed' )
163- }
164- if ( result . stderr ) {
165- console . error ( result . stderr )
166- }
167- if ( result . stdout && ! fix ) {
168- console . log ( result . stdout )
199+ if ( result . exitCode !== 0 ) {
200+ // When fixing, non-zero exit codes are normal if fixes were applied.
201+ if ( ! fix || ( result . stderr && result . stderr . trim ( ) . length > 0 ) ) {
202+ if ( ! quiet ) {
203+ logger . error ( 'Linting failed' )
204+ }
205+ if ( result . stderr ) {
206+ console . error ( result . stderr )
207+ }
208+ if ( result . stdout && ! fix ) {
209+ console . log ( result . stdout )
210+ }
211+ return result . exitCode
169212 }
170- return result . exitCode
171213 }
172214 }
173215
0 commit comments