diff --git a/packages/create/create.js b/packages/create/create.js
index b72b6a8e..1d7972a2 100755
--- a/packages/create/create.js
+++ b/packages/create/create.js
@@ -2,7 +2,6 @@
"use strict";
const child_process = require("child_process");
-const events = require("events");
const fs = require("fs-extra");
const inquirer = require("inquirer");
const os = require("os");
@@ -94,7 +93,6 @@ async function safeOutputFile(file, data, options={}) {
async function execFile(cmd, args) {
logger.verbose(`executing ${cmd} ${args.join(" ")}`);
- const asyncExec = util.promisify(child_process.execFile);
return new Promise((resolve, reject) => {
let child = child_process.execFile(cmd, args, (err, stdout, stderr) => {
if (err) {
diff --git a/packages/ctl/ctl.js b/packages/ctl/ctl.js
index 64e1ff15..9e48860f 100755
--- a/packages/ctl/ctl.js
+++ b/packages/ctl/ctl.js
@@ -327,7 +327,7 @@ instanceCommands.add(new libCommand.Command({
}
instanceConfig.set("instance.name", args.name);
let serialized_config = instanceConfig.serialize("master");
- let response = await libLink.messages.createInstance.send(control, { serialized_config });
+ await libLink.messages.createInstance.send(control, { serialized_config });
},
}));
@@ -563,7 +563,7 @@ instanceCommands.add(new libCommand.Command({
let instanceId = await libCommand.resolveInstance(control, args.instance);
let { seed, mapGenSettings, mapSettings } = await loadMapSettings(args);
await control.setLogSubscriptions({ instance_ids: [instanceId] });
- let response = await libLink.messages.createSave.send(control, {
+ await libLink.messages.createSave.send(control, {
instance_id: instanceId,
name: args.name,
seed,
@@ -611,7 +611,7 @@ instanceCommands.add(new libCommand.Command({
}
for (let requestError of result.body.request_errors || []) {
- logger.error(error);
+ logger.error(requestError);
}
if (result.body.saves && result.body.saves.length) {
@@ -690,7 +690,7 @@ instanceCommands.add(new libCommand.Command({
handler: async function(args, control) {
let instanceId = await libCommand.resolveInstance(control, args.instance);
await control.setLogSubscriptions({ instance_ids: [instanceId] });
- let response = await libLink.messages.exportData.send(control, {
+ await libLink.messages.exportData.send(control, {
instance_id: instanceId,
});
},
@@ -707,7 +707,7 @@ instanceCommands.add(new libCommand.Command({
handler: async function(args, control) {
let instanceId = await libCommand.resolveInstance(control, args.instance);
await control.setLogSubscriptions({ instance_ids: [instanceId] });
- let response = await libLink.messages.startInstance.send(control, {
+ await libLink.messages.startInstance.send(control, {
instance_id: instanceId,
save: args.save || null,
});
@@ -731,7 +731,7 @@ instanceCommands.add(new libCommand.Command({
let instanceId = await libCommand.resolveInstance(control, args.instance);
await control.setLogSubscriptions({ instance_ids: [instanceId] });
let { seed, mapGenSettings, mapSettings } = await loadMapSettings(args);
- let response = await libLink.messages.loadScenario.send(control, {
+ await libLink.messages.loadScenario.send(control, {
instance_id: instanceId,
scenario: args.scenario,
seed,
@@ -749,7 +749,7 @@ instanceCommands.add(new libCommand.Command({
handler: async function(args, control) {
let instanceId = await libCommand.resolveInstance(control, args.instance);
await control.setLogSubscriptions({ instance_ids: [instanceId] });
- let response = await libLink.messages.stopInstance.send(control, {
+ await libLink.messages.stopInstance.send(control, {
instance_id: instanceId,
});
},
@@ -760,7 +760,7 @@ instanceCommands.add(new libCommand.Command({
yargs.positional("instance", { describe: "Instance to delete", type: "string" });
}],
handler: async function(args, control) {
- let response = await libLink.messages.deleteInstance.send(control, {
+ await libLink.messages.deleteInstance.send(control, {
instance_id: await libCommand.resolveInstance(control, args.instance),
});
},
diff --git a/packages/lib/build_mod.js b/packages/lib/build_mod.js
index 3ac716c6..1aedce48 100644
--- a/packages/lib/build_mod.js
+++ b/packages/lib/build_mod.js
@@ -83,7 +83,7 @@ async function build(args) {
for (let entry of await fs.readdir(args.outputDir)) {
let match = splitter.exec(entry);
if (match) {
- let [, name, version] = match;
+ let name = match[1];
if (name === info.name) {
let modPath = path.join(args.outputDir, entry);
console.log(`Removing ${modPath}`);
@@ -94,7 +94,7 @@ async function build(args) {
}
if (info.variants) {
- for (let [variant, variantOverrides] of Object.entries(info.variants)) {
+ for (let variantOverrides of info.variants) {
let variantInfo = {
...info,
...variantOverrides,
diff --git a/packages/lib/config/definitions.js b/packages/lib/config/definitions.js
index 6744e8ff..608ce496 100644
--- a/packages/lib/config/definitions.js
+++ b/packages/lib/config/definitions.js
@@ -376,9 +376,9 @@ ControlConfig.registerGroup(ControlGroup);
function validateGroup(pluginInfo, groupName) {
- if (!pluginInfo[groupName] instanceof classes.PluginConfigGroup) {
+ if (!(pluginInfo[groupName].prototype instanceof classes.PluginConfigGroup)) {
throw new Error(
- `Expected ${groupName} for ${pluginInfo.name} to be an instance of PluginConfigGroup`
+ `Expected ${groupName} for ${pluginInfo.name} to be a subclass of PluginConfigGroup`
);
}
diff --git a/packages/lib/factorio/server.js b/packages/lib/factorio/server.js
index ba7dd424..60070550 100644
--- a/packages/lib/factorio/server.js
+++ b/packages/lib/factorio/server.js
@@ -791,6 +791,7 @@ class FactorioServer extends events.EventEmitter {
try {
let [code, signal] = await events.once(this._server, "exit");
+ void signal;
if (code !== 0) {
throw new Error(`Factorio exited with status ${code}`);
}
diff --git a/packages/lib/link/connectors.js b/packages/lib/link/connectors.js
index dc7bc6a3..fa0f2a91 100644
--- a/packages/lib/link/connectors.js
+++ b/packages/lib/link/connectors.js
@@ -445,7 +445,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
return;
}
- let { seq, type, data } = message;
+ let { type, data } = message;
if (type === "hello") {
logger.verbose(`Connector | received hello from master version ${data.version}`);
this.emit("hello", data);
diff --git a/packages/lib/link/link.js b/packages/lib/link/link.js
index fa98e927..ee68ba3d 100644
--- a/packages/lib/link/link.js
+++ b/packages/lib/link/link.js
@@ -4,7 +4,6 @@
const libSchema = require("../schema");
const libErrors = require("../errors");
const { logger } = require("../logging");
-const messages = require("./messages");
// Some definitions for the terminology used here:
// link: Either side of a master - client connection
@@ -135,7 +134,7 @@ class Link {
* @returns {Boolean} true if a waiter was triggered.
*/
_processWaiters(message) {
- let { seq, type, data } = message;
+ let { type, data } = message;
let waiters = this._waiters.get(type);
if (!waiters || !waiters.length) {
return false;
diff --git a/packages/lib/shared_commands.js b/packages/lib/shared_commands.js
index 1a2f62a3..8f050ad1 100644
--- a/packages/lib/shared_commands.js
+++ b/packages/lib/shared_commands.js
@@ -3,7 +3,6 @@
* @module lib/shared_commands
*/
"use strict";
-const fs = require("fs-extra");
const path = require("path");
const libConfig = require("./config");
diff --git a/packages/master/master.js b/packages/master/master.js
index f2a09f0d..ab9ea436 100755
--- a/packages/master/master.js
+++ b/packages/master/master.js
@@ -89,12 +89,14 @@ const wsActiveConnectionsGauge = new libPrometheus.Gauge(
"How many WebSocket connections are currently open to the master server",
{ callback: function(gauge) { gauge.set(master.wsServer.activeConnectors.size); }}
);
+void wsActiveConnectionsGauge;
const wsActiveSlavesGauge = new libPrometheus.Gauge(
"clusterio_master_active_slaves",
"How many slaves are currently connected to the master",
{ callback: function(gauge) { gauge.set(master.wsServer.slaveConnections.size); }}
);
+void wsActiveSlavesGauge;
const masterConnectedClientsCount = new libPrometheus.Gauge(
"clusterio_master_connected_clients_count", "How many clients are currently connected to this master server",
@@ -105,6 +107,7 @@ const masterConnectedClientsCount = new libPrometheus.Gauge(
},
},
);
+void masterConnectedClientsCount;
async function handleBootstrapCommand(args, masterConfig) {
@@ -356,7 +359,7 @@ async function startup() {
// add better stack traces on promise rejection
process.on("unhandledRejection", err => logger.error(`Unhandled rejection:\n${err.stack}`));
- let { args, shouldRun, clusterLogger, pluginInfos, masterConfigPath, masterConfig } = await initialize(master);
+ let { args, shouldRun, clusterLogger, pluginInfos, masterConfigPath, masterConfig } = await initialize();
if (!shouldRun) {
return;
}
diff --git a/packages/master/src/ControlConnection.js b/packages/master/src/ControlConnection.js
index 5535bcc1..068076ee 100644
--- a/packages/master/src/ControlConnection.js
+++ b/packages/master/src/ControlConnection.js
@@ -385,7 +385,7 @@ class ControlConnection extends BaseConnection {
});
ready.catch(() => {});
- let result = await this._master.forwardRequestToInstance(libLink.messages.pushSave, {
+ await this._master.forwardRequestToInstance(libLink.messages.pushSave, {
instance_id,
stream_id: stream.id,
save,
diff --git a/packages/master/src/HttpCloser.js b/packages/master/src/HttpCloser.js
index 8a488404..af10e14b 100644
--- a/packages/master/src/HttpCloser.js
+++ b/packages/master/src/HttpCloser.js
@@ -1,7 +1,6 @@
"use strict";
const http = require("http");
const https = require("https");
-const util = require("util");
/**
* Gracefully close a Node.js HTTP(S) server
diff --git a/packages/master/src/Master.js b/packages/master/src/Master.js
index b5944ac5..28809002 100644
--- a/packages/master/src/Master.js
+++ b/packages/master/src/Master.js
@@ -97,7 +97,7 @@ class Master {
}
async start(args) {
- if (!this._state === "new") {
+ if (this._state !== "new") {
throw new Error(`Cannot start in state ${this._state}`);
}
diff --git a/packages/master/src/WsServer.js b/packages/master/src/WsServer.js
index 1e1de286..2be97122 100644
--- a/packages/master/src/WsServer.js
+++ b/packages/master/src/WsServer.js
@@ -176,7 +176,7 @@ ${err.stack}`
return;
}
- let { seq, type, data } = message;
+ let { type, data } = message;
if (type === "resume") {
let connector;
diff --git a/packages/web_ui/src/components/App.jsx b/packages/web_ui/src/components/App.jsx
index 3a51feef..db5f64d0 100644
--- a/packages/web_ui/src/components/App.jsx
+++ b/packages/web_ui/src/components/App.jsx
@@ -1,4 +1,3 @@
-import events from "events";
import React, { useEffect, useState } from "react";
import { BrowserRouter } from "react-router-dom";
diff --git a/packages/web_ui/src/components/BaseConfigTree.jsx b/packages/web_ui/src/components/BaseConfigTree.jsx
index 5f78d44d..1e75338a 100644
--- a/packages/web_ui/src/components/BaseConfigTree.jsx
+++ b/packages/web_ui/src/components/BaseConfigTree.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useContext, useState } from "react";
+import React, { useEffect, useState } from "react";
import { Button, Card, Checkbox, Form, Input, InputNumber, Space, Spin, Tree, Typography } from "antd";
const { Title } = Typography;
diff --git a/packages/web_ui/src/components/CreateSaveModal.jsx b/packages/web_ui/src/components/CreateSaveModal.jsx
index 1ded9c5c..5a311c66 100644
--- a/packages/web_ui/src/components/CreateSaveModal.jsx
+++ b/packages/web_ui/src/components/CreateSaveModal.jsx
@@ -1,5 +1,5 @@
import React, { useContext, useState } from "react";
-import { Button, Col, Form, Input, Modal, Row, Typography } from "antd";
+import { Button, Form, Input, Modal } from "antd";
import { libFactorio, libLink } from "@clusterio/lib";
diff --git a/packages/web_ui/src/components/ErrorPage.jsx b/packages/web_ui/src/components/ErrorPage.jsx
index 6dc28028..22748c46 100644
--- a/packages/web_ui/src/components/ErrorPage.jsx
+++ b/packages/web_ui/src/components/ErrorPage.jsx
@@ -1,8 +1,6 @@
-import React, { useContext } from "react";
+import React from "react";
import { Typography } from "antd";
-import { libLink } from "@clusterio/lib";
-
import PageLayout from "./PageLayout";
const { Paragraph } = Typography;
diff --git a/packages/web_ui/src/components/InstanceConfigTree.jsx b/packages/web_ui/src/components/InstanceConfigTree.jsx
index cd77abe2..a2d05a71 100644
--- a/packages/web_ui/src/components/InstanceConfigTree.jsx
+++ b/packages/web_ui/src/components/InstanceConfigTree.jsx
@@ -1,5 +1,4 @@
import React, { useContext } from "react";
-import { Typography } from "antd";
import { libConfig, libLink } from "@clusterio/lib";
diff --git a/packages/web_ui/src/components/InstanceViewPage.jsx b/packages/web_ui/src/components/InstanceViewPage.jsx
index 4559839c..c56be6bd 100644
--- a/packages/web_ui/src/components/InstanceViewPage.jsx
+++ b/packages/web_ui/src/components/InstanceViewPage.jsx
@@ -20,7 +20,7 @@ import { useInstance } from "../model/instance";
import { useSlave } from "../model/slave";
import InstanceStatusTag from "./InstanceStatusTag";
-const { Title, Paragraph } = Typography;
+const { Title } = Typography;
export default function InstanceViewPage(props) {
diff --git a/packages/web_ui/src/components/InstancesPage.jsx b/packages/web_ui/src/components/InstancesPage.jsx
index a6ed0aef..3195c439 100644
--- a/packages/web_ui/src/components/InstancesPage.jsx
+++ b/packages/web_ui/src/components/InstancesPage.jsx
@@ -28,7 +28,7 @@ function CreateInstanceButton(props) {
await instanceConfig.init();
instanceConfig.set("instance.name", values.instanceName);
let serialized_config = instanceConfig.serialize("master");
- let result = await libLink.messages.createInstance.send(control, { serialized_config });
+ await libLink.messages.createInstance.send(control, { serialized_config });
setVisible(false);
history.push(`/instances/${instanceConfig.get("instance.id")}/view`);
}
diff --git a/packages/web_ui/src/components/LoadScenarioModal.jsx b/packages/web_ui/src/components/LoadScenarioModal.jsx
index 045b665d..a0b2c37b 100644
--- a/packages/web_ui/src/components/LoadScenarioModal.jsx
+++ b/packages/web_ui/src/components/LoadScenarioModal.jsx
@@ -1,5 +1,5 @@
import React, { useContext, useState } from "react";
-import { Button, Col, Form, Input, Modal, Row, Typography } from "antd";
+import { Button, Form, Input, Modal } from "antd";
import { libFactorio, libLink } from "@clusterio/lib";
diff --git a/packages/web_ui/src/components/LoginForm.jsx b/packages/web_ui/src/components/LoginForm.jsx
index e44f2ecf..d3b22a38 100644
--- a/packages/web_ui/src/components/LoginForm.jsx
+++ b/packages/web_ui/src/components/LoginForm.jsx
@@ -1,11 +1,11 @@
import React, { Fragment, useContext } from "react";
-import { Button, Card, Divider, Form, Image, Input, List, Space, Spin, Typography } from "antd";
+import { Button, Card, Divider, Form, Image, Input, Space, Typography } from "antd";
import LockOutlined from "@ant-design/icons/LockOutlined";
import logo from "../images/logo.png";
import ControlContext from "./ControlContext";
-const { Paragraph, Text } = Typography;
+const { Paragraph } = Typography;
function TokenAuth(props) {
@@ -22,7 +22,7 @@ function TokenAuth(props) {
>
+ prefix={