Skip to content

Commit d1d8566

Browse files
authored
chore: address linter failures on master branch (#450)
1 parent 6ceaa05 commit d1d8566

File tree

11 files changed

+102
-1367
lines changed

11 files changed

+102
-1367
lines changed

src/decimal128.ts

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,14 @@ const MAX_DIGITS = 34;
1212

1313
// Nan value bits as 32 bit values (due to lack of longs)
1414
const NAN_BUFFER = [
15-
0x7c,
16-
0x00,
17-
0x00,
18-
0x00,
19-
0x00,
20-
0x00,
21-
0x00,
22-
0x00,
23-
0x00,
24-
0x00,
25-
0x00,
26-
0x00,
27-
0x00,
28-
0x00,
29-
0x00,
30-
0x00
15+
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3116
].reverse();
3217
// Infinity value bits 32 bit values (due to lack of longs)
3318
const INF_NEGATIVE_BUFFER = [
34-
0xf8,
35-
0x00,
36-
0x00,
37-
0x00,
38-
0x00,
39-
0x00,
40-
0x00,
41-
0x00,
42-
0x00,
43-
0x00,
44-
0x00,
45-
0x00,
46-
0x00,
47-
0x00,
48-
0x00,
49-
0x00
19+
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
5020
].reverse();
5121
const INF_POSITIVE_BUFFER = [
52-
0x78,
53-
0x00,
54-
0x00,
55-
0x00,
56-
0x00,
57-
0x00,
58-
0x00,
59-
0x00,
60-
0x00,
61-
0x00,
62-
0x00,
63-
0x00,
64-
0x00,
65-
0x00,
66-
0x00,
67-
0x00
22+
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
6823
].reverse();
6924

7025
const EXPONENT_REGEX = /^([-+])?(\d+)?$/;

src/long.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ let wasm: LongWASMHelpers | undefined = undefined;
2727
declare const WebAssembly: any;
2828

2929
try {
30-
wasm = (new WebAssembly.Instance(
30+
wasm = new WebAssembly.Instance(
3131
new WebAssembly.Module(
3232
// prettier-ignore
3333
new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])
3434
),
3535
{}
36-
).exports as unknown) as LongWASMHelpers;
36+
).exports as unknown as LongWASMHelpers;
3737
} catch {
3838
// no wasm support
3939
}

src/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (Object.prototype.hasOwnProperty.call(bsonGlobal, 'Map')) {
3131
bsonMap = bsonGlobal.Map;
3232
} else {
3333
// We will return a polyfill
34-
bsonMap = (class Map {
34+
bsonMap = class Map {
3535
private _keys: string[];
3636
private _values: Record<string, any>;
3737
constructor(array: [string, any][] = []) {
@@ -133,7 +133,7 @@ if (Object.prototype.hasOwnProperty.call(bsonGlobal, 'Map')) {
133133
get size() {
134134
return this._keys.length;
135135
}
136-
} as unknown) as MapConstructor;
136+
} as unknown as MapConstructor;
137137
}
138138

139139
export { bsonMap as Map };

src/parser/deserializer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ function deserializeObject(
246246
if (fieldsAsRaw && fieldsAsRaw[name]) {
247247
arrayOptions = {};
248248
for (const n in options) {
249-
(arrayOptions as {
250-
[key: string]: DeserializeOptions[keyof DeserializeOptions];
251-
})[n] = options[n as keyof DeserializeOptions];
249+
(
250+
arrayOptions as {
251+
[key: string]: DeserializeOptions[keyof DeserializeOptions];
252+
}
253+
)[n] = options[n as keyof DeserializeOptions];
252254
}
253255
arrayOptions['raw'] = true;
254256
}

src/parser/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ export function deprecate<T extends Function>(fn: T, message: string): T {
121121
}
122122
return fn.apply(this, args);
123123
}
124-
return (deprecated as unknown) as T;
124+
return deprecated as unknown as T;
125125
}

src/regexp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class BSONRegExp {
7373
if (typeof doc.$regex !== 'string') {
7474
// This is for $regex query operators that have extended json values.
7575
if (doc.$regex._bsontype === 'BSONRegExp') {
76-
return (doc as unknown) as BSONRegExp;
76+
return doc as unknown as BSONRegExp;
7777
}
7878
} else {
7979
return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));

src/timestamp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export type LongWithoutOverrides = new (low: number | Long, high?: number, unsig
77
[P in Exclude<keyof Long, TimestampOverrides>]: Long[P];
88
};
99
/** @public */
10-
export const LongWithoutOverridesClass: LongWithoutOverrides = (Long as unknown) as LongWithoutOverrides;
10+
export const LongWithoutOverridesClass: LongWithoutOverrides =
11+
Long as unknown as LongWithoutOverrides;
1112

1213
/** @public */
1314
export interface TimestampExtended {

src/uuid_utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Buffer } from 'buffer';
22

33
// Validation regex for v4 uuid (validates with or without dashes)
4-
const VALIDATION_REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i;
4+
const VALIDATION_REGEX =
5+
/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i;
56

67
export const uuidValidateString = (str: string): boolean =>
78
typeof str === 'string' && VALIDATION_REGEX.test(str);

0 commit comments

Comments
 (0)