From 08b3bd2fc58f382b68a922365ead9a6fdc68fb89 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 2 Feb 2022 22:05:41 -0800 Subject: [PATCH] policy: revise manifest.js to avoid empty blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41831 Backport-PR-URL: https://github.com/nodejs/node/pull/42160 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Antoine du Hamel --- lib/internal/policy/manifest.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/internal/policy/manifest.js b/lib/internal/policy/manifest.js index a3f6d347d47025..1be12eb4635d36 100644 --- a/lib/internal/policy/manifest.js +++ b/lib/internal/policy/manifest.js @@ -430,12 +430,11 @@ class Manifest { if (objectButNotArray(obj) && 'onerror' in obj) { const behavior = obj.onerror; - if (behavior === 'throw') { - } else if (behavior === 'exit') { + if (behavior === 'exit') { reaction = REACTION_EXIT; } else if (behavior === 'log') { reaction = REACTION_LOG; - } else { + } else if (behavior !== 'throw') { throw new ERR_MANIFEST_UNKNOWN_ONERROR(behavior); } } @@ -579,8 +578,7 @@ class Manifest { const entry = this.#scopeIntegrities.get(scope); if (entry === true) { return true; - } else if (entry === kCascade) { - } else { + } else if (entry !== kCascade) { break; } }