Skip to content

chore(utils): resolve no-explicit-any lint suppressions - #10249

Draft
cryptodev-2s wants to merge 2 commits into
mainfrom
chore/utils-fix-no-explicit-any-suppressions
Draft

cryptodev-2s wants to merge 2 commits into
mainfrom
chore/utils-fix-no-explicit-any-suppressions

Conversation

@cryptodev-2s

Copy link
Copy Markdown
Contributor

Explanation

Clears the remaining 67 @typescript-eslint/no-explicit-any suppressions the @metamask/utils migration left in eslint-suppressions.json, across 12 files. packages/utils now has zero entries in that file.

Most are tests casting to any to pass deliberately invalid input. Those now cast to the real parameter type instead (CaipChainId, EthereumUnit, string | number | bigint). In fs.test.ts the four stringifier mocks hand copied JSON.stringify's signature, so they are annotated with typeof JSON.stringify and the params are contextually typed.

Three public signatures widen from any to unknown: assert, FrozenMap.forEach and FrozenSet.forEach (thisArg), and getKnownPropertyNames. Not breaking, unknown accepts everything any did. Changelog entry added, PR number needs filling in.

Two keep any with inline disables:

  • json.ts: Struct<unknown> does not compile. refiner is a property, so the value type lands in a contravariant position and no concrete struct satisfies the constraint.
  • json.tst.ts: the any is what the assertion is testing.

Verified: eslint clean, yarn lint:tsc clean repo wide, 1993 unit tests, 120 tstyche assertions.

References

Follows #10185

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

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