Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Breaking: Normalzie type parameters (fixes #197) #196

Merged
merged 1 commit into from
May 6, 2017

Conversation

Pajn
Copy link
Contributor

@Pajn Pajn commented Mar 19, 2017

The deeplyCopy function does a great job of supporting strange TS nodes however I run in to a few where it would have been nice if it had normalized type arguments and type parameters just as for "supported" nodes.
The nodes in question are
For type arguments:

  • TSConstructorType
  • TSFunctionType
  • TSTypeReference

For type parameters:

  • TSCallSignature
  • TSConstructSignature

Now this do break some tests because previously such nodes were outputted as they appeared in the TypeScript AST and is therefore a breaking change. If this actually breaks anyone though is harder to tell, as far as I understand there aren't many TS specific Eslint rules around which could have been using these props. I have not updated any tests yet so you can see the breakage in the Travis logs.

Alternatives for doing this:

  1. Specifically support these nodes.
    TypeScript have a lot of strange syntax so it's a risk that there are more types than the above listed. Specifically supporting these nodes would limit the impact on today unknown types. This would however likely plan out in me opening PRs to support these unknown nodes when I found them.
  2. Not doing this at all.
    The deeplyCopy function already outputs enough to support these nodes without any change in typescript-eslint-parser however that would require prettier to support both formats as supported nodes already are normalized.

@eslintbot
Copy link

Thanks for the pull request, @Pajn! I took a look to make sure it's ready for merging and found some changes are needed:

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@JamesHenry
Copy link
Member

The only known downstream consumer is https://github.com/nzakas/eslint-plugin-typescript. I am onboard with this change, I think we would have done it in the first place, but the deeplyCopy was added long before the other helpers.

@Pajn
Copy link
Contributor Author

Pajn commented Mar 19, 2017

Great! I will fix some tests then

@Pajn Pajn force-pushed the noramlize-type-variables branch from e88a9a4 to 7505189 Compare March 19, 2017 15:02
@eslintbot
Copy link

LGTM

@Pajn Pajn changed the title [RFC] Normalize type arguments and parameters New: Normalzie type parameters (fixes #197) Mar 19, 2017
Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

@Pajn please update this commit to follow the conventions for a breaking change http://eslint.org/docs/developer-guide/contributing/pull-requests

@Pajn Pajn force-pushed the noramlize-type-variables branch from 7505189 to b243747 Compare April 13, 2017 13:46
@eslintbot
Copy link

LGTM

@Pajn Pajn changed the title New: Normalzie type parameters (fixes #197) Breaking: Normalzie type parameters (fixes #197) Apr 13, 2017
@Pajn
Copy link
Contributor Author

Pajn commented Apr 13, 2017

I updated the commit message. Is there anything else I should do as well?

@soda0289
Copy link
Member

@Pajn Looks like the tests are failing. I'm pretty sure they were working before. Did you forget to push some changes?

@Pajn
Copy link
Contributor Author

Pajn commented Apr 13, 2017

Hmm, maybe some other commit intervene. I'll rebase and fix them ASAP, might be next week though.

Pajn referenced this pull request in Pajn/ast-types Apr 21, 2017
@JamesHenry
Copy link
Member

Hi @Pajn, we have another breaking change to merge in here #218, and so it would be great to get them both in together.

When do you think you will have chance to fix the commit?

@JamesHenry
Copy link
Member

JamesHenry commented Apr 29, 2017

And another #233 😄

@Pajn Pajn force-pushed the noramlize-type-variables branch from b243747 to 26af67a Compare May 6, 2017 18:01
@Pajn
Copy link
Contributor Author

Pajn commented May 6, 2017

Sorry for not responding. I have been very busy with a move to a different city.
I've now rebased it.

@eslintbot
Copy link

LGTM

@JamesHenry JamesHenry merged commit c8e881a into eslint:master May 6, 2017
@JamesHenry
Copy link
Member

Thanks, @Pajn!

@Pajn Pajn deleted the noramlize-type-variables branch May 7, 2017 07:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants