Skip to content

feat: add husky pre-commit and push checks#423

Merged
ECWireless merged 3 commits intomainfrom
343-add-husky-pre-commit-and-push-checks
Dec 3, 2025
Merged

feat: add husky pre-commit and push checks#423
ECWireless merged 3 commits intomainfrom
343-add-husky-pre-commit-and-push-checks

Conversation

@ECWireless
Copy link
Collaborator

Summary

  • Adds pre-commit and pre-push husky checks
  • resolves all lint errors

AI Summary

This pull request introduces a series of type safety improvements, dependency updates, and code cleanups across several components, primarily focused on transaction handling, table rendering, and contract interactions. The most significant changes include stricter type usage for contract amounts, migration from ethers to viem for utility functions, improved type definitions for tables, and enhanced robustness in transaction dialogs.

Type Safety and Contract Interaction Improvements

  • Updated all contract interaction components (Approve, DelegatingView, DelegatingWidget/Delegate, Undelegate) to use BigInt for amounts instead of plain numbers or strings, ensuring better type safety and consistency with blockchain data types. [1] [2] [3]
  • Migrated parseEther imports from ethers/lib/utils to viem in relevant components, aligning with the preferred library for contract utilities. [1] [2]

Table and List Rendering Enhancements

  • Refactored table components (Table, PerformanceList, TransactionsList) to use explicit generic types and improved type definitions from react-table, reducing reliance on any and improving type safety for columns and data. [1] [2] [3] [4] [5]
  • Updated table header and cell rendering logic to use more accurate type casting and property access, preventing runtime errors and improving maintainability. [1] [2] [3] [4] [5]

Transaction Dialog Robustness

  • Improved the TxConfirmedDialog to handle missing or undefined transaction input data gracefully, preventing crashes and ensuring correct messaging for bond, unbond, and rebond events. [1] [2] [3] [4] [5] [6]

Code Quality and Consistency

  • Added pre-commit and pre-push hooks for formatting, linting, and type checking to enforce code quality standards. (.husky/pre-commit, .husky/pre-push) [1] [2]
  • Minor cleanups and import reordering for consistency and readability in several components. [1] [2]

History and Performance List Optimizations

  • Refactored event merging and sorting logic in HistoryView and PerformanceList for more concise and type-safe operations, improving performance and reliability. [1] [2] [3] [4] [5] [6]

Let me know if you'd like to review any specific change or need help understanding how these improvements affect the codebase!

Copilot AI review requested due to automatic review settings December 1, 2025 23:30
@ECWireless ECWireless linked an issue Dec 1, 2025 that may be closed by this pull request
@vercel
Copy link
Contributor

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
explorer-arbitrum-one Ready Ready Preview Comment Dec 2, 2025 0:41am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces husky-based Git hooks for automated code quality enforcement and systematically improves type safety across the codebase by replacing any types with explicit TypeScript definitions. The changes primarily focus on transaction handling, table rendering, and contract interactions while migrating some utility functions from ethers.js to viem.

Key Changes:

  • Added pre-commit hooks (format check, lint) and pre-push hooks (type check) using husky v9.1.7
  • Replaced any types with explicit type definitions in transaction dialogs, tables, state management, and GraphQL query results
  • Migrated parseEther utility from ethers.js to viem in delegation components (partial migration)

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.husky/pre-commit Adds git hook to run format checks and linting before commits
.husky/pre-push Adds git hook to run type checking before pushes
package.json Adds husky dependency, typecheck script, and prepare script for hook setup
pnpm-lock.yaml Updates lockfile with husky dependency and transitive dependency resolutions
components/Table/index.tsx Replaces any types with explicit react-table types using HeaderGroup and generic constraints
components/TxConfirmedDialog/index.tsx Adds guard checks for inputData and improves type safety for transaction properties
components/TxStartedDialog/index.tsx Adds null checks for inputData properties to prevent runtime errors
components/PerformanceList/index.tsx Replaces any with explicit Column type and proper type definitions for sort function
components/TransactionsList/index.tsx Replaces any with object[] for table data
components/DelegatingWidget/Delegate.tsx Migrates parseEther from ethers to viem, uses BigInt for amounts
components/DelegatingWidget/Undelegate.tsx Migrates parseEther from ethers to viem
components/DelegatingView/index.tsx Updates amount handling to use BigInt type
components/Approve/index.tsx Updates MAXIMUM_VALUE_UINT256 to BigInt type
components/HistoryView/index.tsx Replaces array reduce with flatMap for cleaner event merging, removes unnecessary type assertions
hooks/useExplorerStore.tsx Defines InputData type to replace any in transaction state management
hooks/useHandleTransaction.tsx Uses InputData type instead of any for transaction arguments
lib/fetchWithRetry.ts Improves error handling types and AbortSignal type casting
lib/earningsTree.tsx Replaces any[] with Buffer[] types in merkle tree implementation
lib/api/polls.ts Adds explicit PollExtended return type
pages/voting/create-poll.tsx Defines explicit types for proposal and lip data structures
pages/voting/[poll].tsx Replaces any casts with explicit type definitions for vote data
pages/transactions.tsx Uses proper GraphQL query result types for events
pages/index.tsx Uses proper GraphQL query result types for events
pages/migrate/delegator/contract-wallet-tool.tsx Defines explicit type for params state
layouts/main.tsx Improves error handling in banner dismissal, reorders imports
components/URLVerificationBanner/index.tsx Reorders imports for consistency
components/Drawer/index.tsx Reorders imports for consistency
components/LlamaswapModal/index.tsx Simplifies import formatting
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@Jipperism Jipperism left a comment

Choose a reason for hiding this comment

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

Nice, I like the updated types.

@github-project-automation github-project-automation bot moved this from Backlog to Todo in Explorer Revamp Dec 3, 2025
@ECWireless ECWireless merged commit c6fabda into main Dec 3, 2025
4 checks passed
@ECWireless ECWireless deleted the 343-add-husky-pre-commit-and-push-checks branch December 3, 2025 14:07
@github-project-automation github-project-automation bot moved this from Todo to Done in Explorer Revamp Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Add Husky pre-commit and push checks

3 participants