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 {
274274 }
275275
276276 try {
277+ // This does not have an actual definition
277278 defaultsObject [ 'npm-version' ] = require ( join ( this . npmPath , 'package.json' ) ) . version
278279 } catch {
279280 // in some weird state where the passed in npmPath does not have a package.json
@@ -568,11 +569,28 @@ class Config {
568569 }
569570 }
570571 }
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+ }
571576 conf . data [ k ] = v
572577 }
573578 }
574579 }
575580
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+
576594 #checkDeprecated ( key ) {
577595 if ( this . deprecated [ key ] ) {
578596 log . warn ( 'config' , key , this . deprecated [ key ] )
You can’t perform that action at this time.
0 commit comments