Svelte
The svelte configuration lints Svelte components with eslint-plugin-svelte, and checks their compiler warnings,
accessibility warnings, and types with svelte-check. Prettier formats .svelte files, and the
CSS guide covers the style blocks of components.
| Check | Stage | Level | What it does |
|---|---|---|---|
svelte/svelte-check |
push |
basic |
Runs svelte-check over the scope for compiler and accessibility warnings, and the types of every component and TypeScript file. |
Type and compiler check
Section titled “Type and compiler check”Before each push, svelte/svelte-check runs in place of typescript/tsc, and checks every component and TypeScript
file. It uses your tsconfig when the scope has one, and the strict options of the level when it has none. It fails on a
warning as it does on an error, so <img src={source} /> gets an a11y_missing_attribute finding.
svelte-check loads the Svelte compiler from your node_modules, so install your project dependencies first.
To accept one warning, write a svelte-ignore comment with a reason, such as
<!-- svelte-ignore a11y_autofocus - reason: the dialog opens with the search field in focus -->.
ESLint rules
Section titled “ESLint rules”javascript/eslint runs the recommended preset of eslint-plugin-svelte on .svelte, .svelte.js, and .svelte.ts
files, and adds svelte/no-target-blank and svelte/button-has-type. Level all adds rules for useless mustaches,
const, and typed event dispatchers.
At level all, gspot reports a folder that holds one code file and nothing else. A +page, +layout, +server, or
+error file does not count, because SvelteKit reads it by its name.