Skip to content

Commit

Permalink
fix: force quote style inside style directives
Browse files Browse the repository at this point in the history
fixes #457
  • Loading branch information
dummdidumm committed Aug 20, 2024
1 parent 727ddce commit 0c5692a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# prettier-plugin-svelte changelog

## 3.2.7 (unreleased)

- (fix) force quote style inside style directives

## 3.2.6

- (feat) Svelte 5: never quote single-expression-attributes
Expand Down
2 changes: 1 addition & 1 deletion src/print/node-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ export function isInsideQuotedAttribute(path: FastPath, options: ParserOptions):

return stack.some(
(node) =>
node.type === 'Attribute' &&
(node.type === 'Attribute' || node.type === 'StyleDirective') &&
(!isLoneMustacheTag(node.value) ||
(options.svelteStrictMode && !options._svelte_is5Plus)),
);
Expand Down
3 changes: 3 additions & 0 deletions test/printer/samples/attributes-nested-quotes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div style:transform="translateX({condition ? '10%' : '20%'})"></div>
<div class="my-class {condition ? 'a' : 'b'}"></div>
<Component class="my-class {condition ? 'a' : 'b'}" />

0 comments on commit 0c5692a

Please sign in to comment.