Skip to content

Commit c694dae

Browse files
Trottruyadorno
authored andcommitted
test: enable no-empty ESLint rule
PR-URL: #41831 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 6c82276 commit c694dae

File tree

46 files changed

+206
-132
lines changed

Some content is hidden

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

46 files changed

+206
-132
lines changed

test/.eslintrc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ env:
55
es6: true
66

77
rules:
8+
multiline-comment-style: ["error", "separate-lines"]
9+
no-empty: error
810
no-var: error
911
prefer-const: error
1012
symbol-description: off
11-
multiline-comment-style: ["error", "separate-lines"]
1213

1314
no-restricted-syntax:
1415
# Config copied from .eslintrc.js

test/addons/uv-handle-leak/test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ try {
1616
const { isMainThread } = require('worker_threads');
1717
if (!isMainThread)
1818
common.skip('Cannot run test in environment with clean-exit policy');
19-
} catch {}
19+
} catch {
20+
// Continue regardless of error.
21+
}
2022

2123
binding.leakHandle();
2224
binding.leakHandle(0);

test/common/inspector-helper.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ class NodeInstance extends EventEmitter {
365365
['--expose-internals'],
366366
`${scriptContents}\nprocess._rawDebug('started');`, undefined);
367367
const msg = 'Timed out waiting for process to start';
368-
while (await fires(instance.nextStderrString(), msg, TIMEOUT) !==
369-
'started') {}
368+
while (await fires(instance.nextStderrString(), msg, TIMEOUT) !== 'started');
370369
process._debugProcess(instance._process.pid);
371370
return instance;
372371
}

test/common/report.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ function validateContent(report, fields = []) {
4646
} catch (err) {
4747
try {
4848
err.stack += util.format('\n------\nFailing Report:\n%O', report);
49-
} catch {}
49+
} catch {
50+
// Continue regardless of error.
51+
}
5052
throw err;
5153
}
5254
}

test/internet/test-dgram-broadcast-multi-process.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ if (process.argv[2] !== 'child') {
184184
const buf = messages[i++];
185185

186186
if (!buf) {
187-
try { sendSocket.close(); } catch {}
187+
try { sendSocket.close(); } catch {
188+
// Continue regardless of error.
189+
}
188190
return;
189191
}
190192

test/internet/test-dgram-multicast-multi-process.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ if (process.argv[2] !== 'child') {
170170
const buf = messages[i++];
171171

172172
if (!buf) {
173-
try { sendSocket.close(); } catch {}
173+
try { sendSocket.close(); } catch {
174+
// Continue regardless of error.
175+
}
174176
return;
175177
}
176178

test/internet/test-dgram-multicast-ssm-multi-process.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ if (process.argv[2] !== 'child') {
164164
const buf = messages[i++];
165165

166166
if (!buf) {
167-
try { sendSocket.close(); } catch {}
167+
try { sendSocket.close(); } catch {
168+
// Continue regardless of error.
169+
}
168170
return;
169171
}
170172

test/internet/test-dgram-multicast-ssmv6-multi-process.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ if (process.argv[2] !== 'child') {
164164
const buf = messages[i++];
165165

166166
if (!buf) {
167-
try { sendSocket.close(); } catch {}
167+
try { sendSocket.close(); } catch {
168+
// Continue regardless of error.
169+
}
168170
return;
169171
}
170172

test/message/vm_dont_display_runtime_error.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ try {
3030
filename: 'test.vm',
3131
displayErrors: false
3232
});
33-
} catch {}
33+
} catch {
34+
// Continue regardless of error.
35+
}
3436

3537
console.error('middle');
3638

test/message/vm_dont_display_syntax_error.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ try {
3030
filename: 'test.vm',
3131
displayErrors: false
3232
});
33-
} catch {}
33+
} catch {
34+
// Continue regardless of error.
35+
}
3436

3537
console.error('middle');
3638

0 commit comments

Comments
 (0)