Skip to content

Commit

Permalink
Add eslint-plugin-react-hooks (#773)
Browse files Browse the repository at this point in the history
Signed-off-by: MTRNord <[email protected]>
Signed-off-by: Michael Weimann <[email protected]>
Co-authored-by: Michael Weimann <[email protected]>
  • Loading branch information
MTRNord and weeman1337 authored Sep 24, 2024
1 parent ecd8c11 commit 1ccdb78
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import jest from 'eslint-plugin-jest';
import notice from 'eslint-plugin-notice';
import pluginPromise from 'eslint-plugin-promise';
import react from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import testingLibrary from 'eslint-plugin-testing-library';
import path from 'path';
import ts from 'typescript-eslint';
Expand Down Expand Up @@ -78,7 +79,12 @@ export default ts.config(
},
{
...react.configs.flat.recommended,
plugins: {
...react.configs.flat.recommended.plugins,
'react-hooks': fixupPluginRules(hooksPlugin),
},
rules: {
...hooksPlugin.configs.recommended.rules,
...react.configs.flat.recommended.rules,
'react/no-unescaped-entities': 'off',
// Disabled because it would conflict with removing unused imports
Expand Down
2 changes: 1 addition & 1 deletion example-widget-mui/src/ImagePage/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const Image: React.FC<ImageProps> = function ({
console.log('Error downloading file', error);
}
})();
}, [contentUrl]);
}, [contentUrl, widgetApi]);

if (dataUrl === undefined) {
return null;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"eslint-plugin-notice": "^1.0.0",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-testing-library": "^6.3.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5897,6 +5897,11 @@ eslint-plugin-react-hooks@^4.3.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172"
integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA==

eslint-plugin-react-hooks@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.2.tgz#c829eb06c0e6f484b3fbb85a97e57784f328c596"
integrity sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==

eslint-plugin-react@^7.27.1, eslint-plugin-react@^7.36.1:
version "7.36.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.36.1.tgz#f1dabbb11f3d4ebe8b0cf4e54aff4aee81144ee5"
Expand Down

0 comments on commit 1ccdb78

Please sign in to comment.