Add dangling commas

Ensure multiline object and array litterals are consistenly typed out
with dangling commas for the last element.
This commit is contained in:
Hornwitser committed 2020-06-17 20:59:37 +02:00
1 parent 3e4f0b6b5e
commit 8cb21c5fa8
16 files changed
+69 -69

No files matched your search

+6 -6
View File
@@ -202,10 +202,10 @@ commands.push(new Command({
yargs.option("id", { type: "number", nargs: 1, describe: "Slave id", default: null });
yargs.option("name", { type: "string", nargs: 1, describe: "Slave name", default: null });
yargs.option("generate-token", {
type: "boolean", nargs: 0, describe: "Generate authentication token", default: false
type: "boolean", nargs: 0, describe: "Generate authentication token", default: false,
});
yargs.option("output", {
type: "string", nargs: 1, describe: "Path to output config (- for stdout)", default: "config-slave.json"
type: "string", nargs: 1, describe: "Path to output config (- for stdout)", default: "config-slave.json",
});
}],
handler: async function(args, control) {
@@ -236,7 +236,7 @@ commands.push(new Command({
handler: async function(args, control) {
let response = await link.messages.listInstances.send(control);
console.log(asTable(response.list));
}
},
}));
commands.push(new Command({
@@ -258,7 +258,7 @@ commands.push(new Command({
type: "boolean",
nargs: 0,
describe: "Specify this is a base config",
group: "Instance Config:"
group: "Instance Config:",
});
}],
handler: async function(args, control) {
@@ -433,7 +433,7 @@ commands.push(new Command({
handler: async function(args, control) {
let response = await link.messages.sendRcon.send(control, {
instance_id: await resolveInstance(control, args.instance),
command: args.command
command: args.command,
});
// Factorio includes a newline in it's response output.
@@ -469,7 +469,7 @@ commands.push(new Command({
let response = await link.messages.createRole.send(control, {
name: args.name,
description: args.description,
permissions: args.permissions
permissions: args.permissions,
});
console.log(`Created role ID ${response.id}`);
},
+2 -2
View File
@@ -28,7 +28,7 @@ MasterGroup.define({
title: "HTTP Port",
description: "Port to listen for HTTP connections on, set to null to not listen for HTTP connections.",
type: "number",
optional: true
optional: true,
});
MasterGroup.define({
name: "https_port",
@@ -139,7 +139,7 @@ SlaveGroup.define({
name: "factorio_directory",
description: "Path to directory to look for factorio installs",
type: "string",
initial_value: "factorio"
initial_value: "factorio",
});
SlaveGroup.define({
name: "instances_directory",
+5 -5
View File
@@ -375,7 +375,7 @@ const outputHeuristics = [
filter: { type: "log", message: /^updateTick\(\d+\) changing state from\(CreatingGame\) to\(InGame\)$/ },
action: function(output) {
this._notifyGameReady().catch((err) => { this.emit("error", err); });
}
},
},
// Message indicating the server has started an autosave
@@ -414,14 +414,14 @@ const outputHeuristics = [
},
action: function(output) {
this.emit("_saved");
}
},
},
// Message indicating the server is shutting down
{
filter: {
type: "generic",
message: /^Quitting: /
message: /^Quitting: /,
},
action: function(output) {
this.emit("_quitting");
@@ -432,7 +432,7 @@ const outputHeuristics = [
if (process.platform === "win32" && output.message === "Quitting: multiplayer error.") {
this._server.kill();
}
}
},
},
// Messages that might be tha cause of an unexpected shutdown.
@@ -1047,7 +1047,7 @@ class FactorioServer extends events.EventEmitter {
path: {
"read-data": this.dataPath(),
"write-data": this.writePath(),
}
},
});
await fs.outputFile(this.writePath("config.ini"), content);
}
+5 -5
View File
@@ -122,7 +122,7 @@ class Request extends Message {
},
],
},
}
},
});
}
@@ -448,7 +448,7 @@ messages.sendRcon = new Request({
},
responseProperties: {
"result": { type: "string" },
}
},
});
messages.listPermissions = new Request({
@@ -503,7 +503,7 @@ messages.createRole = new Request({
},
responseProperties: {
"id": { type: "integer" },
}
},
});
messages.updateRole = new Request({
@@ -697,7 +697,7 @@ class Event extends Message {
if (
this.broadcastTo === "instance"
&& [
"instance-slave", "slave-master", "control-master", "master-slave"
"instance-slave", "slave-master", "control-master", "master-slave",
].includes(`${link.target}-${link.source}`)
) {
if (!handler) {
@@ -759,7 +759,7 @@ messages.instanceInitialized = new Event({
"plugins": {
type: "object",
additionalProperties: { type: "string" },
}
},
},
});
messages.instanceStarted = new Event({
+5 -5
View File
@@ -54,7 +54,7 @@ async function listMods(config, instance) {
factorioAPI.authenticate({
username: config.username,
token: config.token,
require_ownership: false
require_ownership: false,
}).then(token => {
console.log("* Currently installed:");
factorioAPI.readModZips().then(list => {
@@ -84,7 +84,7 @@ async function listMods(config, instance) {
factorioAPI.authenticate({
username: config.username,
token: config.token,
require_ownership: false
require_ownership: false,
}).then(() => {
console.log("\r\n");
console.log("* Mods shared by all instances:");
@@ -119,7 +119,7 @@ async function findMods(config, searchTerm) {
factorioAPI.authenticate({
username: config.username,
token: config.token,
require_ownership: false
require_ownership: false,
}).then(token => {
factorioAPI.searchMods(searchTerm).then(mods => {
let result = asTable(mods.reverse().map(mod => {
@@ -157,7 +157,7 @@ async function addMod(config, term, instance) {
factorioAPI.authenticate({
username: config.username,
token: config.token,
require_ownership: false
require_ownership: false,
}).then(() => {
factorioAPI.searchMods(term.split("/")[term.split("/").length-1]).then(body => {
console.log("Im gonna download: "+body[0].name + " in version: " + body[0].latest_release.version);
@@ -202,7 +202,7 @@ async function addMod(config, term, instance) {
factorioAPI.authenticate({
username: config.username,
token: config.token,
require_ownership: false
require_ownership: false,
}).then(() => {
factorioAPI.searchMods(term).then(body => {
console.log(body);
+2 -2
View File
@@ -88,7 +88,7 @@ const serverHandshake = ajv.compile({
type: "object",
additionalProperties: { type: "string" },
},
}
},
},
},
},
@@ -169,7 +169,7 @@ const clientHandshake = ajv.compile({
"token": { type: "string" },
"agent": { type: "string" },
"version": { type: "string" },
}
},
},
},
},
+4 -4
View File
@@ -66,7 +66,7 @@ app.use(bodyParser.json({
app.use(bodyParser.urlencoded({
parameterLimit: 100000,
limit: "10mb",
extended: true
extended: true,
}));
app.use(fileUpload());
app.use(compression());
@@ -1220,7 +1220,7 @@ wss.on("connection", function (socket, req) {
// Start connection handshake.
socket.send(JSON.stringify({ seq: null, type: "hello", data: {
version,
plugins: pluginList
plugins: pluginList,
}}));
function attachHandler() {
@@ -1350,7 +1350,7 @@ async function handleHandshake(message, socket, req, attachHandler) {
}
let sessionId = nextSessionId++;
let sessionToken = jwt.sign({ aud: masterSession, sid: sessionId, }, masterConfig.get("master.auth_secret"));
let sessionToken = jwt.sign({ aud: masterSession, sid: sessionId }, masterConfig.get("master.auth_secret"));
let connector = new WebSocketServerConnector(socket, sessionId);
activeConnectors.set(sessionId, connector);
@@ -1647,7 +1647,7 @@ async function startServer() {
httpsServer = require("https").createServer({
key: privateKey,
cert: certificate
cert: certificate,
}, app);
await listen(httpsServer, httpsPort);
console.log("Listening for HTTPS on port %s...", httpsServer.address().port);
+1 -1
View File
@@ -14,7 +14,7 @@ const technologies = {
{ type: "integer" },
{ type: ["null", "number"] },
{ type: "boolean" },
]
],
},
};
+1 -1
View File
@@ -184,5 +184,5 @@ async function saveTechnologies(masterConfig, technologies) {
module.exports = {
MasterPlugin
MasterPlugin,
};
+4 -4
View File
@@ -24,16 +24,16 @@ describe("statistics_exporter plugin", function() {
force_flow_statistics: {
player: {
item_production_statistics: {
input: { "inserter": 10, },
output: { "iron-plate": 24, }
input: { "inserter": 10 },
output: { "iron-plate": 24 },
},
}
},
},
game_flow_statistics: {
pollution_statistics: {
input: { "boiler": 2000 },
output: { "tree-proxy": 560 },
}
},
},
})
);
+2 -2
View File
@@ -30,7 +30,7 @@ class neuralDole {
}
constructor({
items
items,
}){
// Set some storage variables for the dole divider
this.items = items;
@@ -127,5 +127,5 @@ function doleDivider({
module.exports = {
doleDivider,
neuralDole
neuralDole,
};
+1 -1
View File
@@ -114,7 +114,7 @@ describe("Integration of Clusterio", function() {
],
[
"ignore_player_limit_for_returning_players", true,
"ignore-player-limit-for-returning-players", "Ignore player limit for returning players: true."
"ignore-player-limit-for-returning-players", "Ignore player limit for returning players: true.",
],
[
"max_players", 11,
+13 -13
View File
@@ -25,35 +25,35 @@ describe("lib/config/classes", function() {
for (let [def, error] of [
[
{ name: "a", type: "invalid", optional: true },
"invalid is not a valid type"
"invalid is not a valid type",
],
[
{ name: [], type: "string", optional: true },
"name must be a string"
"name must be a string",
],
[
{ name: "a", type: "string", enum: true, optional: true },
"enum must be an array"
"enum must be an array",
],
[
{ name: "a", title: 2, type: "string", optional: true },
"title must be a string"
"title must be a string",
],
[
{ name: "a", description: 2, type: "string", optional: true },
"description must be a string"
"description must be a string",
],
[
{ name: "a", type: "string", optional: "yes" },
"optional must be a boolean"
"optional must be a boolean",
],
[
{ name: "a", type: "string", initial_value: 1 },
"initial_value must match the type or be a function"
"initial_value must match the type or be a function",
],
[
{ name: "a", type: "string" },
"Non-optional field a needs an initial_value"
"Non-optional field a needs an initial_value",
],
]) {
assert.throws(() => TestGroup.define(def), new Error(error));
@@ -477,8 +477,8 @@ describe("lib/config/classes", function() {
{
name: "beta",
fields: { bar: {} },
}
]
},
],
});
});
});
@@ -521,7 +521,7 @@ describe("lib/config/classes", function() {
{
name: "beta",
fields: { bar: { value: 20 }},
}
},
];
let testInstance = new TestConfig();
@@ -543,7 +543,7 @@ describe("lib/config/classes", function() {
{
name: "beta",
fields: { bar: { value: 30 }},
}
},
]}, false);
assert.deepEqual(testInstance.serialize(), {
@@ -559,7 +559,7 @@ describe("lib/config/classes", function() {
{
name: "beta",
fields: { bar: { value: 30 }},
}
},
],
});
});
+14 -14
View File
@@ -11,7 +11,7 @@ let testLines = new Map([
level: "Info",
file: "RemoteCommandProcessor.cpp:131",
message: "Starting RCON interface at port 4000",
}
},
],
[
" 0.622 Warning FileUtil.cpp:527: test not found; using test.zip",
@@ -22,7 +22,7 @@ let testLines = new Map([
level: "Warning",
file: "FileUtil.cpp:527",
message: "test not found; using test.zip",
}
},
],
[
" 0.554 Error Main.cpp:839: require_user_verification must be enabled for public games.",
@@ -33,7 +33,7 @@ let testLines = new Map([
level: "Error",
file: "Main.cpp:839",
message: "require_user_verification must be enabled for public games.",
}
},
],
[
" 640.910 Quitting: remote-quit.",
@@ -42,7 +42,7 @@ let testLines = new Map([
time: "640.910",
type: "generic",
message: "Quitting: remote-quit.",
}
},
],
[
"1641.421 Goodbye",
@@ -51,7 +51,7 @@ let testLines = new Map([
time: "1641.421",
type: "generic",
message: "Goodbye",
}
},
],
[
"2019-01-20 10:30:04 [JOIN] User joined the game",
@@ -61,7 +61,7 @@ let testLines = new Map([
type: "action",
action: "JOIN",
message: "User joined the game",
}
},
],
[
"2019-01-20 10:30:07 [CHAT] User: chat message",
@@ -71,7 +71,7 @@ let testLines = new Map([
type: "action",
action: "CHAT",
message: "User: chat message",
}
},
],
[
"2019-01-20 10:30:14 [COMMAND] User (command): blah",
@@ -81,7 +81,7 @@ let testLines = new Map([
type: "action",
action: "COMMAND",
message: "User (command): blah",
}
},
],
[
"2019-01-20 10:30:14 Cannot execute command. Error: [string \"blah\"]:1: syntax error near <eof>",
@@ -90,7 +90,7 @@ let testLines = new Map([
time: "2019-01-20 10:30:14",
type: "generic",
message: "Cannot execute command. Error: [string \"blah\"]:1: syntax error near <eof>",
}
},
],
[
"2019-01-20 10:30:21 [LEAVE] User left the game",
@@ -100,7 +100,7 @@ let testLines = new Map([
type: "action",
action: "LEAVE",
message: "User left the game",
}
},
],
[
"Error while running event level::on_nth_tick(1)",
@@ -108,7 +108,7 @@ let testLines = new Map([
format: "none",
type: "generic",
message: "Error while running event level::on_nth_tick(1)",
}
},
],
[
"4802.763 Info AppManager.cpp:287: Saving to _autosave4 (blocking).",
@@ -119,7 +119,7 @@ let testLines = new Map([
level: "Info",
file: "AppManager.cpp:287",
message: "Saving to _autosave4 (blocking).",
}
},
],
[
" 10.806 Info AppManager.cpp:394: Saving game as C:\\factorio\\saves\\world.zip",
@@ -130,7 +130,7 @@ let testLines = new Map([
level: "Info",
file: "AppManager.cpp:394",
message: "Saving game as C:\\factorio\\saves\\world.zip",
}
},
],
[
"4202.780 Info AppManagerStates.cpp:1802: Saving finished",
@@ -141,7 +141,7 @@ let testLines = new Map([
level: "Info",
file: "AppManagerStates.cpp:1802",
message: "Saving finished",
}
},
],
]);
+3 -3
View File
@@ -523,7 +523,7 @@ describe("lib/prometheus", function() {
let serializedResult = {
metric: { type: "type", name: "name", help: "Help", labels: ["a", "b"] },
samples: [ ['a="1",b="2"', 1], ['a="3",b="4"', 5], ]
samples: [ ['a="1",b="2"', 1], ['a="3",b="4"', 5] ],
};
let deserializedResult = {
metric: new prometheus.Metric("type", "name", "Help", ["a", "b"]),
@@ -563,7 +563,7 @@ describe("lib/prometheus", function() {
prometheus.serializeResult({
metric: new prometheus.Metric("type", "name", "Help"),
samples: new Map([["", 2]]),
}, { metricName: "new", }),
}, { metricName: "new" }),
{
metric: { type: "type", name: "new", help: "Help", labels: [] },
samples: [["", 2]],
@@ -573,7 +573,7 @@ describe("lib/prometheus", function() {
prometheus.serializeResult({
metric: new prometheus.Metric("type", "name", "Help"),
samples: new Map([["", 2]]),
}, { metricHelp: "old", }),
}, { metricHelp: "old" }),
{
metric: { type: "type", name: "name", help: "old", labels: [] },
samples: [["", 2]],
+1 -1
View File
@@ -69,7 +69,7 @@ class MockInstance extends link.Link {
get: (name) => {
if (name === "instance.id") { return 7357; }
throw Error("Not implemented");
}
},
};
}
}