Skip to content

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.

A scope has a file extension .svelte, or a dependency on svelte.

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.

Fix each warning and error svelte-check prints; both fail the check.

A component containing <img src={source} /> reports a11y_missing_attribute. Give the image a text alternative, such as <img src={source} alt={caption} />.

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 Files Why
import-x/no-default-export **/*.svelte Svelte compiles each component to a default export.
Setting Value
javascript.import_extension "extensionless"
Rule file Installed when
.gspot/rules/SVELTE.md Always
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