Skip to content

Commit 64feaf1

Browse files
authored
Run JS linter on src/*.mjs files. NFC (#21510)
As of today all `.mjs` files are part of the compiler itself and don't contains preproccess macros, so that are safe to be run through linter tools.
1 parent 25125ce commit 64feaf1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"lint": "eslint .",
23-
"fmt": "prettier --write tools/*.mjs",
24-
"check": "prettier --check tools/*.mjs"
23+
"fmt": "prettier --write src/*.mjs tools/*.mjs",
24+
"check": "prettier --check src/*.mjs tools/*.mjs"
2525
}
2626
}

src/compiler.mjs

+10-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ globalThis.read = (filename) => {
4545
};
4646

4747
function load(f) {
48-
vm.runInThisContext(read(f), { filename: find(f) });
48+
vm.runInThisContext(read(f), {filename: find(f)});
4949
}
5050

5151
// Basic utilities
@@ -73,7 +73,7 @@ globalThis.symbolsOnly = symbolsOnlyArg != -1;
7373
// In case compiler.js is run directly (as in gen_sig_info)
7474
// ALL_INCOMING_MODULE_JS_API might not be populated yet.
7575
if (!ALL_INCOMING_MODULE_JS_API.length) {
76-
ALL_INCOMING_MODULE_JS_API = INCOMING_MODULE_JS_API
76+
ALL_INCOMING_MODULE_JS_API = INCOMING_MODULE_JS_API;
7777
}
7878

7979
EXPORTED_FUNCTIONS = new Set(EXPORTED_FUNCTIONS);
@@ -87,7 +87,10 @@ if (symbolsOnly) {
8787
}
8888

8989
// Side modules are pure wasm and have no JS
90-
assert(!SIDE_MODULE || (ASYNCIFY && globalThis.symbolsOnly), 'JS compiler should only run on side modules if asyncify is used.');
90+
assert(
91+
!SIDE_MODULE || (ASYNCIFY && globalThis.symbolsOnly),
92+
'JS compiler should only run on side modules if asyncify is used.',
93+
);
9194

9295
// Load compiler code
9396

@@ -116,7 +119,10 @@ try {
116119
// Compiler failed on internal compiler error!
117120
printErr('Internal compiler error in src/compiler.js!');
118121
printErr('Please create a bug report at https://github.com/emscripten-core/emscripten/issues/');
119-
printErr('with a log of the build and the input files used to run. Exception message: "' + (err.stack || err));
122+
printErr(
123+
'with a log of the build and the input files used to run. Exception message: "' +
124+
(err.stack || err),
125+
);
120126
}
121127

122128
// Work around a node.js bug where stdout buffer is not flushed at process exit:

0 commit comments

Comments
 (0)