Skip to content

Commit 96b033b

Browse files
committed
formatting
1 parent a2a2e5c commit 96b033b

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

.github/workflows/formatting.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- synchronize
1111

1212
jobs:
13-
clang-format-checking:
13+
code-format-checks:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
@@ -19,3 +19,13 @@ jobs:
1919
source: '.'
2020
extensions: 'h,c,cc,proto'
2121
clangFormatVersion: 14
22+
- uses: actionsx/prettier@v2
23+
with:
24+
args: --config "${{ github.workspace }}/.prettierrc.toml" --write "**/*.{js,ts}"
25+
# Prettier has no diff view so we must make one ourselves
26+
# https://github.com/prettier/prettier/issues/6885
27+
- run: |
28+
git diff
29+
if [[ -n "$(git status --porcelain)" ]]; then
30+
exit 1
31+
fi

.prettierrc.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Prettier config file. For more opitons see https://prettier.io/docs/en/options
2+
tabWidth = 4
3+
trailingComma = "all"
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
"use strict";
2-
const fs = require('fs');
3-
const path = require('path');
4-
const assert = require('assert');
2+
const fs = require("fs");
3+
const path = require("path");
4+
const assert = require("assert");
55

66
const main = async function (typ, dir) {
7-
const wasm_file = path.join(__dirname, dir, 'hello_world_'+typ+'_wasm_bindgen_bg.wasm');
8-
const buf = fs.readFileSync(wasm_file);
9-
assert.ok(buf);
7+
const wasm_file = path.join(
8+
__dirname,
9+
dir,
10+
"hello_world_" + typ + "_wasm_bindgen_bg.wasm",
11+
);
12+
const buf = fs.readFileSync(wasm_file);
13+
assert.ok(buf);
1014

11-
const res = await WebAssembly.instantiate(buf);
12-
assert.ok(res);
13-
assert.strictEqual(res.instance.exports.double(2), 4);
15+
const res = await WebAssembly.instantiate(buf);
16+
assert.ok(res);
17+
assert.strictEqual(res.instance.exports.double(2), 4);
1418
};
1519

1620
["bundler", "web", "deno", "nomodules", "nodejs"].forEach((typ) => {
17-
main(typ, process.argv.length > 2 ? process.argv[2] : "").catch(function (err) {
18-
console.error(err);
19-
process.exit(1);
20-
});
21-
})
21+
main(typ, process.argv.length > 2 ? process.argv[2] : "").catch(function (
22+
err,
23+
) {
24+
console.error(err);
25+
process.exit(1);
26+
});
27+
});

0 commit comments

Comments
 (0)