From dfe518b4b6aba4309ad98b541ee6cfdfd1beaf4e Mon Sep 17 00:00:00 2001 From: salesh Date: Fri, 15 Jan 2021 20:01:26 +0100 Subject: [PATCH] Fix linter --- .eslintrc | 1 - benchmarks/basic.bench.js | 8 ------ benchmarks/child-child.bench.js | 4 --- benchmarks/child-creation.bench.js | 5 ---- benchmarks/child.bench.js | 5 ---- benchmarks/deep-object.bench.js | 7 ------ benchmarks/formatters.bench.js | 2 -- benchmarks/internal/custom-levels.js | 7 ------ benchmarks/internal/just-pino-heavy.bench.js | 9 ------- benchmarks/internal/just-pino.bench.js | 26 -------------------- benchmarks/internal/parent-vs-child.bench.js | 9 ------- benchmarks/internal/redact.bench.js | 8 ------ benchmarks/long-string.bench.js | 6 ----- benchmarks/multi-arg.bench.js | 24 ------------------ benchmarks/object.bench.js | 7 ------ benchmarks/utils/runbench.js | 3 --- benchmarks/utils/wrap-log-level.js | 1 - browser.js | 2 -- eslintrc.json | 17 +++++++++++++ lib/tools.js | 2 -- package.json | 10 +++++--- test/fixtures/broken-pipe/syncfalse.js | 1 - 22 files changed, 24 insertions(+), 140 deletions(-) delete mode 100644 .eslintrc create mode 100644 eslintrc.json diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index cf4e32602..000000000 --- a/.eslintrc +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "standard" } diff --git a/benchmarks/basic.bench.js b/benchmarks/basic.bench.js index ea5223371..7e6abf1b0 100644 --- a/benchmarks/basic.bench.js +++ b/benchmarks/basic.bench.js @@ -43,56 +43,48 @@ const chill = winston.createLogger({ const run = bench([ function benchBunyan (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info('hello world') } setImmediate(cb) }, function benchWinston (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log('info', 'hello world') } setImmediate(cb) }, function benchBole (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info('hello world') } setImmediate(cb) }, function benchDebug (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { dlog('hello world') } setImmediate(cb) }, function benchLogLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { loglevel.info('hello world') } setImmediate(cb) }, function benchPino (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello world') } setImmediate(cb) }, function benchPinoAsync (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello world') } setImmediate(cb) }, function benchPinoNodeStream (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info('hello world') } diff --git a/benchmarks/child-child.bench.js b/benchmarks/child-child.bench.js index 6a289fe2e..0ee84ec32 100644 --- a/benchmarks/child-child.bench.js +++ b/benchmarks/child-child.bench.js @@ -24,28 +24,24 @@ const blog = bunyan.createLogger({ const run = bench([ function benchBunyanChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAsyncChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoNodeStreamChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info({ hello: 'world' }) } diff --git a/benchmarks/child-creation.bench.js b/benchmarks/child-creation.bench.js index 73bd542de..616e855c3 100644 --- a/benchmarks/child-creation.bench.js +++ b/benchmarks/child-creation.bench.js @@ -28,7 +28,6 @@ require('bole').output({ const run = bench([ function benchBunyanCreation (cb) { const child = blog.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -36,7 +35,6 @@ const run = bench([ }, function benchBoleCreation (cb) { const child = bole('child') - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -44,7 +42,6 @@ const run = bench([ }, function benchPinoCreation (cb) { const child = plogDest.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -52,7 +49,6 @@ const run = bench([ }, function benchPinoAsyncCreation (cb) { const child = plogAsync.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -60,7 +56,6 @@ const run = bench([ }, function benchPinoNodeStreamCreation (cb) { const child = plogNodeStream.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } diff --git a/benchmarks/child.bench.js b/benchmarks/child.bench.js index 3fa6e174c..44c30078b 100644 --- a/benchmarks/child.bench.js +++ b/benchmarks/child.bench.js @@ -28,35 +28,30 @@ require('bole').output({ const run = bench([ function benchBunyanChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info({ hello: 'world' }) } setImmediate(cb) }, function benchBoleChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAssyncChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoNodeStreamChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info({ hello: 'world' }) } diff --git a/benchmarks/deep-object.bench.js b/benchmarks/deep-object.bench.js index 785706133..60de8607c 100644 --- a/benchmarks/deep-object.bench.js +++ b/benchmarks/deep-object.bench.js @@ -42,49 +42,42 @@ const chill = winston.createLogger({ const run = bench([ function benchBunyanDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info(deep) } setImmediate(cb) }, function benchWinstonDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log(deep) } setImmediate(cb) }, function benchBoleDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info(deep) } setImmediate(cb) }, function benchLogLevelDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { loglevel.info(deep) } setImmediate(cb) }, function benchPinoDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info(deep) } setImmediate(cb) }, function benchPinoAsyncDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info(deep) } setImmediate(cb) }, function benchPinoNodeStreamDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info(deep) } diff --git a/benchmarks/formatters.bench.js b/benchmarks/formatters.bench.js index 29a55ecaf..e6cc86189 100644 --- a/benchmarks/formatters.bench.js +++ b/benchmarks/formatters.bench.js @@ -34,14 +34,12 @@ const max = 10 const run = bench([ function benchPinoNoFormatters (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { pinoNoFormatters.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoFormatters (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { pinoFormatters.info({ hello: 'world' }) } diff --git a/benchmarks/internal/custom-levels.js b/benchmarks/internal/custom-levels.js index 52924e080..afb1cf1ae 100644 --- a/benchmarks/internal/custom-levels.js +++ b/benchmarks/internal/custom-levels.js @@ -17,35 +17,30 @@ const max = 100 const run = bench([ function benchPinoNoCustomLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { base.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoCustomLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { baseCl.foo({ hello: 'world' }) } setImmediate(cb) }, function benchChildNoCustomLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildCustomLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { childCl.foo({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildInheritedCustomLevel (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { childOfBaseCl.foo({ hello: 'world' }) } @@ -53,7 +48,6 @@ const run = bench([ }, function benchPinoChildCreation (cb) { const child = base.child({}) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -63,7 +57,6 @@ const run = bench([ const child = base.child({ customLevels: { foo: 31 } }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.foo({ hello: 'world' }) } diff --git a/benchmarks/internal/just-pino-heavy.bench.js b/benchmarks/internal/just-pino-heavy.bench.js index fc5c5378e..12cde819d 100644 --- a/benchmarks/internal/just-pino-heavy.bench.js +++ b/benchmarks/internal/just-pino-heavy.bench.js @@ -18,63 +18,54 @@ const max = 10 const run = bench([ function benchPinoLongString (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info(longStr) } setImmediate(cb) }, function benchPinoDestLongString (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info(longStr) } setImmediate(cb) }, function benchPinoAsyncLongString (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info(longStr) } setImmediate(cb) }, function benchPinoDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info(deep) } setImmediate(cb) }, function benchPinoDestDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info(deep) } setImmediate(cb) }, function benchPinoAsyncDeepObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info(deep) } setImmediate(cb) }, function benchPinoInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello %j', deep) } setImmediate(cb) }, function benchPinoDestInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %j', deep) } setImmediate(cb) }, function benchPinoAsyncInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %j', deep) } diff --git a/benchmarks/internal/just-pino.bench.js b/benchmarks/internal/just-pino.bench.js index af81fdc0f..aef06a3a3 100644 --- a/benchmarks/internal/just-pino.bench.js +++ b/benchmarks/internal/just-pino.bench.js @@ -20,84 +20,72 @@ const max = 10 const run = bench([ function benchPino (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello world') } setImmediate(cb) }, function benchPinoDest (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello world') } setImmediate(cb) }, function benchPinoExtreme (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello world') } setImmediate(cb) }, function benchPinoObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoDestObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAsyncObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoDestChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDestChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAsyncChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsyncChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogChildChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoDestChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDestChildChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAsyncChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsyncChildChild.info({ hello: 'world' }) } @@ -105,7 +93,6 @@ const run = bench([ }, function benchPinoChildCreation (cb) { const child = plog.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } @@ -113,91 +100,78 @@ const run = bench([ }, function benchPinoDestChildCreation (cb) { const child = plogDest.child({ a: 'property' }) - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoMulti (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello', 'world') } setImmediate(cb) }, function benchPinoDestMulti (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello', 'world') } setImmediate(cb) }, function benchPinoAsyncMulti (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello', 'world') } setImmediate(cb) }, function benchPinoInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoDestInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoDestInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoDestInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoAsyncInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchPinoDestInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchPinoAsyncInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } diff --git a/benchmarks/internal/parent-vs-child.bench.js b/benchmarks/internal/parent-vs-child.bench.js index aa7d3dffe..0ad8e60d7 100644 --- a/benchmarks/internal/parent-vs-child.bench.js +++ b/benchmarks/internal/parent-vs-child.bench.js @@ -17,63 +17,54 @@ const max = 100 const run = bench([ function benchPinoBase (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { base.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { childChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { childChildChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChildChildChildChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { childChildChildChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoChild2 (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { child2.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoBaseSerilalizers (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { baseSerializers.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoBaseSerilalizersChild (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { baseSerializersChild.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoBaseSerilalizersChildSeriazliers (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { baseSerializersChildSerializers.info({ hello: 'world' }) } diff --git a/benchmarks/internal/redact.bench.js b/benchmarks/internal/redact.bench.js index 6cdd5e1f8..7ba32fe85 100644 --- a/benchmarks/internal/redact.bench.js +++ b/benchmarks/internal/redact.bench.js @@ -34,56 +34,48 @@ const max = 10 const run = bench([ function benchPinoNoRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plog.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoUnsafeNoRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogUnsafe.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoUnsafeRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogUnsafeRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoAsyncNoRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoAsyncRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoUnsafeAsyncNoRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogUnsafeAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } setImmediate(cb) }, function benchPinoUnsafeAsyncRedact (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogUnsafeAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } }) } diff --git a/benchmarks/long-string.bench.js b/benchmarks/long-string.bench.js index e9ee0fff7..579fa3bb3 100644 --- a/benchmarks/long-string.bench.js +++ b/benchmarks/long-string.bench.js @@ -41,42 +41,36 @@ const chill = winston.createLogger({ const run = bench([ function benchBunyan (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info(longStr) } setImmediate(cb) }, function benchWinston (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.info(longStr) } setImmediate(cb) }, function benchBole (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info(longStr) } setImmediate(cb) }, function benchPino (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info(longStr) } setImmediate(cb) }, function benchPinoAsync (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info(longStr) } setImmediate(cb) }, function benchPinoNodeStream (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info(longStr) } diff --git a/benchmarks/multi-arg.bench.js b/benchmarks/multi-arg.bench.js index 79bf11076..31f35af2a 100644 --- a/benchmarks/multi-arg.bench.js +++ b/benchmarks/multi-arg.bench.js @@ -44,49 +44,42 @@ const max = 10 const run = bench([ function benchBunyanInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info('hello %s', 'world') } setImmediate(cb) }, function benchWinstonInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log('info', 'hello %s', 'world') } setImmediate(cb) }, function benchBoleInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoAsyncInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %s', 'world') } setImmediate(cb) }, function benchPinoNodeStreamInterpolate (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info('hello %s', 'world') } setImmediate(cb) }, function benchBunyanInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info('hello %s %j %d', 'world', { obj: true }, 4) } @@ -94,119 +87,102 @@ const run = bench([ }, function benchWinstonInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchBoleInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoAsyncInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchPinoNodeStreamInterpolateAll (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4) } setImmediate(cb) }, function benchBunyanInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchWinstonInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchBoleInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchPinoInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchPinoAsyncInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchPinoNodeStreamInterpolateExtra (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' }) } setImmediate(cb) }, function benchBunyanInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info('hello %j', deep) } setImmediate(cb) }, function benchWinstonInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.log('info', 'hello %j', deep) } setImmediate(cb) }, function benchBoleInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info('hello %j', deep) } setImmediate(cb) }, function benchPinoInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info('hello %j', deep) } setImmediate(cb) }, function benchPinoAsyncInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info('hello %j', deep) } setImmediate(cb) }, function benchPinoNodeStreamInterpolateDeep (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info('hello %j', deep) } diff --git a/benchmarks/object.bench.js b/benchmarks/object.bench.js index 2d7baa525..8935461f8 100644 --- a/benchmarks/object.bench.js +++ b/benchmarks/object.bench.js @@ -36,49 +36,42 @@ const max = 10 const run = bench([ function benchBunyanObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { blog.info({ hello: 'world' }) } setImmediate(cb) }, function benchWinstonObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { chill.info({ hello: 'world' }) } setImmediate(cb) }, function benchBoleObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { bole.info({ hello: 'world' }) } setImmediate(cb) }, function benchLogLevelObject (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { loglevel.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogDest.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoAsyncObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogAsync.info({ hello: 'world' }) } setImmediate(cb) }, function benchPinoNodeStreamObj (cb) { - /* eslint no-var: off */ for (var i = 0; i < max; i++) { plogNodeStream.info({ hello: 'world' }) } diff --git a/benchmarks/utils/runbench.js b/benchmarks/utils/runbench.js index 5ff832466..5ae911150 100644 --- a/benchmarks/utils/runbench.js +++ b/benchmarks/utils/runbench.js @@ -91,7 +91,6 @@ function runBenchmark (name, done) { function sum (arr) { let result = 0 - /* eslint no-var: off */ for (var i = 0; i < arr.length; i += 1) { result += Number.parseFloat(arr[i].time) } @@ -101,7 +100,6 @@ function sum (arr) { function displayResults (results) { if (quiet === false) console.log('==========') const benchNames = Object.keys(results) - /* eslint no-var: off */ for (var i = 0; i < benchNames.length; i += 1) { console.log(`${benchNames[i].toUpperCase()} benchmark averages`) const benchmark = results[benchNames[i]] @@ -130,7 +128,6 @@ if (selectedBenchmark !== 'all') { benchQueue.push(toBench.bind({ name: selectedBenchmark })) } else { const keys = Object.keys(benchmarks) - /* eslint no-var: off */ for (var i = 0; i < keys.length; i += 1) { benchQueue.push(toBench.bind({ name: keys[i] })) } diff --git a/benchmarks/utils/wrap-log-level.js b/benchmarks/utils/wrap-log-level.js index a79688f3c..f144b687d 100644 --- a/benchmarks/utils/wrap-log-level.js +++ b/benchmarks/utils/wrap-log-level.js @@ -33,7 +33,6 @@ function build (dest) { } else { array = new Array(arguments.length + 1) array[0] = '[' + time.toISOString() + ']' - /* eslint no-var: off */ for (var i = 0; i < arguments.length; i++) { array[i + 1] = arguments[i] } diff --git a/browser.js b/browser.js index 7ebb66534..0d6cc719f 100644 --- a/browser.js +++ b/browser.js @@ -180,7 +180,6 @@ function wrap (opts, logger, level) { const ts = opts.timestamp() const args = new Array(arguments.length) const proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this - /* eslint no-var: off */ for (var i = 0; i < args.length; i++) args[i] = arguments[i] if (opts.serialize && !opts.asObject) { @@ -248,7 +247,6 @@ function bind (parent, bindings, level) { return function () { const args = new Array(1 + arguments.length) args[0] = bindings - /* eslint no-var: off */ for (var i = 1; i < args.length; i++) { args[i] = arguments[i - 1] } diff --git a/eslintrc.json b/eslintrc.json new file mode 100644 index 000000000..54bd8d5d8 --- /dev/null +++ b/eslintrc.json @@ -0,0 +1,17 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "es2021": true, + "node": true + }, + "extends": [ + "standard" + ], + "parserOptions": { + "ecmaVersion": 12 + }, + "rules": { + "no-var": "off" + } +} diff --git a/lib/tools.js b/lib/tools.js index 32decb6d9..c405a27da 100644 --- a/lib/tools.js +++ b/lib/tools.js @@ -73,7 +73,6 @@ function asString (str) { if (l > 100) { return JSON.stringify(str) } - /* eslint no-var: off */ for (var i = 0; i < l && point >= 32; i++) { point = str.charCodeAt(i) if (point === 34 || point === 92) { @@ -261,7 +260,6 @@ function prettifierMetaWrapper (pretty, dest, opts) { const serializers = lastLogger[serializersSym] const keys = Object.keys(serializers) - /* eslint no-var: off */ for (var i = 0; i < keys.length; i++) { const key = keys[i] if (obj[key] !== undefined) { diff --git a/package.json b/package.json index 5a9bb981b..a8dec2f3d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "scripts": { "docs": "docsify serve", "browser-test": "airtap --local 8080 test/browser*test.js", - "test": "standard | snazzy && tap --100 test/*test.js test/*/*test.js", + "lint": "eslint . --config=eslintrc.json", + "test": "npm run lint && tap --100 test/*test.js test/*/*test.js", "cov-ui": "tap --coverage-report=html test/*test.js test/*/*test.js", "bench": "node benchmarks/utils/runbench all", "bench-basic": "node benchmarks/utils/runbench basic", @@ -63,6 +64,11 @@ "bole": "^4.0.0", "bunyan": "^1.8.14", "docsify-cli": "^4.4.1", + "eslint": "^7.17.0", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", "execa": "^4.0.0", "fastbench": "^1.0.1", "flush-write-stream": "^2.0.0", @@ -74,9 +80,7 @@ "proxyquire": "^2.1.3", "pump": "^3.0.0", "semver": "^7.0.0", - "snazzy": "^8.0.0", "split2": "^3.1.1", - "standard": "^16.0.3", "steed": "^1.1.3", "strip-ansi": "^6.0.0", "tap": "^14.10.8", diff --git a/test/fixtures/broken-pipe/syncfalse.js b/test/fixtures/broken-pipe/syncfalse.js index e61c579fa..428f4ae22 100644 --- a/test/fixtures/broken-pipe/syncfalse.js +++ b/test/fixtures/broken-pipe/syncfalse.js @@ -7,7 +7,6 @@ require('os').hostname = function () { return 'abcdefghijklmnopqr' } const pino = require('../../..') const logger = pino(pino.destination({ sync: false })) -/* eslint no-var: off */ for (var i = 0; i < 1000; i++) { logger.info('hello world') }