Skip to content

Function type parameters spacing issues #24

@hsimah

Description

@hsimah

I have noticed two issues around type parameters:

  1. Function type parameters get spaces
  2. Utility functions such as $NonMaybeType and indexed accessor

My .eslintrc
image

Issue 1

When using a React state hook I want to explicitly type the state property useState<?string>(null). This is being formatted as useState < ?string > (null); by the plugin. This causes no linting warnings or errors based on recommended settings.
image

Issue 2

When using $NonMaybeType with indexed types I get a trailing space added $NonMaybeType<SomeType['someNestedArray'][0]> comes out like $NonMaybeType<SomeType['someNestedArray'][0] >. This now throws a linting warning (recommended settings) that the generic parameter should not have trailing spaces.
image

I would love to contribute, if I have time to take a look. Let me know if this is expected behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions