Skip to content

Commit 6a007d9

Browse files
authored
chore: add migration guide for v3 (#1065)
1 parent 20a2f32 commit 6a007d9

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

Diff for: docs/migration.md

+96
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,99 @@ Therefore, you need to replace the package name, and the presets, rules, and set
6262
+ "svelte": { ... }
6363
},
6464
```
65+
66+
## From `eslint-plugin-svelte` v2 To v3
67+
68+
This section explains the necessary changes when upgrading from `eslint-plugin-svelte` v2 to v3.
69+
v3 includes **support for ESLint Flat Config only**, **changes to the recommended rule set**, and other breaking changes.
70+
71+
---
72+
73+
## Breaking Changes
74+
75+
### 1. **Minimum Node.js Version Requirement**
76+
77+
v3 requires **one of the following Node.js versions**:
78+
79+
- `^18.20.4`
80+
- `^20.18.0`
81+
- `>=22.10.0`
82+
83+
### 2. **ESLint Flat Config Only**
84+
85+
- `.eslintrc.js` and `.eslintrc.json` are **no longer supported**.
86+
- You must use **Flat Config (`eslint.config.js`)**.
87+
- See [README](README.md) for more details.
88+
89+
### 3. **ESLint Version Requirement**
90+
91+
- v3 requires **ESLint 8.57.1 or later** (including v9.x).
92+
93+
### 4. **Changes to Recommended Rule Set**
94+
95+
- The following rules are now included in `recommended`:
96+
- `svelte/infinite-reactive-loop`
97+
- `svelte/no-dom-manipulating`
98+
- `svelte/no-dupe-on-directives`
99+
- `svelte/no-reactive-reassign`
100+
- `svelte/require-event-dispatcher-types`
101+
- Many others (See [Changelog](https://github.com/sveltejs/eslint-plugin-svelte/releases/tag/eslint-plugin-svelte%403.0.0-next.16) for more details)
102+
- `svelte/valid-compile` has been **removed** from `recommended`.
103+
104+
### 5. **Deprecated Rules**
105+
106+
- `svelte/no-dynamic-slot-name` is **deprecated**.
107+
- `svelte/no-goto-without-base` is **deprecated** and replaced with `svelte/no-navigation-without-base`.
108+
109+
---
110+
111+
## New Features & Improvements
112+
113+
### 1. **Support for Svelte 5**
114+
115+
- Rules such as `no-not-function-handler` and `valid-prop-names-in-kit-pages` now support **Svelte 5**.
116+
117+
### 2. **New Rules**
118+
119+
- `consistent-selector-style`: Enforce consistent selector styles.
120+
- `no-useless-children-snippet`: Prevent unnecessary `{@children}` usage.
121+
- `prefer-const`: Prefer `const` over `let`.
122+
- `no-navigation-without-base`: Ensure proper usage of `goto()`.
123+
124+
---
125+
126+
## Migration Steps
127+
128+
### 1. **Upgrade Package**
129+
130+
```sh
131+
npm install eslint-plugin-svelte@3
132+
```
133+
134+
### 2. **Check Node.js Version**
135+
136+
```sh
137+
node -v
138+
```
139+
140+
- Ensure it is `v18.20.4` or later.
141+
142+
### 3. **Check ESLint Version**
143+
144+
```sh
145+
npx eslint -v
146+
```
147+
148+
- Ensure it is `8.57.1` or later (or `9.x`).
149+
150+
### 4. **Use Flat Config (`eslint.config.js`)**
151+
152+
- Remove `.eslintrc.js` and migrate to `eslint.config.js`.
153+
154+
### 5. **Apply the Updated Recommended Rules**
155+
156+
- If using `recommended`, check the impact of newly added rules.
157+
158+
### 6. **Replace Deprecated Rules**
159+
160+
- Replace `no-goto-without-base` with `no-navigation-without-base`.

0 commit comments

Comments
 (0)