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
feat(transformer): add remove-vue-import transformer #7
Conversation
8c95059
to
4a4f579
Compare
4a4f579
to
888322f
Compare
should be ready now :) |
888322f
to
7b0868c
Compare
8bb5769
to
2775ee1
Compare
var vue1 = require(\\"vue\\"); | ||
var vue2 = require('vue'); | ||
var vue3 = require(\\"vue\\"); | ||
exports.default = vue_2.defineComponent({ |
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.
Hmm actually this vue_2 should be vue_1 (which is global import
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 am thinking about removing all imports and reference all usages to global Vue import vue_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.
Seems like ideally we should only have one import.
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 I will try to look in that way
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.
This is a very useful PR for me to learn how to use the TS compiler AST
var vue1 = require(\\"vue\\"); | ||
var vue2 = require('vue'); | ||
var vue3 = require(\\"vue\\"); | ||
exports.default = vue_2.defineComponent({ |
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.
Seems like ideally we should only have one import.
* } | ||
* } | ||
* } | ||
*/ |
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.
wow, amazing. will the user need to duplicate this jest.config, or can we merge it in to their own jest config somehow?
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.
Actually it depends on how often users use es6+ in tsconfig.spec.json .
If it is often the case, you can make a preset file and let users reference to that preset. The preset will contain this config.
If it is not often the case, users can opt-in/out this transformer.
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.
great. most of the users are not writing their own config anyway, but using a template. this will be good.
6be0b20
to
0c7875d
Compare
0c7875d
to
b76ab1e
Compare
Caveats this transformer doesn't take care of these 2 syntaxes:
and
|
Sorry - forgot about this. I am not sure I will try this out and merge this today or tomorrow. Thanks @ahnpnl! |
Closes #4