From c84480c6eac2098f014afe93be566e5bad5073e0 Mon Sep 17 00:00:00 2001 From: breeg554 Date: Mon, 2 Dec 2024 14:34:27 +0100 Subject: [PATCH] fix some lint errors --- apps/web-remix/app/components/chat/ChatMarkdown.tsx | 2 ++ .../app/components/form/fields/field.context.tsx | 4 ++-- .../app/components/form/fields/form.field.tsx | 11 ++++++++--- .../app/components/form/fields/text.field.tsx | 4 +--- apps/web-remix/app/components/form/schema/Schema.tsx | 2 +- .../app/components/pages/auth/register/page.tsx | 2 ++ .../runs/components/EvaluationAverageCellBadge.tsx | 3 ++- .../details/components/NodePreview.tsx | 2 +- .../pipelines/interface/interface.loader.server.ts | 5 ++--- .../pages/secrets/list/EditSecretKeyModal.tsx | 2 +- apps/web-remix/app/hooks/useMergeRefs.tsx | 3 ++- .../app/tests/__tests__/auth/login.handlers.ts | 2 +- 12 files changed, 25 insertions(+), 17 deletions(-) diff --git a/apps/web-remix/app/components/chat/ChatMarkdown.tsx b/apps/web-remix/app/components/chat/ChatMarkdown.tsx index 497519891..a6e1767d8 100644 --- a/apps/web-remix/app/components/chat/ChatMarkdown.tsx +++ b/apps/web-remix/app/components/chat/ChatMarkdown.tsx @@ -456,6 +456,7 @@ function Image({ {rest.src} ) : null} {removeUrlProtocol(rest.src)} diff --git a/apps/web-remix/app/components/form/fields/field.context.tsx b/apps/web-remix/app/components/form/fields/field.context.tsx index 8063a8269..98e91034d 100644 --- a/apps/web-remix/app/components/form/fields/field.context.tsx +++ b/apps/web-remix/app/components/form/fields/field.context.tsx @@ -29,7 +29,7 @@ export const FieldContext = React.createContext<{ } | null>(null); export interface UseFieldContextProps { - validationBehavior?: Partial; + validationBehavior?: ValidationBehaviorOptions; } export const useFieldContext = (args?: UseFieldContextProps) => { @@ -37,7 +37,7 @@ export const useFieldContext = (args?: UseFieldContextProps) => { if (!context) throw new Error('You tried to use a field without using '); const fieldProps = useField(context.name, { - validationBehavior: args?.validationBehavior ?? { initial: 'onSubmit' }, + validationBehavior: args?.validationBehavior, }); return useMemo( diff --git a/apps/web-remix/app/components/form/fields/form.field.tsx b/apps/web-remix/app/components/form/fields/form.field.tsx index 5aa5a3c29..a395ad81d 100644 --- a/apps/web-remix/app/components/form/fields/form.field.tsx +++ b/apps/web-remix/app/components/form/fields/form.field.tsx @@ -1,9 +1,13 @@ import { useEffect, useMemo, useState } from 'react'; -import { - FieldArray as FA, +import type { FieldArrayApi as FAI, FieldApi as FApi, FormApi as FoApi, + FormScope as FS, + ValidationBehaviorConfig, +} from '@rvf/remix'; +import { + FieldArray as FA, useControlField as ucf, useField as uf, useFieldArray as ufa, @@ -18,10 +22,11 @@ export const useField = uf; export const useFormScopeOrContext = ufsc; export const FieldArray = FA; export const useFieldArray = ufa; -export type ValidationBehaviorOptions = any; // Define your validation behavior options here +export type ValidationBehaviorOptions = ValidationBehaviorConfig; // Define your validation behavior options here export type FieldArrayApi = FAI; export type FieldApi = FApi; export type FormApi = FoApi; +export type FormScope = FS; export const useCurrentFormState = () => { const { diff --git a/apps/web-remix/app/components/form/fields/text.field.tsx b/apps/web-remix/app/components/form/fields/text.field.tsx index 2329bad7f..21553c89a 100644 --- a/apps/web-remix/app/components/form/fields/text.field.tsx +++ b/apps/web-remix/app/components/form/fields/text.field.tsx @@ -16,8 +16,7 @@ export const TextInputField = ({ validationBehavior, ...props }: Partial & { - validationBehavior?: Partial; - ref?: React.RefObject | null; + validationBehavior?: ValidationBehaviorOptions; }) => { const { name, getInputProps, error } = useFieldContext({ validationBehavior, @@ -27,7 +26,6 @@ export const TextInputField = ({ terms of service {' '} @@ -109,6 +110,7 @@ export function RegisterPage() { href="https://buildel.ai/privacy-policy" target="_blank" className="font-semibold hover:underline" + rel="noreferrer" > privacy policy diff --git a/apps/web-remix/app/components/pages/experiments/experiment/runs/components/EvaluationAverageCellBadge.tsx b/apps/web-remix/app/components/pages/experiments/experiment/runs/components/EvaluationAverageCellBadge.tsx index b9b5d0ae5..57c60c1e0 100644 --- a/apps/web-remix/app/components/pages/experiments/experiment/runs/components/EvaluationAverageCellBadge.tsx +++ b/apps/web-remix/app/components/pages/experiments/experiment/runs/components/EvaluationAverageCellBadge.tsx @@ -1,4 +1,5 @@ -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import type { CellContext } from '@tanstack/react-table'; import { CellText } from '~/components/table/table.components'; diff --git a/apps/web-remix/app/components/pages/knowledgeBase/collectionGraph/details/components/NodePreview.tsx b/apps/web-remix/app/components/pages/knowledgeBase/collectionGraph/details/components/NodePreview.tsx index e95e7d066..cf22e3e97 100644 --- a/apps/web-remix/app/components/pages/knowledgeBase/collectionGraph/details/components/NodePreview.tsx +++ b/apps/web-remix/app/components/pages/knowledgeBase/collectionGraph/details/components/NodePreview.tsx @@ -12,7 +12,7 @@ import { NEXT_NODE_COLOR, PREV_NODE_COLOR, } from '~/components/pages/knowledgeBase/collectionGraph/collectionGraph.utils'; -import { SearchSchema } from '~/components/pages/knowledgeBase/search.schema'; +import type { SearchSchema } from '~/components/pages/knowledgeBase/search.schema'; import { useCopyToClipboard } from '~/hooks/useCopyToClipboard'; import { useOrganizationId } from '~/hooks/useOrganizationId'; import { cn } from '~/utils/cn'; diff --git a/apps/web-remix/app/components/pages/pipelines/interface/interface.loader.server.ts b/apps/web-remix/app/components/pages/pipelines/interface/interface.loader.server.ts index 4bc29a241..08a469000 100644 --- a/apps/web-remix/app/components/pages/pipelines/interface/interface.loader.server.ts +++ b/apps/web-remix/app/components/pages/pipelines/interface/interface.loader.server.ts @@ -2,12 +2,11 @@ import type { LoaderFunctionArgs } from '@remix-run/node'; import { json } from '@remix-run/node'; import invariant from 'tiny-invariant'; -import { IPipelinePublicResponse } from '~/api/pipeline/pipeline.contracts'; +import type { IPipelinePublicResponse } from '~/api/pipeline/pipeline.contracts'; import { PipelineApi } from '~/api/pipeline/PipelineApi'; import { chatSize } from '~/components/chat/chat.types'; import { UnauthorizedError } from '~/utils/errors'; -import type { fetchTyped } from '~/utils/fetch.server'; -import { ParsedResponse } from '~/utils/fetch.server'; +import type { fetchTyped, ParsedResponse } from '~/utils/fetch.server'; export const interfaceLoader = async ( { request, params }: LoaderFunctionArgs, diff --git a/apps/web-remix/app/components/pages/secrets/list/EditSecretKeyModal.tsx b/apps/web-remix/app/components/pages/secrets/list/EditSecretKeyModal.tsx index 61b7824e2..721c88bf0 100644 --- a/apps/web-remix/app/components/pages/secrets/list/EditSecretKeyModal.tsx +++ b/apps/web-remix/app/components/pages/secrets/list/EditSecretKeyModal.tsx @@ -23,7 +23,7 @@ import { import { ValidatedForm, withZod } from '~/utils/form'; import type { ISecretKey } from '../variables.types'; -import { loader } from './loader.server'; +import type { loader } from './loader.server'; interface EditSecretModalProps { isOpen: boolean; diff --git a/apps/web-remix/app/hooks/useMergeRefs.tsx b/apps/web-remix/app/hooks/useMergeRefs.tsx index ecf4a212e..2a6f307a3 100644 --- a/apps/web-remix/app/hooks/useMergeRefs.tsx +++ b/apps/web-remix/app/hooks/useMergeRefs.tsx @@ -1,4 +1,5 @@ -import { RefObject, useCallback } from 'react'; +import type { RefObject } from 'react'; +import { useCallback } from 'react'; export function useMergedRefs( ...refs: Array | undefined | null> diff --git a/apps/web-remix/app/tests/__tests__/auth/login.handlers.ts b/apps/web-remix/app/tests/__tests__/auth/login.handlers.ts index 80060bf91..8a7edec0c 100644 --- a/apps/web-remix/app/tests/__tests__/auth/login.handlers.ts +++ b/apps/web-remix/app/tests/__tests__/auth/login.handlers.ts @@ -1,6 +1,6 @@ import { http, HttpResponse } from 'msw'; -import { ICurrentUser } from '~/api/CurrentUserApi'; +import type { ICurrentUser } from '~/api/CurrentUserApi'; export const handlers = [ http.post('/super-api/users/log_in', () => {