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

Add rule to lint for spacing of type parameters #1143

Open
ericcornelissen opened this issue Aug 10, 2023 · 0 comments
Open

Add rule to lint for spacing of type parameters #1143

ericcornelissen opened this issue Aug 10, 2023 · 0 comments

Comments

@ericcornelissen
Copy link

Motivation

My motivation for this rule is to enforce consistent spacing for type unions in type parameter, specifically to always have spaces surrounding the |. E.g. string | number, not string|number nor string |number nor string| number. (Obviously, alternative spacing preferences should also be supported).

Current behavior

As far as I can tell this is currently not supported at all.

I also believe this is not within the scope of:

NOTE 2: If this is a feature specifically related to the parsing of types, e.g.,
supporting some-new+type-syntax (within curly brackets) in:

/**
 * @param {some-new+type-syntax} myName
 */

...then please file instead at https://github.com/simonseyock/jsdoc-type-pratt-parser/issues/

but please let me know if it is and I'll file an issue there

Desired behavior

A new rule to lint for spacing (or formatting more broadly) of type parameters.

I don't believe this would fit in with any of the existing rules, hence I'm suggesting a new rule. Other than that I don't have any strong opinions on it being a new rule.

Alternatives considered

I considered looking up a separate/alternative ESLint plugin for this, but I feel like this plugin is well suited for this.

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

No branches or pull requests

1 participant