chore(utils): resolve no-explicit-any lint suppressions - #10249
Draft
cryptodev-2s wants to merge 2 commits into
Draft
cryptodev-2s wants to merge 2 commits into
cryptodev-2s wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Clears the remaining 67
@typescript-eslint/no-explicit-anysuppressions the@metamask/utilsmigration left ineslint-suppressions.json, across 12 files.packages/utilsnow has zero entries in that file.Most are tests casting to
anyto pass deliberately invalid input. Those now cast to the real parameter type instead (CaipChainId,EthereumUnit,string | number | bigint). Infs.test.tsthe fourstringifiermocks hand copiedJSON.stringify's signature, so they are annotated withtypeof JSON.stringifyand the params are contextually typed.Three public signatures widen from
anytounknown:assert,FrozenMap.forEachandFrozenSet.forEach(thisArg), andgetKnownPropertyNames. Not breaking,unknownaccepts everythinganydid. Changelog entry added, PR number needs filling in.Two keep
anywith inline disables:json.ts:Struct<unknown>does not compile.refineris a property, so the value type lands in a contravariant position and no concrete struct satisfies the constraint.json.tst.ts: theanyis what the assertion is testing.Verified: eslint clean,
yarn lint:tscclean repo wide, 1993 unit tests, 120 tstyche assertions.References
Follows #10185
Checklist