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 crash when formatting svelte files that have "let:class". #24

Merged
merged 2 commits into from Jan 27, 2022

Conversation

chrsep
Copy link
Contributor

@chrsep chrsep commented Jan 26, 2022

Hi there, I encountered a crash when running the plugin on a svelte file that has a slot component like this:

  <p
    slot="test"
    let:class={className}
    class="h-full w-full p-2 backdrop-blur-0 {className}"
  />

Below was the error message and I've got a repro here:

image

I found that the plugin was trying to read the "value" attribute from the let directive, which is always undefined. So to avoid this, I added a check to make sure that the sorting only runs on the class attributes, not on a directive named class such as let:class={className}.

@bradlc
Copy link
Contributor

bradlc commented Jan 27, 2022

Thank you!

@bradlc bradlc merged commit f3a4a28 into tailwindlabs:main Jan 27, 2022
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.

None yet

2 participants