Skip to content

Commit 1861356

Browse files
authored
fix(eslint-plugin): [padding-line-between-statements] problems within namespaces not being reported (typescript-eslint#3869)
1 parent ec5d506 commit 1861356

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

packages/eslint-plugin/src/rules/padding-line-between-statements.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,11 @@ export default util.createRule<Options, MessageIds>({
723723
if (
724724
!node.parent ||
725725
![
726-
AST_NODE_TYPES.SwitchStatement,
727726
AST_NODE_TYPES.BlockStatement,
728727
AST_NODE_TYPES.Program,
729728
AST_NODE_TYPES.SwitchCase,
729+
AST_NODE_TYPES.SwitchStatement,
730+
AST_NODE_TYPES.TSModuleBlock,
730731
].includes(node.parent.type)
731732
) {
732733
return;

packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5056,5 +5056,45 @@ var a = 1
50565056
{ messageId: 'expectedBlankLine' },
50575057
],
50585058
},
5059+
{
5060+
// https://github.com/typescript-eslint/typescript-eslint/issues/3863
5061+
code: `
5062+
declare namespace Types {
5063+
type Foo = string;
5064+
type Bar = string;
5065+
interface FooBar {
5066+
[key: string]: string;
5067+
}
5068+
interface BarBaz {
5069+
[key: string]: string;
5070+
}
5071+
}
5072+
`,
5073+
output: `
5074+
declare namespace Types {
5075+
type Foo = string;
5076+
5077+
type Bar = string;
5078+
5079+
interface FooBar {
5080+
[key: string]: string;
5081+
}
5082+
5083+
interface BarBaz {
5084+
[key: string]: string;
5085+
}
5086+
}
5087+
5088+
`,
5089+
options: [
5090+
{ blankLine: 'always', prev: '*', next: ['interface', 'type'] },
5091+
],
5092+
errors: [
5093+
{ messageId: 'expectedBlankLine' },
5094+
{ messageId: 'expectedBlankLine' },
5095+
{ messageId: 'expectedBlankLine' },
5096+
{ messageId: 'expectedBlankLine' },
5097+
],
5098+
},
50595099
],
50605100
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy