Skip to content

Conversation

@G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Aug 10, 2019

This is based off #374, which should be reviewed & merged first.

I had to simplify getAccessorValue & AccessorNode to not handle Identifier nodes, as nothing covers that yet.

Otherwise it's a direct port.

@G-Rath G-Rath requested a review from SimenB August 10, 2019 22:46
@SimenB SimenB force-pushed the improve-no-identical-title branch from 768d381 to 93187c3 Compare August 10, 2019 23:26
*
* i.e `KnownCallExpression<'includes'>` represents `.includes()`.
*/
export interface KnownCallExpression<Name extends string = string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to export, but I guess we can clean that up later?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem to be used either?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly - it does need to be exported later for at least one rule.

I don't think it's worth worrying about exports too much right now.
Same with possible use of varargs, as you're about to see in my next PR for no-large-snapshots :P

Copy link
Collaborator Author

@G-Rath G-Rath Aug 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're circular: KnownCallExpression is used by CalledKnownMemberExpression, which is used by KnownCallExpression, and extends KnownMemberExpression.

You're right: they're not needed in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KnownCallExpression is only used in CalledKnownMemberExpression, which is only used in KnownCallExpression. It seems we only need getAccessorValue here? Test coverage won't complain about unused types as they're stripped out (is there some tsc option we can add that yells about it?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, right. GH didn't feel like telling me you had commented...

Copy link
Collaborator Author

@G-Rath G-Rath Aug 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage won't complain about unused types as they're stripped out (is there some tsc option we can add that yells about it?)

Yeah I've been wondering that myself - as far as I know tsc doesn't have such an option, but I think it'd be a pretty big can of worms.

I'm happy to investigate after we've got the bulk of things merged- IntelliJ has an inspection that'll pick them up (which they've now exposed via API, so technically you could use that in CI.... 😜)

I've just checked @typescript-eslint, and they don't have a rule for it.

Right now I think it'd be an annoying can of worms - I'm already running into trouble w/ the fact that an AccessorNode can be an Identifier, but no rule calls getAccessorValue on an Identifier (it'll make sense when you see the PR in a sec).

Copy link
Collaborator Author

@G-Rath G-Rath Aug 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh yeah it seems to be a slow day in the tech world - I'm trying to push a new commit that removes those interfaces, but it's being sllooooww (might have something to do w/ having the jest monorepo open in another project, but eh 🤷‍♂)

@G-Rath
Copy link
Collaborator Author

G-Rath commented Aug 11, 2019

@SimenB Can I merge, since you've approved this?

@G-Rath G-Rath mentioned this pull request Aug 11, 2019
@SimenB
Copy link
Member

SimenB commented Aug 11, 2019

Mind resolving the conflict? Then feel free to merge

@G-Rath
Copy link
Collaborator Author

G-Rath commented Aug 11, 2019

Sweet as. I'm about to make a couple of similar PRs that'll likely conflict, and then head to bed: so if you approve them, I'm happy to resolve conflicts & merge them when I'm up tomorrow :)

But first, got a PR to review: someone over on jest wants someone who knows TS to eye up his PR 😉

@G-Rath G-Rath force-pushed the improve-no-identical-title branch from 12e90dd to cacc150 Compare August 11, 2019 11:57
@G-Rath G-Rath merged commit 2ec3f12 into master Aug 11, 2019
@G-Rath G-Rath deleted the improve-no-identical-title branch August 11, 2019 12:00
@SimenB
Copy link
Member

SimenB commented Aug 12, 2019

🎉 This PR is included in version 22.15.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants