File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,16 @@ export async function lint(options?: Partial<DefaultOptions>) {
2929 const { CLIEngine } = await import ( 'eslint' ) ;
3030 const lintRules = fs . readJsonSync ( path . join ( globalState . projectRootPath , '.eslintrc' ) ) ;
3131 const mergedOptions = _ . defaults ( options || { } , new DefaultOptions ( ) ) ;
32- const cli = new CLIEngine ( { ...( lintRules as any ) , fix : mergedOptions . needFix } ) ;
32+ const eslintIgnorePath = path . join ( globalState . projectRootPath , '.eslintignore' ) ;
33+ const eslintIgnoreExist = fs . existsSync ( eslintIgnorePath ) ;
34+ const cli = new CLIEngine ( {
35+ ...( lintRules as any ) ,
36+ fix : mergedOptions . needFix ,
37+ ignore : true ,
38+ ignorePath : eslintIgnoreExist ? eslintIgnorePath : null ,
39+ globals : [ 'API' , 'defs' ]
40+ } ) ;
41+
3342 let lintFiles : string [ ] = [ ] ;
3443
3544 if ( mergedOptions . lintAll ) {
@@ -48,6 +57,8 @@ export async function lint(options?: Partial<DefaultOptions>) {
4857 } ) ;
4958 }
5059
60+ lintFiles = lintFiles . filter ( file => ! cli . isPathIgnored ( file ) ) ;
61+
5162 const lintResult = await spinner (
5263 `Lint ${ mergedOptions . lintAll ? 'all' : '' } ${ lintFiles . length } files.` ,
5364 async ( ) => {
You can’t perform that action at this time.
0 commit comments