sveltejs/eslint-plugin-svelte

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

Chiusa

#893 aperta il 29 ott 2024

 (1 commento) (1 reazione) (0 assegnatari)TypeScript (72 fork)auto 404
enhancementhelp wantednew rule

Metriche repository

Star
 (400 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor