eslint es2015 fixes

This commit is contained in:
ReznoRMichael 2021-01-24 21:17:55 +01:00
parent a1a662782d
commit 245d48b7db
6 changed files with 19 additions and 9 deletions

1
.eslintignore Normal file
View file

@ -0,0 +1 @@
files/

3
.gitignore vendored
View file

@ -7,4 +7,5 @@ js/LoadJson.js
config.json config.json
package.json package.json
package-lock.json package-lock.json
workspace.code-workspace workspace.code-workspace
.eslintrc.js

View file

@ -1,3 +1,6 @@
/* eslint-disable no-unused-vars */
/* global bench */
/* eslint-disable no-prototype-builtins */
// ---------------- Constants ----------------- // // ---------------- Constants ----------------- //
const DATA_UNKNOWN = "Data unknown"; const DATA_UNKNOWN = "Data unknown";
@ -1008,7 +1011,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
*/ */
function CountMaps(mapArray) { function CountMaps(mapArray) {
let totalMaps = 0; let totalMaps = 0;
for (i = 0, len = mapArray.length; i < len; i++) { for (let i = 0, len = mapArray.length; i < len; i++) {
if (playerData[mapArray[i]] === true) totalMaps++ if (playerData[mapArray[i]] === true) totalMaps++
} }
return totalMaps; return totalMaps;
@ -1018,6 +1021,10 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
textPrefix = dataObject[i][0]; textPrefix = dataObject[i][0];
(dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = ""; (dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = "";
let amount = 0;
let countTotal = 0;
let total = 0;
switch (i) { switch (i) {
case "areaMaps": case "areaMaps":
case "grubsCollected": case "grubsCollected":
@ -1031,7 +1038,6 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
case "journalNotesCompleted": case "journalNotesCompleted":
case "whiteDefenderDefeats": case "whiteDefenderDefeats":
case "greyPrinceDefeats": case "greyPrinceDefeats":
let amount = 0;
if (i === "areaMaps") { if (i === "areaMaps") {
amount = CountMaps(dataObject[i][3]); amount = CountMaps(dataObject[i][3]);
} else if (i === "whisperingRoots") { } else if (i === "whisperingRoots") {
@ -1042,7 +1048,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
if (i === "stationsOpened") { if (i === "stationsOpened") {
if (playerData.openedHiddenStation === true) amount++; if (playerData.openedHiddenStation === true) amount++;
} }
let countTotal = amount; countTotal = amount;
if (i === "journalEntriesCompleted" || i === "journalNotesCompleted") { if (i === "journalEntriesCompleted" || i === "journalNotesCompleted") {
countTotal = amount + " / " + playerData.journalEntriesTotal; countTotal = amount + " / " + playerData.journalEntriesTotal;
} }
@ -1091,7 +1097,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
case "relicsHallownestSeal": case "relicsHallownestSeal":
case "relicsKingsIdol": case "relicsKingsIdol":
case "relicsArcaneEgg": case "relicsArcaneEgg":
let total = playerData[dataObject[i][3]] + playerData[dataObject[i][4]]; total = playerData[dataObject[i][3]] + playerData[dataObject[i][4]];
(total >= dataObject[i][2]) ? CurrentDataTrue(): CurrentDataBlank(); (total >= dataObject[i][2]) ? CurrentDataTrue(): CurrentDataBlank();
textPrefix += ": " + total; textPrefix += ": " + total;
break; break;

View file

@ -1,6 +1,5 @@
var jsonObj = "";
// save file names list in the save/ folder // save file names list in the save/ folder
var fileName = [ var fileName = [
"reznor0", // 0 "reznor0", // 0
"reznor1beforegruz", // 1 "reznor1beforegruz", // 1
@ -24,7 +23,7 @@ var fileName = [
* @param {string} filename Path and .json file name to be loaded * @param {string} filename Path and .json file name to be loaded
* @param callback Function to be called when the request completes * @param callback Function to be called when the request completes
*/ */
function LoadJSON(filename, callback) { function LoadJSON(filename) {
// new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server. // new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server.
var xobj = new XMLHttpRequest(); var xobj = new XMLHttpRequest();
@ -70,4 +69,4 @@ function LoadJSON(filename, callback) {
} */ } */
// jsonObj = LoadJSON("../save/" + fileName[5], JSONparse(response)); // jsonObj = LoadJSON("../save/" + fileName[5], JSONparse(response));
jsonObj = LoadJSON("save/" + fileName[5] + ".json"); LoadJSON("save/" + fileName[5] + ".json");

View file

@ -1,3 +1,4 @@
/* global aesjs, HKReadTextArea */
/* /*
Parts of the code thanks to bloodorca https://github.com/bloodorca/hollow (base64.js, functions.js) with slight modifications. Parts of the code thanks to bloodorca https://github.com/bloodorca/hollow (base64.js, functions.js) with slight modifications.
The steps used there for decryption were taken from KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager The steps used there for decryption were taken from KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager
@ -35,6 +36,7 @@ let bench = {
* Starts benchmarking. * Starts benchmarking.
* @param {FileList} input FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files. * @param {FileList} input FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files.
*/ */
// eslint-disable-next-line no-unused-vars
function LoadSaveFile(input, startTime = new Date()) { function LoadSaveFile(input, startTime = new Date()) {
// console.info("Input length: " + input.files.length) // console.info("Input length: " + input.files.length)

View file

@ -1,3 +1,4 @@
/* eslint-disable */
"use strict"; "use strict";
(function (root) { (function (root) {