Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
bump eslint packages (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanthesha authored Oct 5, 2023
1 parent 0f20db6 commit 421893f
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 85 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"devDependencies": {
"@lavamoat/allow-scripts": "^2.3.1",
"@metamask/auto-changelog": "^3.1.0",
"@metamask/eslint-config": "^11.0.1",
"@metamask/eslint-config-jest": "^11.0.0",
"@metamask/eslint-config-nodejs": "^11.0.1",
"@metamask/eslint-config-typescript": "^11.0.0",
"@metamask/eslint-config": "^12.2.0",
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.43.0",
Expand All @@ -55,8 +55,9 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.5.0",
"jest-it-up": "^2.2.0",
"prettier": "^2.8.7",
Expand Down
6 changes: 3 additions & 3 deletions src/JsonRpcEngine.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { rpcErrors } from '@metamask/rpc-errors';
import type { JsonRpcParams, Json } from '@metamask/utils';
import {
assertIsJsonRpcSuccess,
assertIsJsonRpcFailure,
isJsonRpcFailure,
isJsonRpcSuccess,
JsonRpcParams,
Json,
} from '@metamask/utils';

import { JsonRpcEngine, JsonRpcMiddleware } from '.';
import type { JsonRpcMiddleware } from '.';
import { JsonRpcEngine } from '.';

const jsonrpc = '2.0' as const;

Expand Down
13 changes: 6 additions & 7 deletions src/JsonRpcEngine.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { errorCodes, JsonRpcError, serializeError } from '@metamask/rpc-errors';
import SafeEventEmitter from '@metamask/safe-event-emitter';
import {
hasProperty,
import type {
JsonRpcError as SerializedJsonRpcError,
JsonRpcRequest,
JsonRpcResponse,
JsonRpcNotification,
isJsonRpcRequest,
Json,
JsonRpcParams,
PendingJsonRpcResponse,
} from '@metamask/utils';
import { hasProperty, isJsonRpcRequest } from '@metamask/utils';

export type JsonRpcEngineCallbackError = Error | SerializedJsonRpcError | null;

Expand Down Expand Up @@ -347,11 +346,11 @@ export class JsonRpcEngine extends SafeEventEmitter {
// errors are unexpected and should be surfaced to the caller.
if (error && res === undefined) {
reject(error);
} else {
// Excepting notifications, there will always be a response, and it will
// always have any error that is caught and propagated.
resolve(res);
}

// Excepting notifications, there will always be a response, and it will
// always have any error that is caught and propagated.
resolve(res);
}).catch(reject);
});
}
Expand Down
7 changes: 2 additions & 5 deletions src/asMiddleware.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
assertIsJsonRpcSuccess,
isJsonRpcSuccess,
JsonRpcRequest,
} from '@metamask/utils';
import type { JsonRpcRequest } from '@metamask/utils';
import { assertIsJsonRpcSuccess, isJsonRpcSuccess } from '@metamask/utils';

import { JsonRpcEngine } from '.';

Expand Down
6 changes: 4 additions & 2 deletions src/createAsyncMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ describe('createAsyncMiddleware', () => {
engine.push(
createAsyncMiddleware(async (_request, response, next) => {
expect(response.result).toBeUndefined();
await next(); // eslint-disable-line node/callback-return
// eslint-disable-next-line n/callback-return
await next();
expect(response.result).toBe(1234);
// override value
response.result = 42; // eslint-disable-line require-atomic-updates
Expand Down Expand Up @@ -87,7 +88,8 @@ describe('createAsyncMiddleware', () => {

engine.push(
createAsyncMiddleware(async (_request, _response, next) => {
await next(); // eslint-disable-line node/callback-return
// eslint-disable-next-line n/callback-return
await next();
throw thrownError;
}),
);
Expand Down
5 changes: 2 additions & 3 deletions src/createAsyncMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
import type {
Json,
JsonRpcParams,
JsonRpcRequest,
PendingJsonRpcResponse,
} from '@metamask/utils';

import { JsonRpcMiddleware } from './JsonRpcEngine';
import type { JsonRpcMiddleware } from './JsonRpcEngine';

export type AsyncJsonRpcEngineNextCallback = () => Promise<void>;

Expand Down Expand Up @@ -66,7 +66,6 @@ export function createAsyncMiddleware<

// We pass a return handler to next(). When it is called by the engine,
// the consumer's async middleware will resume executing.
// eslint-disable-next-line node/callback-return
next((runReturnHandlersCallback) => {
// This callback comes from JsonRpcEngine._runReturnHandlers
returnHandlerCallback = runReturnHandlersCallback;
Expand Down
6 changes: 3 additions & 3 deletions src/createScaffoldMiddleware.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { rpcErrors } from '@metamask/rpc-errors';
import type { JsonRpcParams, Json } from '@metamask/utils';
import {
assertIsJsonRpcSuccess,
assertIsJsonRpcFailure,
JsonRpcParams,
Json,
} from '@metamask/utils';

import { JsonRpcEngine, createScaffoldMiddleware, JsonRpcMiddleware } from '.';
import type { JsonRpcMiddleware } from '.';
import { JsonRpcEngine, createScaffoldMiddleware } from '.';

describe('createScaffoldMiddleware', () => {
it('basic middleware test', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/createScaffoldMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Json, JsonRpcParams, JsonRpcSuccess } from '@metamask/utils';
import type { Json, JsonRpcParams, JsonRpcSuccess } from '@metamask/utils';

import { JsonRpcMiddleware } from './JsonRpcEngine';
import type { JsonRpcMiddleware } from './JsonRpcEngine';

type ScaffoldMiddlewareHandler<
Params extends JsonRpcParams,
Expand Down
4 changes: 2 additions & 2 deletions src/idRemapMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Json, JsonRpcParams } from '@metamask/utils';
import type { Json, JsonRpcParams } from '@metamask/utils';

import { getUniqueId } from './getUniqueId';
import { JsonRpcMiddleware } from './JsonRpcEngine';
import type { JsonRpcMiddleware } from './JsonRpcEngine';

/**
* Returns a middleware function that overwrites the `id` property of each
Expand Down
7 changes: 2 additions & 5 deletions src/mergeMiddleware.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
assertIsJsonRpcSuccess,
hasProperty,
JsonRpcRequest,
} from '@metamask/utils';
import type { JsonRpcRequest } from '@metamask/utils';
import { assertIsJsonRpcSuccess, hasProperty } from '@metamask/utils';

import { JsonRpcEngine, mergeMiddleware } from '.';

Expand Down
5 changes: 3 additions & 2 deletions src/mergeMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Json, JsonRpcParams } from '@metamask/utils';
import type { Json, JsonRpcParams } from '@metamask/utils';

import { JsonRpcEngine, JsonRpcMiddleware } from './JsonRpcEngine';
import type { JsonRpcMiddleware } from './JsonRpcEngine';
import { JsonRpcEngine } from './JsonRpcEngine';

/**
* Takes a stack of middleware and joins them into a single middleware function.
Expand Down
Loading

0 comments on commit 421893f

Please sign in to comment.