File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,16 @@ export async function lint(options?: Partial<DefaultOptions>) {
29
29
const { CLIEngine } = await import ( 'eslint' ) ;
30
30
const lintRules = fs . readJsonSync ( path . join ( globalState . projectRootPath , '.eslintrc' ) ) ;
31
31
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
+
33
42
let lintFiles : string [ ] = [ ] ;
34
43
35
44
if ( mergedOptions . lintAll ) {
@@ -48,6 +57,8 @@ export async function lint(options?: Partial<DefaultOptions>) {
48
57
} ) ;
49
58
}
50
59
60
+ lintFiles = lintFiles . filter ( file => ! cli . isPathIgnored ( file ) ) ;
61
+
51
62
const lintResult = await spinner (
52
63
`Lint ${ mergedOptions . lintAll ? 'all' : '' } ${ lintFiles . length } files.` ,
53
64
async ( ) => {
You can’t perform that action at this time.
0 commit comments