diff --git a/eslint.config.mjs b/eslint.config.mjs index d99771c1..21df0f2d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -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'; @@ -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 diff --git a/example-widget-mui/src/ImagePage/Image.tsx b/example-widget-mui/src/ImagePage/Image.tsx index a3e5f8ea..f6e6bf7b 100644 --- a/example-widget-mui/src/ImagePage/Image.tsx +++ b/example-widget-mui/src/ImagePage/Image.tsx @@ -56,7 +56,7 @@ export const Image: React.FC = function ({ console.log('Error downloading file', error); } })(); - }, [contentUrl]); + }, [contentUrl, widgetApi]); if (dataUrl === undefined) { return null; diff --git a/package.json b/package.json index 9c6ad546..cea42fa0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index c5aad0bf..9932f5aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"