Svelte
Svelte-specific configuration for Ultracite.
The Svelte configuration has Svelte-specific configuration. This is a minimal preset as Biome doesn't yet have dedicated Svelte-specific linting rules, but it includes important overrides to prevent false positive linting errors in .svelte files.
Installation
Add the Svelte configuration to your biome.jsonc:
{
"extends": ["ultracite/core", "ultracite/svelte"]
}Overview
This configuration:
- HTML Support: Enables experimental full HTML support with script and style indentation
- React-Specific Props: Flags React-specific props like
classNameandhtmlForsince Svelte uses standard HTML attributes (classandfor) - Svelte File Overrides: Relaxed rules for
.sveltefiles to handle Svelte's component structure
HTML Formatter Configuration
The Svelte preset enables experimental HTML support with special formatting for embedded scripts and styles:
{
"html": {
"experimentalFullSupportEnabled": true,
"formatter": {
"indentScriptAndStyle": true
}
}
}This configuration:
- Experimental Full Support: Enables Biome's experimental HTML parsing and formatting capabilities for
.sveltefiles - Indent Script and Style: Properly indents code inside
<script>and<style>tags in Svelte components
Svelte-Specific Rules
Suspicious
| Rule | Setting | Description |
|---|---|---|
noReactSpecificProps | error | Disallow React-specific props like className and htmlFor in Svelte. Use class and for instead. |
Svelte File Overrides
The following rules are disabled for .svelte files to prevent false positives due to Biome's partial support for Svelte components:
Correctness
| Rule | Setting | Description |
|---|---|---|
noUnusedVariables | off | Allow unused variables in .svelte files. Variables in the script section may only be used in the template. |
noUnusedImports | off | Allow unused imports in .svelte files. Imports may only be used in the template section. |
Style
| Rule | Setting | Description |
|---|---|---|
useConst | off | Allow let and var declarations in .svelte files for reactive statements. |
useImportType | off | Disable explicit import type requirements for better compatibility with Svelte's build system. |
How is this guide?