Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad32ad6

Browse filesBrowse files
Trottruyadorno
authored andcommitted
benchmark: enable no-empty ESLint rule
PR-URL: #41831 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 72f02d8 commit ad32ad6
Copy full SHA for ad32ad6
Expand file treeCollapse file tree

11 files changed

+62
-14
lines changed
Open diff view settings
Collapse file

‎benchmark/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: benchmark/.eslintrc.yaml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ env:
55
es6: true
66

77
rules:
8+
no-empty: error
89
no-var: error
910
prefer-arrow-callback: error
Collapse file

‎benchmark/es/foreach-bench.js‎

Copy file name to clipboardExpand all lines: benchmark/es/foreach-bench.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function useFor(n, items, count) {
2222
function useForOf(n, items) {
2323
bench.start();
2424
for (let i = 0; i < n; i++) {
25-
// eslint-disable-next-line no-unused-vars
25+
// eslint-disable-next-line no-unused-vars, no-empty
2626
for (const item of items) {}
2727
}
2828
bench.end(n);
Collapse file

‎benchmark/fs/bench-statSync-failure.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/bench-statSync-failure.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function main({ n, statSyncType }) {
2121
try {
2222
fs.statSync(arg);
2323
} catch {
24+
// Continue regardless of error.
2425
}
2526
}
2627
}
Collapse file

‎benchmark/fs/read-stream-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/read-stream-throughput.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ function main(conf) {
5050
buf.fill('x');
5151
}
5252

53-
try { fs.unlinkSync(filename); } catch {}
53+
try {
54+
fs.unlinkSync(filename);
55+
} catch {
56+
// Continue regardless of error.
57+
}
5458
const ws = fs.createWriteStream(filename);
5559
ws.on('close', runTest.bind(null, filesize, highWaterMark, encoding, n));
5660
ws.on('drain', write);
@@ -81,7 +85,11 @@ function runTest(filesize, highWaterMark, encoding, n) {
8185
});
8286

8387
rs.on('end', () => {
84-
try { fs.unlinkSync(filename); } catch {}
88+
try {
89+
fs.unlinkSync(filename);
90+
} catch {
91+
// Continue regardless of error.
92+
}
8593
// MB/sec
8694
bench.end(bytes / (1024 * 1024));
8795
});
Collapse file

‎benchmark/fs/readfile-partitioned.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/readfile-partitioned.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ const bench = common.createBenchmark(main, {
2323
});
2424

2525
function main({ len, dur, concurrent }) {
26-
try { fs.unlinkSync(filename); } catch {}
26+
try {
27+
fs.unlinkSync(filename);
28+
} catch {
29+
// Continue regardless of error.
30+
}
2731
let data = Buffer.alloc(len, 'x');
2832
fs.writeFileSync(filename, data);
2933
data = null;
@@ -38,7 +42,11 @@ function main({ len, dur, concurrent }) {
3842
const totalOps = reads + zips;
3943
benchEnded = true;
4044
bench.end(totalOps);
41-
try { fs.unlinkSync(filename); } catch {}
45+
try {
46+
fs.unlinkSync(filename);
47+
} catch {
48+
// Continue regardless of error.
49+
}
4250
}, dur * 1000);
4351

4452
function read() {
Collapse file

‎benchmark/fs/readfile-promises.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/readfile-promises.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const bench = common.createBenchmark(main, {
2020
});
2121

2222
function main({ len, duration, concurrent }) {
23-
try { fs.unlinkSync(filename); } catch { }
23+
try {
24+
fs.unlinkSync(filename);
25+
} catch {
26+
// Continue regardless of error.
27+
}
2428
let data = Buffer.alloc(len, 'x');
2529
fs.writeFileSync(filename, data);
2630
data = null;
@@ -31,7 +35,11 @@ function main({ len, duration, concurrent }) {
3135
setTimeout(() => {
3236
benchEnded = true;
3337
bench.end(writes);
34-
try { fs.unlinkSync(filename); } catch { }
38+
try {
39+
fs.unlinkSync(filename);
40+
} catch {
41+
// Continue regardless of error.
42+
}
3543
process.exit(0);
3644
}, duration * 1000);
3745

Collapse file

‎benchmark/fs/readfile.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/readfile.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const bench = common.createBenchmark(main, {
2020
});
2121

2222
function main({ len, duration, concurrent }) {
23-
try { fs.unlinkSync(filename); } catch {}
23+
try {
24+
fs.unlinkSync(filename);
25+
} catch {
26+
// Continue regardless of error.
27+
}
2428
let data = Buffer.alloc(len, 'x');
2529
fs.writeFileSync(filename, data);
2630
data = null;
@@ -31,7 +35,11 @@ function main({ len, duration, concurrent }) {
3135
setTimeout(() => {
3236
benchEnded = true;
3337
bench.end(reads);
34-
try { fs.unlinkSync(filename); } catch {}
38+
try {
39+
fs.unlinkSync(filename);
40+
} catch {
41+
// Continue regardless of error.
42+
}
3543
process.exit(0);
3644
}, duration * 1000);
3745

Collapse file

‎benchmark/fs/write-stream-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/write-stream-throughput.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ function main({ dur, encodingType, size }) {
3636
throw new Error(`invalid encodingType: ${encodingType}`);
3737
}
3838

39-
try { fs.unlinkSync(filename); } catch {}
39+
try {
40+
fs.unlinkSync(filename);
41+
} catch {
42+
// Continue regardless of error.
43+
}
4044

4145
let started = false;
4246
let ended = false;
@@ -48,7 +52,11 @@ function main({ dur, encodingType, size }) {
4852
f.on('finish', () => {
4953
ended = true;
5054
const written = fs.statSync(filename).size / 1024;
51-
try { fs.unlinkSync(filename); } catch {}
55+
try {
56+
fs.unlinkSync(filename);
57+
} catch {
58+
// Continue regardless of error.
59+
}
5260
bench.end(written / 1024);
5361
});
5462

Collapse file

‎benchmark/fs/writefile-promises.js‎

Copy file name to clipboardExpand all lines: benchmark/fs/writefile-promises.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ function main({ encodingType, duration, concurrent, size }) {
4646
benchEnded = true;
4747
bench.end(writes);
4848
for (let i = 0; i < filesWritten; i++) {
49-
try { fs.unlinkSync(`${filename}-${i}`); } catch { }
49+
try {
50+
fs.unlinkSync(`${filename}-${i}`);
51+
} catch {
52+
// Continue regardless of error.
53+
}
5054
}
5155
process.exit(0);
5256
}, duration * 1000);
Collapse file

‎benchmark/misc/punycode.js‎

Copy file name to clipboardExpand all lines: benchmark/misc/punycode.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const common = require('../common.js');
44
let icu;
55
try {
66
icu = common.binding('icu');
7-
} catch {}
7+
} catch {
8+
// Continue regardless of error.
9+
}
810
const punycode = require('punycode');
911

1012
const bench = common.createBenchmark(main, {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.