1+ import fs from 'node:fs'
2+
13import execa from 'execa'
2- import fs from 'fs-extra'
34import { terminalLink } from 'termi-link'
45
56import { recordTelemetryAttributes } from '@cedarjs/cli-helpers'
@@ -20,6 +21,11 @@ export const builder = (yargs) => {
2021 description : 'Try to fix errors' ,
2122 type : 'boolean' ,
2223 } )
24+ . option ( 'format' , {
25+ default : 'stylish' ,
26+ description : 'Use a specific output format' ,
27+ type : 'string' ,
28+ } )
2329 . epilogue (
2430 `Also see the ${ terminalLink (
2531 'CedarJS CLI Reference' ,
@@ -28,23 +34,20 @@ export const builder = (yargs) => {
2834 )
2935}
3036
31- export const handler = async ( { path, fix } ) => {
32- recordTelemetryAttributes ( {
33- command : 'lint' ,
34- fix,
35- } )
37+ export const handler = async ( { path, fix, format } ) => {
38+ recordTelemetryAttributes ( { command : 'lint' , fix, format } )
3639
3740 try {
3841 const pathString = path ?. join ( ' ' )
42+ const sbPath = getPaths ( ) . web . storybook
3943 const result = await execa (
4044 'yarn eslint' ,
4145 [
4246 fix && '--fix' ,
47+ `--format ${ format } ` ,
4348 ! pathString && fs . existsSync ( getPaths ( ) . web . src ) && 'web/src' ,
4449 ! pathString && fs . existsSync ( getPaths ( ) . web . config ) && 'web/config' ,
45- ! pathString &&
46- fs . existsSync ( getPaths ( ) . web . storybook ) &&
47- 'web/.storybook' ,
50+ ! pathString && fs . existsSync ( sbPath ) && 'web/.storybook' ,
4851 ! pathString && fs . existsSync ( getPaths ( ) . scripts ) && 'scripts' ,
4952 ! pathString && fs . existsSync ( getPaths ( ) . api . src ) && 'api/src' ,
5053 pathString ,
0 commit comments