Skip to content
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

fix: support tag.div and tag(Component) #302

Conversation

nihalgonsalves
Copy link
Contributor

@nihalgonsalves nihalgonsalves commented Dec 29, 2023

fix: support tag.div`` and tag(Component)``

Description

The tagged template support from #41 only supported the very basic tag`...` format, but not formats such as tag.div`...` or tag(Component)`...`. This reads the object and callee of the tag to process those as well.

Libraries such as twc and twin.micro use this pattern.

Fixes #272

Node Support

I used Optional Chaining and the Nullish coalescing operator - these are only supported in Node 14.0.0 and higher, so I bumped the engines field.

Node 12 is EoL for over 2 years, but I can update it to alternative syntax if you like.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Test cases added. I also added missing template tag tests for all the rules.

Test Configuration:

  • OS + version: macOS Sonoma 14.2.1
  • NPM version: 9.8.1
  • Node version: 20.6.1

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation Note that this does not change anything, but tagged template documentation was already missing and is available here: Update README.md #288
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@nihalgonsalves nihalgonsalves changed the title fix: support tag.div and tag(Component) fix: support tag.div and tag(Component) Dec 29, 2023
@nihalgonsalves nihalgonsalves changed the title fix: support tag.div and tag(Component) fix: support tag.div and tag(Component) Dec 29, 2023
@user753
Copy link

user753 commented Feb 20, 2024

@nihalgonsalves is there any plan to merge this pr?

@francoismassart francoismassart merged commit 5a5db1b into francoismassart:master May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] : twin.macro with Styled Components doens't show errors
3 participants