You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utility functions such as $NonMaybeType and indexed accessor
My .eslintrc
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.
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.
I would love to contribute, if I have time to take a look. Let me know if this is expected behaviour.
The text was updated successfully, but these errors were encountered:
Thanks for submitting the issue. Happy for you to raise some fixes if they make sense. I haven't come across this issue myself probably because I don't use those rules.
But as I'm trying to test this issue though it looks like the rule doesn't even work on my environment and I have no clue why, might be some other issues in this rule after all.
But if you can figure out what's wrong with your usage happy for you to raise a PR.
I have noticed two issues around type parameters:
$NonMaybeType
and indexed accessorMy
.eslintrc
Issue 1
When using a React state hook I want to explicitly type the state property
useState<?string>(null)
. This is being formatted asuseState < ?string > (null);
by the plugin. This causes no linting warnings or errors based on recommended settings.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.I would love to contribute, if I have time to take a look. Let me know if this is expected behaviour.
The text was updated successfully, but these errors were encountered: