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 <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>
  • Loading branch information
aduh95 committed Feb 20, 2023
1 parent d9a0a4a commit 9f19253
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 @@ -270,6 +270,7 @@ overrides:
- ./cluster.js
- ./console.js
- ./constants.js
- ./fs.js
- ./internal/assert.js
- ./internal/child_process/*.js
- ./internal/cli_table.js
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 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 @@ -75,7 +75,7 @@ const {
},
AbortError,
uvErrmapGet,
uvException
uvException,
} = require('internal/errors');

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

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

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

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

defineLazyProperties(
Expand All @@ -3140,7 +3140,7 @@ ObjectDefineProperties(fs, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
promises: {
__proto__: null,
Expand All @@ -3149,6 +3149,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 @@ -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);
Expand Down Expand Up @@ -323,7 +323,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {

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

Expand Down Expand Up @@ -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');
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,
};
20 changes: 10 additions & 10 deletions lib/internal/fs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -753,7 +753,7 @@ const defaultRmOptions = {
recursive: false,
force: false,
retryDelay: 100,
maxRetries: 0
maxRetries: 0,
};

const defaultRmdirOptions = {
Expand Down Expand Up @@ -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);
Expand All @@ -829,7 +829,7 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
message: 'is a directory',
path,
syscall: 'rm',
errno: EISDIR
errno: EISDIR,
});
}
}
Expand Down Expand Up @@ -946,5 +946,5 @@ module.exports = {
validateRmOptionsSync,
validateRmdirOptions,
validateStringAfterArrayBufferView,
warnOnNonPortableTemplate
warnOnNonPortableTemplate,
};
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 9f19253

Please sign in to comment.