From 65a3f43ec64d800f19e6b351425041a14aacea65 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Wed, 21 Dec 2022 12:59:46 -0700 Subject: [PATCH] Remove some unused variables and imports --- backend/langs.js | 3 +-- backend/sandbox.bash | 31 ++++++++++++++++--------------- backend/sandbox.js | 6 ------ backend/test-runner.js | 4 ++-- backend/util.js | 1 - 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/backend/langs.js b/backend/langs.js index c18af5c..8a0594e 100644 --- a/backend/langs.js +++ b/backend/langs.js @@ -1,5 +1,4 @@ -import fsOrig, { promises as fs } from "fs"; -import path from "path"; +import fsOrig from "fs"; import debounce from "debounce"; diff --git a/backend/sandbox.bash b/backend/sandbox.bash index 8c6f6ec..6bc61a3 100644 --- a/backend/sandbox.bash +++ b/backend/sandbox.bash @@ -1,17 +1,18 @@ +#!/usr/bin/env bash # This script is sourced by Bash within 'make sandbox'. if [[ -z "$L" ]]; then - echo 'environment variable unset: $L' >&2 + echo "environment variable unset: \$L" >&2 exit 1 fi if [[ -z "$LANG_CONFIG" ]]; then - echo 'environment variable unset: $LANG_CONFIG' >&2 + echo "environment variable unset: \$LANG_CONFIG" >&2 exit 1 fi function get { - jq -r ".$1" <<< "${LANG_CONFIG}" + jq -r ".$1" <<<"${LANG_CONFIG}" } function has { @@ -24,21 +25,21 @@ function riju-exec { function daemon { if has daemon; then - echo "$(get daemon)" + get daemon riju-exec "$(get daemon)" fi } function setup { if has setup; then - echo "$(get setup)" + get setup riju-exec "$(get setup)" fi } function repl { if has repl; then - echo "$(get repl)" + get repl riju-exec "$(get repl)" fi } @@ -47,22 +48,22 @@ function main { if get main | grep -q /; then mkdir -p "$(dirname "$(get main)")" fi - : > "$(get main)" - has prefix && get prefix >> "$(get main)" - get template >> "$(get main)" - has suffix && get suffix >> "$(get main)" + : >"$(get main)" + has prefix && get prefix >>"$(get main)" + get template >>"$(get main)" + has suffix && get suffix >>"$(get main)" } function compile { if has compile; then - echo "$(get compile)" + get compile riju-exec "$(get compile)" fi } function run-only { if has run; then - echo "$(get run)" + get run riju-exec "$(get run)" fi } @@ -73,18 +74,18 @@ function run { function format { if has format; then - echo "$(get format.run)" + get format.run riju-exec "( $(get format.run) ) < $(get main)" fi } function lsp { if has lsp.setup; then - echo "$(get lsp.setup)" + get lsp.setup riju-exec "$(get lsp.setup)" fi if has lsp; then - echo "$(get lsp.start)" + get lsp.start riju-exec "$(get lsp.start)" fi } diff --git a/backend/sandbox.js b/backend/sandbox.js index aef507c..fd3b693 100644 --- a/backend/sandbox.js +++ b/backend/sandbox.js @@ -6,11 +6,9 @@ import { readLangConfig } from "../lib/yaml.js"; import { bash, getUUID, - privilegedExec, privilegedPty, privilegedSession, quote, - run, } from "./util.js"; function die(msg) { @@ -18,10 +16,6 @@ function die(msg) { process.exit(1); } -function log(msg) { - console.log(msg); -} - async function main() { const sandboxScript = await fs.readFile("backend/sandbox.bash", "utf-8"); const lang = process.env.L; diff --git a/backend/test-runner.js b/backend/test-runner.js index 3ca350f..0eb617a 100644 --- a/backend/test-runner.js +++ b/backend/test-runner.js @@ -10,7 +10,7 @@ import { getTestHash } from "../lib/hash-test.js"; import * as api from "./api.js"; import { langsPromise } from "./langs.js"; import { shutdown } from "./shutdown.js"; -import { getUUID, run } from "./util.js"; +import { run } from "./util.js"; let langs = {}; @@ -525,7 +525,7 @@ const testTypes = { ensure: { pred: ({ ensure }) => (ensure ? true : false), }, - run: { pred: (config) => true }, + run: { pred: (_config) => true }, repl: { pred: ({ repl }) => (repl ? true : false), }, diff --git a/backend/util.js b/backend/util.js index 9113ab2..4637783 100644 --- a/backend/util.js +++ b/backend/util.js @@ -1,5 +1,4 @@ import { spawn } from "child_process"; -import os from "os"; import process from "process"; import * as Sentry from "@sentry/node";