Changes according to Eslint

This commit is contained in:
Daniël van Noord
2021-03-16 09:32:50 +01:00
parent 26d8e75935
commit a65af049b6
63 changed files with 314 additions and 295 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import {
CacheObjects1,
CacheObjects10,
@@ -30,17 +31,17 @@ export default function UpdateBuildings() {
if (Game.buyMode === 1) {
if (CMOptions.BuildColor === 1) {
for (const i of Object.keys(target)) {
Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color =
CMOptions.Colors[target[i].color];
}
});
} else {
for (const i of Object.keys(Game.Objects)) {
Object.keys(Game.Objects).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
}
});
}
} else if (Game.buyMode === -1) {
for (const i of Object.keys(CacheObjects1)) {
Object.keys(CacheObjects1).forEach((i) => {
const o = Game.Objects[i];
l(`productPrice${o.id}`).style.color = '';
/*
@@ -54,7 +55,7 @@ export default function UpdateBuildings() {
l(`productPrice${o.id}`).innerHTML = Beautify(
BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1),
);
}
});
}
// Build array of pointers, sort by pp, use array index (+2) as the grid row number

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import { CacheUpgrades } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import {
@@ -29,10 +30,10 @@ export default function UpdateUpgrades() {
let purple = 0;
let gray = 0;
for (const i of Object.keys(Game.UpgradesInStore)) {
Object.keys(Game.UpgradesInStore).forEach((i) => {
const me = Game.UpgradesInStore[i];
let addedColor = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j++) {
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if (
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
) {
@@ -49,14 +50,14 @@ export default function UpdateUpgrades() {
div.className = ColorBackPre + CacheUpgrades[me.name].color;
l(`upgrade${i}`).appendChild(div);
}
if (CacheUpgrades[me.name].color === ColorBlue) blue++;
else if (CacheUpgrades[me.name].color === ColorGreen) green++;
else if (CacheUpgrades[me.name].color === ColorYellow) yellow++;
else if (CacheUpgrades[me.name].color === ColorOrange) orange++;
else if (CacheUpgrades[me.name].color === ColorRed) red++;
else if (CacheUpgrades[me.name].color === ColorPurple) purple++;
else if (CacheUpgrades[me.name].color === ColorGray) gray++;
}
if (CacheUpgrades[me.name].color === ColorBlue) blue += 1;
else if (CacheUpgrades[me.name].color === ColorGreen) green += 1;
else if (CacheUpgrades[me.name].color === ColorYellow) yellow += 1;
else if (CacheUpgrades[me.name].color === ColorOrange) orange += 1;
else if (CacheUpgrades[me.name].color === ColorRed) red += 1;
else if (CacheUpgrades[me.name].color === ColorPurple) purple += 1;
else if (CacheUpgrades[me.name].color === ColorGray) gray += 1;
});
l('CMUpgradeBarBlue').textContent = blue;
l('CMUpgradeBarGreen').textContent = green;
@@ -70,7 +71,7 @@ export default function UpdateUpgrades() {
const arr = [];
// Build array of pointers, sort by pp, set flex positions
// This regulates sorting of upgrades
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
const o = {};
o.name = Game.UpgradesInStore[x].name;
o.price = Game.UpgradesInStore[x].basePrice;
@@ -95,7 +96,7 @@ export default function UpdateUpgrades() {
const nameChecker = function (arr2, upgrade) {
return arr2.findIndex((e) => e.name === upgrade.name);
};
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
l(`upgrade${x}`).style.order =
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
}