fs: add trailing commas in source files

PR-URL: https://github.com/nodejs/node/pull/46696
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel authored and Michaël Zasso committed 2023-03-13 11:22:50 +01:00
1 parent 16bbbacba8
commit 4c12e6eeeb
9 files changed
+51 -49

No files matched your search

+2
View File
@@ -270,6 +270,7 @@ overrides:
- ./cluster.js
- ./console.js
- ./constants.js
- ./fs.js
- ./internal/assert.js
- ./internal/child_process/*.js
- ./internal/cli_table.js
@@ -278,6 +279,7 @@ overrides:
- ./internal/events/*.js
- ./internal/fixed_queue.js
- ./internal/freelist.js
- ./internal/fs/*.js
- ./internal/heap_utils.js
- ./internal/http.js
- ./internal/idna.js
+9 -9
View File
@@ -53,7 +53,7 @@ const {
W_OK,
X_OK,
O_WRONLY,
O_SYMLINK
O_SYMLINK,
} = constants;
const pathModule = require('path');
@@ -75,7 +75,7 @@ const {
},
AbortError,
uvErrmapGet,
uvException
uvException,
} = require('internal/errors');
const { FSReqCallback } = binding;
@@ -122,7 +122,7 @@ const {
validateRmOptionsSync,
validateRmdirOptions,
validateStringAfterArrayBufferView,
warnOnNonPortableTemplate
warnOnNonPortableTemplate,
} = require('internal/fs/utils');
const {
CHAR_FORWARD_SLASH,
@@ -978,7 +978,7 @@ function writev(fd, buffers, position, callback) {
ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
__proto__: null,
value: ['bytesWritten', 'buffer'],
enumerable: false
enumerable: false,
});
/**
@@ -2404,7 +2404,7 @@ function watchFile(filename, options, listener) {
// behavioral changes to a minimum.
interval: 5007,
persistent: true,
...options
...options,
};
validateFunction(listener, 'listener');
@@ -3122,7 +3122,7 @@ module.exports = fs = {
},
// For tests
_toUnixTimestamp: toUnixTimestamp
_toUnixTimestamp: toUnixTimestamp,
};
defineLazyProperties(
@@ -3140,7 +3140,7 @@ ObjectDefineProperties(fs, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
promises: {
__proto__: null,
@@ -3149,6 +3149,6 @@ ObjectDefineProperties(fs, {
get() {
promises ??= require('internal/fs/promises').exports;
return promises;
}
}
},
},
});
+9 -9
View File
@@ -18,8 +18,8 @@ const {
codes: {
ERR_DIR_CLOSED,
ERR_DIR_CONCURRENT_OPERATION,
ERR_MISSING_ARGS
}
ERR_MISSING_ARGS,
},
} = require('internal/errors');
const { FSReqCallback } = binding;
@@ -28,11 +28,11 @@ const {
getDirent,
getOptions,
getValidatedPath,
handleErrorFromBinding
handleErrorFromBinding,
} = require('internal/fs/utils');
const {
validateFunction,
validateUint32
validateUint32,
} = require('internal/validators');
const kDirHandle = Symbol('kDirHandle');
@@ -60,8 +60,8 @@ class Dir {
this[kDirOptions] = {
bufferSize: 32,
...getOptions(options, {
encoding: 'utf8'
})
encoding: 'utf8',
}),
};
validateUint32(this[kDirOptions].bufferSize, 'options.bufferSize', true);
@@ -239,7 +239,7 @@ function opendir(path, options, callback) {
path = getValidatedPath(path);
options = getOptions(options, {
encoding: 'utf8'
encoding: 'utf8',
});
function opendirCallback(error, handle) {
@@ -263,7 +263,7 @@ function opendir(path, options, callback) {
function opendirSync(path, options) {
path = getValidatedPath(path);
options = getOptions(options, {
encoding: 'utf8'
encoding: 'utf8',
});
const ctx = { path };
@@ -281,5 +281,5 @@ function opendirSync(path, options) {
module.exports = {
Dir,
opendir,
opendirSync
opendirSync,
};
+4 -4
View File
@@ -22,7 +22,7 @@ const {
O_SYMLINK,
O_WRONLY,
S_IFMT,
S_IFREG
S_IFREG,
} = constants;
const binding = internalBinding('fs');
@@ -107,7 +107,7 @@ const kLocked = Symbol('kLocked');
const { kUsePromises } = binding;
const { Interface } = require('internal/readline/interface');
const {
JSTransferable, kDeserialize, kTransfer, kTransferList
JSTransferable, kDeserialize, kTransfer, kTransferList,
} = require('internal/worker/js_transferable');
const getDirectoryEntriesPromise = promisify(getDirents);
@@ -323,7 +323,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
return {
data: { handle },
deserializeInfo: 'internal/fs/promises:FileHandle'
deserializeInfo: 'internal/fs/promises:FileHandle',
};
}
@@ -715,7 +715,7 @@ async function mkdir(path, options) {
}
const {
recursive = false,
mode = 0o777
mode = 0o777,
} = options || kEmptyObject;
path = getValidatedPath(path);
validateBoolean(recursive, 'options.recursive');
+1 -1
View File
@@ -10,7 +10,7 @@ const {
constants: {
kReadFileBufferLength,
kReadFileUnknownBufferLength,
}
},
} = require('internal/fs/utils');
const { Buffer } = require('buffer');
+1 -1
View File
@@ -26,7 +26,7 @@ const {
stat,
statSync,
unlink,
unlinkSync
unlinkSync,
} = fs;
const { sep } = require('path');
const { setTimeout } = require('timers');
+6 -6
View File
@@ -104,7 +104,7 @@ const FileHandleOperations = (handle) => {
PromisePrototypeThen(handle.writev(buffers, pos),
(r) => cb(null, r.bytesWritten, r.buffers),
(err) => cb(err, 0, buffers));
}
},
};
};
@@ -221,7 +221,7 @@ ObjectDefineProperty(ReadStream.prototype, 'autoClose', {
},
set(val) {
this._readableState.autoDestroy = val;
}
},
});
const openReadFs = deprecate(function() {
@@ -301,7 +301,7 @@ ReadStream.prototype.close = function(cb) {
ObjectDefineProperty(ReadStream.prototype, 'pending', {
__proto__: null,
get() { return this.fd === null; },
configurable: true
configurable: true,
});
function WriteStream(path, options) {
@@ -382,7 +382,7 @@ ObjectDefineProperty(WriteStream.prototype, 'autoClose', {
},
set(val) {
this._writableState.autoDestroy = val;
}
},
});
const openWriteFs = deprecate(function() {
@@ -487,10 +487,10 @@ WriteStream.prototype.destroySoon = WriteStream.prototype.end;
ObjectDefineProperty(WriteStream.prototype, 'pending', {
__proto__: null,
get() { return this.fd === null; },
configurable: true
configurable: true,
});
module.exports = {
ReadStream,
WriteStream
WriteStream,
};
+10 -10
View File
@@ -31,10 +31,10 @@ const {
ERR_INCOMPATIBLE_OPTION_PAIR,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OUT_OF_RANGE
ERR_OUT_OF_RANGE,
},
hideStackFrames,
uvException
uvException,
} = require('internal/errors');
const {
isArrayBufferView,
@@ -95,13 +95,13 @@ const {
UV_DIRENT_FIFO,
UV_DIRENT_SOCKET,
UV_DIRENT_CHAR,
UV_DIRENT_BLOCK
UV_DIRENT_BLOCK,
},
os: {
errno: {
EISDIR
}
}
EISDIR,
},
},
} = internalBinding('constants');
// The access modes can be any of F_OK, R_OK, W_OK or X_OK. Some might not be
@@ -753,7 +753,7 @@ const defaultRmOptions = {
recursive: false,
force: false,
retryDelay: 100,
maxRetries: 0
maxRetries: 0,
};
const defaultRmdirOptions = {
@@ -804,7 +804,7 @@ const validateRmOptions = hideStackFrames((path, options, expectDir, cb) => {
message: 'is a directory',
path,
syscall: 'rm',
errno: EISDIR
errno: EISDIR,
}));
}
return cb(null, options);
@@ -829,7 +829,7 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
message: 'is a directory',
path,
syscall: 'rm',
errno: EISDIR
errno: EISDIR,
});
}
}
@@ -946,5 +946,5 @@ module.exports = {
validateRmOptionsSync,
validateRmdirOptions,
validateStringAfterArrayBufferView,
warnOnNonPortableTemplate
warnOnNonPortableTemplate,
};
+9 -9
View File
@@ -21,7 +21,7 @@ const {
const {
kFsStatsFieldsNumber,
StatWatcher: _StatWatcher
StatWatcher: _StatWatcher,
} = internalBinding('fs');
const { FSEvent } = internalBinding('fs_event_wrap');
@@ -30,12 +30,12 @@ const { EventEmitter } = require('events');
const {
getStatsFromBinding,
getValidatedPath
getValidatedPath,
} = require('internal/fs/utils');
const {
defaultTriggerAsyncIdScope,
symbols: { owner_symbol }
symbols: { owner_symbol },
} = require('internal/async_hooks');
const { toNamespacedPath } = require('path');
@@ -122,7 +122,7 @@ StatWatcher.prototype[kFSStatWatcherStart] = function(filename,
const error = uvException({
errno: err,
syscall: 'watch',
path: filename
path: filename,
});
error.filename = filename;
throw error;
@@ -207,7 +207,7 @@ function FSWatcher() {
const error = uvException({
errno: status,
syscall: 'watch',
path: filename
path: filename,
});
error.filename = filename;
this.emit('error', error);
@@ -249,7 +249,7 @@ FSWatcher.prototype[kFSWatchStart] = function(filename,
syscall: 'watch',
path: filename,
message: err === UV_ENOSPC ?
'System limit for number of file watchers reached' : ''
'System limit for number of file watchers reached' : '',
});
error.filename = filename;
throw error;
@@ -296,7 +296,7 @@ function emitCloseNT(self) {
ObjectDefineProperty(FSEvent.prototype, 'owner', {
__proto__: null,
get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; }
set(v) { return this[owner_symbol] = v; },
});
async function* watch(filename, options = kEmptyObject) {
@@ -336,7 +336,7 @@ async function* watch(filename, options = kEmptyObject) {
const error = uvException({
errno: status,
syscall: 'watch',
path: filename
path: filename,
});
error.filename = filename;
handle.close();
@@ -354,7 +354,7 @@ async function* watch(filename, options = kEmptyObject) {
syscall: 'watch',
path: filename,
message: err === UV_ENOSPC ?
'System limit for number of file watchers reached' : ''
'System limit for number of file watchers reached' : '',
});
error.filename = filename;
handle.close();