From 3b052f66c8405746fe78384afa7007bd38524671 Mon Sep 17 00:00:00 2001 From: AlecM33 Date: Wed, 30 Mar 2022 21:26:30 -0400 Subject: [PATCH] lint under new rules --- client/src/modules/GameCreationStepManager.js | 6 +++--- client/src/modules/UserUtility.js | 2 +- server/modules/GameManager.js | 14 +++++++------- spec/unit/server/modules/GameManager_Spec.js | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/client/src/modules/GameCreationStepManager.js b/client/src/modules/GameCreationStepManager.js index 36c1c04..f626fad 100644 --- a/client/src/modules/GameCreationStepManager.js +++ b/client/src/modules/GameCreationStepManager.js @@ -462,7 +462,7 @@ function showButtons (back, forward, forwardHandler, backHandler, builtGame = nu // Display a widget for each default card that allows copies of it to be added/removed. Set initial deck state. function showIncludedCards (deckManager) { document.querySelectorAll('.compact-card').forEach((el) => { el.remove(); }); - for (let i = 0; i < deckManager.getCurrentDeck().length; i++) { + for (let i = 0; i < deckManager.getCurrentDeck().length; i ++) { const card = deckManager.getCurrentDeck()[i]; const cardEl = constructCompactDeckBuilderElement(card, deckManager); if (card.team === globals.ALIGNMENT.GOOD) { @@ -487,7 +487,7 @@ function loadDefaultCards (deckManager) { return a.role.localeCompare(b.role); }); const deck = []; - for (let i = 0; i < defaultCards.length; i++) { + for (let i = 0; i < defaultCards.length; i ++) { const card = defaultCards[i]; card.quantity = 0; deck.push(card); @@ -631,7 +631,7 @@ function addOptionsToList (deckManager, selectEl) { } return a.role.localeCompare(b.role); }); - for (let i = 0; i < options.length; i++) { + for (let i = 0; i < options.length; i ++) { const optionEl = document.createElement('div'); optionEl.innerHTML = HTMLFragments.DECK_SELECT_ROLE; optionEl.classList.add('deck-select-role'); diff --git a/client/src/modules/UserUtility.js b/client/src/modules/UserUtility.js index ce1912c..cb6e9eb 100644 --- a/client/src/modules/UserUtility.js +++ b/client/src/modules/UserUtility.js @@ -56,7 +56,7 @@ export const UserUtility = { function createRandomUserId () { let id = ''; - for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) { + for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i ++) { id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)]; } return id; diff --git a/server/modules/GameManager.js b/server/modules/GameManager.js index 506fa92..95fbe67 100644 --- a/server/modules/GameManager.js +++ b/server/modules/GameManager.js @@ -216,7 +216,7 @@ class GameManager { codeDigits = []; let iterations = globals.ACCESS_CODE_LENGTH; while (iterations > 0) { - iterations--; + iterations --; codeDigits.push(charPool[getRandomInt(charCount)]); } accessCode = codeDigits.join(''); @@ -373,9 +373,9 @@ function initializePeopleForGame (uniqueCards, moderator) { let cards = []; // this will contain copies of each card equal to the quantity. let numberOfRoles = 0; for (const card of uniqueCards) { - for (let i = 0; i < card.quantity; i++) { + for (let i = 0; i < card.quantity; i ++) { cards.push(card); - numberOfRoles++; + numberOfRoles ++; } } @@ -388,7 +388,7 @@ function initializePeopleForGame (uniqueCards, moderator) { moderator.gameRoleDescription = cards[j].description; moderator.alignment = cards[j].team; people.push(moderator); - j++; + j ++; } while (j < numberOfRoles) { @@ -404,14 +404,14 @@ function initializePeopleForGame (uniqueCards, moderator) { person.customRole = cards[j].custom; person.hasEnteredName = false; people.push(person); - j++; + j ++; } return people; } function shuffleArray (array) { - for (let i = 0; i < array.length; i++) { + for (let i = 0; i < array.length; i ++) { const randIndex = Math.floor(Math.random() * i); const temp = array[i]; array[i] = array[randIndex]; @@ -422,7 +422,7 @@ function shuffleArray (array) { function createRandomId () { let id = ''; - for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) { + for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i ++) { id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)]; } return id; diff --git a/spec/unit/server/modules/GameManager_Spec.js b/spec/unit/server/modules/GameManager_Spec.js index 2f10f01..aaac3ee 100644 --- a/spec/unit/server/modules/GameManager_Spec.js +++ b/spec/unit/server/modules/GameManager_Spec.js @@ -264,7 +264,7 @@ describe('GameManager', () => { describe('#generateAccessCode', () => { it('should continue to generate access codes up to the max attempts when the generated code is already in use by another game', () => { gameManager.activeGameRunner.activeGames = { - 'AAAA': {} + AAAA: {} }; const accessCode = gameManager.generateAccessCode(['A']); @@ -273,11 +273,11 @@ describe('GameManager', () => { it('should generate and return a unique access code', () => { gameManager.activeGameRunner.activeGames = { - 'AAAA': {} + AAAA: {} }; const accessCode = gameManager.generateAccessCode(['B']); expect(accessCode).toEqual('BBBB'); }); - }) + }); });