Skip to content

Commit 47492ba

Browse files
committed
chore(configs): add react-hooks to eslint rules
1 parent 5746100 commit 47492ba

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

.eslintrc.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"es6": true
55
},
66
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
7-
// Specifying Parser
87
"parser": "@typescript-eslint/parser",
98
"parserOptions": {
109
"ecmaFeatures": {
@@ -15,12 +14,9 @@
1514
"tsconfigRootDir": ".",
1615
"project": ["./tsconfig.json"]
1716
},
18-
// Configuring third-party plugins
19-
"plugins": ["@typescript-eslint"],
20-
// Resolve imports
17+
"plugins": ["@typescript-eslint", "react-hooks"],
2118
"rules": {
2219
"linebreak-style": "off",
23-
// Disallow the `any` type.
2420
"@typescript-eslint/no-explicit-any": "warn",
2521
"@typescript-eslint/ban-types": [
2622
"error",
@@ -31,8 +27,8 @@
3127
}
3228
}
3329
],
34-
"react-hooks/exhaustive-deps": "off",
35-
// Enforce the use of the shorthand syntax.
30+
"react-hooks/rules-of-hooks": "error",
31+
"react-hooks/exhaustive-deps": "warn",
3632
"object-shorthand": "error",
3733
"no-console": "warn"
3834
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"eslint": "^8.56.0",
1616
"eslint-config-prettier": "^9.1.0",
1717
"eslint-plugin-prettier": "^5.1.3",
18+
"eslint-plugin-react-hooks": "^4.6.0",
1819
"husky": "^9.0.10",
1920
"lint-staged": "^15.2.2",
2021
"prettier": "^3.2.5",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,11 @@ eslint-plugin-prettier@^5.1.3:
891891
prettier-linter-helpers "^1.0.0"
892892
synckit "^0.8.6"
893893

894+
eslint-plugin-react-hooks@^4.6.0:
895+
version "4.6.0"
896+
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
897+
integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==
898+
894899
eslint-scope@^7.2.2:
895900
version "7.2.2"
896901
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f"

0 commit comments

Comments
 (0)