@@ -3277,44 +3277,37 @@ class Server {
3277
3277
cwd : watchOptions . cwd ,
3278
3278
dot : true ,
3279
3279
} ) ;
3280
+
3280
3281
const ignoreFunc = ( /** @type {string } */ p ) =>
3281
3282
! watchPathArr . includes ( p ) && ! matcher ( p ) ;
3282
3283
3283
- if ( Array . isArray ( watchOptions . ignored ) ) {
3284
- const ignoredGlobs = [ ] ;
3285
- for ( let i = 0 ; i < watchOptions . ignored . length ; i ++ ) {
3286
- const ignored = watchOptions . ignored [ i ] ;
3287
- if ( typeof ignored === "string" && isGlob ( ignored ) ) {
3288
- ignoredGlobs . push ( ignored ) ;
3289
- watchOptions . ignored . splice ( i , 1 ) ;
3290
- }
3291
- }
3284
+ const ignoredArr = Array . isArray ( watchOptions . ignored )
3285
+ ? watchOptions . ignored
3286
+ : [ ] ;
3292
3287
3293
- if ( ignoredGlobs . length > 0 ) {
3294
- const ignoreMatcher = picomatch ( ignoredGlobs , {
3295
- dot : true ,
3296
- cwd : watchOptions . cwd ,
3297
- } ) ;
3298
- watchOptions . ignored . push ( ignoreMatcher ) ;
3299
- }
3288
+ // Nested ternaries are forbidden by eslint so we end up with this
3289
+ if ( watchOptions . ignored && ! Array . isArray ( watchOptions . ignored ) ) {
3290
+ ignoredArr . push ( watchOptions . ignored ) ;
3291
+ }
3300
3292
3301
- watchOptions . ignored . push ( ignoreFunc ) ;
3302
- } else {
3303
- if (
3304
- watchOptions . ignored &&
3305
- typeof watchOptions . ignored === "string" &&
3306
- isGlob ( watchOptions . ignored )
3307
- ) {
3308
- watchOptions . ignored = picomatch ( watchOptions . ignored , {
3309
- dot : true ,
3310
- cwd : watchOptions . cwd ,
3311
- } ) ;
3293
+ const ignoredGlobs = [ ] ;
3294
+ for ( let i = 0 ; i < ignoredArr . length ; i ++ ) {
3295
+ const ignored = ignoredArr [ i ] ;
3296
+ if ( typeof ignored === "string" && isGlob ( ignored ) ) {
3297
+ ignoredGlobs . push ( ignored ) ;
3298
+ ignoredArr . splice ( i , 1 ) ;
3312
3299
}
3300
+ }
3313
3301
3314
- watchOptions . ignored = watchOptions . ignored
3315
- ? [ watchOptions . ignored , ignoreFunc ]
3316
- : ignoreFunc ;
3302
+ if ( ignoredGlobs . length > 0 ) {
3303
+ const ignoreMatcher = picomatch ( ignoredGlobs , {
3304
+ dot : true ,
3305
+ cwd : watchOptions . cwd ,
3306
+ } ) ;
3307
+ ignoredArr . push ( ignoreMatcher ) ;
3317
3308
}
3309
+
3310
+ ignoredArr . push ( ignoreFunc ) ;
3318
3311
}
3319
3312
}
3320
3313
0 commit comments