Skip to content

Commit

Permalink
feat: add eslint-plugin-react-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Xooone47 committed Jul 6, 2022
1 parent 9852952 commit 8bc88c0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'jsx': true,
},
},
plugins: ['react', 'import', '@typescript-eslint'],
plugins: ['react', 'import', '@typescript-eslint', 'react-hooks'],
env: {
'browser': true,
'node': true,
Expand Down Expand Up @@ -43,6 +43,10 @@ module.exports = {
],
'import/no-unresolved': 2,

// react hook rules
'react-hooks/rules-of-hooks': 2,
'react-hooks/exhaustive-deps': 2,

// ECMAScript rules
'accessor-pairs': 'warn',
'array-bracket-newline': ['warn', {'multiline': true}],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-rich-reporter": "^0.0.10",
"eslint-webpack-plugin": "^3.1.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/RecoilDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const RecoilDemo = () => {
e => {
setFilter(e.target.value);
},
[]
[setFilter]
);

return (
Expand Down
1 change: 0 additions & 1 deletion src/components/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {FC, useEffect, useCallback, useState} from 'react';
import {Button} from 'antd';
import {useCurrentUser, useActions} from '@/hooks';
import {fetchUserInfo} from '@/actions';
import {apiGetTest} from '@/apis';
import ConcurrentDemo from './ConcurrentDemo';
import RecoilDemo from './RecoilDemo';
import styles from './index.less';
Expand Down
14 changes: 6 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3575,20 +3575,13 @@ copy-descriptor@^0.1.0:
resolved "https://registry.npm.taobao.org/copy-descriptor/download/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=

copy-to-clipboard@^3.2.0:
copy-to-clipboard@^3.2.0, copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.npm.taobao.org/copy-to-clipboard/download/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha1-EVqhqZmP+rYZb5MHatbaO5E2Yq4=
dependencies:
toggle-selection "^1.0.6"

copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.npmmirror.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
dependencies:
toggle-selection "^1.0.6"

core-js-compat@^3.6.2:
version "3.6.5"
resolved "https://registry.npm.taobao.org/core-js-compat/download/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c"
Expand Down Expand Up @@ -4478,6 +4471,11 @@ eslint-plugin-import@^2.22.1:
resolve "^1.17.0"
tsconfig-paths "^3.9.0"

eslint-plugin-react-hooks@^4.6.0:
version "4.6.0"
resolved "https://registry.npmmirror.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==

eslint-plugin-react@^7.7.0:
version "7.19.0"
resolved "https://registry.npm.taobao.org/eslint-plugin-react/download/eslint-plugin-react-7.19.0.tgz#6d08f9673628aa69c5559d33489e855d83551666"
Expand Down

0 comments on commit 8bc88c0

Please sign in to comment.