Skip to content

Commit

Permalink
Pin eslint-plugin-import to 2.26.0 as workaround for regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Jun 30, 2023
1 parent a15882b commit 88f7913
Show file tree
Hide file tree
Showing 27 changed files with 60 additions and 52 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -53,6 +53,7 @@
"@types/glob@^7.1.1": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch",
"@types/mocha@^10.0.1": "patch:@types/mocha@npm:10.0.1#.yarn/patches/@types-mocha-npm-10.0.1-7c94e9e170.patch",
"clet@^1.0.1": "patch:clet@npm%3A1.0.1#./.yarn/patches/clet-npm-1.0.1-8523231bdc.patch",
"eslint-plugin-import": "2.26.0",
"find-babel-config": "^2.0.0",
"inline-source-map@~0.6.0": "patch:inline-source-map@npm%3A0.6.2#./.yarn/patches/inline-source-map-npm-0.6.2-96902459a0.patch",
"jest-fetch-mock@^3.0.3": "patch:jest-fetch-mock@npm:3.0.3#.yarn/patches/jest-fetch-mock-npm-3.0.3-ac072ca8af.patch",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-cli/src/cmds/watch/watchHandler.ts
Expand Up @@ -91,7 +91,7 @@ export async function watch(argv: YargsArgs): Promise<void> {

.on('ready', () => {
buildSnap()
.then(() => {
.then(async () => {
if (shouldServe) {
return serve(argv);
}
Expand Down
Expand Up @@ -1772,7 +1772,7 @@ describe('SnapController', () => {
// we need an rpc message handler function to be returned
jest
.spyOn(messenger, 'call')
.mockImplementation((method, ..._args: unknown[]) => {
.mockImplementation(async (method, ..._args: unknown[]) => {
if (method === 'ExecutionService:executeSnap') {
return deferredExecutePromise;
} else if (method === 'ExecutionService:handleRpcRequest') {
Expand Down
Expand Up @@ -113,7 +113,7 @@ export function createEndowments(

const teardown = async () => {
await Promise.all(
result.teardowns.map((teardownFunction) => teardownFunction()),
result.teardowns.map(async (teardownFunction) => teardownFunction()),
);
};
return { endowments: result.allEndowments, teardown };
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-jest/src/helpers.ts
Expand Up @@ -70,7 +70,7 @@ export async function installSnap(
});

return {
request: (options) => {
request: async (options) => {
log('Sending request %o.', options);

// Note: This function is intentionally not async, so that we can access
Expand All @@ -84,7 +84,7 @@ export async function installSnap(
return await sendTransaction(page, options);
},

runCronjob: (options) => {
runCronjob: async (options) => {
log('Running cronjob %o.', options);

// Note: This function is intentionally not async, so that we can access
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-jest/src/internals/request.ts
Expand Up @@ -60,7 +60,7 @@ async function sendRequest(page: Page, args: SnapRpcHookArgs) {
* @param handler - The handler to use. Defaults to `onRpcRequest`.
* @returns The response.
*/
export function request(
export async function request(
page: Page,
{ origin = 'metamask.io', ...options }: RequestOptions,
handler:
Expand Down Expand Up @@ -163,6 +163,6 @@ export async function sendTransaction(
* @param options - The request options.
* @returns The response.
*/
export function runCronjob(page: Page, options: CronjobOptions) {
export async function runCronjob(page: Page, options: CronjobOptions) {
return request(page, options, HandlerType.OnCronjob);
}
7 changes: 7 additions & 0 deletions packages/test-snaps/.eslintrc.js
Expand Up @@ -4,4 +4,11 @@ module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},

ignorePatterns: [
'!.prettierrc.js',
'**/!.eslintrc.js',
'**/.cache/**',
'**/public/**',
],
};
2 changes: 1 addition & 1 deletion packages/test-snaps/src/components/Connect.tsx
Expand Up @@ -3,9 +3,9 @@ import { graphql, useStaticQuery } from 'gatsby';
import { ChangeEvent, FormEvent, FunctionComponent, useState } from 'react';
import { Button, Form } from 'react-bootstrap';

import { ButtonSpinner } from './ButtonSpinner';
import { useInstallSnapMutation } from '../api';
import { useInstalled } from '../utils';
import { ButtonSpinner } from './ButtonSpinner';

type ConnectProps = {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/test-snaps/src/components/Snap.tsx
Expand Up @@ -2,8 +2,8 @@ import { FunctionComponent, ReactNode } from 'react';
import { Card, Col } from 'react-bootstrap';
import CardHeader from 'react-bootstrap/CardHeader';

import { Connect } from './Connect';
import { getSnapId } from '../utils';
import { Connect } from './Connect';

export type SnapProps = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/test-snaps/src/features/snaps/bip32/BIP32.tsx
@@ -1,8 +1,8 @@
import { FunctionComponent } from 'react';

import { Snap } from '../../../components';
import { PublicKey, SignMessage } from './components';
import { BIP_32_PORT, BIP_32_SNAP_ID } from './constants';
import { Snap } from '../../../components';

export const BIP32: FunctionComponent = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/test-snaps/src/features/snaps/bip44/BIP44.tsx
Expand Up @@ -2,11 +2,11 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';

import { SignMessage } from './components';
import { BIP_44_PORT, BIP_44_SNAP_ID } from './constants';
import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { SignMessage } from './components';
import { BIP_44_PORT, BIP_44_SNAP_ID } from './constants';

export const BIP44: FunctionComponent = () => {
const [invokeSnap, { isLoading, data, error }] = useInvokeMutation();
Expand Down
@@ -1,7 +1,7 @@
import { FunctionComponent } from 'react';

import { CRONJOBS_SNAP_ID, CRONJOBS_SNAP_PORT } from './constants';
import { Snap } from '../../../components';
import { CRONJOBS_SNAP_ID, CRONJOBS_SNAP_PORT } from './constants';

export const Cronjobs: FunctionComponent = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/test-snaps/src/features/snaps/dialogs/Dialogs.tsx
Expand Up @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';

import { DIALOGS_SNAP_ID, DIALOGS_SNAP_PORT } from './constants';
import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { DIALOGS_SNAP_ID, DIALOGS_SNAP_PORT } from './constants';

export const Dialogs: FunctionComponent = () => {
const [invokeSnap, { isLoading, data }] = useInvokeMutation();
Expand Down
2 changes: 1 addition & 1 deletion packages/test-snaps/src/features/snaps/errors/Errors.tsx
Expand Up @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button } from 'react-bootstrap';

import { ERRORS_SNAP_ID, ERRORS_SNAP_PORT } from './constants';
import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { ERRORS_SNAP_ID, ERRORS_SNAP_PORT } from './constants';

export const Errors: FunctionComponent = () => {
const [invokeSnap, { isLoading, data, error }] = useInvokeMutation();
Expand Down
Expand Up @@ -2,13 +2,13 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button } from 'react-bootstrap';

import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import {
ETHEREUM_PROVIDER_SNAP_ID,
ETHEREUM_PROVIDER_SNAP_PORT,
} from './constants';
import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';

export const EthereumProvider: FunctionComponent = () => {
const [invokeSnap, { isLoading, data, error }] = useInvokeMutation();
Expand Down
@@ -1,8 +1,8 @@
import { FunctionComponent } from 'react';

import { Snap } from '../../../components';
import { SignMessage } from './components';
import { ETHERS_JS_PORT, ETHERS_JS_SNAP_ID } from './constants';
import { Snap } from '../../../components';

export const EthersJs: FunctionComponent = () => {
return (
Expand Down
@@ -1,8 +1,8 @@
import { FunctionComponent } from 'react';

import { Snap } from '../../../components';
import { SignMessage } from './components';
import { GET_ENTROPY_PORT, GET_ENTROPY_SNAP_ID } from './constants';
import { Snap } from '../../../components';

export const GetEntropy: FunctionComponent = () => {
return (
Expand Down
Expand Up @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button } from 'react-bootstrap';

import { JSON_RPC_SNAP_ID, JSON_RPC_SNAP_PORT } from './constants';
import { useInvokeMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { JSON_RPC_SNAP_ID, JSON_RPC_SNAP_PORT } from './constants';

export const JsonRpc: FunctionComponent = () => {
const [invokeSnap, { isLoading, data, error }] = useInvokeMutation();
Expand Down
@@ -1,9 +1,9 @@
import { FunctionComponent } from 'react';

import { Result, Snap } from '../../../components';
import { ClearData, SendData } from './components';
import { MANAGE_STATE_SNAP_ID, MANAGE_STATE_PORT } from './constants';
import { useSnapState } from './hooks';
import { Result, Snap } from '../../../components';

export const ManageState: FunctionComponent = () => {
const state = useSnapState();
Expand Down
Expand Up @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button } from 'react-bootstrap';

import { NETWORK_ACCESS_PORT, NETWORK_ACCESS_SNAP_ID } from './constants';
import { useInvokeMutation } from '../../../api';
import { Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { NETWORK_ACCESS_PORT, NETWORK_ACCESS_SNAP_ID } from './constants';

export const NetworkAccess: FunctionComponent = () => {
const [invokeSnap, { isLoading }] = useInvokeMutation();
Expand Down
Expand Up @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';

import { NOTIFICATIONS_SNAP_ID, NOTIFICATIONS_SNAP_PORT } from './constants';
import { useInvokeMutation } from '../../../api';
import { Snap } from '../../../components';
import { getSnapId } from '../../../utils';
import { NOTIFICATIONS_SNAP_ID, NOTIFICATIONS_SNAP_PORT } from './constants';

export const Notifications: FunctionComponent = () => {
const [invokeSnap, { isLoading }] = useInvokeMutation();
Expand Down
Expand Up @@ -3,12 +3,12 @@ import { assert } from '@metamask/utils';
import { FunctionComponent } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';

import { useLazyGetAccountsQuery, useLazyRequestQuery } from '../../../api';
import { Snap, Result } from '../../../components';
import {
TRANSACTION_INSIGHTS_SNAP_ID,
TRANSACTION_INSIGHTS_SNAP_PORT,
} from './constants';
import { useLazyGetAccountsQuery, useLazyRequestQuery } from '../../../api';
import { Snap, Result } from '../../../components';

export const TransactionInsights: FunctionComponent = () => {
const [getAccounts, { isLoading: isLoadingAccounts, data: accounts }] =
Expand Down
4 changes: 2 additions & 2 deletions packages/test-snaps/src/features/snaps/updates/Updates.tsx
Expand Up @@ -2,13 +2,13 @@ import { logError } from '@metamask/snaps-utils';
import { FunctionComponent } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';

import { useGetSnapsQuery, useInstallSnapMutation } from '../../../api';
import { Result, Snap } from '../../../components';
import {
UPDATES_SNAP_ID,
UPDATES_SNAP_NEW_VERSION,
UPDATES_SNAP_OLD_VERSION,
} from './constants';
import { useGetSnapsQuery, useInstallSnapMutation } from '../../../api';
import { Result, Snap } from '../../../components';

export const Updates: FunctionComponent = () => {
const [installSnap, { isLoading }] = useInstallSnapMutation();
Expand Down
@@ -1,8 +1,8 @@
import { FunctionComponent } from 'react';

import { Snap } from '../../../components';
import { FibonacciInput } from './components';
import { WASM_SNAP_ID, WASM_SNAP_PORT } from './constants';
import { Snap } from '../../../components';

export const WASM: FunctionComponent = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-tsconfig.mjs
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
const cwd = pathUtils.dirname(fileURLToPath(import.meta.url))

// These are the packages we expect to _not_ be referenced in the root tsconfig.
const IGNORE_LIST = new Set(['examples', 'snaps-types']);
const IGNORE_LIST = new Set(['examples', 'snaps-types', 'test-snaps']);

// Get reference paths from root tsconfig.json
const rootTsconfig = JSON.parse(await fs.readFile('./tsconfig.json', { encoding: 'utf8' }));
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Expand Up @@ -15,6 +15,8 @@
{ "path": "./packages/snaps-webpack-plugin" }
],
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"esModuleInterop": true,
"noEmit": true,
"resolveJsonModule": true
Expand Down

0 comments on commit 88f7913

Please sign in to comment.