adding eslint-plugin-react-hooks plugin and fixing 1 error

This commit is contained in:
Dan 2022-02-14 13:33:52 +00:00 committed by Aria
parent 93d1cfa5ec
commit 72c7b2b9ce
4 changed files with 13 additions and 5 deletions

View file

@ -1,7 +1,7 @@
module.exports = { module.exports = {
root: true, root: true,
plugins: ['unused-imports', 'eslint-plugin-tsdoc'], plugins: ['unused-imports', 'eslint-plugin-tsdoc'],
extends: [], extends: ['plugin:react-hooks/recommended'],
rules: { rules: {
'unused-imports/no-unused-imports': 'warn', 'unused-imports/no-unused-imports': 'warn',
'tsdoc/syntax': 'warn', 'tsdoc/syntax': 'warn',

View file

@ -41,7 +41,7 @@
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.25.1", "eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-tsdoc": "^0.2.14", "eslint-plugin-tsdoc": "^0.2.14",
"eslint-plugin-unused-imports": "^1.1.4", "eslint-plugin-unused-imports": "^1.1.4",
"husky": "^6.0.0", "husky": "^6.0.0",

View file

@ -11,9 +11,8 @@ const EditorHelper = <T extends ElementType>({
component: Component, component: Component,
...props ...props
}: EditorHelperProps<T>) => { }: EditorHelperProps<T>) => {
const helpersRoot = useEditorStore((state) => state.helpersRoot)
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
const helpersRoot = useEditorStore((state) => state.helpersRoot)
return <>{createPortal(<Component {...props} />, helpersRoot)}</> return <>{createPortal(<Component {...props} />, helpersRoot)}</>
} else { } else {
return null return null

View file

@ -11116,6 +11116,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint-plugin-react-hooks@npm:^4.3.0":
version: 4.3.0
resolution: "eslint-plugin-react-hooks@npm:4.3.0"
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
checksum: 55d65863c0aeebbb470c494fe7fdf014b661c5aef21d1ab0c4f19b291d28b2a905de78eb6133891e4677abb7bc37c8b4a252aef007de1559ae28ad70e57d494a
languageName: node
linkType: hard
"eslint-plugin-react@npm:^7.21.5": "eslint-plugin-react@npm:^7.21.5":
version: 7.24.0 version: 7.24.0
resolution: "eslint-plugin-react@npm:7.24.0" resolution: "eslint-plugin-react@npm:7.24.0"
@ -22880,7 +22889,7 @@ fsevents@^1.2.7:
eslint: ^7.32.0 eslint: ^7.32.0
eslint-plugin-jsx-a11y: ^6.4.1 eslint-plugin-jsx-a11y: ^6.4.1
eslint-plugin-react: ^7.25.1 eslint-plugin-react: ^7.25.1
eslint-plugin-react-hooks: ^4.2.0 eslint-plugin-react-hooks: ^4.3.0
eslint-plugin-tsdoc: ^0.2.14 eslint-plugin-tsdoc: ^0.2.14
eslint-plugin-unused-imports: ^1.1.4 eslint-plugin-unused-imports: ^1.1.4
husky: ^6.0.0 husky: ^6.0.0