Skip to content

Commit

Permalink
fs: add trailing commas in source files
Browse files Browse the repository at this point in the history
PR-URL: #46696
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
aduh95 authored and danielleadams committed Apr 5, 2023
1 parent d2692c6 commit efc2409
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 49 deletions.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ overrides:
- ./cluster.js
- ./console.js
- ./constants.js
- ./fs.js
- ./internal/assert.js
- ./internal/child_process/*.js
- ./internal/cli_table.js
Expand All @@ -266,6 +267,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
Expand Down
20 changes: 10 additions & 10 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const {
W_OK,
X_OK,
O_WRONLY,
O_SYMLINK
O_SYMLINK,
} = constants;

const pathModule = require('path');
Expand All @@ -73,7 +73,7 @@ const {
},
AbortError,
uvErrmapGet,
uvException
uvException,
} = require('internal/errors');

const { FSReqCallback } = binding;
Expand Down Expand Up @@ -121,12 +121,12 @@ const {
validateRmdirOptions,
validateStringAfterArrayBufferView,
validatePrimitiveStringAfterArrayBufferView,
warnOnNonPortableTemplate
warnOnNonPortableTemplate,
} = require('internal/fs/utils');
const {
Dir,
opendir,
opendirSync
opendirSync,
} = require('internal/fs/dir');
const {
CHAR_FORWARD_SLASH,
Expand Down Expand Up @@ -974,7 +974,7 @@ function writev(fd, buffers, position, callback) {
ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
__proto__: null,
value: ['bytesWritten', 'buffer'],
enumerable: false
enumerable: false,
});

/**
Expand Down Expand Up @@ -2396,7 +2396,7 @@ function watchFile(filename, options, listener) {
// behavioral changes to a minimum.
interval: 5007,
persistent: true,
...options
...options,
};

validateFunction(listener, 'listener');
Expand Down Expand Up @@ -3116,7 +3116,7 @@ module.exports = fs = {
},

// For tests
_toUnixTimestamp: toUnixTimestamp
_toUnixTimestamp: toUnixTimestamp,
};

ObjectDefineProperties(fs, {
Expand All @@ -3128,7 +3128,7 @@ ObjectDefineProperties(fs, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
promises: {
__proto__: null,
Expand All @@ -3137,6 +3137,6 @@ ObjectDefineProperties(fs, {
get() {
promises ??= require('internal/fs/promises').exports;
return promises;
}
}
},
},
});
18 changes: 9 additions & 9 deletions lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down Expand Up @@ -60,8 +60,8 @@ class Dir {
this[kDirOptions] = {
bufferSize: 32,
...getOptions(options, {
encoding: 'utf8'
})
encoding: 'utf8',
}),
};

validateUint32(this[kDirOptions].bufferSize, 'options.bufferSize', true);
Expand Down Expand Up @@ -239,7 +239,7 @@ function opendir(path, options, callback) {

path = getValidatedPath(path);
options = getOptions(options, {
encoding: 'utf8'
encoding: 'utf8',
});

function opendirCallback(error, handle) {
Expand All @@ -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 };
Expand All @@ -281,5 +281,5 @@ function opendirSync(path, options) {
module.exports = {
Dir,
opendir,
opendirSync
opendirSync,
};
8 changes: 4 additions & 4 deletions lib/internal/fs/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {
O_SYMLINK,
O_WRONLY,
S_IFMT,
S_IFREG
S_IFREG,
} = constants;

const binding = internalBinding('fs');
Expand Down Expand Up @@ -105,7 +105,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 {
Expand Down Expand Up @@ -321,7 +321,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {

return {
data: { handle },
deserializeInfo: 'internal/fs/promises:FileHandle'
deserializeInfo: 'internal/fs/promises:FileHandle',
};
}

Expand Down Expand Up @@ -710,7 +710,7 @@ async function mkdir(path, options) {
}
const {
recursive = false,
mode = 0o777
mode = 0o777,
} = options || kEmptyObject;
path = getValidatedPath(path);
validateBoolean(recursive, 'options.recursive');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/fs/read_file_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
constants: {
kReadFileBufferLength,
kReadFileUnknownBufferLength,
}
},
} = require('internal/fs/utils');

const { Buffer } = require('buffer');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/fs/rimraf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const {
stat,
statSync,
unlink,
unlinkSync
unlinkSync,
} = fs;
const { sep } = require('path');
const { setTimeout } = require('timers');
Expand Down
12 changes: 6 additions & 6 deletions lib/internal/fs/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const FileHandleOperations = (handle) => {
PromisePrototypeThen(handle.writev(buffers, pos),
(r) => cb(null, r.bytesWritten, r.buffers),
(err) => cb(err, 0, buffers));
}
},
};
};

Expand Down Expand Up @@ -221,7 +221,7 @@ ObjectDefineProperty(ReadStream.prototype, 'autoClose', {
},
set(val) {
this._readableState.autoDestroy = val;
}
},
});

const openReadFs = deprecate(function() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -382,7 +382,7 @@ ObjectDefineProperty(WriteStream.prototype, 'autoClose', {
},
set(val) {
this._writableState.autoDestroy = val;
}
},
});

const openWriteFs = deprecate(function() {
Expand Down Expand Up @@ -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,
};
18 changes: 9 additions & 9 deletions lib/internal/fs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,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,
Expand Down Expand Up @@ -96,13 +96,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
Expand Down Expand Up @@ -754,7 +754,7 @@ const defaultRmOptions = {
recursive: false,
force: false,
retryDelay: 100,
maxRetries: 0
maxRetries: 0,
};

const defaultRmdirOptions = {
Expand Down Expand Up @@ -805,7 +805,7 @@ const validateRmOptions = hideStackFrames((path, options, expectDir, cb) => {
message: 'is a directory',
path,
syscall: 'rm',
errno: EISDIR
errno: EISDIR,
}));
}
return cb(null, options);
Expand All @@ -830,7 +830,7 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
message: 'is a directory',
path,
syscall: 'rm',
errno: EISDIR
errno: EISDIR,
});
}
}
Expand Down
18 changes: 9 additions & 9 deletions lib/internal/fs/watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {

const {
kFsStatsFieldsNumber,
StatWatcher: _StatWatcher
StatWatcher: _StatWatcher,
} = internalBinding('fs');

const { FSEvent } = internalBinding('fs_event_wrap');
Expand All @@ -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');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -207,7 +207,7 @@ function FSWatcher() {
const error = uvException({
errno: status,
syscall: 'watch',
path: filename
path: filename,
});
error.filename = filename;
this.emit('error', error);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit efc2409

Please sign in to comment.