-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
fs: undeprecate existsSync #8364
Conversation
For those not following along with the multiple giant threads around this, I think my summary comment tells the clearest story:
Today, Hence this PR, to simply undeprecate |
@nodejs/ctc I find the arguments here compelling and would like to follow through. |
IMHO, our
And, we would be better to keep core simple. we should not re-support those easy API like |
It may surprise you that I mostly agree with this. In PR #4217, I think we reached some consensus that it would have been better if But the problem now is that node is doing too much on top of the POSIX API. What we need is an API that calls That either means adding a new Undeprecating |
LGTM |
Deprecating only the async version would be confusing to the new users I believe. The doc just points to the |
We can add the relevant documentation to this method... (We're not gona undeprecate |
dbe9f8c
to
d75e0a3
Compare
Added relevant documentation to |
@@ -693,6 +693,12 @@ fs.exists('/etc/passwd', (exists) => { | |||
}); | |||
``` | |||
|
|||
**Note that the parameter to this callback is not consistent with other Node |
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.
Node.js
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.
Thanks, fixed.
2cd5cc1
to
db6d9e6
Compare
* `path` {String | Buffer} | ||
|
||
Synchronous version of [`fs.exists()`][]. | ||
Returns `true` if the file exists, `false` otherwise. | ||
|
||
Note that `fs.exists()` is deprecated, but `fs.existsSync()` is not. | ||
(The `callback` parameter to `fs.exists()` accepts parameters that are | ||
inconsistent with other Node callbacks. `fs.existsSync()` does not use |
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.
Another one ;-) s/Node/Node.js/g
Are doc-only deprecations semver-major? If so, then should undoing a doc-only deprecation like this also be semver-major? I don't have an opinion either way; just seeking clarity. |
No, undoing a semver-major generally should be either semver-minor (in most cases) or semver-patch (in case if the breakage that is being reverted was unintended). Likewise, undoing a semver-minor is generally a semver-major. Undoing a semver-major is a semver-major only in cases of an API behaviour change which is not an addition, deprecation or removal of something — and something like that should generally be avoided, if possible. But in this specific situation (where the deprecation was docs-only) we could just land that to all branches starting from 4.x in a patch release, IMO. |
db6d9e6
to
0bb3e9d
Compare
Fixed the last outstanding s/Node/Node.js/ |
ping? |
Are any @nodejs/collaborators strongly in favor of undeprecating I see @jasnell gave this a Anyone else? |
I thought (hoped?) @Fishrock123 was the relevant champion here. |
Good point. @Fishrock123 assigned the issue to themselves as well, which seems like a pretty good indication. It wouldn't hurt to have more champions, I suppose. :-D |
I believe this should be done. If that's the same as championing, then ok 😃 On Monday, September 19, 2016, Rich Trott [email protected] wrote:
|
I'm quite new-in-town, but I'm also in favor of undeprecating fs.existsSync. LGTM |
LGTM |
OK, that's three Do any Collaborators object? That is, are any Collaborators opposed to it to the point that they would veto it? Something stronger than just "I don't like it but I'm not going to stop it if others want it". |
|
@ChALkeR can you approve so I can merge? Thanks :) |
@Fishrock123, @dfabulich, @Trott, sorry for the delay. LGTM now. The PR with the doclint tooling is in #8551, if you will want that again until it's merged =). |
This has been dragged through various long discussions and has been elevated to the CTC multiple times. As noted in #7455 (comment), while this API is still generally considered an anti-pattern, there are still use-cases it is best suited for, such as checking if a git rebase is in progress by looking if ".git/rebase-apply/rebasing" exists. The general consensus is to undeprecate just the sync version, given that the async version still has the "arguments order inconsistency" problem. The consensus at the two last CTC meetings this came up at was also to undeprecate existsSync() but keep exists() deprecated. See: #8242 & #8330 (Description write-up by @Fishrock123) Fixes: #1592 Refs: #4217 Refs: #7455 PR-URL: #8364 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Landed in 7b5ffa4. Hopefully this will put it to rest (for the most part). (I wrote an extensive summary into the commit description.) Thanks so much @dfabulich for helping push this forward. :) |
This has been dragged through various long discussions and has been elevated to the CTC multiple times. As noted in #7455 (comment), while this API is still generally considered an anti-pattern, there are still use-cases it is best suited for, such as checking if a git rebase is in progress by looking if ".git/rebase-apply/rebasing" exists. The general consensus is to undeprecate just the sync version, given that the async version still has the "arguments order inconsistency" problem. The consensus at the two last CTC meetings this came up at was also to undeprecate existsSync() but keep exists() deprecated. See: #8242 & #8330 (Description write-up by @Fishrock123) Fixes: #1592 Refs: #4217 Refs: #7455 PR-URL: #8364 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
This has been dragged through various long discussions and has been elevated to the CTC multiple times. As noted in #7455 (comment), while this API is still generally considered an anti-pattern, there are still use-cases it is best suited for, such as checking if a git rebase is in progress by looking if ".git/rebase-apply/rebasing" exists. The general consensus is to undeprecate just the sync version, given that the async version still has the "arguments order inconsistency" problem. The consensus at the two last CTC meetings this came up at was also to undeprecate existsSync() but keep exists() deprecated. See: #8242 & #8330 (Description write-up by @Fishrock123) Fixes: #1592 Refs: #4217 Refs: #7455 PR-URL: #8364 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) #8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) #8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) #8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) #8100 * npm: Upgraded to 3.10.8 (Kat Marchán) #8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) #8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) #8661 PR-URL: #9034
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) #8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) #8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) #8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) #8100 * npm: Upgraded to 3.10.8 (Kat Marchán) #8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) #8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) #8661 PR-URL: #9034
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) nodejs/node#8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) nodejs/node#8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) nodejs/node#8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) nodejs/node#8100 * npm: Upgraded to 3.10.8 (Kat Marchan) nodejs/node#8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) nodejs/node#8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) nodejs/node#8661 Signed-off-by: Ilkka Myller <[email protected]>
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) nodejs/node#8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) nodejs/node#8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) nodejs/node#8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) nodejs/node#8100 * npm: Upgraded to 3.10.8 (Kat Marchan) nodejs/node#8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) nodejs/node#8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) nodejs/node#8661 Signed-off-by: Ilkka Myller <[email protected]>
It's not deprecated anymore, see nodejs/node#8364
It's not deprecated anymore, see nodejs/node#8364
It's not deprecated anymore, see nodejs/node#8364
It's not deprecated anymore, see nodejs/node#8364
It's not deprecated anymore, see nodejs/node#8364
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
fs
Description of change
Undeprecate
fs.existsSync
, apropos @Fishrock123's comment on PR #7455