Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Dec 12, 2025

Explanation

This fixes all suppressed ESLint errors in the permission-controller package.

References

Closes #7380.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Adds explicit return types and stricter TypeScript typings across permission-controller (core, middleware, errors, tests), refactoring internals to private class fields and tightening APIs with minor non-functional changes.

  • Core (permission-controller):
    • Convert internals to private class fields (e.g., #caveatSpecifications, #permissionSpecifications, #unrestrictedMethods) and private helpers (e.g., #getPermissionSpecification, #validatePermission, #requestUserApproval).
    • Add explicit return types and generics throughout (controllers, caveat decorators, mergers, mutators, helpers).
    • Initialize CaveatMutatorOperation enum values and tighten types for caveat merging, construction, and validation.
    • Use nullish coalescing in SubjectMetadataController.addSubjectMetadata and refactor cache/trim logic with private fields and static #getTrimmedState.
    • Ensure decorateWithCaveats wrapper has explicit Promise<Json> return.
  • Middleware:
    • Introduce ExecuteRestrictedMethod type; pass executeRestrictedMethod via factory; tighten middleware typings and undefined-result handling.
  • Errors:
    • Type return values for unauthorized, methodNotFound, and invalidParams; import needed types from @metamask/rpc-errors.
  • Tests:
    • Add explicit return types, stronger typings for mocks/utilities, optional chaining for side-effect handlers, and minor refactors in test helpers.
  • Config:
    • Remove permission-controller entries from eslint-suppressions.json for resolved rules.

Written by Cursor Bugbot for commit 2acb726. This will update automatically on new commits. Configure here.

@Mrtenz Mrtenz marked this pull request as ready for review December 12, 2025 12:03
@Mrtenz Mrtenz requested review from a team as code owners December 12, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix suppressed lint errors in permission-controller

2 participants