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

@@ -112,47 +112,47 @@ export default function AddMenuStats(title) {
let specDisp = false;
const missingHalloweenCookies = [];
for (const i of Object.keys(GameData.HalloCookies)) {
Object.keys(GameData.HalloCookies).forEach((i) => {
if (!Game.Has(GameData.HalloCookies[i])) {
missingHalloweenCookies.push(GameData.HalloCookies[i]);
specDisp = true;
}
}
});
const missingChristmasCookies = [];
for (const i of Object.keys(GameData.ChristCookies)) {
Object.keys(GameData.ChristCookies).forEach((i) => {
if (!Game.Has(GameData.ChristCookies[i])) {
missingChristmasCookies.push(GameData.ChristCookies[i]);
specDisp = true;
}
}
});
const missingValentineCookies = [];
for (const i of Object.keys(GameData.ValCookies)) {
Object.keys(GameData.ValCookies).forEach((i) => {
if (!Game.Has(GameData.ValCookies[i])) {
missingValentineCookies.push(GameData.ValCookies[i]);
specDisp = true;
}
}
});
const missingNormalEggs = [];
for (const i of Object.keys(Game.eggDrops)) {
Object.keys(Game.eggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.eggDrops[i])) {
missingNormalEggs.push(Game.eggDrops[i]);
specDisp = true;
}
}
});
const missingRareEggs = [];
for (const i of Object.keys(Game.rareEggDrops)) {
Object.keys(Game.rareEggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
missingRareEggs.push(Game.rareEggDrops[i]);
specDisp = true;
}
}
});
const missingPlantDrops = [];
for (const i of Object.keys(GameData.PlantDrops)) {
Object.keys(GameData.PlantDrops).forEach((i) => {
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
missingPlantDrops.push(GameData.PlantDrops[i]);
specDisp = true;
}
}
});
const choEgg =
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg');
@@ -266,11 +266,11 @@ export default function AddMenuStats(title) {
);
if (Game.Has('Fortune cookies')) {
const fortunes = [];
for (const i of Object.keys(GameData.Fortunes)) {
Object.keys(GameData.Fortunes).forEach((i) => {
if (!Game.Has(GameData.Fortunes[i])) {
fortunes.push(GameData.Fortunes[i]);
}
}
});
if (fortunes.length !== 0)
stats.appendChild(
CreateElements.StatsListing(

View File

@@ -106,12 +106,12 @@ export function StatsMissDisp(theMissDisp) {
title.style.textAlign = 'center';
title.textContent = 'Missing';
missing.appendChild(title);
for (const i of Object.keys(theMissDisp)) {
Object.keys(theMissDisp).forEach((i) => {
const div = document.createElement('div');
div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theMissDisp[i]));
missing.appendChild(div);
}
});
placeholder.appendChild(missing);
span.onmouseover = function () {
Game.tooltip.draw(this, escape(placeholder.innerHTML));

View File

@@ -10,7 +10,7 @@ import {
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
*/
export function AddMissingUpgrades() {
for (const menuSection of l('menu').children) {
l('menu').childNodes.forEach((menuSection) => {
if (menuSection.children[0]) {
if (
menuSection.children[0].innerHTML === 'Prestige' &&
@@ -82,7 +82,7 @@ export function AddMissingUpgrades() {
}
}
}
}
});
}
/**
@@ -99,7 +99,7 @@ export function crateMissing(me) {
if (!Game.prefs.crates) noFrame = 1;
if (noFrame) classes += ' noFrame';
let icon = me.icon;
let { icon } = me;
if (me.iconFunction) icon = me.iconFunction();
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
return `<div class="${classes}"

View File

@@ -170,7 +170,7 @@ function CreatePrefOption(config) {
SaveConfig();
Game.UpdateMenu();
};
new JsColor(input, { hash: true, position: 'right', onInput: change });
JsColor(input, { hash: true, position: 'right', onInput: change });
const label = document.createElement('label');
label.textContent = Config.Colors.desc[Colors[i]];
innerDiv.appendChild(label);
@@ -216,14 +216,14 @@ export default function AddMenuPref(title) {
const frag = document.createDocumentFragment();
frag.appendChild(title);
for (const group of Object.keys(ConfigGroups)) {
Object.keys(ConfigGroups).forEach((group) => {
const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group)
frag.appendChild(groupObject);
if (CMOptions.Header[group]) {
// 0 is show, 1 is collapsed
// Make sub-sections of Notification section
if (group === 'Notification') {
for (const subGroup of Object.keys(ConfigGroupsNotification)) {
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
const subGroupObject = CreatePrefHeader(
subGroup,
ConfigGroupsNotification[subGroup],
@@ -232,20 +232,20 @@ export default function AddMenuPref(title) {
subGroupObject.style.opacity = '0.5';
frag.appendChild(subGroupObject);
if (CMOptions.Header[subGroup]) {
for (const option in Config) {
Object.keys(Config).forEach((option) => {
if (Config[option].group === subGroup)
frag.appendChild(CreatePrefOption(option));
}
});
}
}
});
} else {
for (const option of Object.keys(Config)) {
Object.keys(Config).forEach((option) => {
if (Config[option].group === group)
frag.appendChild(CreatePrefOption(option));
}
});
}
}
}
});
const resDef = document.createElement('div');
resDef.className = 'listing';