-
-
Notifications
You must be signed in to change notification settings - Fork 172
Add support for callable template literals when using custom JSX parser #367
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
Add support for callable template literals when using custom JSX parser #367
Conversation
72a2c96
to
23094c7
Compare
@dimitribarbot I made some tweaks so traverse both calls and property accesses at the same time. This will let things like these work:
Not sure if this syntax is commonplace or not but seems reasonable to support it regardless (and it simplifies the code a bit too). I don't suspect there will be any issues with that. Can you think of any? |
Thanks for these changes, the code is indeed simpler this way! I hesitated to apply them, but ultimately felt it would be simpler (in terms of PR review) to leave them as is. For example, the factorization between I also don't think there will be any issues with these modifications, they allow generalization to all use cases. Thanks again! |
Planning on taking another look at this soon (this week or next week) as i'm gonna get some changes into a v0.7.0 release. |
|
* tailwind-main: Add support for callable template literals when using custom JSX parser (tailwindlabs#367) Handle quotes in `@plugin`, `@config`, and `@source` (tailwindlabs#387) Drop support for `prettier-plugin-import-sort` (tailwindlabs#385) Remove `declare` to clean up global scope (tailwindlabs#354)
Support for callable template literals
Description
This PR adds support for callable template literals as it was done for member template literals.
It aims at solving use cases when using the tailwind-styled-components library.
Problem
When extending components using
tailwind-styled-components
and following the documentation described here, we must write something such as:However, the classes under the
RedContainer
component will not be handled by the prettier plugin as only the following options are currently supported:Solution
I added the following as supported options:
Testing
I added new test cases and ran
npm run test
to confirm plugin compatibility and ensure no regressions.Fixes #248