fixing lint errors

This commit is contained in:
Dave 2023-01-13 16:57:06 +00:00
parent c257ef998e
commit 1bde7a6688
2 changed files with 27 additions and 27 deletions

View file

@ -32,7 +32,7 @@ class LiveSession {
); );
this._socket.addEventListener("message", this._handleMessage.bind(this)); this._socket.addEventListener("message", this._handleMessage.bind(this));
this._socket.onopen = this._onOpen.bind(this); this._socket.onopen = this._onOpen.bind(this);
this._socket.onclose = (err) => { this._socket.onclose = err => {
this._socket = null; this._socket = null;
clearInterval(this._pingTimer); clearInterval(this._pingTimer);
this._pingTimer = null; this._pingTimer = null;
@ -105,7 +105,7 @@ class LiveSession {
this._isSpectator this._isSpectator
? this._store.state.session.playerId ? this._store.state.session.playerId
: Object.keys(this._players).length, : Object.keys(this._players).length,
"latency", "latency"
]); ]);
clearTimeout(this._pingTimer); clearTimeout(this._pingTimer);
this._pingTimer = setTimeout(this._ping.bind(this), this._pingInterval); this._pingTimer = setTimeout(this._ping.bind(this), this._pingInterval);
@ -255,7 +255,7 @@ class LiveSession {
*/ */
sendGamestate(playerId = "", isLightweight = false) { sendGamestate(playerId = "", isLightweight = false) {
if (this._isSpectator) return; if (this._isSpectator) return;
this._gamestate = this._store.state.players.players.map((player) => ({ this._gamestate = this._store.state.players.players.map(player => ({
name: player.name, name: player.name,
id: player.id, id: player.id,
isDead: player.isDead, isDead: player.isDead,
@ -263,12 +263,12 @@ class LiveSession {
pronouns: player.pronouns, pronouns: player.pronouns,
...(player.role && player.role.team === "traveler" ...(player.role && player.role.team === "traveler"
? { roleId: player.role.id } ? { roleId: player.role.id }
: {}), : {})
})); }));
if (isLightweight) { if (isLightweight) {
this._sendDirect(playerId, "gs", { this._sendDirect(playerId, "gs", {
gamestate: this._gamestate, gamestate: this._gamestate,
isLightweight, isLightweight
}); });
} else { } else {
const { session, grimoire } = this._store.state; const { session, grimoire } = this._store.state;
@ -283,8 +283,8 @@ class LiveSession {
lockedVote: session.lockedVote, lockedVote: session.lockedVote,
isVoteInProgress: session.isVoteInProgress, isVoteInProgress: session.isVoteInProgress,
markedPlayer: session.markedPlayer, markedPlayer: session.markedPlayer,
fabled: fabled.map((f) => (f.isCustom ? f : { id: f.id })), fabled: fabled.map(f => (f.isCustom ? f : { id: f.id })),
...(session.nomination ? { votes: session.votes } : {}), ...(session.nomination ? { votes: session.votes } : {})
}); });
} }
} }
@ -307,7 +307,7 @@ class LiveSession {
lockedVote, lockedVote,
isVoteInProgress, isVoteInProgress,
markedPlayer, markedPlayer,
fabled, fabled
} = data; } = data;
const players = this._store.state.players.players; const players = this._store.state.players.players;
// adjust number of players // adjust number of players
@ -325,7 +325,7 @@ class LiveSession {
const player = players[x]; const player = players[x];
const { roleId } = state; const { roleId } = state;
// update relevant properties // update relevant properties
["name", "id", "isDead", "isVoteless", "pronouns"].forEach((property) => { ["name", "id", "isDead", "isVoteless", "pronouns"].forEach(property => {
const value = state[property]; const value = state[property];
if (player[property] !== value) { if (player[property] !== value) {
this._store.commit("players/update", { player, property, value }); this._store.commit("players/update", { player, property, value });
@ -340,14 +340,14 @@ class LiveSession {
this._store.commit("players/update", { this._store.commit("players/update", {
player, player,
property: "role", property: "role",
value: role, value: role
}); });
} }
} else if (!roleId && player.role.team === "traveler") { } else if (!roleId && player.role.team === "traveler") {
this._store.commit("players/update", { this._store.commit("players/update", {
player, player,
property: "role", property: "role",
value: {}, value: {}
}); });
} }
}); });
@ -359,11 +359,11 @@ class LiveSession {
votes, votes,
votingSpeed, votingSpeed,
lockedVote, lockedVote,
isVoteInProgress, isVoteInProgress
}); });
this._store.commit("session/setMarkedPlayer", markedPlayer); this._store.commit("session/setMarkedPlayer", markedPlayer);
this._store.commit("players/setFabled", { this._store.commit("players/setFabled", {
fabled: fabled.map((f) => this._store.state.fabled.get(f.id) || f), fabled: fabled.map(f => this._store.state.fabled.get(f.id) || f)
}); });
} }
} }
@ -381,7 +381,7 @@ class LiveSession {
} }
this._sendDirect(playerId, "edition", { this._sendDirect(playerId, "edition", {
edition: edition.isOfficial ? { id: edition.id } : edition, edition: edition.isOfficial ? { id: edition.id } : edition,
...(roles ? { roles } : {}), ...(roles ? { roles } : {})
}); });
} }
@ -422,7 +422,7 @@ class LiveSession {
const { fabled } = this._store.state.players; const { fabled } = this._store.state.players;
this._send( this._send(
"fabled", "fabled",
fabled.map((f) => (f.isCustom ? f : { id: f.id })) fabled.map(f => (f.isCustom ? f : { id: f.id }))
); );
} }
@ -434,7 +434,7 @@ class LiveSession {
_updateFabled(fabled) { _updateFabled(fabled) {
if (!this._isSpectator) return; if (!this._isSpectator) return;
this._store.commit("players/setFabled", { this._store.commit("players/setFabled", {
fabled: fabled.map((f) => this._store.state.fabled.get(f.id) || f), fabled: fabled.map(f => this._store.state.fabled.get(f.id) || f)
}); });
} }
@ -454,7 +454,7 @@ class LiveSession {
this._send("player", { this._send("player", {
index, index,
property, property,
value: value.id, value: value.id
}); });
} else if (this._gamestate[index].roleId) { } else if (this._gamestate[index].roleId) {
// player was previously a traveler // player was previously a traveler
@ -484,7 +484,7 @@ class LiveSession {
this._store.commit("players/update", { this._store.commit("players/update", {
player, player,
property: "role", property: "role",
value: {}, value: {}
}); });
} else { } else {
// load role, first from session, the global, then fail gracefully // load role, first from session, the global, then fail gracefully
@ -495,7 +495,7 @@ class LiveSession {
this._store.commit("players/update", { this._store.commit("players/update", {
player, player,
property: "role", property: "role",
value: role, value: role
}); });
} }
} else { } else {
@ -535,7 +535,7 @@ class LiveSession {
player, player,
property: "pronouns", property: "pronouns",
value, value,
isFromSockets: true, isFromSockets: true
}); });
} }
@ -556,12 +556,12 @@ class LiveSession {
} }
} }
// remove claimed seats from players that are no longer connected // remove claimed seats from players that are no longer connected
this._store.state.players.players.forEach((player) => { this._store.state.players.players.forEach(player => {
if (player.id && !this._players[player.id]) { if (player.id && !this._players[player.id]) {
this._store.commit("players/update", { this._store.commit("players/update", {
player, player,
property: "id", property: "id",
value: "", value: ""
}); });
} }
}); });
@ -635,7 +635,7 @@ class LiveSession {
this._store.commit("players/update", { this._store.commit("players/update", {
player: players[oldIndex], player: players[oldIndex],
property, property,
value: "", value: ""
}); });
} }
// add playerId to new seat // add playerId to new seat
@ -659,7 +659,7 @@ class LiveSession {
if (player.id && player.role) { if (player.id && player.role) {
message[player.id] = [ message[player.id] = [
"player", "player",
{ index, property: "role", value: player.role.id }, { index, property: "role", value: player.role.id }
]; ];
} }
}); });
@ -757,7 +757,7 @@ class LiveSession {
this._send("vote", [ this._send("vote", [
index, index,
this._store.state.session.votes[index], this._store.state.session.votes[index],
!this._isSpectator, !this._isSpectator
]); ]);
} }
} }
@ -836,7 +836,7 @@ class LiveSession {
} }
} }
export default (store) => { export default store => {
// setup // setup
const session = new LiveSession(store); const session = new LiveSession(store);

View file

@ -1,5 +1,5 @@
module.exports = { module.exports = {
// if the app is supposed to run on Github Pages in a subfolder, use the following config: // if the app is supposed to run on Github Pages in a subfolder, use the following config:
// publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/" // publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/"
publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/", publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/"
}; };