Closed hsimah closed 2 years ago
I had a bit of a play with it and it looks like we would want to use the TypeParameterInstantiation
to get any type params on a call expression and check the parent/callee.
I made a first pass you can check out here. Most of the tests are failing and there are a bunch of ironic linting errors. I haven't worked on the always
option yet, just the never
.
I did some more work on this - [see my local PR)[https://github.com/hsimah/eslint-plugin-flowtype/pull/1]. It seems okay to fix the spacing both inside and outside the type parameters. I wrote comprehensive tests, which are failing. I'm going to move onto other things so if you want to work together to sort this out.
After talking with some colleagues I'm going to use https://github.com/flow-typed/eslint-plugin-ft-flow instead as it's the official team release.
Hello - thanks for the plugin. I know Flow is not as geared to developers as TS, so being able to use it at home with some success is great.
I have noticed two issues around type parameters:
$NonMaybeType
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 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.