Skip to content

Commit

Permalink
use @typescript-eslint/recommended-type-checked and fix two errors fr…
Browse files Browse the repository at this point in the history
…om it
  • Loading branch information
Kageetai committed Jan 30, 2024
1 parent e951b77 commit 2c6b5a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
plugins: ["@typescript-eslint"],
root: true,
};
10 changes: 4 additions & 6 deletions src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ function drawActors() {
asciiDisplay[player.y][player.x] = player.hp;

// draw the enemies
for (const a in enemyList) {
if (enemyList[a] != null && enemyList[a].hp > 0)
asciiDisplay[enemyList[a].y][enemyList[a].x] = "e";
for (const a of enemyList) {
if (a != null && a.hp > 0) asciiDisplay[a.y][a.x] = "e";
}
}

Expand Down Expand Up @@ -182,9 +181,8 @@ export function onKeyUp(event: DirectionalEvent) {

// enemies act every time the player does
if (acted)
for (const enemy in enemyList) {
const e = enemyList[enemy];
if (e != null) aiAct(e);
for (const enemy of enemyList) {
if (enemy != null) aiAct(enemy);
}

// draw actors in new positions
Expand Down

0 comments on commit 2c6b5a7

Please sign in to comment.