From 8749e51c13220faa1d843844b50562274d706db3 Mon Sep 17 00:00:00 2001 From: Guz013 <43732358+Guz013@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:26:26 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20'off'=20rule=20level=20be?= =?UTF-8?q?ing=20overridden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configs/js/src/lib/rule-variations.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/configs/js/src/lib/rule-variations.js b/configs/js/src/lib/rule-variations.js index 382820b..47822e2 100644 --- a/configs/js/src/lib/rule-variations.js +++ b/configs/js/src/lib/rule-variations.js @@ -69,17 +69,19 @@ function iterateRules(rules, handler) { function createVariations(config) { const configError = { ...config, - rules: iterateRules( - config.rules ?? {}, - ([key, entry]) => [key, changeLevel(entry, 'error')], + rules: iterateRules(config.rules ?? {}, ([key, entry]) => + (entry === 'off' || (Array.isArray(entry) && entry[0] === 'off') + ? [key, entry] + : [key, changeLevel(entry, 'error')]), ), }; const configWarning = { ...config, - rules: iterateRules( - config.rules ?? {}, - ([key, entry]) => [key, changeLevel(entry, 'warn')], + rules: iterateRules(config.rules ?? {}, ([key, entry]) => + (entry === 'off' || (Array.isArray(entry) && entry[0] === 'off') + ? [key, entry] + : [key, changeLevel(entry, 'warn')]), ), };