Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint-plugin): [padding-line-between-statements] make function overloading is also processed #4345

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -803,7 +803,9 @@ export default util.createRule<Options, MessageIds>({
':statement': verify,

SwitchCase: verifyThenEnterScope,
TSDeclareFunction: verifyThenEnterScope,
'SwitchCase:exit': exitScope,
'TSDeclareFunction:exit': exitScope,
};
},
});
Expand Up @@ -2799,6 +2799,20 @@ var a = 1
{ blankLine: 'always', prev: 'block-like', next: 'block-like' },
],
},
{
code: 'export function foo(arg1: string): number;\nexport function foo(arg2: number) {\n return arg2;\n}',
options: [
{ blankLine: 'always', prev: '*', next: 'block-like' },
{ blankLine: 'never', prev: '*', next: 'export' },
],
},
{
code: 'function foo(arg1: string): number;\nfunction foo(arg2: number) {\n return arg2;\n}',
options: [
{ blankLine: 'always', prev: '*', next: 'block-like' },
{ blankLine: 'never', prev: '*', next: 'function' },
],
},
],
invalid: [
//----------------------------------------------------------------------
Expand Down Expand Up @@ -5101,5 +5115,19 @@ declare namespace Types {
{ messageId: 'expectedBlankLine' },
],
},
{
code: 'export function foo(arg1: string): number;\nexport function foo(arg2: number) {\n return arg2;\n}',
output:
'export function foo(arg1: string): number;\n\nexport function foo(arg2: number) {\n return arg2;\n}',
options: [{ blankLine: 'always', prev: '*', next: 'block-like' }],
errors: [{ messageId: 'expectedBlankLine' }],
},
{
code: 'function foo(arg1: string): number;\nfunction foo(arg2: number) {\n return arg2;\n}',
output:
'function foo(arg1: string): number;\n\nfunction foo(arg2: number) {\n return arg2;\n}',
options: [{ blankLine: 'always', prev: '*', next: 'block-like' }],
errors: [{ messageId: 'expectedBlankLine' }],
},
],
});