diff --git a/eslint.config.mjs b/eslint.config.mjs
index aa94178c..88e13f44 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -41,12 +41,6 @@ export default tseslint.config(
ignoreRestSiblings: true,
},
],
- // TODO: hooks called inside render callbacks, incorrect hook usage patterns,
- // and missing/extra effect dependencies — to be fixed in a separate ticket.
- 'react-hooks/rules-of-hooks': 'off',
- 'react-hooks/refs': 'off',
- 'react-hooks/set-state-in-render': 'off',
- 'react-hooks/set-state-in-effect': 'off',
'react-hooks/immutability': 'off',
'react-hooks/exhaustive-deps': 'off',
// TypeScript handles these; disable the core JS versions.
@@ -61,10 +55,15 @@ export default tseslint.config(
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
- '@typescript-eslint/no-unnecessary-type-assertion': 'off',
- '@typescript-eslint/no-redundant-type-constituents': 'off',
+ },
+ },
+ {
+ // Test files: `async` test callbacks and `act(async () => {})` wrappers are
+ // idiomatic even when they contain no `await` (async `act` flushes the
+ // microtask queue). Relaxing require-await here avoids churn in test infra.
+ files: ['**/*.spec.{ts,tsx}', '**/*.test.{ts,tsx}'],
+ rules: {
'@typescript-eslint/require-await': 'off',
- '@typescript-eslint/no-misused-promises': 'off',
},
},
prettierRecommended,
diff --git a/src/app/[locale]/account/AccountGeneral.tsx b/src/app/[locale]/account/AccountGeneral.tsx
index ea469f56..1d70c994 100644
--- a/src/app/[locale]/account/AccountGeneral.tsx
+++ b/src/app/[locale]/account/AccountGeneral.tsx
@@ -42,6 +42,9 @@ export default function AccountGeneral(): React.ReactElement {
draftIsRegisteredToReceiveAPIAnnouncements,
setDraftIsRegisteredToReceiveAPIAnnouncements,
] = React.useState(false);
+ const [alertSeverity, setAlertSeverity] = React.useState<'success' | 'error'>(
+ 'success',
+ );
const handleEditClick = (): void => {
setDraftFullName(user?.fullName ?? '');
@@ -76,14 +79,13 @@ export default function AccountGeneral(): React.ReactElement {
React.useEffect(() => {
if (saveStatus === 'success') {
setIsEditing(false);
+ setAlertSeverity('success');
+ } else if (saveStatus === 'fail') {
+ setAlertSeverity('error');
}
}, [saveStatus]);
- // Reference is due to dispatch save status acting faster than the exit animation of the alert, causing a flash of the wrong alert severity. With this reference, the severity will be consistent during the whole display of the alert.
const isSaving = saveStatus === 'loading';
- const alertSeverity = React.useRef<'success' | 'error'>('success');
- if (saveStatus === 'success') alertSeverity.current = 'success';
- if (saveStatus === 'fail') alertSeverity.current = 'error';
return (
<>
@@ -96,15 +98,13 @@ export default function AccountGeneral(): React.ReactElement {
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
>
{
dispatch(saveUserProfileReset());
}}
sx={{ width: '100%' }}
>
- {alertSeverity.current === 'success'
- ? t('saveSuccess')
- : t('saveError')}
+ {alertSeverity === 'success' ? t('saveSuccess') : t('saveError')}
{
+ onSubmit: (values) => {
if (user != null) {
dispatch(
refreshUserInformation({
diff --git a/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx
index a203f336..35893604 100644
--- a/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx
+++ b/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx
@@ -107,7 +107,11 @@ export default function FormFirstStep({
return (
<>
-