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
Copy file name to clipboardExpand all lines: readme.md
+63-11Lines changed: 63 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,40 @@ Install the package:
25
25
npm i -D @aboutbits/eslint-config
26
26
```
27
27
28
+
We recommend linting by running `eslint` without `--ext` option. What files are to be linted should be specified inside the ESLint config and the TypeScript config.
29
+
All files included (or not ignored) by the ESLint config (`.eslintrc.json`) must be included by the TypeScript config (`tsconfig.json`).
30
+
For example, if this is your `.eslintrc.json`:
31
+
32
+
```json
33
+
{
34
+
// ...remaining config
35
+
"ignorePatterns": ["node_modules", "dist"]
36
+
}
37
+
```
38
+
39
+
You may include the following files inside your `tsconfig.json`:
40
+
41
+
```json
42
+
{
43
+
// ...remaining config
44
+
"exclude": ["node_modules", "dist"],
45
+
"include": ["**/*.ts", "**/*.tsx"]
46
+
}
47
+
```
48
+
49
+
Should you have files that you want to be linted, but not inside your `tsconfig.json`, you can create a `tsconfig.eslint.json` file.
50
+
Then change `.eslintrc.json` to be:
51
+
52
+
```json
53
+
{
54
+
// ...omitted
55
+
"parserOptions": {
56
+
"project": "./tsconfig.eslint.json"
57
+
}
58
+
// ...omitted
59
+
}
60
+
```
61
+
28
62
### TypeScript
29
63
30
64
Install the required packages:
@@ -33,11 +67,14 @@ Install the required packages:
33
67
npm i -D eslint prettier @typescript-eslint/eslint-plugin eslint-plugin-prettier eslint-plugin-import
34
68
```
35
69
36
-
`.eslintrc`
70
+
`.eslintrc.json`
37
71
38
72
```json
39
73
{
40
-
"extends": "@aboutbits/eslint-config/ts"
74
+
"extends": "@aboutbits/eslint-config/ts",
75
+
"parserOptions": {
76
+
"project": true
77
+
}
41
78
}
42
79
```
43
80
@@ -49,11 +86,14 @@ Install the required packages:
49
86
npm i -D eslint prettier @typescript-eslint/eslint-plugin eslint-plugin-prettier eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks
50
87
```
51
88
52
-
`.eslintrc`
89
+
`.eslintrc.json`
53
90
54
91
```json
55
92
{
56
-
"extends": "@aboutbits/eslint-config/ts-react"
93
+
"extends": "@aboutbits/eslint-config/ts-react",
94
+
"parserOptions": {
95
+
"project": true
96
+
}
57
97
}
58
98
```
59
99
@@ -65,11 +105,14 @@ Install the required packages:
0 commit comments