Skip to content

Commit

Permalink
lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Sep 7, 2023
1 parent a6d09ec commit 4afbff3
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
SubjectPermissions,
ValidPermission,
} from '@metamask/permission-controller';
import { providerErrors, rpcErrors } from '@metamask/rpc-errors';
import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods';
import type { SnapPermissions, ValidatedSnapId } from '@metamask/snaps-utils';
import {
Expand Down Expand Up @@ -31,7 +32,6 @@ import {
} from '@metamask/snaps-utils/test-utils';
import type { SemVerRange, SemVerVersion } from '@metamask/utils';
import { AssertionError } from '@metamask/utils';
import { providerErrors, rpcErrors } from '@metamask/rpc-errors';
import fetchMock from 'jest-fetch-mock';
import { createAsyncMiddleware, JsonRpcEngine } from 'json-rpc-engine';
import { createEngineStream } from 'json-rpc-middleware-stream';
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
ValidPermission,
} from '@metamask/permission-controller';
import { SubjectType } from '@metamask/permission-controller';
import { rpcErrors } from '@metamask/rpc-errors';
import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods';
import type { BlockReason } from '@metamask/snaps-registry';
import type {
Expand Down Expand Up @@ -76,7 +77,6 @@ import {
} from '@metamask/utils';
import type { StateMachine } from '@xstate/fsm';
import { createMachine, interpret } from '@xstate/fsm';
import { rpcErrors } from '@metamask/rpc-errors';
import type { Patch } from 'immer';
import { nanoid } from 'nanoid';

Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/endowments/cronjob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import type {
CaveatSpecificationConstraint,
} from '@metamask/permission-controller';
import { PermissionType, SubjectType } from '@metamask/permission-controller';
import { rpcErrors } from '@metamask/rpc-errors';
import type { CronjobSpecification } from '@metamask/snaps-utils';
import {
SnapCaveatType,
isCronjobSpecificationArray,
} from '@metamask/snaps-utils';
import type { Json, NonEmptyArray } from '@metamask/utils';
import { assert, hasProperty, isPlainObject } from '@metamask/utils';
import { rpcErrors } from '@metamask/rpc-errors';

import { SnapEndowments } from './enum';

Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/endowments/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import type {
ValidPermissionSpecification,
} from '@metamask/permission-controller';
import { PermissionType, SubjectType } from '@metamask/permission-controller';
import { rpcErrors } from '@metamask/rpc-errors';
import type { RpcOrigins } from '@metamask/snaps-utils';
import { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils';
import type { Json, NonEmptyArray } from '@metamask/utils';
import { hasProperty, isPlainObject, assert } from '@metamask/utils';
import { rpcErrors } from '@metamask/rpc-errors';

import { SnapEndowments } from './enum';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import type {
Caveat,
} from '@metamask/permission-controller';
import { PermissionType, SubjectType } from '@metamask/permission-controller';
import { rpcErrors } from '@metamask/rpc-errors';
import { SnapCaveatType } from '@metamask/snaps-utils';
import type { Json, NonEmptyArray } from '@metamask/utils';
import { assert, hasProperty, isObject, isPlainObject } from '@metamask/utils';
import { rpcErrors } from '@metamask/rpc-errors';

import { SnapEndowments } from './enum';

Expand Down
8 changes: 6 additions & 2 deletions packages/snaps-controllers/src/snaps/registry/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { BaseControllerV2 as BaseController } from '@metamask/base-controller';
import type { SnapsRegistryDatabase } from '@metamask/snaps-registry';
import { verify } from '@metamask/snaps-registry';
import type { SnapId } from '@metamask/snaps-utils';
import type { Hex } from '@metamask/utils';
import type { Hex, SemVerRange } from '@metamask/utils';
import {
assert,
Duration,
inMilliseconds,
satisfiesVersionRange,
SemVerVersion,

Check failure on line 12 in packages/snaps-controllers/src/snaps/registry/json.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (@metamask/snaps-controllers)

'SemVerVersion' is defined but never used
} from '@metamask/utils';

import type {
Expand Down Expand Up @@ -226,7 +227,10 @@ export class JsonSnapsRegistry extends BaseController<
if ('id' in blocked) {
return (
blocked.id === snapId &&
satisfiesVersionRange(snapInfo.version, blocked.versionRange)
satisfiesVersionRange(
snapInfo.version,
blocked.versionRange as SemVerRange,

Check failure on line 232 in packages/snaps-controllers/src/snaps/registry/json.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Build types

Conversion of type 'import("/home/runner/work/snaps/snaps/node_modules/@metamask/snaps-registry/node_modules/@metamask/utils/dist/types/versions").SemVerRange' to type 'import("/home/runner/work/snaps/snaps/node_modules/@metamask/utils/dist/types/versions").SemVerRange' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/test-utils/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
SubjectMetadata,
} from '@metamask/permission-controller';
import { SubjectType } from '@metamask/permission-controller';
import { providerErrors } from '@metamask/rpc-errors';
import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods';
import type { ValidatedSnapId } from '@metamask/snaps-utils';
import { SnapCaveatType } from '@metamask/snaps-utils';
Expand All @@ -19,7 +20,6 @@ import {
MOCK_SNAP_ID,
} from '@metamask/snaps-utils/test-utils';
import type { Json } from '@metamask/utils';
import { providerErrors } from '@metamask/rpc-errors';

import type {
CronjobControllerActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// <reference path="../../../../node_modules/ses/types.d.ts" />
import { StreamProvider } from '@metamask/providers';
import type { RequestArguments } from '@metamask/providers/dist/BaseProvider';
import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors';
import type { SnapsGlobalObject } from '@metamask/rpc-methods';
import type {
SnapExports,
Expand All @@ -27,7 +28,6 @@ import {
hasProperty,
getSafeJson,
} from '@metamask/utils';
import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors';
import { createIdRemapMiddleware } from 'json-rpc-engine';
import type { Duplex } from 'stream';
import { validate } from 'superstruct';
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-execution-environments/src/common/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StreamProvider } from '@metamask/providers';
import type { RequestArguments } from '@metamask/providers/dist/BaseProvider';
import { assert, assertStruct, JsonStruct } from '@metamask/utils';
import { rpcErrors } from '@metamask/rpc-errors';
import { assert, assertStruct, JsonStruct } from '@metamask/utils';

import { log } from '../logging';

Expand Down

0 comments on commit 4afbff3

Please sign in to comment.