Registry / testing / eslint-plugin-svelte

eslint-plugin-svelte

JSON →
library3.17.1jsnpmunverified

Official ESLint plugin for Svelte that leverages AST from svelte-eslint-parser. Current stable version is 3.17.1, with active release cadence (multiple minor/patch releases per month). Provides 80+ rules covering accessibility, best practices, style, and Svelte-specific patterns. Supports Svelte 3, 4, and 5. Requires ESLint v8.57.1+, v9+ or v10+. Ships TypeScript definitions. Recommended over deprecated eslint-plugin-svelte3. Integrates with flat config (eslint.config.js) and provides recommended configs.

testing
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only since v3; CommonJS require will fail. Use default import to get the plugin object for flat config.

import svelte from 'eslint-plugin-svelte'

defineConfig is from eslint package, not from eslint-plugin-svelte. Common mistake is to import it from eslint-plugin-svelte.

import { defineConfig } from 'eslint/config'

configs is a property of the default export, not a named export. Use svelte.configs.recommended.

import svelte from 'eslint-plugin-svelte'; export default [... svelte.configs.recommended, ...]

Flat config using TypeScript-ESLint parser for Svelte files and recommending both TypeScript and Svelte rules.

// eslint.config.js import svelte from 'eslint-plugin-svelte'; import globals from 'globals'; import ts from 'typescript-eslint'; export default [ { ignores: ['build/', 'dist/', 'node_modules/'] }, ...ts.configs.recommended, ...svelte.configs.recommended, { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, { files: ['**/*.svelte', '**/*.svelte.ts'], languageOptions: { parserOptions: { parser: ts.parser } } } ];
Debug
Known footguns
breakingeslint-plugin-svelte >= 2.0.0 no longer supports CommonJS require(). Use ESM imports only.
deprecatedeslint-plugin-svelte3 is deprecated. Use eslint-plugin-svelte instead.
gotchaFlat config (eslint.config.js) is required for v3+. The plugin no longer supports .eslintrc files.
gotchasvelte.config.js must be imported in eslint.config.js if using runes or Svelte 5 features; otherwise parser may fail.
gotchaWhen using TypeScript, you must set `parserOptions.parser` to the TypeScript parser (e.g., `typescript-eslint/parser`).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
amazonbot
4
script
1
Resources