Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Use babylon typescript parser #143

Merged
merged 5 commits into from
Feb 28, 2018
Merged

Use babylon typescript parser #143

merged 5 commits into from
Feb 28, 2018

Conversation

asvetliakov
Copy link
Member

@asvetliakov asvetliakov commented Nov 20, 2017

New babylon@7 understands and parses typescript by the same way as flow. This have following advantages over the typescript-eslint-parser:

  1. Babylon parser is backward compatible, new TS versions & language additions won't break it.
  2. No need to maintain another dependency
  3. No broken vscode-stylelint extension with unsupported TS versions, since typescript-eslint-parser emits warning in this case, breaking the extension.

@emilgoldsmith
Copy link
Member

Hey @asvetliakov, great for noticing this! Don't you think a stable version will soon be released though and that we could wait for that instead of putting a beta product into our production branch?

@emilgoldsmith
Copy link
Member

For your personal use if this is currently bothering you, you can of course just use this branch and use that as your stylelint processor :)

@asvetliakov
Copy link
Member Author

Hey @asvetliakov, great for noticing this! Don't you think a stable version will soon be released though and that we could wait for that instead of putting a beta product into our production branch?

From my expirience babylon/babel@7 is pretty stable and works very good - i'm using it with typescript over the pretty big project. There are few issues but nothing major.
For typescript-eslint-parser , i was unable to get it working with latest version of TS, even with manually installed version 9.
Also the typescript-eslint-parser produces warning for unsupported versions (typescript@next, typescript@rc) and it's broken in this case in vscode-stylelint extension, since vscode text protocol doesn't expect it.

Your call here merge it now or later, for my personal use i have private npm server, so it's not bothering me too much.

@emilgoldsmith
Copy link
Member

I'd like to hear opinions from @mxstbr and @ismay on this, but I think my gut feeling tells me let's wait until a stable release, if Babel aren't comfortable putting this in a production environment yet I don't feel like we should be recommending it.

If we end up not merging this then let's leave the code here though so if someone is in a similar situation to you and wants to use this "at their own risk" they can use this branch.

@exogen
Copy link

exogen commented Feb 25, 2018

This will thankfully get rid of the annoying typescript peerDep warning on projects not using TypeScript (which does break some commands, btw – npm ls exits with an error code on peerDep warnings, for example). It's the reason I'm holding off on using stylelint at all until a patch like this lands.

What's the latest on babylon stability? 😃

@emilgoldsmith
Copy link
Member

@exogen I'm afraid it still seems quite far away https://github.com/babel/babel/milestone/14. Feel free to help them out finish it faster though ;)

@existentialism
Copy link
Member

existentialism commented Feb 26, 2018

Just chiming in, the milestone you linked to is our "release after 7.0" list, we're just one issue away from 7.0-rc.

Also, re: [email protected], we've been using it in Prettier for 11 months without issue :)

@emilgoldsmith
Copy link
Member

@existentialism thanks for the input, maybe we should get this branch up to date and merged in then in that case as the above sounds pretty promising?

@asvetliakov
Copy link
Member Author

@emilgoldsmith Updated

@coveralls
Copy link

coveralls commented Feb 26, 2018

Coverage Status

Coverage decreased (-0.008%) to 99.663% when pulling af3a66f on asvetliakov:babylon-typescript into 8da398e on styled-components:master.

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Please remove the package-lock.json file again, it'd also be great if you could add it to the .gitignore so folks don't re-add it later on 😊

Other than that this sounds great to me!

@emilgoldsmith
Copy link
Member

@mxstbr no we need the package-lock right? And it's already there, it's what specifies the exact versions we're using, no? Or should we stop using it?

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Oh oopsie, I thought we were using yarn.lock. Nevermind my comment then, this looks good!

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

👍 definitely let us know if you run into any TS-related (or other) issues!

Copy link
Member

@emilgoldsmith emilgoldsmith left a comment

Choose a reason for hiding this comment

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

Yeah think it looks good, I'm pretty swamped right now might find time to merge and deploy this in the near future but if anyone else wants to feel free.

The only thing I'm curious about is whether we are importing babel-traverse somewhere and need to change that to @babel/traverse now?

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

@asvetliakov
Copy link
Member Author

@existentialism good catch, updated

@emilgoldsmith
Copy link
Member

I wonder how the CI was passing with a wrong import that... must have been a dependency of another package?

@asvetliakov
Copy link
Member Author

devDependencies specifies babel-cli v6 which has dependency for babel-traverse. That's why CI/test run didn't catch it

@emilgoldsmith
Copy link
Member

I just checked it out locally and when I run npm install it removes about 1000 redundant lines from package-lock.json so I pushed that (went from 1400 lines changed to 240 or something like that). I'll merge it in when CI passes

@emilgoldsmith emilgoldsmith merged commit bf2795a into styled-components:master Feb 28, 2018
@mxstbr
Copy link
Member

mxstbr commented Feb 28, 2018

Thank you so much for helping us improve styled-components! Based on our Community Guidelines every person that has a PR of any kind merged is offered an invitation to the styled-components organization—that is you right now!

Should you accept, you'll get write access to the main repository. (and a fancy styled-components logo on your GitHub profile!) You'll be able to label and close issues, merge pull requests, create new branches, etc. We want you to help us out with those things, so don't be scared to do them! Make sure to read our contribution and community guidelines, which explains all of this in more detail. Of course, if you have any questions just let me know!

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.

6 participants