Skip to content

Commit 5f7c1d4

Browse files
committed
1 parent 9bf57bf commit 5f7c1d4

File tree

6 files changed

+40
-10
lines changed

6 files changed

+40
-10
lines changed

.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended"
5+
],
6+
"parser": "@typescript-eslint/parser",
7+
"plugins": [
8+
"@typescript-eslint"
9+
],
10+
"root": true
11+
}

.github/workflows/check_code.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v3
13+
- name: Setup Node
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 18
17+
- name: Show environment
18+
run: set -x; pwd; ls -la; node -v; npm -v;
19+
- name: Install dependencies
20+
run: npm install
21+
22+
# TODO: Remove next step
1323
- name: Setup Deno
1424
uses: denoland/setup-deno@v1
1525
with:
1626
deno-version: v1.x
17-
- name: Show environment
18-
run: set -x; pwd; ls -la; deno --version;
1927

2028
- name: Test
2129
run: deno test ./src/
2230
- name: Check
2331
run: deno check ./src/test/index.ts
24-
- name: Format
25-
run: deno fmt ./src/
32+
- name: Lint
33+
run: npm run lint

.github/workflows/publish_to_npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@v3
2626
- name: Show environment
2727
run: set -x; pwd; ls -la; node -v; npm -v;
28-
- name: Run npm install
28+
- name: Install dependencies
2929
run: npm install
3030
- name: Configure git
3131
run: |

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@
3535
"scripts": {
3636
"build": "esbuild --bundle --platform=neutral --outfile=./dist/index.js ./src/index.ts",
3737
"check": "deno check ./src/test/index.ts",
38-
"fmt": "deno fmt ./src/",
38+
"lint": "eslint ./src/",
39+
"lint:fix": "eslint --fix ./src/",
3940
"prepare": "npm run build",
4041
"test": "deno test ./src/"
4142
},
4243
"devDependencies": {
43-
"esbuild": "^0.18.15"
44+
"@typescript-eslint/eslint-plugin": "^6.2.1",
45+
"@typescript-eslint/parser": "^6.2.1",
46+
"esbuild": "^0.18.15",
47+
"eslint": "^8.46.0",
48+
"typescript": "^5.1.6"
4449
}
4550
}

src/hex.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Deno.test("Hex", async (t) => {
4040

4141
await t.step("Hex.toBin(Not string)", () => {
4242
try {
43-
Hex.toBin(1234 as any);
43+
Hex.toBin(1234 as any); // eslint-disable-line @typescript-eslint/no-explicit-any
4444
fail("Hex.toBin() is not thrown Error");
4545
} catch (err) {
4646
assert(err instanceof Error);
@@ -55,11 +55,11 @@ Deno.test("Hex", async (t) => {
5555
await t.step("Hex.fromBin(Not Uint8Array)", () => {
5656
assertEquals(HexText, Hex.fromBin(HexBin));
5757
try {
58-
Hex.fromBin(new Int8Array(4) as any);
58+
Hex.fromBin(new Int8Array(4) as any); // eslint-disable-line @typescript-eslint/no-explicit-any
5959
fail("Hex.fromBin() is not thrown Error");
6060
} catch (err) {
6161
assert(err instanceof Error);
6262
assertEquals(err.message, '"bin" is not Uint8Array');
6363
}
64-
});
64+
})
6565
});

src/types.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export namespace SimpleEncryption {
1212
type HexString = string;
1313
type SupportAlgorithm = "AES-GCM" | "AES-CBC";
1414

15+
// FIXME
16+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1517
interface EncryptArgs {
1618
alg?: SupportAlgorithm | null;
1719
iv?: HexString | null;
@@ -25,10 +27,14 @@ export namespace SimpleEncryption {
2527
iv: HexString;
2628
}
2729

30+
// FIXME
31+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2832
interface DecryptArgs extends EncryptedData {
2933
key: HexString;
3034
}
3135

36+
// FIXME
37+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3238
interface DecryptedData {
3339
plainData: Uint8Array;
3440
}

0 commit comments

Comments
 (0)