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
@nihalgonsalves nihalgonsalves force-pushed the ng/fix-tagged-template-support branch from 7b9bd9a to 44f2f20 Compare January 15, 2024 09:09
@nihalgonsalves nihalgonsalves force-pushed the ng/fix-tagged-template-support branch from 44f2f20 to 01e5e69 Compare January 15, 2024 09:10
@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
@@ -50,7 +50,7 @@
},
"packageManager": "npm@10.2.5+sha256.8002e3e7305d2abd4016e1368af48d49b066c269079eeb10a56e7d6598acfdaa",
"engines": {
"node": ">=12.13.0"
"node": ">=14.0.0"
Copy link
Contributor

@kachkaev kachkaev May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a breaking change (should generate v2 of the plugin). But in practice, v12 is too old so maybe it’s OK. If someone complains about v12 → v14 without notice, it is possible to release a bugfix. It will bring back v12 and replace ?. / ?? with longer notations.

If there are any plans to release anything breaking soon, might be worth bumping Node to v18 given the opportunity. v16 and below are EOL.

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
4 participants