Skip to content

Commit

Permalink
🚑 Fix ESLint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rootasjey committed Jul 20, 2020
1 parent 68f0f79 commit bf17c03
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ module.exports = {
'@typescript-eslint/strict-boolean-expressions': [0],
'@typescript-eslint/quotes': [1],
'@typescript-eslint/explicit-function-return-type': [0],
'@typescript-eslint/prefer-nullish-coalescing': [1, { ignoreMixedLogicalExpressions: true }],
'comma-dangle': [1, 'always-multiline'],
'key-spacing': [0, { 'align': 'colon', 'mode': 'minimum' }],
'no-floating-decimal': 1,
'no-multi-spaces': [1, {
exceptions: {
'AssignmentExpression': true,
Expand Down
38 changes: 19 additions & 19 deletions src/gameObjects/GameMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
weaponSelectionPanel: Phaser.Tilemaps.DynamicTilemapLayer.prototype,
};

// @ts-ignore : This prop is initialized in the `init()` method in the constructor.
// @ts-expect-error : This prop is initialized in the `init()` method in the constructor.
public map: Phaser.Tilemaps.Tilemap;

// @ts-ignore : This prop is initialized in the `init()` method in the constructor.
// @ts-expect-error : This prop is initialized in the `init()` method in the constructor.
public mapMatrix: number[][];

public selectedUnit?: Phaser.Tilemaps.Tile;
Expand All @@ -62,10 +62,10 @@ export default class GameMap extends Phaser.GameObjects.GameObject {

private canDrag: boolean = false;

// @ts-ignore : This prop is initialized in the `init()` method in the constructor.
// @ts-expect-error : This prop is initialized in the `init()` method in the constructor.
private createUnit: () => Unit;

// @ts-ignore : This prop is initialized in the `init()` method in the constructor.
// @ts-expect-error : This prop is initialized in the `init()` method in the constructor.
private cursor: Phaser.Tilemaps.Tile;

/** Last cursor coordinates on pointerdown. TODO: Use velocity w/ Phaser 3.16. */
Expand All @@ -79,11 +79,11 @@ export default class GameMap extends Phaser.GameObjects.GameObject {

private previousUnitCoord?: Coord;

// @ts-ignore : This prop is initialized in the `init()` method in the constructor.
// @ts-expect-error : This prop is initialized in the `init()` method in the constructor.
private tileset: {
map: Phaser.Tilemaps.Tileset,
ui: Phaser.Tilemaps.Tileset,
units: Phaser.Tilemaps.Tileset,
map: Phaser.Tilemaps.Tileset
ui: Phaser.Tilemaps.Tileset
units: Phaser.Tilemaps.Tileset
};

/**
Expand Down Expand Up @@ -196,7 +196,7 @@ export default class GameMap extends Phaser.GameObjects.GameObject {

tweens: [
{
alpha: .8,
alpha: 0.8,
},
{
alpha: 0,
Expand Down Expand Up @@ -429,7 +429,7 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
const { x, y } = this.cursor;

if (this.selectedUnit) {
this.updateUnitPosition({ coord: {x, y} });
this.updateUnitPosition({ coord: { x, y } });
this.cursor.tint = colors.tileMovementPassive;
return;
}
Expand All @@ -440,7 +440,7 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
}

this.selectedUnit = this.layers
.units.getTileAt(x, y);
.units.getTileAt(x, y);

const tileUnit = this.selectedUnit.properties.tileUnit as TileUnit;
tileUnit.select();
Expand Down Expand Up @@ -476,8 +476,8 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
private moveCamera(x: number, y: number) {
const { x: worldX, y: worldY } = this.map.tileToWorldXY(x, y);

if (window.innerWidth - worldX < 60 || window.innerHeight - worldY < 60
|| worldX < 60 || worldY < 60) {
if (window.innerWidth - worldX < 60 || window.innerHeight - worldY < 60 ||
worldX < 60 || worldY < 60) {

this.scene.cameras.main.pan(worldX, worldY, 500);
}
Expand Down Expand Up @@ -753,10 +753,10 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
* When the silent options is true, no actions menu will open after the unit moves.
*/
private updateUnitPosition(param: UpdateUnitPositionParam) {
const { coord: { x, y }, dontShowMenu } = param;
const { coord: { x, y } } = param;

const { createUnit, scene } = this;
const unitsLayer = this.layers.units as Phaser.Tilemaps.DynamicTilemapLayer;
const unitsLayer = this.layers.units;

if (!this.selectedUnit) {
return this;
Expand All @@ -765,7 +765,7 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
const tileUnit = this.selectedUnit.properties.tileUnit as TileUnit;
const { x: unitX, y: unitY } = this.selectedUnit;

if (!tileUnit.canMoveTo({x, y})) {
if (!tileUnit.canMoveTo({ x, y })) {
tileUnit.unselect();

this.selectedUnit = undefined;
Expand All @@ -777,7 +777,7 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
tileUnit
.moveTo(x, y)
.then((result) => {
const unit = result.tileUnit as TileUnit;
const unit = result.tileUnit;
unit.unselect();
return result;
})
Expand All @@ -789,8 +789,8 @@ export default class GameMap extends Phaser.GameObjects.GameObject {
this.previousUnitCoord = { x: this.selectedUnit.x, y: this.selectedUnit.y };

const tile = unitsLayer
.putTileAt(this.selectedUnit, x, y)
.setAlpha(1);
.putTileAt(this.selectedUnit, x, y)
.setAlpha(1);

tileUnit.destroy();
this.selectedUnit.destroy();
Expand Down

0 comments on commit bf17c03

Please sign in to comment.