-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: supports babel 7 #3
Conversation
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.
Thanks a lot for the changes! I would like to wait for non-beta v7 babel before merging this.
But please revert the jest
for now.
package.json
Outdated
"classnames": "^2.2.5", | ||
"eslint": "^4.1.1", | ||
"eslint-config-prettier": "^2.3.0", | ||
"glob": "^7.1.2", | ||
"husky": "^0.14.2", | ||
"jest": "^20.0.4", | ||
"jest": "^22.4.3", |
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.
Can you please revert this jest
upgrade? I think the new version introduces some formatting changes to the snapshot file. I prefer this PR to just upgrade babel
and any requirements for it.
I'll upgrade jest
with a follow-up commit.
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.
jest had a direct dependency to babel-core, witch they fixed in jest 21: https://github.com/facebook/jest/blob/master/CHANGELOG.md#jest-2100
Change babel-core to peerDependency for compatibility with Babel 7
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.
I can modify to 21 if you prefer
test/styles.css.js
Outdated
@@ -1,6 +1,4 @@ | |||
const styles = { | |||
module.exports = { |
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.
Any specific reason for changing this to commonjs?
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.
The tests fails without the change:
● executes basic.js
/Users/chris/Work/utils/babel-plugin-inline-classnames/test/styles.css.js:6
export default styles;
^^^^^^
SyntaxError: Unexpected token export
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316:17)
at eval (eval at it (test/index.test.js:30:18), <anonymous>:5:38)
at Object.it (test/index.test.js:30:18)
This ones also fails:
- executes custom-import-name.js
- executes object-expression.js
- executes string-literal-mixed.js
3270ce6
to
eb190fb
Compare
package.json
Outdated
"classnames": "^2.2.5", | ||
"eslint": "^5.4.0", | ||
"eslint-config-prettier": "^3.0.1", | ||
"glob": "^7.1.2", | ||
"husky": "^0.14.3", | ||
"jest": "^23.5.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.
jest 23 is not compatible with babel 7:
jestjs/jest#4923
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.
issue: jestjs/jest#6913
package.json
Outdated
@@ -55,7 +57,7 @@ | |||
"validate-commit-msg": "^2.14.0" | |||
}, | |||
"peerDependencies": { | |||
"babel-core": "6.*" | |||
"babel-core": "6.* || ^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.
If you want to make a breaking change, I can update to "@babel/core": "7.*"
?
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, let's do that. I'll publish this as a major version bump anyways.
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.
done :)
BREAKING CHANGE: @babel/core is now a peer dependency and replace babel-core
f314d65
to
1113f5d
Compare
The documentation has the wrong name, there is a pr :
jestjs/jest#6745 🙂
…On Sat 1 Sep 2018 at 14:02, Valentin Agachi ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In package.json
<#3 (comment)>
:
> @@ -38,11 +38,13 @@
"test": "jest"
},
"devDependencies": {
- "babel-cli": "^6.24.1",
- "babel-core": "^6.25.0",
- "babel-eslint": "^7.2.3",
- "babel-plugin-syntax-jsx": "^6.18.0",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
+ ***@***.***/cli": "^7.0.0",
+ ***@***.***/core": "^7.0.0",
+ ***@***.***/plugin-syntax-jsx": "^7.0.0",
+ ***@***.***/plugin-transform-modules-commonjs": "^7.0.0",
+ "babel-core": "^7.0.0-bridge.0",
+ "babel-eslint": "^9.0.0",
+ "babel-jest": "^23.4.2",
Ohh, my mistake. I had the files cached by jest. Indeed, it does not run
without those packages.
But let's at least change the babel-core dependency to babel-core@^7.0.0-0
according to the jest docs.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASfKzLxjHa740rQOCW0p7cI5W4lA7cMks5uWndugaJpZM4Tebp3>
.
|
Thanks ! |
Hello !
I tried this plugin and it didn't work with babel 7, because import is removed and binding lost.
The solution is to use
Program.exit
to remove it after.Maybe you want to wait for the official babel 7 release before looking at this ?