From 0df44e3e8737779c3831607645bc17d929d126e5 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Sat, 4 Sep 2021 23:11:13 -0500 Subject: [PATCH] updated eslint rules --- .eslintrc.js | 8 +++++++- src/main.ts | 4 ++-- src/model/GameState.ts | 2 +- src/model/resource/Pastor.ts | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d6c4342..42e9a2a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,6 +10,12 @@ module.exports = { '@typescript-eslint/triple-slash-reference': 0, '@typescript-eslint/no-unused-vars': 0, '@typescript-eslint/no-explicit-any': 0, - '@typescript-eslint/ban-ts-comment': 0 + '@typescript-eslint/ban-ts-comment': 0, + '@typescript-eslint/explicit-function-return-type': 1, + 'quotes': [2, 'single', {avoidEscape: true},], + 'no-extra-parens': 1, + 'consistent-return': 1, + 'no-eq-null': 1, + 'no-implicit-globals': 1 } }; diff --git a/src/main.ts b/src/main.ts index f1a9c7c..fe8055c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,13 +8,13 @@ const cycleLength = 250; function gameLoop (state: GameState, renderer: IRenderer): void { // figure out how much actual time has passed const elapsedTime: number = globalStartTime > 0 - ? (new Date()).getTime() - globalStartTime : 0; + ? new Date().getTime() - globalStartTime : 0; state.advance(elapsedTime); renderer.render(state); // run again in 1sec - globalStartTime = (new Date()).getTime(); + globalStartTime = new Date().getTime(); globalTimeout = setTimeout((): void => gameLoop(state, renderer), cycleLength); } diff --git a/src/model/GameState.ts b/src/model/GameState.ts index a937291..c586048 100644 --- a/src/model/GameState.ts +++ b/src/model/GameState.ts @@ -22,7 +22,7 @@ class GameState { } public advance (time: number): void { - this.now = (new Date()).getTime(); + this.now = new Date().getTime(); this._timeSinceSave += time; if (this._timeSinceSave >= this._timeBetweenSaves) { diff --git a/src/model/resource/Pastor.ts b/src/model/resource/Pastor.ts index f706f43..c758aa7 100644 --- a/src/model/resource/Pastor.ts +++ b/src/model/resource/Pastor.ts @@ -15,6 +15,7 @@ class Pastor extends Job { public isUnlocked (state: GameState): boolean { if (this._isUnlocked) return true; this._isUnlocked = state.getResource('chrch').isUnlocked(state); + return this._isUnlocked; } public advanceAction (time: number, state: GameState): void {