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

[type-annotation-spacing] Number of spaces aren't enforced #1001

Closed
rhalaly opened this issue Sep 23, 2019 · 10 comments
Closed

[type-annotation-spacing] Number of spaces aren't enforced #1001

rhalaly opened this issue Sep 23, 2019 · 10 comments
Labels
enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on

Comments

@rhalaly
Copy link

rhalaly commented Sep 23, 2019

Repro

{
  "rules": {
    "@typescript-eslint/type-annotation-spacing": "error"
  }
}
class Foo {
    private bar:          Bar;
}

Expected Result
Error for member filed bar, that have more than one space after colon.

Actual Result
No error

Additional Info
The current rule enforces the spaces as described, but it doesn't enforce how much spaces there is.

Versions

package version
@typescript-eslint/eslint-plugin 2.1.0
@typescript-eslint/parser 2.1.0
TypeScript 3.5.3
ESLint 6.3.0
node 8.11.3
npm 6.11.2
@rhalaly rhalaly added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Sep 23, 2019
@bradzacher bradzacher added enhancement New feature or request good first issue Good for newcomers and removed triage Waiting for maintainers to take a look labels Sep 23, 2019
@vinaysharma14
Copy link

You can use "no-multi-spaces": "error",

@rhalaly
Copy link
Author

rhalaly commented Feb 16, 2021

I thought this rule should enforce multi spaces as well... But thank you

@vinaysharma14
Copy link

Could you elaborate on what you mean by multiline enforcement?

@rhalaly
Copy link
Author

rhalaly commented Feb 16, 2021

Sorry, typo :). Meant multi spaces enforcement...

@armano2
Copy link
Member

armano2 commented Feb 16, 2021

this rule actually works as described in documentation and similarity to other spacing rules from eslint
spacing rules except no-multi-spaces and indent enforce no whitespace or at least one whitespace between tokens

https://eslint.org/docs/rules/template-curly-spacing
https://eslint.org/docs/rules/generator-star-spacing
https://eslint.org/docs/rules/array-bracket-spacing
etc..

@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@lonyele
Copy link
Contributor

lonyele commented Feb 13, 2022

hm... should this rule also error when there is more than 1 space? If that's the case, I could make a PR

@Josh-Cena
Copy link
Member

I don't think this should even be accepting PRs @JoshuaKGoldberg? ESLint's spacing rules do not enforce the number of spaces anyways, since there's the no-multi-spaces rule.

@lonyele
Copy link
Contributor

lonyele commented Feb 27, 2022

hm... so for this situation, extending no-multi-spaces(probably enhancement: new base rule extension tag) and cover type annotation is better?

@Josh-Cena
Copy link
Member

That would be my thought, yeah

@JoshuaKGoldberg
Copy link
Member

Oof, yes, sorry for marking this as accepting prs - that was incorrect of me. Thanks for the catch.

@JoshuaKGoldberg JoshuaKGoldberg added wontfix This will not be worked on and removed good first issue Good for newcomers accepting prs Go ahead, send a pull request that resolves this issue labels Feb 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on
Projects
None yet
7 participants