-
-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for *-deprecation
command-line flags of Node.js
#7550
Add support for *-deprecation
command-line flags of Node.js
#7550
Conversation
🦋 Changeset detectedLatest commit: 47c57d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fpetrakov Thanks for the pull request!
As @Mouvedia commented, 'DeprecationWarning'
is required to affect the *-deprecation
CLI flags of Node.js. Can you address the comment, please?
process.emitWarning()
instead of console.warn()
*-deprecation
command-line flags of Node.js
*-deprecation
command-line flags of Node.js*-deprecation
command-line flags of Node.js
If we can settle on
then this PR could be merged. |
@Mouvedia Thanks for the good points 👍🏼 I think having a period is better as the Node.js API does: $ node -e "new Buffer('')" --throw-deprecation
node:internal/process/warning:185
throw warning;
^
DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
at showFlaggedDeprecation (node:buffer:188:11)
at new Buffer (node:buffer:266:3)
at [eval]:1:1
at runScriptInThisContext (node:internal/vm:209:10)
at node:internal/process/execution:109:14
at [eval]-wrapper:6:24
at runScript (node:internal/process/execution:92:62)
at evalScript (node:internal/process/execution:123:10)
at node:internal/main/eval_string:51:3 {
code: 'DEP0005'
}
Node.js v21.7.1 Also, I'm fine if the code order is like Ref https://nodejs.org/api/deprecations.html Besides, although it is not required, adding a utility might be helpful, e.g. const CODES = {
'001': {message: 'Message 1', detail: '...'},
'002': {message: 'Message 2'},
// ...
};
/**
* @param {keyof CODES} code
*/
function emitDeprecation(code) {
const {message, detail} = CODES[code];
process.emitWarning(message, {type: 'DeprecationWarning', code: `stylelint:${code}`, detail});
} |
The suggestions have been updated.
OK |
@fpetrakov @ybiquitous |
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
7e5c3cd
to
500bd8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fpetrakov Sorry for the late response, and thank you for addressing the reviews!
I've pushed a commit (47c57d1) about the code style, but it's a trivial change.
LGTM 👍🏼
@Mouvedia Do you have any thoughts left? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Can you open an issue and add it to the list? |
Closes #7533
No, it's self-explanatory.