Skip to content

fix: remove unused imports and variables (Phase 1 lint cleanup)#20

Merged
kilbot merged 1 commit intomainfrom
refactor/lint-cleanup-safe
Jan 29, 2026
Merged

fix: remove unused imports and variables (Phase 1 lint cleanup)#20
kilbot merged 1 commit intomainfrom
refactor/lint-cleanup-safe

Conversation

@kilbot
Copy link
Copy Markdown
Contributor

@kilbot kilbot commented Jan 29, 2026

Safe, no-behavior-change fixes across the monorepo:

  • Remove 75+ unused imports, variables, and type declarations
  • Fix no-undef errors by adding eslint-env node to Node.js scripts
  • Fix react/no-unescaped-entities by escaping apostrophes in JSX
  • Remove unused catch parameters
  • Add missing displayName to forwardRef components
  • Fix missing key props in iterators
  • Replace empty interfaces with type aliases

Packages affected:

  • @wcpos/core: 82 → 36 problems
  • @wcpos/components: 43 → 25 problems
  • @wcpos/web-bundle: 2 → 2 problems (all fixed, remaining are no-undef)
  • @wcpos/main: 4 → 2 problems
  • @wcpos/utils: 4 → 3 problems

Total reduction: 213 → 138 problems (~35% reduction)

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed text display escaping for apostrophes in error messages.
    • Adjusted search algorithm scoring by removing distance-from-start penalty for more consistent match relevance.
  • Refactor

    • Removed unused imports and type definitions across components for improved code efficiency.
    • Optimized store lookup logic using set-based filtering.
    • Added component display names for better debugging.

✏️ Tip: You can customize this high-level summary in your review settings.

Safe, no-behavior-change fixes across the monorepo:
- Remove 75+ unused imports, variables, and type declarations
- Fix no-undef errors by adding eslint-env node to Node.js scripts
- Fix react/no-unescaped-entities by escaping apostrophes in JSX
- Remove unused catch parameters
- Add missing displayName to forwardRef components
- Fix missing key props in iterators
- Replace empty interfaces with type aliases

Packages affected:
- @wcpos/core: 82 → 36 problems
- @wcpos/components: 43 → 25 problems
- @wcpos/web-bundle: 2 → 2 problems (all fixed, remaining are no-undef)
- @wcpos/main: 4 → 2 problems
- @wcpos/utils: 4 → 3 problems

Total reduction: 213 → 138 problems (~35% reduction)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This pull request performs extensive codebase cleanup across 40+ files, removing unused imports (React, UI components, utilities), eliminating unused type definitions and constants, simplifying error handling in catch clauses, and updating string escaping in TSX literals. The changes are predominantly refactoring-focused with minimal functional impact.

Changes

