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:

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 className and htmlFor since Svelte uses standard HTML attributes (class and for)
  • Svelte File Overrides: Relaxed rules for .svelte files 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 .svelte files
  • Indent Script and Style: Properly indents code inside <script> and <style> tags in Svelte components

Svelte-Specific Rules

Suspicious

RuleSettingDescription
noReactSpecificPropserrorDisallow 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

RuleSettingDescription
noUnusedVariablesoffAllow unused variables in .svelte files. Variables in the script section may only be used in the template.
noUnusedImportsoffAllow unused imports in .svelte files. Imports may only be used in the template section.

Style

RuleSettingDescription
useConstoffAllow let and var declarations in .svelte files for reactive statements.
useImportTypeoffDisable explicit import type requirements for better compatibility with Svelte's build system.

How is this guide?