Breaking: deprecate safe-buffer.Buffer calls#110
Merged
mysticatea merged 1 commit intomysticatea:masterfrom Mar 9, 2018
Merged
Breaking: deprecate safe-buffer.Buffer calls#110mysticatea merged 1 commit intomysticatea:masterfrom
mysticatea merged 1 commit intomysticatea:masterfrom
Conversation
safe-buffer.Buffer function/constructror is just a re-export of
buffer.Buffer and should be deprecated likewise.
Otherwise, using Buffer = require('safe-buffer').Buffer magically hides
the deprecation message, which it shouldn't, as that code will
actually cause runtime deprecation errors on Node.js >= 10.
Codecov Report
@@ Coverage Diff @@
## master #110 +/- ##
==========================================
+ Coverage 98.21% 98.21% +<.01%
==========================================
Files 43 43
Lines 1065 1066 +1
==========================================
+ Hits 1046 1047 +1
Misses 19 19
Continue to review full report at Codecov.
|
Owner
|
Sounds good to me. Thank you! |
brettz9
pushed a commit
to brettz9/eslint-plugin-node
that referenced
this pull request
Jul 24, 2024
* docs: improve wording of file-extension-in-import docs mysticatea#325 * Update docs/rules/file-extension-in-import.md * docs: Remove multiple blank lines --------- Co-authored-by: Sebastian Good <2230835+scagood@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
safe-buffer.Bufferfunction/constructor is just a re-export ofbuffer.Bufferand should be deprecated likewise.Otherwise, using
Buffer = require('safe-buffer').Buffermagically hides the deprecation message, which it shouldn't, as that code will actually cause runtime deprecation errors on Node.js >= 10.In fact, ecosystem analysis shows that people do that a lot to silence
standardlinter — they see a recommendation to usesafe-bufferin the warning, they throw invar Buffer = require('buffer').Buffer, the warning goes away, nothing actually changes.Example:
Also, even if they migrate to the new API and install
safe-bufferfor the actual polyfills, the fact that that line alone disables the deprecation message makes them overlook calls to the old API.Examples:
Old Buffer API is going to be runtime-deprecated in Node.js 10.0 (nodejs/node#19079) and
require('safe-buffer').Buffer(arg)actually hits that deprecated API, so this change is needed for developers to spot those issues that would soon become runtime warnings, in advance.eslint-plugin-nodewas already helping developers to spot that deprecated Buffer API usage in advance, but only until they putBuffer = require('safe-buffer').Bufferinto their code (and they do that a lot, since that's the recommended way to keep older Node.js versions support).Actually, I am not even sure if this should be a breaking or a bugfix change. Thoughts?
/cc @Trott, @feross .