Skip to content

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Oct 3, 2023

We support member access for tagged template literals when you specify custom sortable functions.

For example — the following:

module.exports = {
  tailwindFunctions: ['tw'],
}

Can sort these:

const a = tw`sm:p-1 p-2`
const b = tw.foo`sm:p-1 p-2`
const c = tw.foo.bar`sm:p-1 p-2`

This PR adds support for function calls / CallExpression so it works in this case too:

const a = tw("sm:p-1 p-2")
const b = tw.foo("sm:p-1 p-2")
const c = tw.foo.bar("sm:p-1 p-2")

@thecrypticace thecrypticace merged commit 047d591 into main Oct 3, 2023
@thecrypticace thecrypticace deleted the fix/member-access-call-expressions branch October 3, 2023 17:24
bronisMateusz pushed a commit to bronisMateusz/prettier-plugin-tailwindcss-drupal that referenced this pull request Apr 16, 2025
* Refactor

* Fix test script

* Support member access on function calls

* Update changelog
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.

2 participants