Skip to content

Commit 5a4bf75

Browse files
committed
fs: fix lint for recursive readdir fast path
Use primordials Array instead of the global, return undefined explicitly for the JSDoc check, and match clang-format on the directory descent condition. Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
1 parent f0e1dc9 commit 5a4bf75

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/fs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'use strict';
2626

2727
const {
28+
Array,
2829
ArrayFromAsync,
2930
ArrayPrototypePush,
3031
BigIntPrototypeToString,
@@ -1779,7 +1780,7 @@ function readdirSyncRecursive(basePath, options) {
17791780
withFileTypes,
17801781
);
17811782
if (result === undefined) {
1782-
return;
1783+
return undefined;
17831784
}
17841785
if (!withFileTypes) {
17851786
return result;

src/node_file.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,8 +3292,8 @@ static void ReadDirRecursiveSync(const FunctionCallbackInfo<Value>& args) {
32923292
// Descend into directories. For symlinks / unknown types, follow with
32933293
// stat() like internalModuleStat (JS: isDirectory() || stat===1).
32943294
bool is_dir = ent_type == UV_DIRENT_DIR;
3295-
if (!is_dir && (ent_type == UV_DIRENT_UNKNOWN ||
3296-
ent_type == UV_DIRENT_LINK)) {
3295+
if (!is_dir &&
3296+
(ent_type == UV_DIRENT_UNKNOWN || ent_type == UV_DIRENT_LINK)) {
32973297
uv_fs_t sreq;
32983298
if (uv_fs_stat(nullptr, &sreq, full.c_str(), nullptr) == 0) {
32993299
const uv_stat_t* s = static_cast<const uv_stat_t*>(sreq.ptr);

0 commit comments

Comments
 (0)