Add rules covering bug prevention (noLeakedRender, noFloatingPromises, noImportCycles, noReactForwardRef), security (noScriptUrl, noAlert), performance (noAwaitInLoops, useTopLevelRegex), and code style (noNestedTernary, useGlobalThis, useNullishCoalescing, useSortedClasses, plus ~40 more). Fix all violations: extract top-level regex constants, guard React && renders with boolean coercion, refactor nested ternaries, replace window with globalThis, sort Tailwind classes, and introduce expectDomainError test helper to eliminate conditional expects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
662 B
TypeScript
22 lines
662 B
TypeScript
import type { InputHTMLAttributes, RefObject } from "react";
|
|
import { cn } from "../../lib/utils";
|
|
|
|
type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
|
|
export const Input = ({
|
|
className,
|
|
ref,
|
|
...props
|
|
}: InputProps & { ref?: RefObject<HTMLInputElement | null> }) => {
|
|
return (
|
|
<input
|
|
ref={ref}
|
|
className={cn(
|
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-foreground text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|