This repository was archived by the owner on Jun 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ const MINIMATCH_OPTIONS = {
3131
3232const CONFIG_TYPES = new Set ( [ 'array' , 'function' ] ) ;
3333
34+ /**
35+ * Fields that are considered metadata and not part of the config object.
36+ */
37+ const META_FIELDS = new Set ( [ 'name' ] ) ;
38+
3439const FILES_AND_IGNORES_SCHEMA = new ObjectSchema ( filesAndIgnoresSchema ) ;
3540
3641/**
@@ -597,7 +602,7 @@ export class ConfigArray extends Array {
597602 * In this case, it acts list a globally ignored pattern. If there
598603 * are additional keys, then ignores act like exclusions.
599604 */
600- if ( config . ignores && Object . keys ( config ) . length === 1 ) {
605+ if ( config . ignores && Object . keys ( config ) . filter ( key => ! META_FIELDS . has ( key ) ) . length === 1 ) {
601606 result . push ( ...config . ignores ) ;
602607 }
603608 }
Original file line number Diff line number Diff line change @@ -2116,6 +2116,22 @@ describe('ConfigArray', () => {
21162116 expect ( ignores ) . to . deep . equal ( expectedIgnores ) ;
21172117
21182118 } ) ;
2119+
2120+ it ( 'should ignore name field for when considering global ignores' , ( ) => {
2121+ configs = new ConfigArray ( [
2122+ {
2123+ name : 'foo' ,
2124+ ignores : [ 'ignoreme' ]
2125+ } ,
2126+ ] , {
2127+ basePath
2128+ } ) ;
2129+
2130+ configs . normalizeSync ( ) ;
2131+
2132+ expect ( configs . isFileIgnored ( path . join ( basePath , 'ignoreme/foo.js' ) ) ) . to . be . true ;
2133+ expect ( configs . ignores ) . to . eql ( [ 'ignoreme' ] ) ;
2134+ } ) ;
21192135 } ) ;
21202136
21212137 describe ( 'push()' , ( ) => {
You can’t perform that action at this time.
0 commit comments