Skip to content

Commit 84418e9

Browse files
committed
upgrade dependencies && npm run lint:fix
1 parent b0e4662 commit 84418e9

10 files changed

+977
-632
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
{ "selector": "default", "format": ["camelCase", "UPPER_CASE", "PascalCase"], "leadingUnderscore": "allow" },
4949
{ "selector": "typeLike", "format": ["PascalCase"], "leadingUnderscore": "allow" },
5050
],
51-
"@typescript-eslint/restrict-plus-operands": ["warn", { "checkCompoundAssignments": true }],
51+
"@typescript-eslint/restrict-plus-operands": "warn",
5252
"@typescript-eslint/no-throw-literal": "warn",
5353
"@typescript-eslint/unbound-method": "warn",
5454
"@typescript-eslint/explicit-module-boundary-types": "warn",

package-lock.json

+955-615
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CachedKeyDecoder.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export class CachedKeyDecoder implements KeyDecoder {
1717
miss = 0;
1818
private readonly caches: Array<Array<KeyCacheRecord>>;
1919

20-
constructor(readonly maxKeyLength = DEFAULT_MAX_KEY_LENGTH, readonly maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) {
20+
constructor(
21+
readonly maxKeyLength = DEFAULT_MAX_KEY_LENGTH,
22+
readonly maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY,
23+
) {
2124
// avoid `new Array(N)`, which makes a sparse array,
2225
// because a sparse array is typically slower than a non-sparse array.
2326
this.caches = [];

src/Decoder.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export type DecoderOptions<ContextType = undefined> = Readonly<
6060
> &
6161
ContextOf<ContextType>;
6262

63-
6463
const STATE_ARRAY = "array";
6564
const STATE_MAP_KEY = "map_key";
6665
const STATE_MAP_VALUE = "map_value";
@@ -120,7 +119,6 @@ class StackPool {
120119
this.stackHeadPosition++;
121120

122121
if (this.stackHeadPosition === this.stack.length) {
123-
124122
const partialState: Partial<StackState> = {
125123
type: undefined,
126124
size: 0,
@@ -131,7 +129,7 @@ class StackPool {
131129
key: null,
132130
};
133131

134-
this.stack.push(partialState as StackState)
132+
this.stack.push(partialState as StackState);
135133
}
136134

137135
return this.stack[this.stackHeadPosition];
@@ -182,7 +180,9 @@ try {
182180
EMPTY_VIEW.getInt8(0);
183181
} catch (e) {
184182
if (!(e instanceof RangeError)) {
185-
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
183+
throw new Error(
184+
"This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access",
185+
);
186186
}
187187
}
188188
export const DataViewIndexOutOfBoundsError = RangeError;
@@ -220,7 +220,7 @@ export class Decoder<ContextType = undefined> {
220220
this.maxArrayLength = options?.maxArrayLength ?? UINT32_MAX;
221221
this.maxMapLength = options?.maxMapLength ?? UINT32_MAX;
222222
this.maxExtLength = options?.maxExtLength ?? UINT32_MAX;
223-
this.keyDecoder = (options?.keyDecoder !== undefined) ? options.keyDecoder : sharedCachedKeyDecoder;
223+
this.keyDecoder = options?.keyDecoder !== undefined ? options.keyDecoder : sharedCachedKeyDecoder;
224224
}
225225

226226
private reinitializeState() {

src/Encoder.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ensureUint8Array } from "./utils/typedArrays";
55
import type { ExtData } from "./ExtData";
66
import type { ContextOf } from "./context";
77

8-
98
export const DEFAULT_MAX_DEPTH = 100;
109
export const DEFAULT_INITIAL_BUFFER_SIZE = 2048;
1110

@@ -69,7 +68,8 @@ export type EncoderOptions<ContextType = undefined> = Partial<
6968
*/
7069
forceIntegerToFloat: boolean;
7170
}>
72-
> & ContextOf<ContextType>;
71+
> &
72+
ContextOf<ContextType>;
7373

7474
export class Encoder<ContextType = undefined> {
7575
private readonly extensionCodec: ExtensionCodecType<ContextType>;

src/ExtData.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
* ExtData is used to handle Extension Types that are not registered to ExtensionCodec.
33
*/
44
export class ExtData {
5-
constructor(readonly type: number, readonly data: Uint8Array) {}
5+
constructor(
6+
readonly type: number,
7+
readonly data: Uint8Array,
8+
) {}
69
}

src/decode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const defaultDecodeOptions: never = undefined as never;
1616
* It decodes a single MessagePack object in a buffer.
1717
*
1818
* This is a synchronous decoding function.
19-
* See other variants for asynchronous decoding: {@link decodeAsync()}, {@link decodeStream()}, or {@link decodeArrayStream()}.
19+
* See other variants for asynchronous decoding: {@link decodeAsync}, {@link decodeStream}, or {@link decodeArrayStream}.
2020
*
2121
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
2222
* @throws {@link DecodeError} if the buffer contains invalid data.
@@ -31,7 +31,7 @@ export function decode<ContextType = undefined>(
3131

3232
/**
3333
* It decodes multiple MessagePack objects in a buffer.
34-
* This is corresponding to {@link decodeMultiStream()}.
34+
* This is corresponding to {@link decodeMultiStream}.
3535
*
3636
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
3737
* @throws {@link DecodeError} if the buffer contains invalid data.

src/decodeAsync.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { SplitUndefined } from "./context";
88
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
99
* @throws {@link DecodeError} if the buffer contains invalid data.
1010
*/
11-
export async function decodeAsync<ContextType = undefined>(
11+
export async function decodeAsync<ContextType = undefined>(
1212
streamLike: ReadableStreamLike<ArrayLike<number> | BufferSource>,
1313
options?: DecoderOptions<SplitUndefined<ContextType>>,
1414
): Promise<unknown> {
@@ -21,7 +21,7 @@ import type { SplitUndefined } from "./context";
2121
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.
2222
* @throws {@link DecodeError} if the buffer contains invalid data.
2323
*/
24-
export function decodeArrayStream<ContextType>(
24+
export function decodeArrayStream<ContextType>(
2525
streamLike: ReadableStreamLike<ArrayLike<number> | BufferSource>,
2626
options?: DecoderOptions<SplitUndefined<ContextType>>,
2727
): AsyncGenerator<unknown, void, unknown> {
@@ -44,6 +44,6 @@ export function decodeMultiStream<ContextType>(
4444
}
4545

4646
/**
47-
* @deprecated Use {@link decodeMultiStream()} instead.
47+
* @deprecated Use {@link decodeMultiStream} instead.
4848
*/
4949
export const decodeStream: never = undefined as never;

src/utils/utf8.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
export function utf8Count(str: string): number {
32
const strLength = str.length;
43

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"noUncheckedIndexedAccess": true,
4141
"noPropertyAccessFromIndexSignature": true,
4242
"noImplicitOverride": true,
43-
// "verbatimModuleSyntax": true, // TODO
43+
"verbatimModuleSyntax": false,
4444

4545
/* Module Resolution Options */
4646
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */

0 commit comments

Comments
 (0)