Skip to content

Commit b0cddaf

Browse files
committed
Update doc
1 parent 9a06510 commit b0cddaf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/rules/prefer-style-directive.md

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Style directive were added in Svelte v3.46.
2020

2121
<ESLintCodeBlock fix>
2222

23+
<!-- prettier-ignore-start -->
2324
<!--eslint-skip-->
2425

2526
```svelte
@@ -30,11 +31,25 @@ Style directive were added in Svelte v3.46.
3031
3132
<!-- ✓ GOOD -->
3233
<div style:color={color}>...</div>
34+
<div
35+
style:position="absolute"
36+
style:top={position === "absolute" ? "20px" : null}
37+
style:pointer-events={pointerEvents ? null : "none"}
38+
/>
3339
3440
<!-- ✗ BAD -->
3541
<div style="color: {color};">...</div>
42+
<div
43+
style="
44+
position: {position};
45+
{position === 'absolute' ? 'top: 20px;' : ''}
46+
{pointerEvents === false ? 'pointer-events:none;' : ''}
47+
"
48+
/>
3649
```
3750

51+
<!-- prettier-ignore-end -->
52+
3853
</ESLintCodeBlock>
3954

4055
You cannot enforce this style by using [prettier-plugin-svelte]. That is, this rule does not conflict with [prettier-plugin-svelte] and can be used with [prettier-plugin-svelte].

0 commit comments

Comments
 (0)