Skip to content

Commit 3eb1262

Browse files
committed
Add v1 -> v2 migration instructions
1 parent 60a37c4 commit 3eb1262

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Find an overview of what rules are enabled, and why, in this article:
66

77
📚 [**14 Linting Rules To Help You Write Asynchronous Code in JavaScript**](https://maximorlov.com/linting-rules-for-asynchronous-code-in-javascript/)
88

9+
## Table of contents
10+
11+
- [Installation & usage](#installation--usage)
12+
- [Migrating from v1 to v2](#migrating-from-v1-to-v2)
13+
914
## Installation & usage
1015

1116
### Base rules
@@ -73,3 +78,53 @@ module.exports = {
7378
}
7479
};
7580
```
81+
82+
## Migrating from v1 to v2
83+
84+
Version 2 adds TypeScript specific rules and exports multiple configs, namely:
85+
86+
- Base rules (`eslint-config-async`)
87+
- Node.js specific rules (`eslint-config-async/node`)
88+
- TypeScript rules (`eslint-config-async/typescript`)
89+
90+
In version 1, the base and Node.js specific rules were included by default. In version 2, you need to explicitly add the Node.js rules:
91+
92+
```diff
93+
module.exports = {
94+
extends: [
95+
- 'eslint-config-async'
96+
+ 'eslint-config-async',
97+
+ 'eslint-config-async/node'
98+
],
99+
}
100+
```
101+
102+
Or using the short syntax:
103+
104+
```diff
105+
module.exports = {
106+
extends: [
107+
- 'eslint-config-async'
108+
+ 'async',
109+
+ 'async/node'
110+
],
111+
}
112+
```
113+
114+
If you added the TypeScript specific rules manually in your project, you can remove them and replace them with this config:
115+
116+
```diff
117+
module.exports = {
118+
extends: [
119+
'async',
120+
'async/node',
121+
+ 'async/typescript'
122+
],
123+
rules: {
124+
- "@typescript-eslint/await-thenable": "error",
125+
- "@typescript-eslint/no-floating-promises": "error",
126+
- "@typescript-eslint/no-misused-promises": "error",
127+
- "@typescript-eslint/promise-function-async": "error",
128+
}
129+
}
130+
```

0 commit comments

Comments
 (0)