svelte
Svelte components: markup and script rules, HTML injection and DOM checks at both levels, and typing rules at level all. It requires javascript. Guide: Svelte.
Selected when
Section titled “Selected when”A scope has a file extension .svelte, or a dependency on svelte.
Checks
Section titled “Checks”svelte-check
Section titled “svelte-check”Runs svelte-check over the scope for compiler and accessibility warnings, and the types of every component and TypeScript file.
Runs at the push stage, once per scope, and loads your code.
tsc cannot parse a component file, and the Svelte compiler warns about markup that no browser reports.
What to do
Section titled “What to do”Fix each warning and error svelte-check prints; both fail the check.
Example
Section titled “Example”A component containing <img src={source} /> reports a11y_missing_attribute. Give the image a text alternative, such as <img src={source} alt={caption} />.
Turn it off
Section titled “Turn it off”gspot ignore svelte/svelte-check --paths "<path>" --reason "<why>"To silence one place, write a comment such as:
<!-- svelte-ignore a11y_autofocus - reason: the dialog opens with the search field in focus -->Lint rules turned off
Section titled “Lint rules turned off”| Lint rules | Files | Why |
|---|---|---|
import-x/no-default-export |
**/*.svelte |
Svelte compiles each component to a default export. |
Defaults set for other configurations
Section titled “Defaults set for other configurations”| Setting | Value |
|---|---|
javascript.import_extension |
"extensionless" |
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/rules/SVELTE.md |
Always |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| eslint-plugin-svelte | 3.23.1 |
| svelte-eslint-parser | 1.9.0 |
| svelte-check | 4.7.7 |
| prettier-plugin-svelte | 4.1.1 |