Skip to content

Commit 0c5692a

Browse files
committed
fix: force quote style inside style directives
fixes #457
1 parent 727ddce commit 0c5692a

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# prettier-plugin-svelte changelog
22

3+
## 3.2.7 (unreleased)
4+
5+
- (fix) force quote style inside style directives
6+
37
## 3.2.6
48

59
- (feat) Svelte 5: never quote single-expression-attributes

src/print/node-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ export function isInsideQuotedAttribute(path: FastPath, options: ParserOptions):
533533

534534
return stack.some(
535535
(node) =>
536-
node.type === 'Attribute' &&
536+
(node.type === 'Attribute' || node.type === 'StyleDirective') &&
537537
(!isLoneMustacheTag(node.value) ||
538538
(options.svelteStrictMode && !options._svelte_is5Plus)),
539539
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div style:transform="translateX({condition ? '10%' : '20%'})"></div>
2+
<div class="my-class {condition ? 'a' : 'b'}"></div>
3+
<Component class="my-class {condition ? 'a' : 'b'}" />

0 commit comments

Comments
 (0)