Manual cleanup of a few issues detected by eslint

merge-requests/43/head
Sebastian Delmont 2020-12-13 20:30:10 -05:00
rodzic 502de6db9d
commit 4c8db9fa50
6 zmienionych plików z 562 dodań i 608 usunięć

Wyświetl plik

@ -48,7 +48,6 @@ function findAdiField(row, field) {
var newLen = newLenSearch[0];
value = secondSplitArray[1].slice(0, newLen);
}
delete secondSplitArray;
}
return value;
}
@ -369,10 +368,6 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) {
}
}
delete rawAdiBuffer;
delete activeAdifArray;
redrawGrids();
updateCountStats();
updateLogbook();
@ -591,7 +586,6 @@ function qrzCallback(buffer, flag) {
tryToWriteAdifToDocFolder("qrz.adif", htmlString);
onAdiLoadComplete(htmlString, true, "qrz.adif", true);
delete htmlString;
}
}
}
@ -1111,14 +1105,13 @@ function getABuffer(
let fileBuffer = null;
let options = null;
{
options = {
host: url.parse(file_url).host,
port: port,
path: url.parse(file_url).path,
method: "get",
};
}
options = {
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
method: "get"
};
if (typeof stringOfFlag != "undefined") window[stringOfFlag] = true;
if (typeof imgToGray != "undefined") {
imgToGray.parentNode.style.background =
@ -1209,9 +1202,9 @@ function getAPostBuffer(
var fileBuffer = null;
var options = {
host: url.parse(file_url).host,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
path: url.parse(file_url).path,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
method: "post",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
@ -1277,7 +1270,7 @@ function getAPostBuffer(
});
});
req.on("error", function (err) {
req.on("error", function (err) { // eslint-disable-line node/handle-callback-err
window[stringOfFlag] = false;
if (typeof imgToGray != "undefined") {
imgToGray.parentNode.style.background = "";
@ -1292,7 +1285,7 @@ function getAPostBuffer(
function sendUdpMessage(msg, length, port, address) {
var dgram = require("dgram");
var socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
socket.send(msg, 0, length, port, address, (err) => {
socket.send(msg, 0, length, port, address, (err) => { // eslint-disable-line node/handle-callback-err
socket.close();
});
}
@ -1897,7 +1890,7 @@ function sendLotwLogEntry(report) {
child_process.execFile(
g_trustedQslSettings.binaryFile,
options,
(error, stdout, stderr) => {
(error, stdout, stderr) => { // eslint-disable-line node/handle-callback-err
if (stderr.indexOf("Final Status: Success") < 0) {
alert(stderr);
addLastTraffic("<font style='color:red'>Fail log to TQSL</font>");
@ -2235,13 +2228,13 @@ function getPostJSONBuffer(
try {
var postData = JSON.stringify(theData);
var url = require("url");
var protocol = url.parse(file_url).protocol;
var protocol = url.parse(file_url).protocol; // eslint-disable-line node/no-deprecated-api
var http = require(protocol.replace(":", ""));
var fileBuffer = null;
var options = {
host: url.parse(file_url).hostname,
port: url.parse(file_url).port,
path: url.parse(file_url).path,
host: url.parse(file_url).hostname, // eslint-disable-line node/no-deprecated-api
port: url.parse(file_url).port, // eslint-disable-line node/no-deprecated-api
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
method: "post",
headers: {
"Content-Type": "application/json",
@ -2273,7 +2266,7 @@ function getPostJSONBuffer(
req.abort();
});
});
req.on("error", function (err) {
req.on("error", function (err) { // eslint-disable-line node/handle-callback-err
if (typeof timeoutCallback != "undefined")
timeoutCallback(
file_url,

Wyświetl plik

@ -332,7 +332,6 @@ function addNewAlert() {
valid = ValidateCallsign(alertValueInput, null);
if (!valid) {
error = "Invalid Callsign";
} else {
}
}
}
@ -391,10 +390,11 @@ function resetAlert(key) {
}
function processAlertMessage(decodeWords, message, band, mode) {
if (Object.keys(g_alerts).length == 0)
if (Object.keys(g_alerts).length == 0) {
// no alerts, don't bother
return false;
}
else
{
var CQ = false;
var validQTH = false;
@ -439,7 +439,7 @@ function processAlertMessage(decodeWords, message, band, mode) {
msgDEcallsign = decodeWords[1];
}
var okayToAlert = true;
var okayToAlert = true;
if (msgDEcallsign + band + mode in g_liveCallsigns)
found_callsign = g_liveCallsigns[msgDEcallsign + band + mode];

Wyświetl plik

@ -142,7 +142,7 @@ function processLotwCallsigns(result, flag) {
//var result = String(buffer);
var lines = Array();
lines = result.split("\n");
delete result;
var lotwCallsigns = Object();
for (x in lines) {
var breakout = lines[x].split(",");
@ -160,7 +160,7 @@ function processLotwCallsigns(result, flag) {
lotwCallsigns[breakout[0]] = parseInt(dateTime.getTime() / 1000) / 86400;
}
}
delete lines;
g_callsignLookups.lotwLastUpdate = timeNowSec();
var now = timeNowSec();
@ -472,20 +472,20 @@ function getChunkedBuffer(
var options = null;
if (cookie != null) {
options = {
host: url.parse(file_url).host,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
followAllRedirects: true,
path: url.parse(file_url).path,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
headers: {
Cookie: cookie,
},
};
} else {
options = {
host: url.parse(file_url).host,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
followAllRedirects: true,
path: url.parse(file_url).path,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
};
}
http.get(options, function (res) {
@ -502,7 +502,7 @@ function getChunkedBuffer(
if (fileBuffer == null) {
fileBuffer = callback(data, flag, cookies, true, isEnd);
} else {
fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd);
fileBuffer = callback(fileBuffer + data, flag, cookies, false, isEnd); // eslint-disable-line node/no-callback-literal
}
})
.on("end", function () {})
@ -584,7 +584,6 @@ function processulsCallsigns(data, flag, cookies, starting, finished) {
}
}
}
delete lines;
lines = null;
});
}
@ -619,7 +618,7 @@ function processulsCallsigns(data, flag, cookies, starting, finished) {
});
}
return Buffer(returnBuffer);
return Buffer(returnBuffer); // eslint-disable-line node/no-deprecated-api
}
function lookupUsCallsign(object, writeState = false) {

Plik diff jest za duży Load Diff

Wyświetl plik

@ -87,16 +87,13 @@ function gtConnectChat() {
}
if (typeof jsmesg.type == "undefined") {
g_gtState = ChatState.error;
delete jsmesg;
return;
}
if (jsmesg.type in g_chatRecvFunctions) {
g_chatRecvFunctions[jsmesg.type](jsmesg);
delete jsmesg;
} else {
g_gtState = ChatState.error;
delete jsmesg;
return;
}
}
@ -132,7 +129,6 @@ function closeGtSocket() {
if (g_gtChatSocket.readyState != WebSocket.CLOSED) g_gtChatSocket.close();
if (g_gtChatSocket.readyState === WebSocket.CLOSED) {
delete g_gtChatSocket;
g_gtChatSocket = null;
g_gtState = ChatState.none;
}
@ -140,7 +136,6 @@ function closeGtSocket() {
}
function gtClosedSocket() {
delete g_gtChatSocket;
g_gtChatSocket = null;
g_gtState = ChatState.none;
}
@ -350,14 +345,14 @@ function makeGtPin(obj) {
function gtChatNewList(jsmesg) {
clearGtFlags();
for (cid in g_gtFlagPins) {
for (var cid in g_gtFlagPins) {
g_gtFlagPins[cid].live = false;
if (!(cid in g_gtMessages)) {
delete g_gtFlagPins[cid];
}
}
for (key in jsmesg.data.calls) {
for (var key in jsmesg.data.calls) {
var cid = jsmesg.data.cid[key];
var id = jsmesg.data.id[key];
if (id != myChatId) {
@ -417,7 +412,7 @@ function gtChatMessage(jsmesg) {
var cid = jsmesg.cid;
jsmesg.when = Date.now();
try {
jsmesg.msg = new Buffer.from(jsmesg.msg, "base64").toString("utf8");
jsmesg.msg = new Buffer.from(jsmesg.msg, "base64").toString("utf8"); // eslint-disable-line new-cap
jsmesg.msg = htmlEntities(jsmesg.msg);
} catch (e) {
jsmesg.msg = "Corrupt message recieved";
@ -446,7 +441,7 @@ function gtSendMessage(message, who) {
msg.type = "mesg";
msg.uuid = g_appSettings.chatUUID;
msg.cid = who;
msg.msg = new Buffer.from(message).toString("base64");
msg.msg = new Buffer.from(message).toString("base64"); // eslint-disable-line new-cap
sendGtJson(JSON.stringify(msg));
msg.msg = htmlEntities(message);
msg.id = 0;
@ -567,15 +562,13 @@ function newChatMessage(id, jsmesg) {
var g_lastChatMsgAlert = 0;
function alertChatMessage() {
{
if (g_msgSettings.msgAlertSelect == 1) {
// Text to speech
speakAlertString(g_msgSettings.msgAlertWord);
}
if (g_msgSettings.msgAlertSelect == 2) {
// Audible
playAlertMediaFile(g_msgSettings.msgAlertMedia);
}
g_lastChatMsgAlert = timeNowSec();
if (g_msgSettings.msgAlertSelect == 1) {
// Text to speech
speakAlertString(g_msgSettings.msgAlertWord);
}
if (g_msgSettings.msgAlertSelect == 2) {
// Audible
playAlertMediaFile(g_msgSettings.msgAlertMedia);
}
g_lastChatMsgAlert = timeNowSec();
}

Wyświetl plik

@ -438,7 +438,7 @@ function viewRoster() {
else allOnlyNewDiv.style.display = "none";
var now = timeNowSec();
for (callHash in callRoster) {
for (var callHash in callRoster) {
var call = callRoster[callHash].DEcall;
callRoster[callHash].tx = true;
@ -614,22 +614,21 @@ function viewRoster() {
continue;
}
{
var hash =
call +
hashMaker(
callRoster[callHash].callObj.band,
callRoster[callHash].callObj.mode
);
if (callMode == "worked" && hash in g_worked.call) {
callRoster[callHash].tx = false;
continue;
}
if (callMode == "confirmed" && hash in g_confirmed.call) {
callRoster[callHash].tx = false;
continue;
}
var hash =
call +
hashMaker(
callRoster[callHash].callObj.band,
callRoster[callHash].callObj.mode
);
if (callMode == "worked" && hash in g_worked.call) {
callRoster[callHash].tx = false;
continue;
}
if (callMode == "confirmed" && hash in g_confirmed.call) {
callRoster[callHash].tx = false;
continue;
}
if (g_rosterSettings.hunting == "grid") {
var hash =
callRoster[callHash].callObj.grid.substr(0, 4) +
@ -828,6 +827,7 @@ function viewRoster() {
if (g_rosterSettings.hunting == "usstate" && g_currentUSCallsigns) {
if (call in g_currentUSCallsigns) {
// Do Nothing
} else {
callRoster[callHash].tx = false;
continue;
@ -921,7 +921,7 @@ function viewRoster() {
var wpx = "#FFFF00";
hasGtPin = false;
shouldAlert = false;
var shouldAlert = false;
var callsignBg,
gridBg,
callingBg,
@ -2407,13 +2407,13 @@ function setVisual() {
// Award Hunter
if (referenceNeed.value == 6) {
/*for ( key in g_rosterSettings.wanted )
{
document.getElementById(key).checked = true;
var t = key.replace("hunt","");
if ( t in g_rosterSettings.columns )
g_rosterSettings.columns[t] = true;
}*/
/* for ( key in g_rosterSettings.wanted )
{
document.getElementById(key).checked = true;
var t = key.replace("hunt","");
if ( t in g_rosterSettings.columns )
g_rosterSettings.columns[t] = true;
} */
HuntingControls.style.display = "none";
CallsignsControls.style.display = "none";
@ -2421,7 +2421,7 @@ function setVisual() {
huntingMatrixDiv.style.display = "";
updateAwardList();
} else {
for (key in g_rosterSettings.wanted) {
for (var key in g_rosterSettings.wanted) {
if (document.getElementById(key))
document.getElementById(key).checked = g_rosterSettings.wanted[key];
}
@ -2615,18 +2615,18 @@ function getBuffer(file_url, callback, flag, mode, port, cookie) {
var options = null;
if (cookie != null) {
options = {
host: url.parse(file_url).host,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
path: url.parse(file_url).path,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
headers: {
Cookie: cookie,
},
};
} else {
options = {
host: url.parse(file_url).host,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
path: url.parse(file_url).path,
path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api
};
}
http.get(options, function (res) {
@ -2654,7 +2654,7 @@ function callsignResult(buffer, flag) {
r_currentUSState = flag;
g_currentUSCallsigns = Object();
for (key in rawData.c) g_currentUSCallsigns[rawData.c[key]] = true;
for (var key in rawData.c) g_currentUSCallsigns[rawData.c[key]] = true;
window.opener.goProcessRoster();
}
@ -2728,7 +2728,7 @@ function manifestResult(buffer, flag) {
r_callsignManifest = JSON.parse(buffer);
var newSelect = document.getElementById("stateSelect");
for (key in r_callsignManifest.cnt) {
for (var key in r_callsignManifest.cnt) {
var option = document.createElement("option");
if (window.opener.g_enums[key]) {
option.value = key;
@ -2808,78 +2808,74 @@ function openIgnoreEdit() {
editView.style.display = "inline-block";
var worker = "";
var clearString = "<th>none</th>";
{
if (Object.keys(g_blockedCalls).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllCallsignIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;padding:0px;vertical-align:top;display:inline-block;margin-right:2px;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>Callsigns</th>" +
clearString +
"</tr>";
Object.keys(g_blockedCalls)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:#FFFF00;' >" +
key +
"</td><td style='cursor:pointer;' onclick='deleteCallsignIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
}
{
clearString = "<th>none</th>";
if (Object.keys(g_blockedCQ).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllCQIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;padding:0px;vertical-align:top;display:inline-block;margin-right:2px;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>CQ</th>" +
clearString +
"</tr>";
Object.keys(g_blockedCQ)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:cyan;' >" +
key +
"</td><td style='cursor:pointer;' onclick='deleteCQIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
}
if (Object.keys(g_blockedCalls).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllCallsignIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;padding:0px;vertical-align:top;display:inline-block;margin-right:2px;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>Callsigns</th>" +
clearString +
"</tr>";
Object.keys(g_blockedCalls)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:#FFFF00;' >" +
key +
"</td><td style='cursor:pointer;' onclick='deleteCallsignIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
clearString = "<th>none</th>";
if (Object.keys(g_blockedCQ).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllCQIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;padding:0px;vertical-align:top;display:inline-block;margin-right:2px;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>CQ</th>" +
clearString +
"</tr>";
Object.keys(g_blockedCQ)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:cyan;' >" +
key +
"</td><td style='cursor:pointer;' onclick='deleteCQIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
clearString = "<th>none</th>";
if (Object.keys(g_blockedDxcc).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllDxccIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;vertical-align:top;display:inline-block;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>DXCCs</th>" +
clearString +
"</tr>";
Object.keys(g_blockedDxcc)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:#FFA500' >" +
window.opener.g_dxccToAltName[key] +
" (" +
window.opener.g_worldGeoData[window.opener.g_dxccToGeoData[key]].pp +
")</td><td style='cursor:pointer;' onclick='deleteDxccIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
{
clearString = "<th>none</th>";
if (Object.keys(g_blockedDxcc).length > 0)
clearString =
"<th style='cursor:pointer;' onclick='clearAllDxccIgnores()'>Clear All</th>";
worker +=
"<div style='margin:10px;vertical-align:top;display:inline-block;overflow:auto;overflow-x:hidden;height:" +
(window.innerHeight - 135) +
"px;'><table class='darkTable' align=center><tr><th align=left>DXCCs</th>" +
clearString +
"</tr>";
Object.keys(g_blockedDxcc)
.sort()
.forEach(function (key, i) {
worker +=
"<tr><td align=left style='color:#FFA500' >" +
window.opener.g_dxccToAltName[key] +
" (" +
window.opener.g_worldGeoData[window.opener.g_dxccToGeoData[key]].pp +
")</td><td style='cursor:pointer;' onclick='deleteDxccIgnore(\"" +
key +
"\")'><img src='/img/trash_24x48.png' style='height:17px;margin:-1px;margin-bottom:-3px;padding:0px'></td></tr>";
});
worker += "</table></div>";
}
editTables.innerHTML = worker;
}
@ -2929,7 +2925,7 @@ function init() {
window.opener.setRosterSpot(g_rosterSettings.columns.Spot);
for (key in g_rosterSettings.wanted) {
for (var key in g_rosterSettings.wanted) {
if (document.getElementById(key))
document.getElementById(key).checked = g_rosterSettings.wanted[key];
}
@ -3930,13 +3926,13 @@ function scoreAIOTA(award, obj) {
// NO IOTA YET
function testAIOTA(award, obj, baseHash) {
/*if ( obj.IOTA )
{
var test = g_awards[award.sponsor].awards[award.name];
{
var test = g_awards[award.sponsor].awards[award.name];
if ( "IOTA" in test.rule && test.rule.IOTA.indexOf(obj.IOTA) == -1 )
return false;
if ( "IOTA" in test.rule && test.rule.IOTA.indexOf(obj.IOTA) == -1 )
return false;
}*/
}*/
return false;
}
@ -4278,7 +4274,6 @@ function loadAwardJson() {
alert("Core awards.json : " + e);
g_awards = {};
}
delete filebuf;
} else alert("Missing core awards.json");
}
@ -4309,8 +4304,8 @@ function newAwardTrackerObject(sponsor, award, enable) {
newAward.enable = enable;
newAward.mode = g_awards[sponsor].awards[award].rule.mode[0];
newAward.band = g_awards[sponsor].awards[award].rule.band[0];
(newAward.count = g_awards[sponsor].awards[award].rule.count[0]),
(newAward.stat = {});
newAward.count = g_awards[sponsor].awards[award].rule.count[0];
newAward.stat = {};
newAward.comp = {};
newAward.test = {};
return newAward;
@ -4421,12 +4416,12 @@ function doubleCompile(award, firstLevel) {
}
}
/*for ( var mode in obj.modes )
{
if ( !(mode in firstLevel[k].modes) )
firstLevel[k].modes[mode] = 0;
if ( obj.modes[mode] > 0 )
firstLevel[k].modes[mode] += 1;
}*/
{
if ( !(mode in firstLevel[k].modes) )
firstLevel[k].modes[mode] = 0;
if ( obj.modes[mode] > 0 )
firstLevel[k].modes[mode] += 1;
}*/
delete firstLevel[k].unique;
firstLevel[k].unique = null;