diff --git a/frontend/.prettierignore b/frontend/.prettierignore index 91a3983..2368dab 100644 --- a/frontend/.prettierignore +++ b/frontend/.prettierignore @@ -1,3 +1,8 @@ dist node_modules package-lock.json +# Generated by tests and coverage, the same folders as in .gitignore +coverage +test-results +playwright-report +blob-report diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index 8d061c7..d71ae67 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -7,7 +7,8 @@ import { defineConfig, globalIgnores } from 'eslint/config'; import prettier from 'eslint-config-prettier'; export default defineConfig([ - globalIgnores(['dist']), + // Built and generated files, the same folders as in .gitignore. + globalIgnores(['dist', 'coverage', 'test-results', 'playwright-report', 'blob-report']), { files: ['**/*.{ts,tsx}'], extends: [ diff --git a/frontend/src/features/auth/components/AuthForm.tsx b/frontend/src/features/auth/components/AuthForm.tsx index 0958fc3..be48b9c 100644 --- a/frontend/src/features/auth/components/AuthForm.tsx +++ b/frontend/src/features/auth/components/AuthForm.tsx @@ -37,17 +37,18 @@ export function AuthForm({ mode, onSubmit }: AuthFormProps) { const [formError, setFormError] = useState(''); const [working, setWorking] = useState(false); const id = useId(); - const inputs = { - username: useRef(null), - password: useRef(null), - }; + // Two plain refs, passed straight to `ref`. Keeping them in an object and reading + // `inputs.password` while rendering breaks the react-hooks/refs rule (React Compiler). + const usernameInput = useRef(null); + const passwordInput = useRef(null); const isRegister = mode === 'register'; /** Shows the messages and moves focus to the first field that has one. */ function showFieldErrors(errors: FieldErrors) { setFieldErrors(errors); const first = FIELDS.find((field) => errors[field]); - if (first) inputs[first].current?.focus(); + if (first === 'username') usernameInput.current?.focus(); + else if (first === 'password') passwordInput.current?.focus(); } async function handleSubmit(event: FormEvent) { @@ -102,7 +103,7 @@ export function AuthForm({ mode, onSubmit }: AuthFormProps) {

)} )}