From 2fcf89fadcf2d868f56da184eca3833bc2755adf Mon Sep 17 00:00:00 2001 From: Joseph Zidell Date: Fri, 1 Oct 2021 21:00:27 -0400 Subject: [PATCH 1/3] TSModuleBlock should change scope Updates the scope changes to include `TSModuleBlock`. This helps a `module` declaration be its own scope, thereby fixing false positives related to #3869 --- .../eslint-plugin/src/rules/padding-line-between-statements.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index 2da4042fbf0..e99b0e49346 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -763,9 +763,11 @@ export default util.createRule({ Program: enterScope, BlockStatement: enterScope, SwitchStatement: enterScope, + TSModuleBlock: enterScope, 'Program:exit': exitScope, 'BlockStatement:exit': exitScope, 'SwitchStatement:exit': exitScope, + 'TSModuleBlock:exit': exitScope, ':statement': verify, From c178f2747cb595fa1326129d7de591fd5b1f6c1f Mon Sep 17 00:00:00 2001 From: Joseph Zidell Date: Fri, 1 Oct 2021 21:13:23 -0400 Subject: [PATCH 2/3] Update the test Updates the test to expect 3 errors --- .../tests/rules/padding-line-between-statements.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts index c55a85de08b..c1cc44f78c3 100644 --- a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts +++ b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts @@ -5093,7 +5093,6 @@ declare namespace Types { { messageId: 'expectedBlankLine' }, { messageId: 'expectedBlankLine' }, { messageId: 'expectedBlankLine' }, - { messageId: 'expectedBlankLine' }, ], }, ], From b66073fe762a31241346e9df7640525d3d22671a Mon Sep 17 00:00:00 2001 From: Joseph Zidell Date: Sat, 2 Oct 2021 09:17:01 -0400 Subject: [PATCH 3/3] Removes trailing blank line Removes an unnecessary trailing blank line --- .../tests/rules/padding-line-between-statements.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts index c1cc44f78c3..8021b4a650e 100644 --- a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts +++ b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts @@ -5084,7 +5084,6 @@ declare namespace Types { [key: string]: string; } } - `, options: [ { blankLine: 'always', prev: '*', next: ['interface', 'type'] },