Manual cleanup of a few issues detected by eslint

Canadian-Provinces-Territories-Award-Layer
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,
host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api
port: port,
path: url.parse(file_url).path,
method: "get",
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;

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) {

Wyświetl plik

@ -288,7 +288,6 @@ function clearAndReload() {
chrome.runtime.reload();
}
{
win.hide();
win.on("close", function () {
@ -296,7 +295,6 @@ function clearAndReload() {
});
win.show();
win.setMinimumSize(200, 600);
}
var g_wsjtxProcessRunning = false;
var g_jtdxProcessRunning = false;
@ -1487,7 +1485,6 @@ function changePathWidth() {
if (qrzPathWidthValue.value == 0) {
g_layerSources["transmit"].clear();
delete g_transmitFlightPath;
g_transmitFlightPath = null;
} else {
featureStroke.setWidth(qrzPathWidthValue.value);
@ -2246,7 +2243,6 @@ function tempGridToBox(iQTH, oldGrid, borderColor, boxColor, layer) {
if (oldGrid) {
if (g_layerSources["temp"].hasFeature(oldGrid))
g_layerSources["temp"].removeFeature(oldGrid);
delete oldGrid;
}
var bounds = [
[LL.lo1, LL.la1],
@ -3137,8 +3133,6 @@ function mouseUpGrid() {
g_layerSources["temp"].removeFeature(g_tempGridBox);
}
delete g_tempGridBox;
g_tempGridBox = null;
}
@ -4536,7 +4530,6 @@ function setStrikeDistance() {
try {
g_strikeWebSocket.send(send);
} catch (e) {
delete g_strikeWebSocket;
g_strikeWebSocket = null;
}
} else {
@ -4642,17 +4635,14 @@ function loadStrikes() {
addLastTraffic(worker);
}
}
delete Strikes;
delete evt.data;
};
g_strikeWebSocket.onerror = function () {
delete g_strikeWebSocket;
g_strikeWebSocket = null;
};
g_strikeWebSocket.onclose = function () {
delete g_strikeWebSocket;
g_strikeWebSocket = null;
};
}
@ -4988,7 +4978,6 @@ function toggleNexrad() {
if (g_nexradEnable == 1) {
if (g_Nexrad != null) {
g_map.removeLayer(g_Nexrad);
delete g_Nexrad;
}
g_Nexrad = createNexRad();
@ -5003,7 +4992,6 @@ function toggleNexrad() {
}
if (g_Nexrad) {
g_map.removeLayer(g_Nexrad);
delete g_Nexrad;
g_Nexrad = null;
}
}
@ -5842,8 +5830,6 @@ function fitViewBetweenPoints(points, maxZoom = 20) {
padding: [75, 75, 75, 75],
});
delete feature;
delete line;
}
var g_spotCollector = {};
@ -6293,7 +6279,6 @@ function handleWsjtxDecode(newMessage) {
if (dxcc != -1) {
locality = g_worldGeoData[g_dxccToGeoData[dxcc]].geo;
if (locality == "deleted") locality = null;
} else {
}
}
@ -6827,8 +6812,8 @@ function myDxccCompare(a, b) {
}
function myDxccIntCompare(a, b) {
if (!a in g_dxccToAltName) return 0;
if (!b in g_dxccToAltName)
if (!(a in g_dxccToAltName)) return 0;
if (!(b in g_dxccToAltName))
return g_dxccToAltName[a].localeCompare(g_dxccToAltName[b]);
}
@ -7059,7 +7044,7 @@ function showWorkedBox(sortIndex, nextPage, redraw) {
var startIndex = g_qsoPage * g_qsoItemsPerPage;
var endIndex = startIndex + g_qsoItemsPerPage;
if (endIndex > ObjectCount) endIndex = ObjectCount;
{
var workHead = "<b> Entries (" + ObjectCount + ")</b>";
if (g_qsoPages > 1) {
@ -7305,7 +7290,7 @@ function showWorkedBox(sortIndex, nextPage, redraw) {
setStatsDivHeight("workedListDiv", getStatsWindowHeight() - 6 + "px");
} else setStatsDiv("workedListDiv", "None");
}
myObjects = null;
} catch (e) {
console.log(e);
@ -7360,7 +7345,6 @@ function statsAppendChild(elementString, object, onInputString, defaultValue) {
}
}
function showDXCCsBox() {
{
var worker = getCurrentBandModeHTML();
var confirmed = 0;
var worked = 0;
@ -7485,7 +7469,6 @@ function showDXCCsBox() {
}
setStatsDiv("dxccListDiv", worker);
}
}
function showCQzoneBox() {
var worker = getCurrentBandModeHTML();
@ -7682,13 +7665,11 @@ function showRootInfoBox() {
}
function showSettingsBox() {
{
updateRunningProcesses();
helpDiv.style.display = "none";
g_helpShow = false;
rootSettingsDiv.style.display = "inline-block";
}
}
function toggleBaWindow(event) {
event.preventDefault();
@ -9524,7 +9505,6 @@ function renderBandActivity() {
var blockMyBand = "";
if (band == myBand) blockMyBand = " class='myBand' ";
{
var title =
"Score: " +
bandData[band].score +
@ -9554,7 +9534,6 @@ function renderBandActivity() {
"</div>";
buffer += "</div>";
}
}
} else {
buffer = "..no data yet..";
}
@ -10313,7 +10292,6 @@ function loadMaidenHeadData() {
var dxcc = dxccGeo.features[key].properties.dxcc_entity_code;
g_worldGeoData[g_dxccToGeoData[dxcc]].geo = dxccGeo.features[key];
}
delete dxccGeo;
file = "./data/counties.json";
files = fs.readFileSync(file);
var countyData = JSON.parse(files);
@ -10560,8 +10538,6 @@ function loadMaidenHeadData() {
g_wacZones[name].confirmed_modes = {};
}
}
delete fileBuf;
}
}
@ -10594,7 +10570,6 @@ function toggleTimezones() {
} else {
if (g_timezoneLayer != null) {
g_map.removeLayer(g_timezoneLayer);
delete g_timezoneLayer;
g_timezoneLayer = null;
}
}
@ -10806,10 +10781,10 @@ function getBuffer(file_url, callback, flag, mode, port, cache = null) {
var options = 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
};
http.get(options, function (res) {
@ -10851,9 +10826,9 @@ function getPostBuffer(
var http = require(mode);
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",
@ -10889,7 +10864,7 @@ function getPostBuffer(
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,
@ -11863,7 +11838,8 @@ function updateWsjtxListener(port) {
g_wsjtUdpSocketError = true;
});
g_wsjtUdpServer.on("message", function (message, remote) {
if (g_closing == true) true;
// if (g_closing == true) true;
if (
typeof udpForwardEnable != "undefined" &&
udpForwardEnable.checked == true
@ -12261,7 +12237,7 @@ function continueWithLookup(callsign, gridPass) {
}
function callookResults(buffer, gridPass) {
var results = JSON.parse(buffer);
if (typeof results.status != undefined) {
if (typeof results.status != "undefined") {
if (results.status == "VALID") {
var callObject = {};
var dxcc = callsignToDxcc(results.current.callsign);
@ -13200,7 +13176,6 @@ function searchLogForCallsign(call) {
setLookupDiv("lookupLocalDiv", worker);
}
delete list;
list = null;
}
@ -13379,7 +13354,6 @@ function mediaCheck() {
clearLogFilesAndCounts();
}
delete data;
fs.unlinkSync(g_NWappData + "internal_qso.json");
}
loadReceptionReports();

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,7 +562,6 @@ function newChatMessage(id, jsmesg) {
var g_lastChatMsgAlert = 0;
function alertChatMessage() {
{
if (g_msgSettings.msgAlertSelect == 1) {
// Text to speech
speakAlertString(g_msgSettings.msgAlertWord);
@ -578,4 +572,3 @@ function alertChatMessage() {
}
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,7 +614,6 @@ function viewRoster() {
continue;
}
{
var hash =
call +
hashMaker(
@ -629,7 +628,7 @@ function viewRoster() {
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,
@ -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,7 +2808,7 @@ 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>";
@ -2829,9 +2829,7 @@ function openIgnoreEdit() {
"\")'><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 =
@ -2853,9 +2851,7 @@ function openIgnoreEdit() {
"\")'><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 =
@ -2879,7 +2875,7 @@ function openIgnoreEdit() {
"\")'><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];
}
@ -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;