Cohort / File(s) Summary
String Escaping in UI Text
apps/main/app/+not-found.tsx, apps/main/components/root-error.tsx, apps/main/app/(app)/(drawer)/(pos)/(modals)/cart/add-misc-product.tsx
Updated apostrophe escaping in rendered text literals (e.g., "This screen doesn't exist" → "This screen doesn't exist").
React Namespace Import Cleanup
packages/core/src/contexts/app-state/use-hydration-suspense.ts, packages/core/src/screens/main/hooks/use-base-tax-location.ts, packages/core/src/screens/main/hooks/use-tax-incl-or-excl.ts, packages/core/src/screens/main/pos/contexts/current-order/use-new-order.ts, packages/core/src/screens/main/products/add-product/index.tsx
Removed unused default React imports or converted to specific named imports where only hooks are used.
Component Library Import Cleanup
packages/components/src/input/index.tsx, packages/components/src/loader/index.tsx, packages/components/src/label/index.tsx, packages/components/src/logo/logo.tsx, packages/components/src/data-table/index.tsx, packages/components/src/data-table/row.tsx, packages/components/src/select/index.tsx
Removed unused component props and animation imports (Platform, ActivityIndicator, FadeIn, FadeOut, PressableRef, StyleProp, cn).
Utility & Operator Import Cleanup
packages/core/src/screens/main/pos/cart/table.tsx, packages/core/src/screens/main/pos/cart/cells/edit-shipping-line/form.tsx, packages/core/src/screens/main/contexts/translations/cache.ts, packages/core/src/contexts/translations/index.tsx, packages/core/src/screens/main/hooks/use-collection.ts, packages/core/src/screens/main/hooks/barcodes/use-barcode-detection.ts, packages/core/src/screens/main/contexts/tax-rates/tax-rates.helpers.ts, packages/core/src/screens/main/reports/orders/index.tsx, packages/core/src/screens/main/pos/cart/add-cart-item-buttons.tsx, packages/core/src/screens/main/products/cells/actions.tsx, packages/core/src/screens/main/pos/hooks/use-cart-lines.ts
Removed unused lodash utilities (toString, isEqual, uniq, get), RxJS operators (tap, startWith), and library-specific imports (isRxDocument, ERROR_CODES, expo-router components).
Type System Refactoring
packages/components/src/command/index.tsx, packages/components/src/virtualized-list/virtualized-list.tsx, packages/components/src/tooltip/index.web.tsx, packages/components/src/print/text.tsx, packages/core/src/screens/main/components/incl-excl-tax-radio-group.tsx, packages/core/src/screens/main/components/tax-display-radio-group.tsx, packages/core/src/screens/main/components/customer-select.tsx, packages/core/src/screens/main/pos/cart/rows/fee-line.tsx, packages/core/src/screens/main/pos/cart/rows/line-item.tsx, packages/core/src/screens/main/pos/cart/rows/shipping-line.tsx, packages/core/src/screens/main/pos/cart/customer.tsx, packages/core/src/screens/main/pos/cart/tabs.tsx, packages/core/src/screens/main/pos/hooks/use-add-product.ts, packages/core/src/screens/main/pos/hooks/use-add-variation.ts
Removed unused type imports (ItemProps, TooltipTriggerProps, FormItemProps, TableProps) and local type aliases (TextUnderline, RenderItem, OrderDocument, LineItem). Changed CommandSeparatorProps from interface to type alias.
Component Enhancements
packages/components/src/pressable/index.tsx, packages/components/src/numpad/index.tsx, packages/components/src/format/list.tsx
Added displayName properties to Pressable and Numpad components for debugging; added missing key prop to Text element in list rendering; removed unused iconMap constant.
Error Handling Simplification
packages/core/src/lib/url/parse-link-header.ts, packages/utils/src/logger/index.ts, packages/components/src/webview/index.tsx
Simplified catch clauses from capturing error objects to parameterless catch blocks while maintaining equivalent error handling behavior.
Search Algorithm Update
packages/components/src/combobox/utils/fuzzy-search.ts
Removed PENALTY_DISTANCE_FROM_START constant (0.9) from scoring logic, eliminating distance-from-start bias in fuzzy search results.
Data Management Refinements
packages/core/src/utils/merge-stores.ts, packages/core/src/screens/main/pos/products/scanner-button.tsx, packages/core/src/screens/main/pos/cart/index.tsx, packages/core/src/screens/main/components/header/user-menu.tsx, packages/core/src/screens/main/pos/cart/index.tsx, packages/core/src/screens/main/pos/cart/table.tsx, packages/core/src/screens/main/pos/cart/index.tsx, packages/core/src/screens/main/pos/cart/index.tsx, packages/core/src/screens/main/pos/cart/index.tsx
Replaced Map-based store lookups with Set-based remoteStoreIds in merge-stores; removed unused destructured values (disconnect, isWebApp, Button, ButtonGroup); removed extraDataWithTimestamp memoization from data-table web variant.
Web Import Consolidation
packages/components/src/format-number/format-number.tsx, packages/components/src/data-table/index.web.tsx
Consolidated import statements and converted Text import style from default to named import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A Cleanup Quest

Unused imports, I hopped them away,
Type aliases trimmed for a cleaner day,
Search penalties gone, fuzzy now flies,
Catch blocks simplified—no error disguise,
The codebase gleams, spick and span,
All tidied up by this refactoring plan! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the PR: removing unused imports and variables as part of a lint cleanup effort.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilbot kilbot merged commit 5efb576 into main Jan 29, 2026
3 of 5 checks passed
@kilbot kilbot deleted the refactor/lint-cleanup-safe branch January 29, 2026 01: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.

1 participant