diff --git a/javascript/.eslintrc.js b/javascript/.eslintrc.js index 6cedc194..4f7f120a 100644 --- a/javascript/.eslintrc.js +++ b/javascript/.eslintrc.js @@ -8,6 +8,7 @@ */ module.exports = { + root: true, ignorePatterns: ["dist/**", "**/*.d.ts"], parser: "@babel/eslint-parser", extends: [ diff --git a/javascript/.prettierrc.js b/javascript/.prettierrc.js new file mode 100644 index 00000000..ae47ee6e --- /dev/null +++ b/javascript/.prettierrc.js @@ -0,0 +1,15 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +module.exports = { + trailingComma: "es5", + tabWidth: 2, + semi: true, + singleQuote: false, +}; diff --git a/javascript/just.config.js b/javascript/just.config.js index e5eed568..b07d151a 100644 --- a/javascript/just.config.js +++ b/javascript/just.config.js @@ -40,7 +40,7 @@ task( ); function defineFlavor(flavor, env) { - task(`cmake-build:${flavor}`, cmakeBuildTask([flavor])); + task(`cmake-build:${flavor}`, cmakeBuildTask({ targets: [flavor] })); task(`jest:${flavor}`, jestTask({ env })); task( `test:${flavor}`, @@ -54,8 +54,14 @@ defineFlavor("wasm-async", { WASM: 1, SYNC: 0 }); defineFlavor("wasm-sync", { WASM: 1, SYNC: 1 }); task("cmake-build:all", cmakeBuildTask()); -task("cmake-build:async", cmakeBuildTask(["asmjs-async", "wasm-async"])); -task("cmake-build:sync", cmakeBuildTask(["asmjs-sync", "wasm-sync"])); +task( + "cmake-build:async", + cmakeBuildTask({ targets: ["asmjs-async", "wasm-async"] }) +); +task( + "cmake-build:sync", + cmakeBuildTask({ targets: ["asmjs-sync", "wasm-sync"] }) +); task("build", series("prepare-for-build", "cmake-build:all")); @@ -117,13 +123,13 @@ function emcmakeGenerateTask() { }; } -function cmakeBuildTask(targets) { +function cmakeBuildTask(opts) { return () => { const cmake = which.sync("cmake"); const args = [ "--build", "build", - ...(targets ? ["--target", ...targets] : []), + ...(opts?.targets ? ["--target", ...opts.targets] : []), ]; logger.info(["cmake", ...args].join(" "));