From 9973da52a6bc0f2b0fc40fe6b47bcc6042cb916c Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 8 May 2023 21:31:47 +0100 Subject: [PATCH] Lint JS --- js/auth.js | 1 + js/find-code.js | 23 ++++++++++++----------- js/index.js | 1 + js/issue.js | 1 + js/lib.main.js | 6 ++++-- js/pis.js | 1 + js/settings.js | 1 + js/simple-board.js | 5 +++-- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/js/auth.js b/js/auth.js index b2ac26a..880949a 100644 --- a/js/auth.js +++ b/js/auth.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ /* Auth process: User Requests Key => Server emails key to user => user opens link to auth.html => diff --git a/js/find-code.js b/js/find-code.js index 6c12395..a2625aa 100644 --- a/js/find-code.js +++ b/js/find-code.js @@ -1,14 +1,15 @@ hideLoading() +// eslint-disable-next-line no-unused-vars async function fetchEntry(){ // This can be condensed showLoading() - var name = document.getElementById('name') - var crs = document.getElementById('3alpha') - var nlc = document.getElementById('nlc') - var tiploc = document.getElementById('tiploc') - var stanox = document.getElementById('stanox') + let name = document.getElementById('name') + let crs = document.getElementById('3alpha') + let nlc = document.getElementById('nlc') + let tiploc = document.getElementById('tiploc') + let stanox = document.getElementById('stanox') - var values = { + let values = { name: name.value, crs: crs.value, nlc: nlc.value, @@ -71,19 +72,19 @@ async function displayData(data){ vibe('ok') try { document.getElementById('name').value = data['0']['NLCDESC'] - } catch (err) {} + } catch (err) {log(err)} try { document.getElementById('3alpha').value = data['0']['3ALPHA'] - } catch (err) {} + } catch (err) {log(err)} try { document.getElementById('nlc').value = data['0']['NLC'] - } catch (err) {} + } catch (err) {log(err)} try { document.getElementById('tiploc').value = data['0']['TIPLOC'] - } catch (err) {} + } catch (err) {log(err)} try { document.getElementById('stanox').value = data['0']['STANOX'] - } catch (err) {} + } catch (err) {log(err)} } } diff --git a/js/index.js b/js/index.js index cea6830..98e1be3 100644 --- a/js/index.js +++ b/js/index.js @@ -11,6 +11,7 @@ async function pageInit() { hideLoading() // From lib.main } +// eslint-disable-next-line no-unused-vars async function gotoBoard(station){ vibe('ok') window.location.assign(`${window.location.origin}/board.html?stn=${station}`) diff --git a/js/issue.js b/js/issue.js index e8330c5..5d6e217 100644 --- a/js/issue.js +++ b/js/issue.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ init() async function init() { diff --git a/js/lib.main.js b/js/lib.main.js index 846e9aa..4b6a8c0 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ /* All Page Init */ const version = '2.0.2' @@ -130,9 +131,10 @@ async function getApi(path,auth = false) { let apiVer = 'v1' let url = `${window.location.origin}/api/${apiVer}/${path}` log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) + let options if (auth) { let key = localStorage.getItem('uuid') - var options = { + options = { method: 'GET', redirect: 'follow', headers: { @@ -140,7 +142,7 @@ async function getApi(path,auth = false) { } } } else { - var options = { + options = { method: 'GET', redirect: 'follow' } diff --git a/js/pis.js b/js/pis.js index f0c3ba5..aab2701 100644 --- a/js/pis.js +++ b/js/pis.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ hideLoading() versionDisplay() showHideAuthNotice() diff --git a/js/settings.js b/js/settings.js index ae158c8..e7fec42 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ // // Init: // diff --git a/js/simple-board.js b/js/simple-board.js index 0fcc622..89866a9 100644 --- a/js/simple-board.js +++ b/js/simple-board.js @@ -15,12 +15,13 @@ async function init() { // Gets query string and then fetch API response and pas log('init: Staff Version not supported yet.') log('init: Unable to proceed.') } else { + let data try { - var data = await publicLdb(stn) + data = await publicLdb(stn) setLoadingDesc(`${stn.toUpperCase()}\nParsing Data`) log('simple-board.init: Fetched LDB Data', 'INFO') } catch (err) { - var data = 'err' + data = 'err' setLoadingDesc('Waiting\nConnection') log(`simple-board.init: Error fetching data: ${err}`, 'ERR') }