-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to @babel/parser; Apply Babel to TS transform files #287
Conversation
"env": { | ||
"jasmine": true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted this file from yml to json for consistency
babelrc: false, | ||
presets: [ | ||
require('babel-preset-es2015'), | ||
require('babel-preset-stage-1'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@babel/preset-stage-1
is deprecated (see https://babeljs.io/docs/en/babel-preset-stage-1).
It was added in 28eb515.
Are there any experimental features we'd like to include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I'll take a look at the current proposal.
Another question though: Can @babel/preset-flow
and @babel/preset-typescript
be both loaded at the same time? It feels like this should be incompatible (at least you cannot set both options in babylon).
cc @hzoo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you shouldn't be able to because they would both try to set options in babylon and fail as incompat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting. Thank you so much for pointing this out! I didn't get an error from babel register about it and it appeared to run fine on the TS file I tested. But, I realize that my test TS file was valid flow so I didn't see any issues. I tried adding a TypeScript-only construct and it does indeed fail. I updated this PR to only load the typescript preset if it's a .tsx?
transform.
Thank you! I will try to get this in in the next few days. |
"@babel/preset-flow": "^7.0.0", | ||
"@babel/preset-typescript": "^7.1.0", | ||
"@babel/register": "^7.0.0", | ||
"babel-core": "^7.0.0-bridge.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed or can I just remove it? @brieb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's needed if as a dep (it just links to @babel/core
) for any dependency that uses babel-core
as a dep like jest and hasn't explicitly upgraded to @babel/core
themselves (https://github.com/facebook/jest/tree/master/packages/babel-jest#usage)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thank you @hzoo!
babylon
(deprecated) to@babel/parser
@babel/preset-typescript
jscodeshift -t sample/reverse-identifiers.ts all-the-code
Reviewers: @fkling @cpojer