Skip to content

Commit a324a7a

Browse files
authored
Bump ESLint configs and dependencies to latest version (#89)
* Bump ESLint configs and dependencies to latest versions * Update code coverage percentage values The previous values of code coverage were updated to new and more accurate values.
1 parent 23c4857 commit a324a7a

File tree

9 files changed

+235
-124
lines changed

9 files changed

+235
-124
lines changed

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ module.exports = {
4747
global: {
4848
branches: 94.25,
4949
functions: 94.11,
50-
lines: 97.02,
51-
statements: 97.02,
50+
lines: 97.04,
51+
statements: 97.04,
5252
},
5353
},
5454

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@
4242
"devDependencies": {
4343
"@lavamoat/allow-scripts": "^2.0.3",
4444
"@metamask/auto-changelog": "^2.3.0",
45-
"@metamask/eslint-config": "^10.0.0",
45+
"@metamask/eslint-config": "^11.1.0",
4646
"@metamask/eslint-config-jest": "^11.1.0",
47-
"@metamask/eslint-config-nodejs": "^10.0.0",
48-
"@metamask/eslint-config-typescript": "^10.0.0",
47+
"@metamask/eslint-config-nodejs": "^11.1.0",
48+
"@metamask/eslint-config-typescript": "^11.1.0",
4949
"@types/jest": "^28.1.6",
50-
"@typescript-eslint/eslint-plugin": "^5.33.1",
51-
"@typescript-eslint/parser": "^5.33.1",
52-
"eslint": "^8.22.0",
50+
"@typescript-eslint/eslint-plugin": "^5.42.1",
51+
"@typescript-eslint/parser": "^5.42.1",
52+
"eslint": "^8.27.0",
5353
"eslint-config-prettier": "^8.5.0",
5454
"eslint-plugin-import": "^2.26.0",
55-
"eslint-plugin-jest": "^26.8.3",
56-
"eslint-plugin-jsdoc": "^39.3.6",
55+
"eslint-plugin-jest": "^27.1.5",
56+
"eslint-plugin-jsdoc": "^39.6.2",
5757
"eslint-plugin-node": "^11.1.0",
5858
"eslint-plugin-prettier": "^4.2.1",
5959
"fast-deep-equal": "^2.0.1",

src/classes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import safeStringify from 'fast-safe-stringify';
21
import {
32
isPlainObject,
43
Json,
54
JsonRpcError as SerializedJsonRpcError,
65
} from '@metamask/utils';
6+
import safeStringify from 'fast-safe-stringify';
7+
78
import { DataWithOptionalCause, serializeCause } from './utils';
89

9-
export { SerializedJsonRpcError };
10+
export type { SerializedJsonRpcError };
1011

1112
/**
1213
* Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors

src/error-constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const errorCodes = {
2121
},
2222
};
2323

24+
/* eslint-disable @typescript-eslint/naming-convention */
2425
export const errorValues = {
2526
'-32700': {
2627
standard: 'JSON RPC 2.0',
@@ -89,3 +90,4 @@ export const errorValues = {
8990
message: 'The provider is disconnected from the specified chain.',
9091
},
9192
};
93+
/* eslint-enable @typescript-eslint/naming-convention */

src/errors.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
import { assert, isPlainObject } from '@metamask/utils';
2-
import { getMessageFromCode, JSON_RPC_SERVER_ERROR_MESSAGE } from './utils';
2+
3+
import { rpcErrors, providerErrors, errorCodes } from '.';
34
import {
45
dummyData,
56
CUSTOM_ERROR_MESSAGE,
67
SERVER_ERROR_CODE,
78
CUSTOM_ERROR_CODE,
89
} from './__fixtures__';
9-
import { rpcErrors, providerErrors, errorCodes } from '.';
10+
import { getMessageFromCode, JSON_RPC_SERVER_ERROR_MESSAGE } from './utils';
1011

1112
describe('rpcErrors.invalidInput', () => {
1213
it('accepts a single string argument where appropriate', () => {
13-
const err = rpcErrors.invalidInput(CUSTOM_ERROR_MESSAGE);
14-
expect(err.code).toBe(errorCodes.rpc.invalidInput);
15-
expect(err.message).toBe(CUSTOM_ERROR_MESSAGE);
14+
const error = rpcErrors.invalidInput(CUSTOM_ERROR_MESSAGE);
15+
expect(error.code).toBe(errorCodes.rpc.invalidInput);
16+
expect(error.message).toBe(CUSTOM_ERROR_MESSAGE);
1617
});
1718
});
1819

1920
describe('providerErrors.unauthorized', () => {
2021
it('accepts a single string argument where appropriate', () => {
21-
const err = providerErrors.unauthorized(CUSTOM_ERROR_MESSAGE);
22-
expect(err.code).toBe(errorCodes.provider.unauthorized);
23-
expect(err.message).toBe(CUSTOM_ERROR_MESSAGE);
22+
const error = providerErrors.unauthorized(CUSTOM_ERROR_MESSAGE);
23+
expect(error.code).toBe(errorCodes.provider.unauthorized);
24+
expect(error.message).toBe(CUSTOM_ERROR_MESSAGE);
2425
});
2526
});
2627

src/errors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JsonRpcError, EthereumProviderError } from './classes';
2-
import { DataWithOptionalCause, getMessageFromCode } from './utils';
32
import { errorCodes } from './error-constants';
3+
import { DataWithOptionalCause, getMessageFromCode } from './utils';
44

55
type EthereumErrorOptions<T extends DataWithOptionalCause> = {
66
message?: string;
@@ -242,7 +242,7 @@ function getJsonRpcError<T extends DataWithOptionalCause>(
242242
arg?: JsonRpcErrorsArg<T>,
243243
): JsonRpcError<T> {
244244
const [message, data] = parseOpts(arg);
245-
return new JsonRpcError(code, message || getMessageFromCode(code), data);
245+
return new JsonRpcError(code, message ?? getMessageFromCode(code), data);
246246
}
247247

248248
/**
@@ -259,7 +259,7 @@ function getEthProviderError<T extends DataWithOptionalCause>(
259259
const [message, data] = parseOpts(arg);
260260
return new EthereumProviderError(
261261
code,
262-
message || getMessageFromCode(code),
262+
message ?? getMessageFromCode(code),
263263
data,
264264
);
265265
}
@@ -282,7 +282,7 @@ function parseOpts<T extends DataWithOptionalCause>(
282282
if (message && typeof message !== 'string') {
283283
throw new Error('Must specify string message.');
284284
}
285-
return [message || undefined, data];
285+
return [message ?? undefined, data];
286286
}
287287
}
288288

src/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { errorCodes, rpcErrors } from '.';
12
import {
23
invalidError0,
34
invalidError1,
@@ -16,7 +17,6 @@ import {
1617
dummyData,
1718
} from './__fixtures__';
1819
import { getMessageFromCode, serializeError } from './utils';
19-
import { errorCodes, rpcErrors } from '.';
2020

2121
const rpcCodes = errorCodes.rpc;
2222

src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
JsonRpcError as SerializedJsonRpcError,
88
RuntimeObject,
99
} from '@metamask/utils';
10+
1011
import { errorCodes, errorValues } from './error-constants';
1112

1213
/**

0 commit comments

Comments
 (0)