| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 72f02d8 commit ad32ad6
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,5 +5,6 @@ env: | |||
| 5 | 5 | es6: true | |
| 6 | 6 | ||
| 7 | 7 | rules: | |
| 8 | + no-empty: error | ||
| 8 | 9 | no-var: error | |
| 9 | 10 | prefer-arrow-callback: error | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ function useFor(n, items, count) { | |||
| 22 | 22 | function useForOf(n, items) { | |
| 23 | 23 | bench.start(); | |
| 24 | 24 | 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 | ||
| 26 | 26 | for (const item of items) {} | |
| 27 | 27 | } | |
| 28 | 28 | bench.end(n); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ function main({ n, statSyncType }) { | |||
| 21 | 21 | try { | |
| 22 | 22 | fs.statSync(arg); | |
| 23 | 23 | } catch { | |
| 24 | + // Continue regardless of error. | ||
| 24 | 25 | } | |
| 25 | 26 | } | |
| 26 | 27 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,11 @@ function main(conf) { | |||
| 50 | 50 | buf.fill('x'); | |
| 51 | 51 | } | |
| 52 | 52 | ||
| 53 | - try { fs.unlinkSync(filename); } catch {} | ||
| 53 | + try { | ||
| 54 | + fs.unlinkSync(filename); | ||
| 55 | + } catch { | ||
| 56 | + // Continue regardless of error. | ||
| 57 | + } | ||
| 54 | 58 | const ws = fs.createWriteStream(filename); | |
| 55 | 59 | ws.on('close', runTest.bind(null, filesize, highWaterMark, encoding, n)); | |
| 56 | 60 | ws.on('drain', write); | |
@@ -81,7 +85,11 @@ function runTest(filesize, highWaterMark, encoding, n) { | |||
| 81 | 85 | }); | |
| 82 | 86 | ||
| 83 | 87 | rs.on('end', () => { | |
| 84 | - try { fs.unlinkSync(filename); } catch {} | ||
| 88 | + try { | ||
| 89 | + fs.unlinkSync(filename); | ||
| 90 | + } catch { | ||
| 91 | + // Continue regardless of error. | ||
| 92 | + } | ||
| 85 | 93 | // MB/sec | |
| 86 | 94 | bench.end(bytes / (1024 * 1024)); | |
| 87 | 95 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,11 @@ const bench = common.createBenchmark(main, { | |||
| 23 | 23 | }); | |
| 24 | 24 | ||
| 25 | 25 | 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 | + } | ||
| 27 | 31 | let data = Buffer.alloc(len, 'x'); | |
| 28 | 32 | fs.writeFileSync(filename, data); | |
| 29 | 33 | data = null; | |
@@ -38,7 +42,11 @@ function main({ len, dur, concurrent }) { | |||
| 38 | 42 | const totalOps = reads + zips; | |
| 39 | 43 | benchEnded = true; | |
| 40 | 44 | bench.end(totalOps); | |
| 41 | - try { fs.unlinkSync(filename); } catch {} | ||
| 45 | + try { | ||
| 46 | + fs.unlinkSync(filename); | ||
| 47 | + } catch { | ||
| 48 | + // Continue regardless of error. | ||
| 49 | + } | ||
| 42 | 50 | }, dur * 1000); | |
| 43 | 51 | ||
| 44 | 52 | function read() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,11 @@ const bench = common.createBenchmark(main, { | |||
| 20 | 20 | }); | |
| 21 | 21 | ||
| 22 | 22 | 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 | + } | ||
| 24 | 28 | let data = Buffer.alloc(len, 'x'); | |
| 25 | 29 | fs.writeFileSync(filename, data); | |
| 26 | 30 | data = null; | |
@@ -31,7 +35,11 @@ function main({ len, duration, concurrent }) { | |||
| 31 | 35 | setTimeout(() => { | |
| 32 | 36 | benchEnded = true; | |
| 33 | 37 | bench.end(writes); | |
| 34 | - try { fs.unlinkSync(filename); } catch { } | ||
| 38 | + try { | ||
| 39 | + fs.unlinkSync(filename); | ||
| 40 | + } catch { | ||
| 41 | + // Continue regardless of error. | ||
| 42 | + } | ||
| 35 | 43 | process.exit(0); | |
| 36 | 44 | }, duration * 1000); | |
| 37 | 45 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,11 @@ const bench = common.createBenchmark(main, { | |||
| 20 | 20 | }); | |
| 21 | 21 | ||
| 22 | 22 | 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 | + } | ||
| 24 | 28 | let data = Buffer.alloc(len, 'x'); | |
| 25 | 29 | fs.writeFileSync(filename, data); | |
| 26 | 30 | data = null; | |
@@ -31,7 +35,11 @@ function main({ len, duration, concurrent }) { | |||
| 31 | 35 | setTimeout(() => { | |
| 32 | 36 | benchEnded = true; | |
| 33 | 37 | bench.end(reads); | |
| 34 | - try { fs.unlinkSync(filename); } catch {} | ||
| 38 | + try { | ||
| 39 | + fs.unlinkSync(filename); | ||
| 40 | + } catch { | ||
| 41 | + // Continue regardless of error. | ||
| 42 | + } | ||
| 35 | 43 | process.exit(0); | |
| 36 | 44 | }, duration * 1000); | |
| 37 | 45 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,11 @@ function main({ dur, encodingType, size }) { | |||
| 36 | 36 | throw new Error(`invalid encodingType: ${encodingType}`); | |
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | - try { fs.unlinkSync(filename); } catch {} | ||
| 39 | + try { | ||
| 40 | + fs.unlinkSync(filename); | ||
| 41 | + } catch { | ||
| 42 | + // Continue regardless of error. | ||
| 43 | + } | ||
| 40 | 44 | ||
| 41 | 45 | let started = false; | |
| 42 | 46 | let ended = false; | |
@@ -48,7 +52,11 @@ function main({ dur, encodingType, size }) { | |||
| 48 | 52 | f.on('finish', () => { | |
| 49 | 53 | ended = true; | |
| 50 | 54 | 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 | + } | ||
| 52 | 60 | bench.end(written / 1024); | |
| 53 | 61 | }); | |
| 54 | 62 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,11 @@ function main({ encodingType, duration, concurrent, size }) { | |||
| 46 | 46 | benchEnded = true; | |
| 47 | 47 | bench.end(writes); | |
| 48 | 48 | 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 | + } | ||
| 50 | 54 | } | |
| 51 | 55 | process.exit(0); | |
| 52 | 56 | }, duration * 1000); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,9 @@ const common = require('../common.js'); | |||
| 4 | 4 | let icu; | |
| 5 | 5 | try { | |
| 6 | 6 | icu = common.binding('icu'); | |
| 7 | - } catch {} | ||
| 7 | + } catch { | ||
| 8 | + // Continue regardless of error. | ||
| 9 | + } | ||
| 8 | 10 | const punycode = require('punycode'); | |
| 9 | 11 | ||
| 10 | 12 | const bench = common.createBenchmark(main, { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments