You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5139800
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/src/use/migrate-to-10.0.0.md
+38-5Lines changed: 38 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,25 @@ eleventyNavigation:
9
9
10
10
ESLint v10.0.0 is a major release of ESLint, and as such, has several breaking changes that you need to be aware of. This guide is intended to walk you through the breaking changes.
11
11
12
+
To help with this migration, ESLint provides migration codemods to automate many of the changes described in this guide. All official ESLint codemods are available in the [eslint/codemods](https://github.com/eslint/codemods) repository and through the [Codemod Registry](https://app.codemod.com/registry?q=scope%3Aeslint).
13
+
14
+
## Use migration codemods
15
+
16
+
The `@eslint/v9-to-v10` codemod upgrades ESLint projects from v9 to v10. It includes four individual codemods that can also be run independently:
17
+
18
+
-`@eslint/v9-to-v10-config`: Remove legacy env vars and CLI flags
19
+
-`@eslint/v9-to-v10-custom-rules`: Replace removed `context` and `SourceCode` methods
20
+
-`@eslint/v9-to-v10-ruletester`: Clean up `RuleTester` test cases
21
+
-`@eslint/v9-to-v10-linter-api`: Fix `Linter`/`ESLint` API usage
22
+
23
+
```shell
24
+
npx codemod @eslint/v9-to-v10
25
+
```
26
+
27
+
Learn more in the [Codemod Registry](https://app.codemod.com/registry?q=scope%3Aeslint).
28
+
29
+
Codemods are a starting point. Review the changes and consult the breaking changes below for anything the codemods do not cover.
30
+
12
31
The lists below are ordered roughly by the number of users each change is expected to affect, where the first items are expected to affect the most users.
13
32
14
33
## Table of Contents
@@ -82,9 +101,11 @@ Three new rules have been enabled in `eslint:recommended`:
82
101
83
102
In ESLint v9, the alternate config lookup behavior could be enabled with the `v10_config_lookup_from_file` feature flag. This behavior made ESLint locate `eslint.config.*` by starting from the directory of each linted file and searching up towards the filesystem root. In ESLint v10.0.0, this behavior is now the default and the `v10_config_lookup_from_file` flag has been removed. Attempting to use this flag will now result in an error.
84
103
104
+
**Codemod:** Use the [@eslint/v9-to-v10-config](#use-migration-codemods) codemod to remove legacy flags from your setup.
Starting with ESLint v10.0.0, the old configuration format is no longer supported.
100
121
122
+
**Codemod:** Use the [@eslint/v9-to-v10](#use-migration-codemods) codemod to automate much of this migration. Use the [@eslint/v9-to-v10-linter-api](#use-migration-codemods) codemod to update deprecated `FlatESLint` and `LegacyESLint` usage.
123
+
101
124
**To address:**
102
125
103
-
-Follow the instructions in the [configuration migration guide](./configure/migration-guide).
126
+
-Or follow the instructions in the [configuration migration guide](./configure/migration-guide).
104
127
- Be aware that the deprecated APIs `FlatESLint` and `LegacyESLint` have been removed. Always use `ESLint` instead.
105
128
- The `configType` option of the `Linter` class can no longer be set to `"eslintrc"`. Remove the option to use the new configuration format.
106
129
@@ -267,7 +290,9 @@ This change should not require any action for most users. However, if you are us
267
290
268
291
In ESLint v10.0.0, the deprecated `type` property in errors of invalid test cases for rules has been removed. Using the `type` property in test cases now throws an error.
269
292
270
-
**To address:** Remove the `type` property from error objects in invalid test cases.
293
+
**Codemod:** Use the [@eslint/v9-to-v10-ruletester](#use-migration-codemods) codemod to automate this change.
294
+
295
+
**To address:** Remove the `type` property from error objects in invalid test cases manually.
@@ -336,6 +361,8 @@ In ESLint v9.x, we deprecated the following [methods](https://eslint.org/blog/20
336
361
337
362
In ESLint v10.0.0, all of these members have been removed.
338
363
364
+
**Codemod:** Use the [@eslint/v9-to-v10-custom-rules](#use-migration-codemods) codemod to automate this change.
365
+
339
366
**To address:** In your custom rules, make the following changes:
340
367
341
368
|**Removed on `context`**|**Replacement on `context`**|
@@ -375,6 +402,8 @@ The following deprecated `SourceCode` methods have been removed in ESLint v10.0.
375
402
376
403
These methods have been deprecated for multiple major versions and were primarily used by deprecated formatting rules and internal ESLint utilities. Custom rules using these methods must be updated to use their modern replacements.
377
404
405
+
**Codemod:** Use the [@eslint/v9-to-v10-custom-rules](#use-migration-codemods) codemod to automate this change.
406
+
378
407
**To address:** In your custom rules, make the following changes:
## <aname="lintmessage-nodetype-removed"></a> Removal of `nodeType` property in `LintMessage` objects
420
451
421
452
In ESLint v10.0.0, the deprecated `nodeType` property on `LintMessage` objects has been removed. This affects consumers of the Node.js API (for example, custom formatters and editor/tool integrations) that previously relied on `message.nodeType`.
422
453
423
-
**To address:** Remove all usages of `message.nodeType` in your integrations and formatters.
454
+
**Codemod:** Use the [@eslint/v9-to-v10-linter-api](#use-migration-codemods) codemod to automate this change.
455
+
456
+
**To address:** Remove all usages of `message.nodeType` in your integrations and formatters manually.
0 commit comments