Skip to content

Disallow certain HTML elements from being used #436

Closed
@dkrutsko

Description

@dkrutsko

Motivation

Svelte can be used as a strongly component-based system where most of the elements used are components. Therefore, it makes sense that an error is raised whenever an element is specified but should not be used.

Description

Disallows certain built-in HTML elements from being used, instead there's likely a component that should be used in its place. For example, instead of using the h1 element, import and use the Heading element.

Examples

<script>
import Heading from 'heading.svelte';
import Code from 'code.svelte';
</script>

<!-- ✓ GOOD -->
<!-- [ 'error', { disallow: [ 'h1', 'code' ] } ] -->
<div />
<Heading type={1}>H1</Heading>
<Code>code</Code>

<!-- ✗ BAD -->
<h1>H1</h1>
<code>code</code>

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions