Skip to content

Fix Glimmer Concatenation#119

Merged
thecrypticace merged 5 commits intotailwindlabs:mainfrom
Alonski:bugfix/no-fix-concat-glimmer
Feb 7, 2023
Merged

Fix Glimmer Concatenation#119
thecrypticace merged 5 commits intotailwindlabs:mainfrom
Alonski:bugfix/no-fix-concat-glimmer

Conversation

@Alonski
Copy link
Copy Markdown
Contributor

@Alonski Alonski commented Jan 30, 2023

Glimmer supports concatenation via the (concat) helper.

The plugin is currently incorrectly breaking up the concatenation

I first added a failing test showing the issue.

Use ignoreLast in a Glimmer StringLiteral if the parent is a SubExpression (meaning helper) and the last character of the node value is not whitespace

Meaning (concat "border-l-blue border-" @color) does not get sorted

While (concat "border-l-blue border ") does get sorted

Glimmer supports concatenation via the `(concat)` helper.

The plugin is currently incorrectly breaking up the concatenation

This adds a failing test showing the issue.
Comment thread src/index.js Outdated
@thecrypticace
Copy link
Copy Markdown
Contributor

I think, for now at least, we should special-case concat as an exception. Though we made end up changing this to all sub-expressions but I think that might be far too broad of an approach. Could you update the PR to do that?

Use ignoreLast in a Glimmer StringLiteral if the parent is a SubExpression (meaning helper) and the last character of the node value is not whitespace

Meaning `(concat "border-l-blue border-" @color)` does not get sorted

While `(concat "border-l-blue border ")` does get sorted
The main issue is with (concat) so we will hardcode that in

If in the future we think we need more helpers we can do that
@Alonski Alonski force-pushed the bugfix/no-fix-concat-glimmer branch from a1a1946 to 4183b28 Compare February 5, 2023 13:38
@Alonski
Copy link
Copy Markdown
Contributor Author

Alonski commented Feb 6, 2023

@thecrypticace Can you take another look please?

@thecrypticace thecrypticace self-assigned this Feb 7, 2023
@thecrypticace thecrypticace merged commit e14a94b into tailwindlabs:main Feb 7, 2023
@thecrypticace
Copy link
Copy Markdown
Contributor

Thanks! Will get a release out this week with this change. Appreciate it! ✨

@Alonski
Copy link
Copy Markdown
Contributor Author

Alonski commented Feb 7, 2023

Thank you! Can't wait!

@Alonski Alonski deleted the bugfix/no-fix-concat-glimmer branch February 8, 2023 08:21
@Alonski
Copy link
Copy Markdown
Contributor Author

Alonski commented Feb 15, 2023

Hey @thecrypticace,
Can you please release a new version with this fix?

@thecrypticace
Copy link
Copy Markdown
Contributor

@Alonski Ah sorry! This one slipped by me. Just published v0.2.3 on NPM

@Alonski
Copy link
Copy Markdown
Contributor Author

Alonski commented Feb 15, 2023

Thanks! @MichalBryxi let's update our repo!

bronisMateusz pushed a commit to bronisMateusz/prettier-plugin-tailwindcss-drupal that referenced this pull request Apr 16, 2025
* test(Glimmer): Add Failing Test For Glimmer Concatenation

Glimmer supports concatenation via the `(concat)` helper.

The plugin is currently incorrectly breaking up the concatenation

This adds a failing test showing the issue.

* fix(Glimmer): Fix Glimmer Concatenation

Use ignoreLast in a Glimmer StringLiteral if the parent is a SubExpression (meaning helper) and the last character of the node value is not whitespace

Meaning `(concat "border-l-blue border-" @color)` does not get sorted

While `(concat "border-l-blue border ")` does get sorted

* fix(Glimmer): Only Fix Concat Helper

The main issue is with (concat) so we will hardcode that in

If in the future we think we need more helpers we can do that

* Update changelog

* Tweak regex

---------

Co-authored-by: Jordan Pittman <[email protected]>
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.

3 participants