Skip to content

Commit c410572

Browse files
aduh95danielleadams
authored andcommittedApr 3, 2023
lib: enforce use of trailing commas in more files
Some part of the codebase already use trailing commas, this commit is adding a lint rule to ensure it stays this way. This commit also adds the rule for a few files that were missing only one or two trailing commas. PR-URL: #46655 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent 3afbb92 commit c410572

File tree

8 files changed

+61
-12
lines changed

8 files changed

+61
-12
lines changed
 

‎lib/.eslintrc.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,52 @@ globals:
249249
module: false
250250
internalBinding: false
251251
primordials: false
252+
overrides:
253+
- files:
254+
- ./*/promises.js
255+
- ./_stream_*.js
256+
- ./_tls_common.js
257+
- ./assert/*.js
258+
- ./cluster.js
259+
- ./console.js
260+
- ./constants.js
261+
- ./internal/assert.js
262+
- ./internal/child_process/*.js
263+
- ./internal/cli_table.js
264+
- ./internal/debugger/inspect.js
265+
- ./internal/events/*.js
266+
- ./internal/fixed_queue.js
267+
- ./internal/freelist.js
268+
- ./internal/heap_utils.js
269+
- ./internal/http.js
270+
- ./internal/idna.js
271+
- ./internal/js_stream_socket.js
272+
- ./internal/mime.js
273+
- ./internal/modules/*.js
274+
- ./internal/per_context/messageport.js
275+
- ./internal/policy/*.js
276+
- ./internal/priority_queue.js
277+
- ./internal/readline/*.js
278+
- ./internal/readme.md
279+
- ./internal/repl/history.js
280+
- ./internal/source_map/prepare_stack_trace.js
281+
- ./internal/structured_clone.js
282+
- ./internal/test/*.js
283+
- ./internal/test_runner/**/*.js
284+
- ./internal/tls/secure-context.js
285+
- ./internal/util/parse_args/*.js
286+
- ./internal/v8_prof_processor.js
287+
- ./internal/vm.js
288+
- ./internal/watch_mode/*.js
289+
- ./internal/webidl.js
290+
- ./module.js
291+
- ./path/*.js
292+
- ./process.js
293+
- ./punycode.js
294+
- ./stream/*.js
295+
- ./sys.js
296+
- ./test.js
297+
- ./url.js
298+
- ./util/*.js
299+
rules:
300+
comma-dangle: [error, always-multiline]

‎lib/internal/modules/cjs/helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
} = primordials;
1616
const {
1717
ERR_MANIFEST_DEPENDENCY_MISSING,
18-
ERR_UNKNOWN_BUILTIN_MODULE
18+
ERR_UNKNOWN_BUILTIN_MODULE,
1919
} = require('internal/errors').codes;
2020
const { BuiltinModule } = require('internal/bootstrap/loaders');
2121

@@ -201,7 +201,7 @@ function addBuiltinLibsToObject(object, dummyModuleName) {
201201
},
202202
set: setReal,
203203
configurable: true,
204-
enumerable: false
204+
enumerable: false,
205205
});
206206
});
207207
}

‎lib/internal/policy/sri.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const {
1414
} = primordials;
1515

1616
const {
17-
ERR_SRI_PARSE
17+
ERR_SRI_PARSE,
1818
} = require('internal/errors').codes;
1919
const kWSP = '[\\x20\\x09]';
2020
const kVCHAR = '[\\x21-\\x7E]';
@@ -55,7 +55,7 @@ const parse = (str) => {
5555
algorithm: match[2],
5656
value: BufferFrom(match[3], 'base64'),
5757
options: match[4] === undefined ? null : match[4],
58-
})
58+
}),
5959
});
6060
prevIndex += match[0].length;
6161
}

‎lib/internal/readline/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function* emitKeys(stream) {
9393
name: undefined,
9494
ctrl: false,
9595
meta: false,
96-
shift: false
96+
shift: false,
9797
};
9898

9999
if (ch === kEscape) {
@@ -388,5 +388,5 @@ module.exports = {
388388
commonPrefix,
389389
emitKeys,
390390
kSubstringSearch,
391-
CSI
391+
CSI,
392392
};

‎lib/internal/test/transfer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class F extends E {
3030
[kClone]() {
3131
return {
3232
data: { b: this.b },
33-
deserializeInfo: 'internal/test/transfer:F'
33+
deserializeInfo: 'internal/test/transfer:F',
3434
};
3535
}
3636

‎lib/internal/test_runner/harness.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function setup(root) {
125125
},
126126
destroy(asyncId) {
127127
testResources.delete(asyncId);
128-
}
128+
},
129129
});
130130

131131
hook.enable();

‎lib/internal/test_runner/yaml_to_js.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const {
33
codes: {
44
ERR_TEST_FAILURE,
5-
}
5+
},
66
} = require('internal/errors');
77
const AssertionError = require('internal/assert/assertion_error');
88
const {
@@ -37,7 +37,7 @@ function reConstructError(parsedYaml) {
3737
message: parsedYaml.error,
3838
actual: parsedYaml.actual,
3939
expected: parsedYaml.expected,
40-
operator: parsedYaml.operator
40+
operator: parsedYaml.operator,
4141
});
4242
} else {
4343
// eslint-disable-next-line no-restricted-syntax

‎lib/timers/promises.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const {
1212
const {
1313
Timeout,
1414
Immediate,
15-
insert
15+
insert,
1616
} = require('internal/timers');
1717
const {
1818
clearImmediate,
@@ -26,7 +26,7 @@ const {
2626
ERR_ILLEGAL_CONSTRUCTOR,
2727
ERR_INVALID_ARG_TYPE,
2828
ERR_INVALID_THIS,
29-
}
29+
},
3030
} = require('internal/errors');
3131

3232
const {

0 commit comments

Comments
 (0)
Please sign in to comment.