(fix): change plugin order to make styled-components/macro work#644
Merged
agilgur5 merged 1 commit intojaredpalmer:masterfrom Sep 17, 2020
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0176678 to
093bec3
Compare
This comment has been minimized.
This comment has been minimized.
agilgur5
commented
Sep 17, 2020
Collaborator
Author
agilgur5
left a comment
There was a problem hiding this comment.
One nit, otherwise seems good to go if all tests pass
- if babel-plugin-macros is first, macros get applied first
- babel-plugin-styled-components says it should be placed first, but
unfortunately all user plugins are added after TSDX plugins
- unknown how changing this ordering could impact lots of code out
there, but could be very breaking.
- moving to a preset instead would mean this is more in user
control
- but we can change it so macros are added first and so one can use
styled-components/macro instead as a workaround
- based on babel-plugin-styled-component's code, docs, and output in
detail, I think its ordering conflict may be with
babel-plugin-annotate-pure-calls, which so happens to be the first
plugin in babelPluginTsdx
- maybe this should be last given that other plugins can change
functions etc
(test): update styled-component template tag test to reflect the
slightly different tag due to the usage of the macro
(fix/test): comment removal should use toBeFalsy, not toBeTruthy,
since it's removed
- this was a bug I introduced when adding the grep helper; just added
it the same everywhere but this was the one place that was testing
to get an error code
- fix the comment so it doesn't say error code anymore either
- since this test was skipped, I didn't pick up that it was wrong
until it ran now
093bec3 to
5bf22ad
Compare
paul-vd
pushed a commit
to EezyQuote/tsdx
that referenced
this pull request
Dec 1, 2020
…dpalmer#644) - if babel-plugin-macros is first, macros get applied first - babel-plugin-styled-components says it should be placed first, but unfortunately all user plugins are added after TSDX plugins - unknown how changing this ordering could impact lots of code out there, but could be very breaking. - moving to a preset instead would mean this is more in user control - but we can change it so macros are added first and so one can use styled-components/macro instead as a workaround - based on babel-plugin-styled-component's code, docs, and output in detail, I think its ordering conflict may be with babel-plugin-annotate-pure-calls, which so happens to be the first plugin in babelPluginTsdx - maybe this should be last given that other plugins can change functions etc (test): update styled-component template tag test to reflect the slightly different tag due to the usage of the macro (fix/test): comment removal should use toBeFalsy, not toBeTruthy, since it's removed - this was a bug I introduced when adding the grep helper; just added it the same everywhere but this was the one place that was testing to get an error code - fix the comment so it doesn't say error code anymore either - since this test was skipped, I didn't pick up that it was wrong until it ran now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
if babel-plugin-macros is first, macros get applied first
unfortunately all user plugins are added after TSDX plugins
there, but could be very breaking.
control
styled-components/macro instead as a workaround
based on babel-plugin-styled-component's code, docs, and output in
detail, I think its ordering conflict may be with
babel-plugin-annotate-pure-calls, which so happens to be the first
plugin in babelPluginTsdx
functions etc
(test): update styled-component template tag test to reflect the
slightly different tag due to the usage of the macro
(fix/test): comment removal should use toBeFalsy, not toBeTruthy,
since it's removed
it the same everywhere but this was the one place that was testing
to get an error code
until it ran now
Workaround for #543
Should go out in a minor since it's possible changing the order of this one plugin could break some things, but highly unlikely