Skip to content

Commit 67302aa

Browse files
committed
refactor: update to comply with eslint and prettier config
1 parent 5af69e8 commit 67302aa

File tree

6 files changed

+54
-29
lines changed

6 files changed

+54
-29
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: CI
2-
on: [ push, pull_request ]
2+
on: [push, pull_request]
33
env:
44
CI: true
55
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node-version: [ 12.x, 14.x, 16.x, 17.x ]
14+
node-version: [12.x, 14.x, 16.x, 17.x]
1515
steps:
1616
- name: Find yarn cache
1717
id: find-yarn-cache

LICENSE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Copyright 2019-2022 Software Ventures Limited.
22

3-
Permission to use, copy, modify, and/or distribute this software for any
4-
purpose with or without fee is hereby granted, provided that the above
5-
copyright notice and this permission notice appear in all copies.
3+
Permission to use, copy, modify, and/or distribute this software for any purpose
4+
with or without fee is hereby granted, provided that the above copyright notice
5+
and this permission notice appear in all copies.
66

7-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13+
THIS SOFTWARE.

index.test.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
import test from "ava";
2-
import {i32, iadd, iand, icmp, idiv, ieq, igt, igte, ilt, ilte, imod, ineg, ineq, inot, ior, ipow, isub} from "./index";
2+
import {
3+
i32,
4+
iadd,
5+
iand,
6+
icmp,
7+
idiv,
8+
ieq,
9+
igt,
10+
igte,
11+
ilt,
12+
ilte,
13+
imod,
14+
ineg,
15+
ineq,
16+
inot,
17+
ior,
18+
ipow,
19+
isub
20+
} from "./index";
321

422
test("i32", t => {
523
t.is(i32(0), 0);
@@ -273,4 +291,4 @@ test("ior", t => {
273291
t.is(ior(0x100000001, 2431), 1);
274292
t.is(ior(0x100000001, 0), 1);
275293
t.is(ior(1, 0x100000012), 1);
276-
});
294+
});

index.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
2+
13
import {fold} from "@softwareventures/array";
24

35
/** Coerces the specified value to a signed 32-bit integer. */
@@ -6,15 +8,16 @@ export function i32(value: number): number {
68
}
79

810
export function inot(value: number): number {
9-
return ((!(value | 0)) as any) | 0;
11+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12+
return (!(value | 0) as any) | 0;
1013
}
1114

1215
export function icmp(value: number): number {
1316
return ~value;
1417
}
1518

1619
export function ineg(value: number): number {
17-
return (-(value | 0)) | 0;
20+
return -(value | 0) | 0;
1821
}
1922

2023
export function ipow(a: number, b: number): number {
@@ -39,6 +42,7 @@ export function ipow(a: number, b: number): number {
3942
}
4043

4144
let accumulator = 1;
45+
// eslint-disable-next-line no-constant-condition
4246
while (true) {
4347
if (exp & 1) {
4448
const next = imul(accumulator, base);
@@ -69,7 +73,7 @@ export function idiv(a: number, b: number): number {
6973
}
7074

7175
export function imod(a: number, b: number): number {
72-
return ((a | 0) % (b | 0)) | 0;
76+
return (a | 0) % (b | 0) | 0;
7377
}
7478

7579
export function iadd(a: number, b: number): number {
@@ -93,26 +97,32 @@ export function ishr(a: number, b: number): number {
9397
}
9498

9599
export function ilt(a: number, b: number): number {
100+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
96101
return (((a | 0) < (b | 0)) as any) | 0;
97102
}
98103

99104
export function ilte(a: number, b: number): number {
105+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
100106
return (((a | 0) <= (b | 0)) as any) | 0;
101107
}
102108

103109
export function igt(a: number, b: number): number {
110+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
104111
return (((a | 0) > (b | 0)) as any) | 0;
105112
}
106113

107114
export function igte(a: number, b: number): number {
115+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
108116
return (((a | 0) >= (b | 0)) as any) | 0;
109117
}
110118

111119
export function ieq(a: number, b: number): number {
120+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
112121
return (((a | 0) === (b | 0)) as any) | 0;
113122
}
114123

115124
export function ineq(a: number, b: number): number {
125+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
116126
return (((a | 0) !== (b | 0)) as any) | 0;
117127
}
118128

@@ -129,9 +139,11 @@ export function ibor(a: number, b: number): number {
129139
}
130140

131141
export function iand(a: number, b: number): number {
132-
return (((a | 0) && (b | 0)) as any) | 0;
142+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
143+
return ((a | 0 && b | 0) as any) | 0;
133144
}
134145

135146
export function ior(a: number, b: number): number {
136-
return (((a | 0) || (b | 0)) as any) | 0;
137-
}
147+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
148+
return ((a | 0 || b | 0) as any) | 0;
149+
}

renovate.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"extends": [
3-
"@softwareventures:js-lib"
4-
]
5-
}
2+
"extends": ["@softwareventures:js-lib"]
3+
}

tsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extends": "@softwareventures/tsconfig",
3-
"exclude": [
4-
"**/*.test.ts",
5-
"**/test.ts"
6-
]
7-
}
3+
"exclude": ["**/*.test.ts", "**/test.ts"]
4+
}

0 commit comments

Comments
 (0)