1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-26 21:12:59 +02:00

Tools: Resolves #2579: Add support for Rule of Hooks plugin (#2579) (#2585)

* installed eslint-plugin-react-hooks and set up rules of hooks

* fixed linter error

* changed react-hooks/exhaustive-deps option to error

* changed spaces to tabs in eslint config
This commit is contained in:
Runo Saduwa 2020-02-27 01:20:55 +01:00 committed by GitHub
parent 4840671f0e
commit 25a246b6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 1 deletions

View File

@ -53,6 +53,11 @@ module.exports = {
// possible race conditions in contexts where we know it cannot happen.
"require-atomic-updates": 0,
// Checks rules of Hooks
"react-hooks/rules-of-hooks": "error",
// Checks effect dependencies
"react-hooks/exhaustive-deps": "error",
// -------------------------------
// Formatting
// -------------------------------
@ -90,5 +95,6 @@ module.exports = {
"plugins": [
"react",
"@typescript-eslint",
"react-hooks"
],
};

View File

@ -34,7 +34,7 @@ export default function NoteContentPropertiesDialog(props:NoteContentPropertiesD
setCharactersNoSpace(counter.characters);
});
setLines(props.text.split('\n').length);
}, []);
}, [props.text]);
const textProperties: TextPropertiesMap = {
lines: lines,

6
package-lock.json generated
View File

@ -1695,6 +1695,12 @@
}
}
},
"eslint-plugin-react-hooks": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.4.0.tgz",
"integrity": "sha512-bH5DOCP6WpuOqNaux2BlaDCrSgv8s5BitP90bTgtZ1ZsRn2bdIfeMDY5F2RnJVnyKDy6KRQRDbipPLZ1y77QtQ==",
"dev": true
},
"eslint-scope": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",

View File

@ -32,6 +32,7 @@
"@typescript-eslint/parser": "^2.10.0",
"eslint": "^6.1.0",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.4.0",
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"gulp": "^4.0.2",