Skip to content

form.tsx imports react-hook-form but @loopover/ui-kit's package.json never declares it as a dependency #8309

Description

@JSONbored

Context

@loopover/ui-kit is a real, published npm package (packages/loopover-ui-kit/package.json: "publishConfig": { "access": "public" }). Every one of its components that wraps an external library declares that library as a dependency in its own package.json — 23 separate @radix-ui/react-* packages, plus cmdk, embla-carousel-react, input-otp, react-day-picker, react-resizable-panels, recharts, sonner, tailwind-merge, vaul, class-variance-authority, and clsx are all listed under "dependencies".

packages/loopover-ui-kit/src/components/form.tsx imports directly from "react-hook-form":

import {
  Controller,
  FormProvider,
  useFormContext,
  type ControllerProps,
  type FieldPath,
  type FieldValues,
} from "react-hook-form";

react-hook-form does not appear anywhere in packages/loopover-ui-kit/package.json — not in dependencies, peerDependencies, or devDependencies. It is currently only declared as a dependency of apps/loopover-ui (the main site). Inside this monorepo's own workspace, module resolution happens to succeed today only because npm workspaces hoist apps/loopover-ui's react-hook-form install to the shared root node_modules, which packages/loopover-ui-kit incidentally resolves against. Any consumer that installs @loopover/ui-kit as a real published npm package outside this monorepo — or any workspace member (like apps/loopover-miner-ui, which does not install react-hook-form at all) resolving in an environment without that hoisting guarantee — would have form.tsx's import fail to resolve.

Requirements

  • Add react-hook-form to packages/loopover-ui-kit/package.json, in the same category (dependencies) the package's other wrapped-library imports already use — check the currently-installed react-hook-form version in apps/loopover-ui/package.json and use a matching semver range, so the two don't silently drift to incompatible majors within the same workspace.
  • Do not change form.tsx's implementation or any other file — this is a package.json manifest fix only.
  • Regenerate the workspace lockfile (npm install at the repo root) so package-lock.json reflects the new declared dependency, and commit the updated lockfile alongside the manifest change.

Deliverables

  • react-hook-form added to packages/loopover-ui-kit/package.json's dependencies, version-matched to apps/loopover-ui's existing react-hook-form dependency
  • package-lock.json regenerated and committed to reflect the change
  • A test (or an assertion added to an existing packaging/lint check, if this repo has one — e.g. test/unit/codecov-policy.test.ts-style manifest assertions) verifying every external import in packages/loopover-ui-kit/src/components/*.tsx has a corresponding entry in packages/loopover-ui-kit/package.json's dependencies, so this class of gap is caught automatically for future components rather than only manually

Test Coverage Requirements

packages/loopover-ui-kit is not in the root vitest.config.ts's coverage.include and is not Codecov-gated, but the new manifest-consistency check requested in Deliverables should itself live under test/ (or wherever this repo's existing drift-check tests live) where it is measured, since it's asserting against package.json content rather than ui-kit's own component logic — check test/unit/ for the closest existing precedent (e.g. a similar "package.json declares what source imports" assertion) before choosing its exact location.

Expected Outcome

packages/loopover-ui-kit/package.json accurately declares every external package its components import, including react-hook-form for form.tsx — installing @loopover/ui-kit in isolation (or in a workspace member that doesn't happen to hoist react-hook-form from elsewhere) no longer risks an unresolved-import failure on form.tsx.

Links & Resources

  • packages/loopover-ui-kit/src/components/form.tsx (the file with the undeclared import)
  • packages/loopover-ui-kit/package.json (missing the react-hook-form entry; see its existing dependencies list for the declared-dependency convention every other wrapped library already follows)
  • apps/loopover-ui/package.json (the existing react-hook-form version to match)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions