Skip to content

chore: clean up and remove dead code#195

Merged
jaredhightower-youversion merged 2 commits intomainfrom
jh/YPE-1140-identify-unused-code-and-remove-it
Mar 13, 2026
Merged

chore: clean up and remove dead code#195
jaredhightower-youversion merged 2 commits intomainfrom
jh/YPE-1140-identify-unused-code-and-remove-it

Conversation

@jaredhightower-youversion
Copy link
Collaborator

Summary

This PR cleans up dead code and analyzer findings across the monorepo, fixes a real circular dependency in core, and aligns rev-dep with the SDK’s intended public API surface.

What Changed

Core

  • Fixed the circular dependency between schemas/book.ts and utils/constants.ts
  • Centralized canon literals in shared constants and removed the schema/constants back-edge
  • Removed genuinely unused test mock files
  • Inlined orphaned type declarations into packages/core/src/types/index.ts
  • Removed dead helper exports and internal-only schema/type exports that were not used

Hooks

  • Removed unused test-only exports from mocks and test utilities
  • Narrowed auth-related test helper exports
  • Stopped exporting YouVersionAuthProviderProps since it is not part of the package surface

UI

  • Promoted Separator and Textarea into the public UI barrel because they are intended SDK exports
  • Removed dead internal helper exports that were not part of the published package API
  • Preserved RootProps for BibleChapterPicker as a supported public type
  • Kept the icon library intact and updated analyzer config so story-only icons are not treated as orphaned production files

Analyzer / Config

  • Updated .rev-dep.config.jsonc to better reflect SDK realities
  • Ignored intentional public exports such as RootProps
  • Excluded the UI icon library from orphan-file detection
  • Verified the repo now analyzes cleanly

Why

The repo had a mix of:

  • real dead code,
  • internal-only exports being treated like public API,
  • analyzer findings that conflicted with intended SDK usage.

This change separates those cases so we can remove genuinely unused code while preserving intentional SDK exports and keeping the analysis tooling trustworthy.

Before / After

Before After
Before the fix Screenshot 2026-03-12 at 5 31 26 PM

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

⚠️ No Changeset found

Latest commit: b7ca16b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR removes genuinely dead code, resolves a real circular dependency in packages/core, and aligns the static-analysis configuration with the SDK's intended public API surface. The changes are well-scoped and the author has carefully verified that each deleted/narrowed export is not consumed anywhere in the monorepo.

Key changes:

  • Circular dependency fixCANON_IDS moved from schemas/book.ts into utils/constants.ts; constants.ts now derives its local CanonId/KnownBookUsfm types from the array literal instead of importing from schemas/book.ts, breaking the cycle cleanly.
  • Type consolidationApiConfig, AuthenticationState, HighlightColor, and related types inlined directly into types/index.ts; the three now-empty source files (api-config.ts, auth.ts, highlight.ts) are deleted.
  • Dead export pruningbadgeVariants, InputGroupButton/Text/Textarea, ButtonGroup*, ItemActions/Separator/Header/Footer, PopoverAnchor, BookUsfm, Canon, YouVersionAuthProviderProps, and three test-only mock files in core are all removed. Verified no production or test consumers remain.
  • UI public API expansionSeparator and Textarea promoted to the UI barrel export; BibleChapterPickerRootProps alias added as a clearly-named alternative to the generic RootProps.
  • Analyzer configsrc/components/icons/** excluded from orphan detection; RootProps added to ignoreExports to suppress false positives for the intentionally generic name shared across component files.

Confidence Score: 5/5

  • This PR is safe to merge — all removed exports are verified unused and the circular-dependency fix is correct.
  • Every deleted export was confirmed to have zero consumers across the monorepo via grep. The circular dependency fix is mechanically sound (CANON_IDS moves upstream, book.ts imports it downstream). Type inlining preserves the same public surface. The only finding is an import statement placed after export lines in types/index.ts, which is a minor style issue with no runtime impact.
  • No files require special attention.

Important Files Changed

Filename Overview
packages/core/src/utils/constants.ts Adds CANON_IDS constant and removes the circular import of Canon/BookUsfm types from schemas/book.ts; correctly fixes the circular dependency.
packages/core/src/schemas/book.ts CanonSchema now derives from CANON_IDS constant (breaking the circular dep); BibleBookIntroSchema made private; BookUsfm type alias removed — BookUsfmSchema still exported so z.infer usage still works.
packages/core/src/types/index.ts Inlines ApiConfig, AuthenticationState, AuthenticationScopes, SignInWithYouVersionPermissionValues, and HighlightColor; import statement is placed after export statements which is unconventional.
packages/ui/src/components/index.ts Promotes Separator and Textarea into public API; exports both RootProps and BibleChapterPickerRootProps (an alias) for BibleChapterPicker — intentional for backward compat.
packages/ui/src/components/ui/input-group.tsx Removes InputGroupButton, InputGroupText, and InputGroupTextarea along with their Button and Textarea imports; retains InputGroup, InputGroupAddon, and InputGroupInput.
.rev-dep.config.jsonc Adds src/components/icons/** to orphan-file exclusions and RootProps to unused-export ignores for UI package; accurately reflects intended SDK surface.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before (circular dependency)"]
        B_constants["utils/constants.ts\nimport Canon, BookUsfm"] -->|type import| B_book["schemas/book.ts\nexport Canon, BookUsfm\nimport BOOK_IDS"]
        B_book -->|import| B_constants
    end

    subgraph After["After (resolved)"]
        A_constants["utils/constants.ts\nexport CANON_IDS\nlocal: CanonId, KnownBookUsfm"] -->|export CANON_IDS, BOOK_IDS| A_book["schemas/book.ts\nimport CANON_IDS, BOOK_IDS\nexport CANON, BookUsfmSchema"]
        A_types["types/index.ts\ninline: ApiConfig\nAuthenticationState\nHighlightColor"] -->|re-exports| A_index["core/src/index.ts\nexport * from types\nexport * from utils/constants"]
        A_book -->|export via schemas/index| A_index
    end

    style Before fill:#ffeeee,stroke:#cc0000
    style After fill:#eeffee,stroke:#009900
Loading

Last reviewed commit: 8664273

Copy link
Collaborator

@cameronapak cameronapak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

(& no changeset needed, so you're good to merge)

@jaredhightower-youversion jaredhightower-youversion merged commit dc9d45e into main Mar 13, 2026
5 checks passed
@jaredhightower-youversion jaredhightower-youversion deleted the jh/YPE-1140-identify-unused-code-and-remove-it branch March 13, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants