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 }}
This repository was archived by the owner on May 12, 2025. It is now read-only.
BREAKING CHANGE: Install `eslint-config-airbnb` (or `eslint-config-airbnb-base`) and `@typescript-eslint/parser` as dependencies. Follow the updated README.md file.
Make sure you have the regular Airbnb config setup. See [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb), or [eslint-config-airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base) if you're not using React.
16
12
17
-
ESLint plugins used by this config must also be installed within your project. This is a limitation within ESLint (see [RFC](https://github.com/eslint/rfcs/tree/master/designs/2019-config-simplification)and [progress](https://github.com/eslint/eslint/issues/13481)).
13
+
### 2) Install this config (and peer dependencies)
18
14
19
15
```bash
20
-
npm install eslint-plugin-import@^2.22.0 \
21
-
eslint-plugin-jsx-a11y@^6.3.1 \
22
-
eslint-plugin-react@^7.20.3 \
23
-
eslint-plugin-react-hooks@^4.0.8 \
24
-
@typescript-eslint/eslint-plugin@^4.4.1 \
25
-
--save-dev
26
-
```
27
-
28
-
If you don't need React support:
29
-
30
-
```bash
31
-
npm install eslint-plugin-import@^2.22.0 \
32
-
@typescript-eslint/eslint-plugin@^4.4.1 \
16
+
npm install eslint-config-airbnb-typescript \
17
+
@typescript-eslint/eslint-plugin \
18
+
@typescript-eslint/parser \
33
19
--save-dev
34
20
```
35
21
36
22
### 3) Configure ESLint
37
23
38
-
Add `"extends": "airbnb-typescript"` to your ESLint config file.
24
+
Within your ESLint config file:
39
25
40
-
If you don't need React support, add `"extends": "airbnb-typescript/base"` instead.
26
+
```diff
27
+
extends: [
28
+
'airbnb',
29
+
+ 'airbnb-typescript'
30
+
]
31
+
```
41
32
42
-
An example `.eslintrc.js`:
33
+
If you don't need React support:
43
34
44
-
```js
45
-
module.exports= {
46
-
extends: ['airbnb-typescript'],
47
-
};
35
+
```diff
36
+
extends: [
37
+
'airbnb-base',
38
+
+ 'airbnb-typescript/base'
39
+
]
48
40
```
49
41
50
42
### 4) Configure the ESLint TypeScript parser
@@ -56,12 +48,12 @@ In your ESLint config, set [parserOptions.project](https://github.com/typescript
56
48
For example:
57
49
58
50
```diff
59
-
module.exports = {
60
-
extends: ['airbnb-typescript'],
61
-
+parserOptions: {
62
-
+project: './tsconfig.json',
51
+
{
52
+
extends: ['airbnb', 'airbnb-typescript'],
53
+
+ parserOptions: {
54
+
+ project: './tsconfig.json'
63
55
+ }
64
-
};
56
+
}
65
57
```
66
58
67
59
### 5) Run ESLint
@@ -78,10 +70,6 @@ You can also get results in realtime inside most IDEs via a plugin.
78
70
79
71
## FAQ
80
72
81
-
### Does this work with JavaScript files too?
82
-
83
-
Yep! This config is a drop-in replacement for `eslint-config-airbnb`, decorating it with TypeScript support.
84
-
85
73
### I get this error when running ESLint: "The file must be included in at least one of the projects provided"
86
74
87
75
This means you are attempting to lint a file that `tsconfig.json` doesn't include.
@@ -104,17 +92,20 @@ parserOptions: {
104
92
}
105
93
```
106
94
107
-
### I get peer dependency warnings for ESLint React plugins, but I'm using `airbnb-typescript/base`
95
+
### Why do I need the peer dependencies?
96
+
97
+
`@typescript-eslint/eslint-plugin` is a peer dependency because of a limitation within ESLint. See [issue](https://github.com/eslint/eslint/issues/3458), [RFC](https://github.com/eslint/rfcs/tree/master/designs/2019-config-simplification), and [progress](https://github.com/eslint/eslint/issues/13481).
108
98
109
-
This is a known problem. Some suggestions exist in this [GitHub issue](https://github.com/iamturns/eslint-config-airbnb-typescript/issues/6).
99
+
`@typescript-eslint/parser` is a peer dependency because the version number must match `@typescript-eslint/eslint-plugin`.
110
100
111
101
### I wish this config would support [...]
112
102
113
-
The goal of `eslint-config-airbnb-typescript` is to simply decorate `eslint-config-airbnb` with TypeScript support. It's not a single config to cater for all TypeScript linting requirements. For additional functionality, alter your ESLint config file. For example:
103
+
This configsimply enhances the Airbnb with TypeScript support. It's not a single config to cater for all TypeScript linting requirements. For additional functionality, alter your ESLint config file. For example:
0 commit comments