File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,7 @@ export async function lint(options?: Partial<DefaultOptions>) {
74
74
const lintResult = await spinner (
75
75
`Lint ${ mergedOptions . lintAll ? 'all' : '' } ${ lintFiles . length } files.` ,
76
76
async ( ) => {
77
- const files = execSync (
78
- `${ globalState . projectRootPath } /node_modules/.bin/prettier --list-different --write ${ lintFiles . join ( ' ' ) } ` ,
79
- ) ;
77
+ const files = execSync ( `npx prettier --list-different --write ${ lintFiles . join ( ' ' ) } ` ) ;
80
78
prettierFiles = _ . compact ( files . toString ( ) . split ( '\n' ) ) ;
81
79
return cli . executeOnFiles ( lintFiles ) ;
82
80
} ,
@@ -156,16 +154,16 @@ export async function lint(options?: Partial<DefaultOptions>) {
156
154
}
157
155
158
156
if ( mergedOptions . needFix && ( lintResult . results . some ( each => each . output ) || prettierFiles . length > 0 ) ) {
159
- const fixedFiles = _ . uniq (
157
+ const fixedFilePaths = _ . uniq (
160
158
lintResult . results
161
159
. filter ( each => each . output )
162
160
. map ( item => item . filePath )
163
161
. concat ( prettierFiles ) ,
164
162
) ;
165
163
166
164
// eslint-disable-next-line no-console
167
- console . log ( colors . yellow ( `${ fixedFiles . length } files autofixed, please recheck your code.` ) ) ;
168
- execSync ( `git add ${ fixedFiles . join ( ' ' ) } ` ) ;
165
+ console . log ( colors . yellow ( `${ fixedFilePaths . length } files autofixed, please recheck your code.` ) ) ;
166
+ execSync ( `git add ${ fixedFilePaths . join ( ' ' ) } ` ) ;
169
167
}
170
168
171
169
if ( mergedOptions . typeCheck ) {
You can’t perform that action at this time.
0 commit comments