Add .suppressWarnings() for warnings in #1915 #1931 #1938 #1940#1955
Add .suppressWarnings() for warnings in #1915 #1931 #1938 #1940#1955aweebit wants to merge 1 commit intotj:developfrom
.suppressWarnings() for warnings in #1915 #1931 #1938 #1940#1955Conversation
Motivation: tj#1955
Motivation: tj#1955
Motivation: tj#1955
Motivation: tj#1955
Motivation: tj#1955
|
Lots of mind-dump comments. Warnings are something I think about in general, and applicable to multiple of your suggested PRs. Not ready for a big control switch yet. A somewhat related concept is "convention over configuration": https://en.wikipedia.org/wiki/Convention_over_configuration I think suppressing the warnings would need a narrower more explicit focus than just "warnings". In general I prefer messages to be for high-value issues that don't need to be made conditional. On a vaguely related note, I have thought about added in combined make-old-programs-work configuration, but got talked out of it the one time I wrote code. And I think it doesn't work as a concept in the longterm. Instead, I have been explicit about documenting deprecated patterns, but not removing them until there is a gain for the client pain. There is potentially a tension between the mistakes someone makes when very first attempting to use the library, versus the things authors try adding isolated custom behaviour or making major additions. |
Peer PRs
Requires changes when merged with…
chainArgParserCalls()for configuration. Additionally await thenable implicit and default option values and thenable default argument values #1915.command()#1938.parse()#1940👉 ❗ 💬 This PR is the place for discussions about the warning model that apply to all of the PRs listed above!
Incompatible with…
.suppressWarnings()introduced here become incorrect. The fact there is currently no well-defined meaning for such calls is one of the reasons why #1938 and #1940 should be preferred over #1917!Changes summary
Proposed mistake handling model
Based on #1940 (comment). Could be added to the docs.
suppressWarningsis on – a setting added specifically so that warnings can be hidden from end usersthrowthe error for the author to handle – should not be seen by end userChangeLog
Added
.suppressWarnings()to suppress warnings about presumably wrong library usageSome explanations
Why
.suppressWarning()instead of an environment variable such asNODE_ENV(as originally proposed)?Environment variables are used for stuff the end user should be able to control, but in our case, the tool author is the one to decide whether the warnings are to be shown.
See also: #1940 (comment).