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
* chore: bump peer dependency version
* Update README.md
* Upgrade to ESLint v9
- Update supported Node.js versions to conform to ESLint v9
- Replace eslint-config-node (unmaintaned) with eslint-config-n. Also move from peer dependency to dependency
- Replace @typescript-eslint/parser & @typescript-eslint/eslint-plugin with typescript-eslint
- Mark typescript as optional peer dependency
- Merge index.js, node.js, and typescript.js into single file with named exports
- Update Installation instructions for Non-TS and TS users
- Add migration guide from v2 to v3
- Add ESLint & Node.js version requirements, and direct ESLint v8 users to v2
* Update package-lock.json
---------
Co-authored-by: Maxim Orlov <[email protected]>
@@ -8,75 +8,156 @@ Find an overview of what rules are enabled, and why, in this article:
8
8
9
9
## Table of contents
10
10
11
-
-[Installation & usage](#installation--usage)
11
+
-[Table of contents](#table-of-contents)
12
+
-[Requirements](#requirements)
13
+
-[Installation \& usage](#installation--usage)
14
+
-[Non-TypeScript users](#non-typescript-users)
15
+
-[TypeScript users](#typescript-users)
16
+
-[Migrating from v2 to v3](#migrating-from-v2-to-v3)
12
17
-[Migrating from v1 to v2](#migrating-from-v1-to-v2)
13
18
19
+
## Requirements
20
+
21
+
- ESLint v9
22
+
- Node.js ^18.18.0, ^20.9.0, or >=21.1.0 (set by ESLint v9)
23
+
24
+
If you're using ESLint v8, you should use v2 of this library. [Installation & usage for eslint-config-async v2](https://github.com/Maximization/eslint-config-async/blob/v2.0.3/README.md).
25
+
14
26
## Installation & usage
15
27
16
-
### Base rules
28
+
### Non-TypeScript users
17
29
Install this package and ESLint:
18
30
19
31
```shell
20
32
npm install --save-dev eslint eslint-config-async
21
33
```
22
34
23
-
In your `.eslintrc.js` configuration file:
35
+
In your `eslint.config.js` configuration file:
24
36
25
37
```js
26
-
module.exports= {
27
-
extends: [
28
-
'async'
29
-
],
30
-
};
38
+
constasyncConfig=require("eslint-config-async");
39
+
40
+
module.exports= [
41
+
...asyncConfig.base, // enable base rules
42
+
...asyncConfig.node, // enable Node.js specific rules (recommended)
43
+
];
31
44
```
32
45
33
-
### Base rules + Node.js specific rules (recommended for non-TypeScript users)
tseslint.configs.base, // adds the parser only, without any rules
63
+
// or
64
+
...tseslint.configs.recommended, // includes base + a list of recommended rules
65
+
// ..and others
66
+
67
+
...asyncConfig.base, // enable base rules
68
+
...asyncConfig.node, // enable Node.js specific rules (recommended)
69
+
...asyncConfig.typescript, // enable TypeScript specific rules
70
+
{
71
+
files: ["*.ts"], // tell ESLint to include TypeScript files
72
+
languageOptions: {
73
+
parserOptions: {
74
+
projectService:true,
75
+
tsconfigRootDir:import.meta.dirname,
76
+
},
77
+
},
78
+
},
79
+
];
52
80
```
53
81
54
-
### Base rules + Node.js specific rules + TypeScript rules (recommended for TypeScript users)
55
-
Install this package and its peer dependencies:
82
+
## Migrating from v2 to v3
83
+
84
+
Version 3 upgrades ESLint to v9. ESLint uses a [flat configuration file](https://eslint.org/docs/latest/use/configure/configuration-files). `.eslintrc.*` has been deprecated and you should rename it to `eslint.config.js` (or .cjs, .mjs):
85
+
86
+
```diff
87
+
- .eslintrc
88
+
+ eslint.config.js
89
+
```
90
+
91
+
In your `eslint.config.js` file, make the following changes:
+ ...asyncConfig.node, // enable Node.js specific rules (recommended)
108
+
+ ];
109
+
```
110
+
111
+
`eslint-plugin-node` is no longer maintained and has been replaced with its fork, `eslint-plugin-n`. `eslint-plugin-n` is not a peer dependency and is included with this library, therefore you no longer need to install it separately:
0 commit comments