From d9df38be5a3ce1122adb768e42fb559bd470fb87 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 3 Aug 2023 13:56:00 -0700 Subject: [PATCH] make declaration rule slightly more strict --- src/lint/rules/variable-use-def.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lint/rules/variable-use-def.ts b/src/lint/rules/variable-use-def.ts index 3bef1a6f..84a70ead 100644 --- a/src/lint/rules/variable-use-def.ts +++ b/src/lint/rules/variable-use-def.ts @@ -68,17 +68,15 @@ class Scope { mayBeShadowed: boolean = false ): void { if (this.declared(name)) { - if (!mayBeShadowed) { - for (const scope of this.strictScopes) { - if (scope.has(name)) { - this.report({ - ruleId: 're-declaration', - message: `${JSON.stringify(name)} is already declared`, - line: nameNode!.location.start.line, - column: nameNode!.location.start.column, - }); - return; - } + for (const scope of this.strictScopes) { + if (scope.has(name)) { + this.report({ + ruleId: 're-declaration', + message: `${JSON.stringify(name)} is already declared`, + line: nameNode!.location.start.line, + column: nameNode!.location.start.column, + }); + return; } } } else {