Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

feat: warn on deprecated config #62

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,9 @@ class Config {
}

[_checkDeprecated] (key, where, obj, kv) {
// XXX a future npm version will make this a warning.
// An even more future npm version will make this an error.
// XXX(npm9+) make this throw an error
if (this.deprecated[key]) {
log.verbose('config', key, this.deprecated[key])
log.warn('config', key, this.deprecated[key])
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ loglevel = yolo
['warn', 'invalid config', 'Must be one or more', 'numeric value'],
['warn', 'invalid config', 'prefix=true', 'set in command line options'],
['warn', 'invalid config', 'Must be', 'valid filesystem path'],
['verbose', 'config', 'also', 'Please use --include=dev instead.'],
['warn', 'config', 'also', 'Please use --include=dev instead.'],
['warn', 'invalid config', 'loglevel="yolo"',
`set in ${resolve(path, 'project/.npmrc')}`],
['warn', 'invalid config', 'Must be one of:',
Expand Down Expand Up @@ -506,7 +506,7 @@ loglevel = yolo
['warn', 'invalid config', 'Must be one or more', 'numeric value'],
['warn', 'invalid config', 'prefix=true', 'set in command line options'],
['warn', 'invalid config', 'Must be', 'valid filesystem path'],
['verbose', 'config', 'also', 'Please use --include=dev instead.'],
['warn', 'config', 'also', 'Please use --include=dev instead.'],
])
})

Expand Down