Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Rule enhancement proposal: add <generics> to space-in-parens #3092

Closed
KurtPreston opened this issue Aug 2, 2017 · 3 comments
Closed

Rule enhancement proposal: add <generics> to space-in-parens #3092

KurtPreston opened this issue Aug 2, 2017 · 3 comments

Comments

@KurtPreston
Copy link

KurtPreston commented Aug 2, 2017

The space-in-parens rule can enforce consistent spacing around (), {}, and [] brackets. However, I can't figure out if there's a way to do this for generic parameters (<> brackets). For example, the following lines of code are all valid:

function foo<T>(bar: T) {}
function foo< T >(bar: T) {}
function foo <T> (bar: T) {}
function foo < T > (bar: T) {}
function foo                  <                        T> (bar: T) {}

I'd like to be able to add a rule to enforce consistent use of spacing around these characters.

@ajafff
Copy link
Contributor

ajafff commented Aug 13, 2017

space-in-parens seems to be a rule from tslint-eslint-rules. TSLint core only has space-within-parens which only checks space between ( and ).

Anyways, I agree that it would make sense to also check {}, [] and <>. That should either be added to whitespace, implemented as a new rule (space-in-brackets?) or added to space-within-parens (which would then need to be renamed?).

@adidahiya
Copy link
Contributor

I think it should be added to the whitespace rule. See #1044

@JoshuaKGoldberg
Copy link
Contributor

Merged into #3092 as a subset of that one.

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

No branches or pull requests

4 participants