Skip to content

refactor(perps): type over interface to match core#26054

Merged
abretonc7s merged 1 commit intomainfrom
refactor/perps/typesoverinterface
Feb 13, 2026
Merged

refactor(perps): type over interface to match core#26054
abretonc7s merged 1 commit intomainfrom
refactor/perps/typesoverinterface

Conversation

@abretonc7s
Copy link
Copy Markdown
Contributor

@abretonc7s abretonc7s commented Feb 13, 2026

Description

Migrate all interface declarations in app/controllers/perps/ to type aliases to align with the @metamask/core monorepo ESLint rule (@typescript-eslint/consistent-type-definitions: ['error', 'type']). This reduces linting friction when the perps controller is migrated to core.

  • Added folder-specific ESLint override enforcing type for app/controllers/perps/**
  • Converted 120 interface declarations across 26 files to type aliases
  • Removed 3 now-unnecessary eslint-disable comments
  • Fixed pre-existing duplicate LastTransactionResult in transactionTypes.ts (interface merging hid this)

Changelog

CHANGELOG entry: null

Related issues

Refs: Core monorepo migration preparation

Manual testing steps

Feature: Perps type definitions alignment

  Scenario: user interacts with perps features after type-level refactor
    Given the app is built with type aliases instead of interfaces in perps controller

    When user interacts with any perps feature (trading, positions, deposits, withdrawals)
    Then all behavior remains identical since this is a type-level-only change

Screenshots/Recordings

N/A - Type-level refactor only, no UI or behavioral changes.

Before

N/A

After

N/A

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@abretonc7s abretonc7s requested a review from a team as a code owner February 13, 2026 03:32
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added team-perps Perps team INVALID-PR-TEMPLATE PR's body doesn't match template labels Feb 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a pure TypeScript refactoring that converts interface declarations to type declarations across all files in the app/controllers/perps/ directory. The changes include:

  1. ESLint configuration: Added a rule in .eslintrc.js to enforce @typescript-eslint/consistent-type-definitions: ['error', 'type'] for the perps directory
  2. Type definition changes: Converted ~100+ interface declarations to type aliases (e.g., interface X { ... }type X = { ... })
  3. Removed eslint-disable comments: Cleaned up comments that were previously needed to suppress the linting rule
  4. Fixed duplicate definition: Removed a duplicate LastTransactionResult interface in transactionTypes.ts

Why this is low risk:

  • TypeScript interface and type are functionally equivalent for object type definitions
  • No runtime behavior changes - the compiled JavaScript is identical
  • No business logic, API contracts, or functionality has been modified
  • All changes are mechanical and consistent

Why SmokePerps is selected:

  • The changes touch the PerpsController (marked as CRITICAL) and all related perps services, providers, types, and utilities
  • While the changes are purely syntactic, running SmokePerps provides confidence that the perps functionality still works correctly
  • Per tag description, SmokePerps tests the perpetuals trading functionality including Add Funds flow, balance verification, and Perps interface

Why other tags are not needed:

  • No changes to confirmations, accounts, network, trading, wallet platform, or other features
  • The perps changes are isolated to type definitions only
  • No UI components, hooks, or user-facing code was modified

Performance Test Selection:
This PR contains only TypeScript type definition changes (converting interface to type declarations) and ESLint configuration updates. These are compile-time only changes that produce identical JavaScript output. There are no runtime behavior changes, no UI rendering changes, no data loading changes, and no changes to any performance-critical code paths. The changes are purely syntactic and have zero impact on app performance.

View GitHub Actions results

@abretonc7s abretonc7s enabled auto-merge February 13, 2026 03:49
@abretonc7s abretonc7s added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed no changelog required No changelog entry is required for this change and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Feb 13, 2026
@sonarqubecloud
Copy link
Copy Markdown

@abretonc7s abretonc7s added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit cb38bbc Feb 13, 2026
124 checks passed
@abretonc7s abretonc7s deleted the refactor/perps/typesoverinterface branch February 13, 2026 04:17
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changelog required No changelog entry is required for this change no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.67.0 Issue or pull request that will be included in release 7.67.0 size-L team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants