Skip to content

Commit 4c12e6e

Browse files
aduh95targos
authored andcommitted
fs: add trailing commas in source files
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>
1 parent 16bbbac commit 4c12e6e

9 files changed

+51
-49
lines changed

lib/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ overrides:
270270
- ./cluster.js
271271
- ./console.js
272272
- ./constants.js
273+
- ./fs.js
273274
- ./internal/assert.js
274275
- ./internal/child_process/*.js
275276
- ./internal/cli_table.js
@@ -278,6 +279,7 @@ overrides:
278279
- ./internal/events/*.js
279280
- ./internal/fixed_queue.js
280281
- ./internal/freelist.js
282+
- ./internal/fs/*.js
281283
- ./internal/heap_utils.js
282284
- ./internal/http.js
283285
- ./internal/idna.js

lib/fs.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const {
5353
W_OK,
5454
X_OK,
5555
O_WRONLY,
56-
O_SYMLINK
56+
O_SYMLINK,
5757
} = constants;
5858

5959
const pathModule = require('path');
@@ -75,7 +75,7 @@ const {
7575
},
7676
AbortError,
7777
uvErrmapGet,
78-
uvException
78+
uvException,
7979
} = require('internal/errors');
8080

8181
const { FSReqCallback } = binding;
@@ -122,7 +122,7 @@ const {
122122
validateRmOptionsSync,
123123
validateRmdirOptions,
124124
validateStringAfterArrayBufferView,
125-
warnOnNonPortableTemplate
125+
warnOnNonPortableTemplate,
126126
} = require('internal/fs/utils');
127127
const {
128128
CHAR_FORWARD_SLASH,
@@ -978,7 +978,7 @@ function writev(fd, buffers, position, callback) {
978978
ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
979979
__proto__: null,
980980
value: ['bytesWritten', 'buffer'],
981-
enumerable: false
981+
enumerable: false,
982982
});
983983

984984
/**
@@ -2404,7 +2404,7 @@ function watchFile(filename, options, listener) {
24042404
// behavioral changes to a minimum.
24052405
interval: 5007,
24062406
persistent: true,
2407-
...options
2407+
...options,
24082408
};
24092409

24102410
validateFunction(listener, 'listener');
@@ -3122,7 +3122,7 @@ module.exports = fs = {
31223122
},
31233123

31243124
// For tests
3125-
_toUnixTimestamp: toUnixTimestamp
3125+
_toUnixTimestamp: toUnixTimestamp,
31263126
};
31273127

31283128
defineLazyProperties(
@@ -3140,7 +3140,7 @@ ObjectDefineProperties(fs, {
31403140
__proto__: null,
31413141
configurable: false,
31423142
enumerable: true,
3143-
value: constants
3143+
value: constants,
31443144
},
31453145
promises: {
31463146
__proto__: null,
@@ -3149,6 +3149,6 @@ ObjectDefineProperties(fs, {
31493149
get() {
31503150
promises ??= require('internal/fs/promises').exports;
31513151
return promises;
3152-
}
3153-
}
3152+
},
3153+
},
31543154
});

lib/internal/fs/dir.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const {
1818
codes: {
1919
ERR_DIR_CLOSED,
2020
ERR_DIR_CONCURRENT_OPERATION,
21-
ERR_MISSING_ARGS
22-
}
21+
ERR_MISSING_ARGS,
22+
},
2323
} = require('internal/errors');
2424

2525
const { FSReqCallback } = binding;
@@ -28,11 +28,11 @@ const {
2828
getDirent,
2929
getOptions,
3030
getValidatedPath,
31-
handleErrorFromBinding
31+
handleErrorFromBinding,
3232
} = require('internal/fs/utils');
3333
const {
3434
validateFunction,
35-
validateUint32
35+
validateUint32,
3636
} = require('internal/validators');
3737

3838
const kDirHandle = Symbol('kDirHandle');
@@ -60,8 +60,8 @@ class Dir {
6060
this[kDirOptions] = {
6161
bufferSize: 32,
6262
...getOptions(options, {
63-
encoding: 'utf8'
64-
})
63+
encoding: 'utf8',
64+
}),
6565
};
6666

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

240240
path = getValidatedPath(path);
241241
options = getOptions(options, {
242-
encoding: 'utf8'
242+
encoding: 'utf8',
243243
});
244244

245245
function opendirCallback(error, handle) {
@@ -263,7 +263,7 @@ function opendir(path, options, callback) {
263263
function opendirSync(path, options) {
264264
path = getValidatedPath(path);
265265
options = getOptions(options, {
266-
encoding: 'utf8'
266+
encoding: 'utf8',
267267
});
268268

269269
const ctx = { path };
@@ -281,5 +281,5 @@ function opendirSync(path, options) {
281281
module.exports = {
282282
Dir,
283283
opendir,
284-
opendirSync
284+
opendirSync,
285285
};

lib/internal/fs/promises.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const {
2222
O_SYMLINK,
2323
O_WRONLY,
2424
S_IFMT,
25-
S_IFREG
25+
S_IFREG,
2626
} = constants;
2727

2828
const binding = internalBinding('fs');
@@ -107,7 +107,7 @@ const kLocked = Symbol('kLocked');
107107
const { kUsePromises } = binding;
108108
const { Interface } = require('internal/readline/interface');
109109
const {
110-
JSTransferable, kDeserialize, kTransfer, kTransferList
110+
JSTransferable, kDeserialize, kTransfer, kTransferList,
111111
} = require('internal/worker/js_transferable');
112112

113113
const getDirectoryEntriesPromise = promisify(getDirents);
@@ -323,7 +323,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
323323

324324
return {
325325
data: { handle },
326-
deserializeInfo: 'internal/fs/promises:FileHandle'
326+
deserializeInfo: 'internal/fs/promises:FileHandle',
327327
};
328328
}
329329

@@ -715,7 +715,7 @@ async function mkdir(path, options) {
715715
}
716716
const {
717717
recursive = false,
718-
mode = 0o777
718+
mode = 0o777,
719719
} = options || kEmptyObject;
720720
path = getValidatedPath(path);
721721
validateBoolean(recursive, 'options.recursive');

lib/internal/fs/read_file_context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const {
1010
constants: {
1111
kReadFileBufferLength,
1212
kReadFileUnknownBufferLength,
13-
}
13+
},
1414
} = require('internal/fs/utils');
1515

1616
const { Buffer } = require('buffer');

lib/internal/fs/rimraf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const {
2626
stat,
2727
statSync,
2828
unlink,
29-
unlinkSync
29+
unlinkSync,
3030
} = fs;
3131
const { sep } = require('path');
3232
const { setTimeout } = require('timers');

lib/internal/fs/streams.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const FileHandleOperations = (handle) => {
104104
PromisePrototypeThen(handle.writev(buffers, pos),
105105
(r) => cb(null, r.bytesWritten, r.buffers),
106106
(err) => cb(err, 0, buffers));
107-
}
107+
},
108108
};
109109
};
110110

@@ -221,7 +221,7 @@ ObjectDefineProperty(ReadStream.prototype, 'autoClose', {
221221
},
222222
set(val) {
223223
this._readableState.autoDestroy = val;
224-
}
224+
},
225225
});
226226

227227
const openReadFs = deprecate(function() {
@@ -301,7 +301,7 @@ ReadStream.prototype.close = function(cb) {
301301
ObjectDefineProperty(ReadStream.prototype, 'pending', {
302302
__proto__: null,
303303
get() { return this.fd === null; },
304-
configurable: true
304+
configurable: true,
305305
});
306306

307307
function WriteStream(path, options) {
@@ -382,7 +382,7 @@ ObjectDefineProperty(WriteStream.prototype, 'autoClose', {
382382
},
383383
set(val) {
384384
this._writableState.autoDestroy = val;
385-
}
385+
},
386386
});
387387

388388
const openWriteFs = deprecate(function() {
@@ -487,10 +487,10 @@ WriteStream.prototype.destroySoon = WriteStream.prototype.end;
487487
ObjectDefineProperty(WriteStream.prototype, 'pending', {
488488
__proto__: null,
489489
get() { return this.fd === null; },
490-
configurable: true
490+
configurable: true,
491491
});
492492

493493
module.exports = {
494494
ReadStream,
495-
WriteStream
495+
WriteStream,
496496
};

lib/internal/fs/utils.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const {
3131
ERR_INCOMPATIBLE_OPTION_PAIR,
3232
ERR_INVALID_ARG_TYPE,
3333
ERR_INVALID_ARG_VALUE,
34-
ERR_OUT_OF_RANGE
34+
ERR_OUT_OF_RANGE,
3535
},
3636
hideStackFrames,
37-
uvException
37+
uvException,
3838
} = require('internal/errors');
3939
const {
4040
isArrayBufferView,
@@ -95,13 +95,13 @@ const {
9595
UV_DIRENT_FIFO,
9696
UV_DIRENT_SOCKET,
9797
UV_DIRENT_CHAR,
98-
UV_DIRENT_BLOCK
98+
UV_DIRENT_BLOCK,
9999
},
100100
os: {
101101
errno: {
102-
EISDIR
103-
}
104-
}
102+
EISDIR,
103+
},
104+
},
105105
} = internalBinding('constants');
106106

107107
// 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 = {
753753
recursive: false,
754754
force: false,
755755
retryDelay: 100,
756-
maxRetries: 0
756+
maxRetries: 0,
757757
};
758758

759759
const defaultRmdirOptions = {
@@ -804,7 +804,7 @@ const validateRmOptions = hideStackFrames((path, options, expectDir, cb) => {
804804
message: 'is a directory',
805805
path,
806806
syscall: 'rm',
807-
errno: EISDIR
807+
errno: EISDIR,
808808
}));
809809
}
810810
return cb(null, options);
@@ -829,7 +829,7 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
829829
message: 'is a directory',
830830
path,
831831
syscall: 'rm',
832-
errno: EISDIR
832+
errno: EISDIR,
833833
});
834834
}
835835
}
@@ -946,5 +946,5 @@ module.exports = {
946946
validateRmOptionsSync,
947947
validateRmdirOptions,
948948
validateStringAfterArrayBufferView,
949-
warnOnNonPortableTemplate
949+
warnOnNonPortableTemplate,
950950
};

lib/internal/fs/watchers.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {
2121

2222
const {
2323
kFsStatsFieldsNumber,
24-
StatWatcher: _StatWatcher
24+
StatWatcher: _StatWatcher,
2525
} = internalBinding('fs');
2626

2727
const { FSEvent } = internalBinding('fs_event_wrap');
@@ -30,12 +30,12 @@ const { EventEmitter } = require('events');
3030

3131
const {
3232
getStatsFromBinding,
33-
getValidatedPath
33+
getValidatedPath,
3434
} = require('internal/fs/utils');
3535

3636
const {
3737
defaultTriggerAsyncIdScope,
38-
symbols: { owner_symbol }
38+
symbols: { owner_symbol },
3939
} = require('internal/async_hooks');
4040

4141
const { toNamespacedPath } = require('path');
@@ -122,7 +122,7 @@ StatWatcher.prototype[kFSStatWatcherStart] = function(filename,
122122
const error = uvException({
123123
errno: err,
124124
syscall: 'watch',
125-
path: filename
125+
path: filename,
126126
});
127127
error.filename = filename;
128128
throw error;
@@ -207,7 +207,7 @@ function FSWatcher() {
207207
const error = uvException({
208208
errno: status,
209209
syscall: 'watch',
210-
path: filename
210+
path: filename,
211211
});
212212
error.filename = filename;
213213
this.emit('error', error);
@@ -249,7 +249,7 @@ FSWatcher.prototype[kFSWatchStart] = function(filename,
249249
syscall: 'watch',
250250
path: filename,
251251
message: err === UV_ENOSPC ?
252-
'System limit for number of file watchers reached' : ''
252+
'System limit for number of file watchers reached' : '',
253253
});
254254
error.filename = filename;
255255
throw error;
@@ -296,7 +296,7 @@ function emitCloseNT(self) {
296296
ObjectDefineProperty(FSEvent.prototype, 'owner', {
297297
__proto__: null,
298298
get() { return this[owner_symbol]; },
299-
set(v) { return this[owner_symbol] = v; }
299+
set(v) { return this[owner_symbol] = v; },
300300
});
301301

302302
async function* watch(filename, options = kEmptyObject) {
@@ -336,7 +336,7 @@ async function* watch(filename, options = kEmptyObject) {
336336
const error = uvException({
337337
errno: status,
338338
syscall: 'watch',
339-
path: filename
339+
path: filename,
340340
});
341341
error.filename = filename;
342342
handle.close();
@@ -354,7 +354,7 @@ async function* watch(filename, options = kEmptyObject) {
354354
syscall: 'watch',
355355
path: filename,
356356
message: err === UV_ENOSPC ?
357-
'System limit for number of file watchers reached' : ''
357+
'System limit for number of file watchers reached' : '',
358358
});
359359
error.filename = filename;
360360
handle.close();

0 commit comments

Comments
 (0)