Fixed linting issues

This commit is contained in:
Daniël van Noord
2021-05-01 22:43:02 +02:00
parent 1d12977984
commit 1c8bd79640
94 changed files with 8692 additions and 1316 deletions

View File

@@ -1,8 +1,4 @@
import {
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -31,8 +27,7 @@ export default function UpdateBuildings() {
if (Game.buyMode === 1) {
if (CMOptions.BuildColour === 1) {
Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color =
CMOptions[`Colour${target[i].color}`];
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
});
} else {
Object.keys(Game.Objects).forEach((i) => {
@@ -70,14 +65,16 @@ export default function UpdateBuildings() {
return o;
});
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
} else if (CMOptions.SortBuildings === 2) {
arr = Object.keys(target).map((k) => {
const o = target[k];
@@ -86,14 +83,16 @@ export default function UpdateBuildings() {
return o;
});
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
}
for (let x = 0; x < arr.length; x++) {

View File

@@ -38,24 +38,12 @@ function CreateUpgradeBarLegend() {
return div;
};
legend.appendChild(
legendLine(ColourBlue, 'Better than the best PP of a building option'),
);
legend.appendChild(
legendLine(ColourGreen, 'Same as the best PP building option'),
);
legend.appendChild(
legendLine(ColourYellow, 'Within the top 10 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourOrange, 'Within the top 20 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourRed, 'Within the top 30 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'),
);
legend.appendChild(legendLine(ColourBlue, 'Better than the best PP of a building option'));
legend.appendChild(legendLine(ColourGreen, 'Same as the best PP building option'));
legend.appendChild(legendLine(ColourYellow, 'Within the top 10 of PP for buildings'));
legend.appendChild(legendLine(ColourOrange, 'Within the top 20 of PP for buildings'));
legend.appendChild(legendLine(ColourRed, 'Within the top 30 of PP for buildings'));
legend.appendChild(legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'));
legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP'));
return legend;
}
@@ -99,8 +87,5 @@ export default function CreateUpgradeBar() {
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple));
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray));
l('upgrades').parentNode.insertBefore(
UpgradeBar,
l('upgrades').parentNode.childNodes[3],
);
l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
}

View File

@@ -33,11 +33,8 @@ export default function UpdateUpgrades() {
const me = Game.UpgradesInStore[i];
let addedColour = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if (
l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1
) {
l(`upgrade${i}`).childNodes[j].className =
ColourBackPre + CacheUpgrades[me.name].color;
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
addedColour = true;
break;
}
@@ -79,13 +76,15 @@ export default function UpdateUpgrades() {
}
if (CMOptions.SortUpgrades) {
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1
: a.pp < b.pp
? -1
: 0);
: 0,
);
} else {
arr.sort((a, b) => a.price - b.price);
}
@@ -94,7 +93,6 @@ export default function UpdateUpgrades() {
return arr2.findIndex((e) => e.name === upgrade.name);
};
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
l(`upgrade${x}`).style.order =
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
}
}