Skip to content

Commit 5aaa8c3

Browse files
aduh95juanarbol
authored andcommitted
tools: enforce use of trailing commas in tools/
PR-URL: #45889 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent a749ced commit 5aaa8c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+128
-121
lines changed

.eslintrc.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
files: ['**/*.md/*.cjs', '**/*.md/*.js'],
6969
parserOptions: {
7070
sourceType: 'script',
71-
ecmaFeatures: { impliedStrict: true }
71+
ecmaFeatures: { impliedStrict: true },
7272
},
7373
rules: { strict: 'off' },
7474
},
@@ -103,11 +103,11 @@ module.exports = {
103103
},
104104
{
105105
name: 'Buffer',
106-
message: 'Import Buffer instead of using the global'
106+
message: 'Import Buffer instead of using the global',
107107
},
108108
{
109109
name: 'process',
110-
message: 'Import process instead of using the global'
110+
message: 'Import process instead of using the global',
111111
},
112112
] },
113113
},
@@ -134,13 +134,7 @@ module.exports = {
134134
ignorePattern: '.*',
135135
},
136136
}],
137-
'comma-dangle': ['error', {
138-
arrays: 'always-multiline',
139-
exports: 'only-multiline',
140-
functions: 'only-multiline',
141-
imports: 'only-multiline',
142-
objects: 'only-multiline',
143-
}],
137+
'comma-dangle': ['error', 'always-multiline'],
144138
'comma-spacing': 'error',
145139
'comma-style': 'error',
146140
'computed-property-spacing': 'error',

benchmark/.eslintrc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ env:
55
es6: true
66

77
rules:
8+
comma-dangle: [error, {
9+
arrays: always-multiline,
10+
exports: only-multiline,
11+
functions: only-multiline,
12+
imports: only-multiline,
13+
objects: only-multiline,
14+
}]
815
prefer-arrow-callback: error

doc/.eslintrc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ rules:
1515

1616
# Stylistic Issues
1717
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
18-
comma-dangle: [error, always-multiline]

lib/.eslintrc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ env:
22
es6: true
33

44
rules:
5+
comma-dangle: [error, {
6+
arrays: always-multiline,
7+
exports: only-multiline,
8+
functions: only-multiline,
9+
imports: only-multiline,
10+
objects: only-multiline,
11+
}]
512
prefer-object-spread: error
613
no-buffer-constructor: error
714
no-mixed-operators:

tools/build-addons.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function buildAddon(dir) {
3131
await execFile(process.execPath, [nodeGyp, 'rebuild', `--directory=${dir}`],
3232
{
3333
stdio: 'inherit',
34-
env: { ...process.env, MAKEFLAGS: '-j1' }
34+
env: { ...process.env, MAKEFLAGS: '-j1' },
3535
});
3636

3737
// We buffer the output and print it out once the process is done in order

tools/doc/addon-verify.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tree.children.forEach((node) => {
3838

3939
await Promise.all(
4040
Object.keys(addons).flatMap(
41-
(header) => verifyFiles(addons[header].files, header)
41+
(header) => verifyFiles(addons[header].files, header),
4242
));
4343

4444
function verifyFiles(files, blockName) {
@@ -82,8 +82,8 @@ ${files[name].replace(
8282
sources: files.map(({ name }) => name),
8383
includes: ['../common.gypi'],
8484
},
85-
]
86-
})
85+
],
86+
}),
8787
});
8888

8989
const dirCreation = mkdir(dir);

tools/doc/allhtml.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ all = all.slice(0, apiStart.index + apiStart[0].length)
9696
'\n</head>',
9797
buildCSSForFlavoredJS(new Set(Array.from(
9898
apicontent.matchAll(/(?<=<pre class="with-)\d+(?=-chars">)/g),
99-
(x) => Number(x[0])
100-
))) + '\n</head>'
99+
(x) => Number(x[0]),
100+
))) + '\n</head>',
101101
) +
102102
apicontent +
103103
all.slice(apiEnd);

tools/doc/alljson.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const results = {
1818
modules: [],
1919
classes: [],
2020
globals: [],
21-
methods: []
21+
methods: [],
2222
};
2323

2424
// Identify files that should be skipped. As files are processed, they
@@ -33,7 +33,7 @@ for (const link of toc.match(/<a.*?>/g)) {
3333
if (!jsonFiles.includes(json) || seen.has(json)) continue;
3434
const data = JSON.parse(
3535
fs.readFileSync(new URL(`./${json}`, source), 'utf8')
36-
.replace(/<a href=\\"#/g, `<a href=\\"${href}#`)
36+
.replace(/<a href=\\"#/g, `<a href=\\"${href}#`),
3737
);
3838

3939
for (const property in data) {

tools/doc/apilinks.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function execSync(command) {
2727
try {
2828
return child_process.execSync(
2929
command,
30-
{ stdio: ['ignore', null, 'ignore'] }
30+
{ stdio: ['ignore', null, 'ignore'] },
3131
).toString().trim();
3232
} catch {
3333
return '';

tools/doc/deprecationCodes.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const testHeading = (headingNode, expectedDeprecationCode) => {
2727
assert.strictEqual(
2828
headingNode?.children[0]?.value.substring(0, 9),
2929
`${expectedDeprecationCode}: `,
30-
'Ill-formed or out-of-order deprecation code.'
30+
'Ill-formed or out-of-order deprecation code.',
3131
);
3232
} catch (e) {
3333
throw addMarkdownPathToErrorStack(e, headingNode);
@@ -39,7 +39,7 @@ const testYAMLComment = (commentNode) => {
3939
assert.match(
4040
commentNode?.value?.substring(0, 21),
4141
/^<!-- YAML\r?\nchanges:\r?\n/,
42-
'Missing or ill-formed YAML comment.'
42+
'Missing or ill-formed YAML comment.',
4343
);
4444
} catch (e) {
4545
throw addMarkdownPathToErrorStack(e, commentNode);
@@ -51,7 +51,7 @@ const testDeprecationType = (paragraphNode) => {
5151
assert.strictEqual(
5252
paragraphNode?.children[0]?.value?.substring(0, 6),
5353
'Type: ',
54-
'Missing deprecation type.'
54+
'Missing deprecation type.',
5555
);
5656
} catch (e) {
5757
throw addMarkdownPathToErrorStack(e, paragraphNode);
@@ -74,7 +74,7 @@ for (let i = 0; i < tree.children.length; i++) {
7474
assert.strictEqual(
7575
deprecationCodeAsText,
7676
expectedDeprecationCode,
77-
'Deprecation codes are not ordered correctly.'
77+
'Deprecation codes are not ordered correctly.',
7878
);
7979
} catch (e) {
8080
throw addMarkdownPathToErrorStack(e, node);

0 commit comments

Comments
 (0)