Skip to content

Commit efc2409

Browse files
aduh95danielleadams
authored andcommitted
fs: add trailing commas in source files
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]>
1 parent d2692c6 commit efc2409

9 files changed

+51
-49
lines changed

lib/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ overrides:
258258
- ./cluster.js
259259
- ./console.js
260260
- ./constants.js
261+
- ./fs.js
261262
- ./internal/assert.js
262263
- ./internal/child_process/*.js
263264
- ./internal/cli_table.js
@@ -266,6 +267,7 @@ overrides:
266267
- ./internal/events/*.js
267268
- ./internal/fixed_queue.js
268269
- ./internal/freelist.js
270+
- ./internal/fs/*.js
269271
- ./internal/heap_utils.js
270272
- ./internal/http.js
271273
- ./internal/idna.js

lib/fs.js

+10-10
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');
@@ -73,7 +73,7 @@ const {
7373
},
7474
AbortError,
7575
uvErrmapGet,
76-
uvException
76+
uvException,
7777
} = require('internal/errors');
7878

7979
const { FSReqCallback } = binding;
@@ -121,12 +121,12 @@ const {
121121
validateRmdirOptions,
122122
validateStringAfterArrayBufferView,
123123
validatePrimitiveStringAfterArrayBufferView,
124-
warnOnNonPortableTemplate
124+
warnOnNonPortableTemplate,
125125
} = require('internal/fs/utils');
126126
const {
127127
Dir,
128128
opendir,
129-
opendirSync
129+
opendirSync,
130130
} = require('internal/fs/dir');
131131
const {
132132
CHAR_FORWARD_SLASH,
@@ -974,7 +974,7 @@ function writev(fd, buffers, position, callback) {
974974
ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
975975
__proto__: null,
976976
value: ['bytesWritten', 'buffer'],
977-
enumerable: false
977+
enumerable: false,
978978
});
979979

980980
/**
@@ -2396,7 +2396,7 @@ function watchFile(filename, options, listener) {
23962396
// behavioral changes to a minimum.
23972397
interval: 5007,
23982398
persistent: true,
2399-
...options
2399+
...options,
24002400
};
24012401

24022402
validateFunction(listener, 'listener');
@@ -3116,7 +3116,7 @@ module.exports = fs = {
31163116
},
31173117

31183118
// For tests
3119-
_toUnixTimestamp: toUnixTimestamp
3119+
_toUnixTimestamp: toUnixTimestamp,
31203120
};
31213121

31223122
ObjectDefineProperties(fs, {
@@ -3128,7 +3128,7 @@ ObjectDefineProperties(fs, {
31283128
__proto__: null,
31293129
configurable: false,
31303130
enumerable: true,
3131-
value: constants
3131+
value: constants,
31323132
},
31333133
promises: {
31343134
__proto__: null,
@@ -3137,6 +3137,6 @@ ObjectDefineProperties(fs, {
31373137
get() {
31383138
promises ??= require('internal/fs/promises').exports;
31393139
return promises;
3140-
}
3141-
}
3140+
},
3141+
},
31423142
});

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');
@@ -105,7 +105,7 @@ const kLocked = Symbol('kLocked');
105105
const { kUsePromises } = binding;
106106
const { Interface } = require('internal/readline/interface');
107107
const {
108-
JSTransferable, kDeserialize, kTransfer, kTransferList
108+
JSTransferable, kDeserialize, kTransfer, kTransferList,
109109
} = require('internal/worker/js_transferable');
110110

111111
const {
@@ -321,7 +321,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
321321

322322
return {
323323
data: { handle },
324-
deserializeInfo: 'internal/fs/promises:FileHandle'
324+
deserializeInfo: 'internal/fs/promises:FileHandle',
325325
};
326326
}
327327

@@ -710,7 +710,7 @@ async function mkdir(path, options) {
710710
}
711711
const {
712712
recursive = false,
713-
mode = 0o777
713+
mode = 0o777,
714714
} = options || kEmptyObject;
715715
path = getValidatedPath(path);
716716
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

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ const {
3232
ERR_INCOMPATIBLE_OPTION_PAIR,
3333
ERR_INVALID_ARG_TYPE,
3434
ERR_INVALID_ARG_VALUE,
35-
ERR_OUT_OF_RANGE
35+
ERR_OUT_OF_RANGE,
3636
},
3737
hideStackFrames,
38-
uvException
38+
uvException,
3939
} = require('internal/errors');
4040
const {
4141
isArrayBufferView,
@@ -96,13 +96,13 @@ const {
9696
UV_DIRENT_FIFO,
9797
UV_DIRENT_SOCKET,
9898
UV_DIRENT_CHAR,
99-
UV_DIRENT_BLOCK
99+
UV_DIRENT_BLOCK,
100100
},
101101
os: {
102102
errno: {
103-
EISDIR
104-
}
105-
}
103+
EISDIR,
104+
},
105+
},
106106
} = internalBinding('constants');
107107

108108
// The access modes can be any of F_OK, R_OK, W_OK or X_OK. Some might not be
@@ -754,7 +754,7 @@ const defaultRmOptions = {
754754
recursive: false,
755755
force: false,
756756
retryDelay: 100,
757-
maxRetries: 0
757+
maxRetries: 0,
758758
};
759759

760760
const defaultRmdirOptions = {
@@ -805,7 +805,7 @@ const validateRmOptions = hideStackFrames((path, options, expectDir, cb) => {
805805
message: 'is a directory',
806806
path,
807807
syscall: 'rm',
808-
errno: EISDIR
808+
errno: EISDIR,
809809
}));
810810
}
811811
return cb(null, options);
@@ -830,7 +830,7 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
830830
message: 'is a directory',
831831
path,
832832
syscall: 'rm',
833-
errno: EISDIR
833+
errno: EISDIR,
834834
});
835835
}
836836
}

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)