Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.38 KB

no-object-in-text-mustaches.md

File metadata and controls

54 lines (36 loc) · 1.38 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/no-object-in-text-mustaches
disallow objects in text mustache interpolation
v0.5.0

svelte/no-object-in-text-mustaches

disallow objects in text mustache interpolation

  • ⚙️ This rule is included in "plugin:svelte/recommended".

📖 Rule Details

This rule disallows the use of objects in text mustache interpolation.
When you use an object for text interpolation, it is drawn as [object Object]. It's almost always a mistake. You may have written a lot of unnecessary curly braces.

<script>
  /* eslint svelte/no-object-in-text-mustaches: "error" */
</script>

<!-- ✓ GOOD -->
{foo}
<input class="{foo} bar" />
<MyComponent prop={{ foo }} />

<!-- ✗ BAD -->
{{ foo }}
<input class="{{ foo }} bar" />

🔧 Options

Nothing.

👫 Related Rules

🚀 Version

This rule was introduced in eslint-plugin-svelte v0.5.0

🔍 Implementation