# Migration Guide
# From eslint-plugin-svelte3
You can not use both eslint-plugin-svelte3 and eslint-plugin-svelte at same time.
So before start to use this plugin, you need to remove eslint-plugin-svelte3’s stuff from both package.json and .eslintrc.*.
Note: If you want to know difference between
eslint-plugin-svelteandeslint-plugin-svelte3, Please read the reason for deprecatingeslint-plugin-svelte3in eslint-plugin-svelte3 README.
Note: If you’re using TypeScript, maybe you get
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.error at some configuration files.
In this case, please refer this GitHub comment to solve it.
# From eslint-plugin-svelte v1 To v2
eslint-plugin-svelte v1 was an alias for eslint-plugin-svelte3, but eslint-plugin-svelte v2 is now an independent eslint-plugin.
If you want the previous behavior, replace it with eslint-plugin-svelte3.
# From @ota-meshi/eslint-plugin-svelte
@ota-meshi/eslint-plugin-svelte has been renamed to eslint-plugin-svelte.
Therefore, you need to replace the package name, and the presets, rules, and settings specified in the configuration.
-
package.json
Replace the package name.- "@ota-meshi/eslint-plugin-svelte": "^0.X.X" + "eslint-plugin-svelte": "^X.X.X" -
.eslintrc.*
Replace@ota-meshi/sveltewithsvelteas a string.
Examples:-
Presets
"extends": [ - "plugin:@ota-meshi/svelte/recommended" + "plugin:svelte/recommended" ], -
Rules
"rules": { - "@ota-meshi/svelte/no-dupe-else-if-blocks": "error", + "svelte/no-dupe-else-if-blocks": "error", - "@ota-meshi/svelte/button-has-type": "error", + "svelte/button-has-type": "error", }, -
settings"settings": { - "@ota-meshi/svelte": { ... } + "svelte": { ... } },
-
# From eslint-plugin-svelte v2 To v3
This section explains the necessary changes when upgrading from eslint-plugin-svelte v2 to v3.
v3 includes support for ESLint Flat Config only, changes to the recommended rule set, and other breaking changes.
# Breaking Changes
# 1. Minimum Node.js Version Requirement
v3 requires one of the following Node.js versions:
^18.20.4^20.18.0>=22.10.0
# 2. ESLint Flat Config Only
.eslintrc.jsand.eslintrc.jsonare no longer supported.- You must use Flat Config (
eslint.config.js). - See README for more details.
# 3. ESLint Version Requirement
- v3 requires ESLint 8.57.1 or later (including v9.x).
# 4. Changes to Recommended Rule Set
- The following rules are now included in
recommended:svelte/infinite-reactive-loopsvelte/no-dom-manipulatingsvelte/no-dupe-on-directivessvelte/no-reactive-reassignsvelte/require-event-dispatcher-types- Many others (See Changelog for more details)
svelte/valid-compilehas been removed fromrecommended.
# 5. Deprecated Rules
svelte/no-dynamic-slot-nameis deprecated.svelte/no-goto-without-baseis deprecated and replaced withsvelte/no-navigation-without-base.
# New Features & Improvements
# 1. Support for Svelte 5
- Rules such as
no-not-function-handlerandvalid-prop-names-in-kit-pagesnow support Svelte 5.
# 2. New Rules
consistent-selector-style: Enforce consistent selector styles.no-useless-children-snippet: Prevent unnecessary{@children}usage.prefer-const: Preferconstoverlet.no-navigation-without-base: Ensure proper usage ofgoto().
# Migration Steps
# 1. Upgrade Package
npm install eslint-plugin-svelte@3
# 2. Check Node.js Version
node -v
- Ensure it is
v18.20.4or later.
# 3. Check ESLint Version
npx eslint -v
- Ensure it is
8.57.1or later (or9.x).
# 4. Use Flat Config (eslint.config.js)
- Remove
.eslintrc.jsand migrate toeslint.config.js.
# 5. Apply the Updated Recommended Rules
- If using
recommended, check the impact of newly added rules.
# 6. Replace Deprecated Rules
- Replace
no-goto-without-basewithno-navigation-without-base.