Skip to content

Commit 9abc0d5

Browse files
authored
Added react-typescript config (#67)
1 parent a38e6de commit 9abc0d5

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ For validating **React** project use `react` version (`htmlacademy/react` includ
5252
}
5353
```
5454

55-
Caution! `htmlacademy/react` doesn't include `react-hooks/rules-of-hooks` and `react-hooks/exhaustive-deps` because in our courses we use CRA (Create React App) which includes these plugins out of box. Install them yourself if necessary.
55+
For validating **React** project with TypeScript use `react-typescript` version (`htmlacademy/react-typescript` includes `react/recommended` and `@typescript-eslint/recommended`):
56+
57+
```json
58+
{
59+
"parserOptions": {
60+
"ecmaVersion": 2018,
61+
"sourceType": "module"
62+
},
63+
"env": {
64+
"es2017": true,
65+
"browser": true
66+
},
67+
"extends": "htmlacademy/react-typescript",
68+
"rules": {
69+
// Additional rules...
70+
}
71+
}
72+
```
73+
74+
Caution! `htmlacademy/react` and `htmlacademy/react-typescript` doesn't include `react-hooks/rules-of-hooks` and `react-hooks/exhaustive-deps` because in our courses we use CRA (Create React App) which includes these plugins out of box. Install them yourself if necessary.
5675

5776
**Node.js** versions soon.

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module.exports = {
66
'htmlacademy/node',
77
'htmlacademy/vanilla',
88
'htmlacademy/react',
9+
'htmlacademy/react-typescript',
910
]
1011
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"node.js",
1010
"vanilla.js",
1111
"react.js",
12+
"react-typescript.js",
1213
"index.js"
1314
],
1415
"keywords": [

react-typescript.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
extends: [
3+
'htmlacademy/react',
4+
'plugin:@typescript-eslint/recommended'
5+
],
6+
rules: {
7+
'no-use-before-define': 'off',
8+
'@typescript-eslint/no-use-before-define': ['error'],
9+
'no-shadow': 'off',
10+
'@typescript-eslint/no-shadow': 'error',
11+
"no-unused-vars": "off",
12+
"@typescript-eslint/no-unused-vars": ["error"]
13+
}
14+
}

0 commit comments

Comments
 (0)