sveltejs/eslint-plugin-svelte

Add rule: warn if entire attribute value is placed in es6 template literal

Closed

#893 opened on Oct 29, 2024

 (1 comment) (1 reaction) (0 assignees)TypeScript (72 forks)auto 404
enhancementhelp wantednew rule

Repository metrics

Stars
 (400 stars)
PR merge metrics
 (PR metrics pending)

Description

Motivation

some developers (and ai, too!) will write attributes in jsx style. eg <a href={`https://example.com${path}`}>link</a>.

in idiomatic svelte, this should be <a href="https://example.com{path}">link</a>

Description

warn on attr={``}

Examples

<script>
</script>

<!-- ✓ GOOD -->
<Foo attr="foo${bar}" />

<!-- ✗ BAD -->
<Foo attr={`foo${bar}`} />

Additional comments

No response

Contributor guide