Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect invalid HTML elements #913

Open
benglewis opened this issue Nov 12, 2024 · 0 comments · May be fixed by #918
Open

Detect invalid HTML elements #913

benglewis opened this issue Nov 12, 2024 · 0 comments · May be fixed by #918
Labels
enhancement New feature or request new rule

Comments

@benglewis
Copy link

Motivation

I found that in Svelte 4.0, we had used the following syntax:

<head>
  <script>...</script>
</head>

<svelte:head>
   <title>...</title>
</svelte:head>

<div>
</div>

But it turns out that in Svelte 5.0 (and officially even before Svelte 5.0, even though it worked :P) this is not valid syntax.

Description

The idea is to have a list of Svelte tags (known as "Special elements" in the Svelte docs) which are only supported with the svelte: syntax, e.g. head, body, window, document, element and to automatically notify the user if they are incorrect using these tags without the svelte: prefix. AFAIK, the linter already blocks components from using lower-case names (component-name-lowercase), so I believe that this rule would be exceedingly unlikely to trigger false positives.

Examples

<script>
</script>

<!-- ✓ GOOD -->
<svelte:head>
...
</svelte:head>

<!-- ✗ BAD -->
<head>
...
</head>

Additional comments

No response

@benglewis benglewis added enhancement New feature or request new rule labels Nov 12, 2024
@mikededo mikededo linked a pull request Nov 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant