File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,12 +67,21 @@ export function formatErrors(
6767 ) ;
6868 // Split positive and negative patterns to replicate micromatch semantics:
6969 // a file must match a positive pattern AND not match any negative pattern.
70- const positivePatterns = loaderOptions . reportFiles . filter (
71- p => ! p . startsWith ( '!' )
72- ) ;
73- const negativePatterns = loaderOptions . reportFiles
74- . filter ( p => p . startsWith ( '!' ) )
75- . map ( p => p . slice ( 1 ) ) ;
70+ const { positivePatterns, negativePatterns } =
71+ loaderOptions . reportFiles . reduce < {
72+ positivePatterns : string [ ] ;
73+ negativePatterns : string [ ] ;
74+ } > (
75+ ( acc , p ) => {
76+ if ( p . startsWith ( '!' ) ) {
77+ acc . negativePatterns . push ( p . slice ( 1 ) ) ;
78+ } else {
79+ acc . positivePatterns . push ( p ) ;
80+ }
81+ return acc ;
82+ } ,
83+ { positivePatterns : [ ] , negativePatterns : [ ] }
84+ ) ;
7685 const matchPos = picomatch (
7786 positivePatterns . length > 0 ? positivePatterns : [ '**' ]
7887 ) ;
You can’t perform that action at this time.
0 commit comments