File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ class Config {
274
274
}
275
275
276
276
try {
277
+ // This does not have an actual definition
277
278
defaultsObject [ 'npm-version' ] = require ( join ( this . npmPath , 'package.json' ) ) . version
278
279
} catch {
279
280
// in some weird state where the passed in npmPath does not have a package.json
@@ -568,11 +569,28 @@ class Config {
568
569
}
569
570
}
570
571
}
572
+ // Some defaults like npm-version are not user-definable and thus don't have definitions
573
+ if ( where !== 'default' ) {
574
+ this . #checkUnknown( where , key )
575
+ }
571
576
conf . data [ k ] = v
572
577
}
573
578
}
574
579
}
575
580
581
+ #checkUnknown ( where , key ) {
582
+ if ( ! this . definitions [ key ] ) {
583
+ if ( ! key . includes ( ':' ) ) {
584
+ log . warn ( `Unknown ${ where } config "${ where === 'cli' ? '--' : '' } ${ key } ". This will stop working in the next major version of npm.` )
585
+ return
586
+ }
587
+ const baseKey = key . split ( ':' ) . pop ( )
588
+ if ( ! this . definitions [ baseKey ] && ! this . nerfDarts . includes ( baseKey ) ) {
589
+ log . warn ( `Unknown ${ where } config "${ baseKey } " (${ key } ). This will stop working in the next major version of npm.` )
590
+ }
591
+ }
592
+ }
593
+
576
594
#checkDeprecated ( key ) {
577
595
if ( this . deprecated [ key ] ) {
578
596
log . warn ( 'config' , key , this . deprecated [ key ] )
You can’t perform that action at this time.
0 commit comments