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] problems within namespaces not being reported #3869

Merged
merged 1 commit into from Sep 20, 2021

Conversation

rafaelss95
Copy link
Contributor

@rafaelss95 rafaelss95 commented Sep 12, 2021

Fixes #3863.

@typescript-eslint
Copy link
Contributor

@typescript-eslint typescript-eslint bot commented Sep 12, 2021

Thanks for the PR, @rafaelss95!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@codecov
Copy link

@codecov codecov bot commented Sep 12, 2021

Codecov Report

Merging #3869 (00fd923) into master (4a88de2) will increase coverage by 0.82%.
The diff coverage is n/a.

Current head 00fd923 differs from pull request most recent head 0d58a24. Consider uploading reports for the commit 0d58a24 to get more accurate results

@@            Coverage Diff             @@
##           master    #3869      +/-   ##
==========================================
+ Coverage   92.70%   93.53%   +0.82%     
==========================================
  Files         329      149     -180     
  Lines       11534     8043    -3491     
  Branches     3257     2550     -707     
==========================================
- Hits        10693     7523    -3170     
+ Misses        368      164     -204     
+ Partials      473      356     -117     
Flag Coverage Δ
unittest 93.53% <ø> (+0.82%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...lugin/src/rules/padding-line-between-statements.ts 91.09% <ø> (ø)
packages/scope-manager/src/lib/es2021.string.ts
packages/scope-manager/src/scope/ForScope.ts
...e-manager/src/scope/FunctionExpressionNameScope.ts
...-utils/src/ast-utils/eslint-utils/scopeAnalysis.ts
...experimental-utils/src/ts-eslint-scope/Variable.ts
packages/scope-manager/src/variable/Variable.ts
packages/scope-manager/src/scope/TSEnumScope.ts
.../experimental-utils/src/ts-eslint/ParserOptions.ts
...xperimental-utils/src/eslint-utils/applyDefault.ts
... and 171 more

@rafaelss95 rafaelss95 changed the title fix(eslint-plugin): [padding-line-between-statements]: problems within namespaces not being reported fix(eslint-plugin): [padding-line-between-statements] problems within namespaces not being reported Sep 12, 2021
@bradzacher bradzacher added the bug label Sep 13, 2021
Copy link
Member

@bradzacher bradzacher left a comment

thanks for fixing this!

@josephzidell
Copy link
Contributor

@josephzidell josephzidell commented Oct 2, 2021

@rafaelss95, this solution definitely works to force newlines between statements within a declare block. However, it seems to also force a newline before the first item.

To wit, even the test scenario produces an error. In fact, I wonder why there are 4 expected errors when there should have been 3?

Code:

declare namespace Types {
	type Foo = string;

	type Bar = string;

	interface FooBar {
		[key: string]: string;
	}

	interface BarBaz {
		[key: string]: string;
	}
}

Output:

error: Expected blank line before this statement (@typescript-eslint/padding-line-between-statements) at src/types.d.ts:4:2:
  2 | 
  3 | declare namespace Types {
> 4 |   type Foo = string;
    |   ^
  5 | 
  6 |   type Bar = string;
  7 | 

@josephzidell
Copy link
Contributor

@josephzidell josephzidell commented Oct 2, 2021

In fact, upon closer look, it seems to have an error even if there is a blank line before.

@josephzidell
Copy link
Contributor

@josephzidell josephzidell commented Oct 2, 2021

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants