Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

feat(forms): enforce the validation convention (noValidate + useForm lint guard)

Sergey Kozyrenko3ac35ee0d25c
diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs
index 33deafbc..fe438889 100644
--- a/frontend/eslint.config.mjs
+++ b/frontend/eslint.config.mjs
@@ -36,6 +36,15 @@ const eslintConfig = [
],
curly: ['error', 'all'],
'no-fallthrough': 'off',
+ 'no-restricted-syntax': [
+ 'error',
+ {
+ message:
+ 'Do not set mode/reValidateMode on useForm — use useAppForm, which owns the silent-until-submit form timing.',
+ selector:
+ 'CallExpression[callee.name="useForm"] > ObjectExpression > Property[key.name="mode"], CallExpression[callee.name="useForm"] > ObjectExpression > Property[key.name="reValidateMode"]',
+ },
+ ],
'padding-line-between-statements': [
'error',
{
@@ -76,6 +85,12 @@ const eslintConfig = [
'react/prop-types': 'off', // TypeScript provides type checking
},
},
+ {
+ // useAppForm is the single owner of the form timing — the one place
+ // allowed to set mode/reValidateMode on useForm.
+ files: ['src/hooks/use-app-form.ts'],
+ rules: { 'no-restricted-syntax': 'off' },
+ },
perfectionist.configs['recommended-natural'],
{
ignores: ['node_modules/**', 'dist/**', 'build/**', 'public/mockServiceWorker.js', 'src/graphql/types.ts'],
diff --git a/frontend/src/features/authentication/login-form.tsx b/frontend/src/features/authentication/login-form.tsx
index 5c75e2d9..966076ab 100644
--- a/frontend/src/features/authentication/login-form.tsx
+++ b/frontend/src/features/authentication/login-form.tsx
@@ -173,6 +173,7 @@ function LoginForm({ providers, returnUrl = routes.newFlow }: LoginFormProps) {
<Form {...form}>
<form
className="mx-auto grid w-[350px] gap-8"
+ noValidate
onSubmit={form.handleSubmit(handleSubmit)}
>
<h1 className="text-center text-3xl font-bold">PentAGI</h1>
diff --git a/frontend/src/features/authentication/name-change-form.tsx b/frontend/src/features/authentication/name-change-form.tsx
index 6e321596..7e332605 100644
--- a/frontend/src/features/authentication/name-change-form.tsx
+++ b/frontend/src/features/authentication/name-change-form.tsx
@@ -62,6 +62,7 @@ export function NameChangeForm({ onCancel, onSuccess }: NameChangeFormProps) {
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={form.handleSubmit(handleSubmit)}
>
<FormField
diff --git a/frontend/src/features/authentication/password-change-form.tsx b/frontend/src/features/authentication/password-change-form.tsx
index 84b5656b..96058bb1 100644
--- a/frontend/src/features/authentication/password-change-form.tsx
+++ b/frontend/src/features/authentication/password-change-form.tsx
@@ -138,6 +138,7 @@ export function PasswordChangeForm({
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={form.handleSubmit(handleSubmit)}
>
<FormField
diff --git a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx
index be246349..dca26820 100644
--- a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx
+++ b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx
@@ -213,6 +213,7 @@ function FlowFilesPromoteDialogForm({ files, flowId, onClose }: FlowFilesPromote
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={handleSave}
>
<FormField
diff --git a/frontend/src/features/flows/flow-form.tsx b/frontend/src/features/flows/flow-form.tsx
index 8568b340..451dd12b 100644
--- a/frontend/src/features/flows/flow-form.tsx
+++ b/frontend/src/features/flows/flow-form.tsx
@@ -157,6 +157,7 @@ export function FlowForm({
resourceIds: defaultValues?.resourceIds ?? [],
useAgents: defaultValues?.useAgents ?? false,
},
+ // eslint-disable-next-line no-restricted-syntax -- flow-form keeps live validation; useAppForm migration deferred
mode: 'onChange',
resolver: zodResolver(formSchema),
});
@@ -483,7 +484,10 @@ export function FlowForm({
return (
<Form {...form}>
- <form onSubmit={handleFormSubmit(handleSubmit)}>
+ <form
+ noValidate
+ onSubmit={handleFormSubmit(handleSubmit)}
+ >
<FormField
control={control}
name="message"
diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsx
index 102ddbad..b297365e 100644
--- a/frontend/src/features/knowledges/knowledge-form.tsx
+++ b/frontend/src/features/knowledges/knowledge-form.tsx
@@ -363,12 +363,12 @@ export function KnowledgeForm({ initialValues, isNew, knowledge, onSubmit }: Kno
return (
<>
<Form {...form}>
- <form
- // Desktop: lock to the viewport so the resizable panels
+ <form // Desktop: lock to the viewport so the resizable panels
// inside the body can fill the remaining space below the
// sticky header. Mobile: allow the page to grow with its
// content (single column, vertical scroll).
className={isDesktop ? 'flex h-[100dvh] min-h-0 w-full flex-col' : 'flex min-h-[100dvh] flex-col'}
+ noValidate
onSubmit={handleSubmit(onSubmitWithGuard)}
>
<KnowledgeFormHeader
diff --git a/frontend/src/features/resources/resources-copy-dialog.tsx b/frontend/src/features/resources/resources-copy-dialog.tsx
index d974158b..aa57a592 100644
--- a/frontend/src/features/resources/resources-copy-dialog.tsx
+++ b/frontend/src/features/resources/resources-copy-dialog.tsx
@@ -208,6 +208,7 @@ function ResourcesCopyDialogForm({ files, onClose }: ResourcesCopyDialogFormProp
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={handleSave}
>
<FormField
diff --git a/frontend/src/features/resources/resources-mkdir-dialog.tsx b/frontend/src/features/resources/resources-mkdir-dialog.tsx
index a361cc60..970edbbe 100644
--- a/frontend/src/features/resources/resources-mkdir-dialog.tsx
+++ b/frontend/src/features/resources/resources-mkdir-dialog.tsx
@@ -83,6 +83,7 @@ function ResourcesMkdirDialogForm({ defaultParentPath, onClose }: ResourcesMkdir
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={handleSubmit}
>
<FormField
diff --git a/frontend/src/features/resources/resources-move-dialog.tsx b/frontend/src/features/resources/resources-move-dialog.tsx
index 2eab1f82..f7a618c4 100644
--- a/frontend/src/features/resources/resources-move-dialog.tsx
+++ b/frontend/src/features/resources/resources-move-dialog.tsx
@@ -210,6 +210,7 @@ function ResourcesMoveDialogForm({ files, onClose }: ResourcesMoveDialogFormProp
<Form {...form}>
<form
className="flex flex-col gap-4"
+ noValidate
onSubmit={handleSave}
>
<FormField
diff --git a/frontend/src/pages/settings/settings-prompt.tsx b/frontend/src/pages/settings/settings-prompt.tsx
index eb28918a..303066b2 100644
--- a/frontend/src/pages/settings/settings-prompt.tsx
+++ b/frontend/src/pages/settings/settings-prompt.tsx
@@ -848,6 +848,7 @@ function SettingsPrompt() {
<form
className="flex min-h-0 flex-1 flex-col"
id="system-prompt-form"
+ noValidate
onSubmit={systemForm.handleSubmit(handleSystemSubmit)}
>
<FormMarkdownItem
@@ -871,6 +872,7 @@ function SettingsPrompt() {
<form
className="flex min-h-0 flex-1 flex-col"
id="human-prompt-form"
+ noValidate
onSubmit={humanForm.handleSubmit(handleHumanSubmit)}
>
<FormMarkdownItem
diff --git a/frontend/src/pages/settings/settings-provider.tsx b/frontend/src/pages/settings/settings-provider.tsx
index d7e61ffc..824f4e9c 100644
--- a/frontend/src/pages/settings/settings-provider.tsx
+++ b/frontend/src/pages/settings/settings-provider.tsx
@@ -1873,6 +1873,7 @@ function SettingsProvider() {
<form
className="flex min-h-0 flex-1 flex-col"
id="provider-form"
+ noValidate
onSubmit={handleFormSubmit(handleSubmit)}
>
{isDesktop ? (
diff --git a/frontend/src/pages/templates/template.tsx b/frontend/src/pages/templates/template.tsx
index b31126a3..af8f932b 100644
--- a/frontend/src/pages/templates/template.tsx
+++ b/frontend/src/pages/templates/template.tsx
@@ -725,6 +725,7 @@ function Template() {
<form
className="flex min-h-0 flex-1 flex-col"
id="template-form"
+ noValidate
onSubmit={handleFormSubmit(handleSubmit)}
>
{isDesktop ? (