From ff5b56ea9d70d24140bf4bc53b8692ef1513f43a Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 17 Feb 2018 03:45:07 +0100 Subject: [PATCH] tools: enable eslint no-undef-init rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also fixes the three entries that did not pass. PR-URL: https://github.com/nodejs/node/pull/18831 Reviewed-By: Luigi Pinca Reviewed-By: Matheus Marchini Reviewed-By: Anna Henningsen Reviewed-By: Michaƫl Zasso Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig --- .eslintrc.js | 1 + lib/internal/util.js | 4 ++-- test/parallel/test-fs-utimes.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index cd5fc51e8e3071..58f131c1b6f8e8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -130,6 +130,7 @@ module.exports = { // http://eslint.org/docs/rules/#variables 'no-delete-var': 'error', 'no-undef': 'error', + 'no-undef-init': 'error', 'no-unused-vars': ['error', { args: 'none' }], 'no-use-before-define': ['error', { classes: true, diff --git a/lib/internal/util.js b/lib/internal/util.js index 630cd0ef213bdb..5cec64ca18bfba 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -228,8 +228,8 @@ function getSystemErrorName(err) { // getConstructorOf is wrapped into this to save iterations function getIdentificationOf(obj) { const original = obj; - let constructor = undefined; - let tag = undefined; + let constructor; + let tag; while (obj) { if (constructor === undefined) { diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index dae9c7dc9eabfc..5b57287a6428b5 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -88,7 +88,7 @@ function testIt(atime, mtime, callback) { expect_errno('futimesSync', fd, ex, 'ENOSYS'); } - let err = undefined; + let err; try { fs.utimesSync('foobarbaz', atime, mtime); } catch (ex) {