refactor(lint): apply automatic eslint fixes

This commit is contained in:
Max Baumann
2020-12-12 22:57:41 +01:00
parent 105c148ccc
commit 36558f5460
16 changed files with 313 additions and 313 deletions

View File

@@ -5,13 +5,13 @@ import Config from "./config";
(<any> window).SB = Config;
import Utils from "./utils";
var utils = new Utils({
const utils = new Utils({
registerFirefoxContentScript,
unregisterFirefoxContentScript
});
// Used only on Firefox, which does not support non persistent background pages.
var contentScriptRegistrations = {};
const contentScriptRegistrations = {};
// Register content script if needed
if (utils.isFirefox()) {
@@ -91,7 +91,7 @@ chrome.runtime.onInstalled.addListener(function (object) {
* @param {JSON} options
*/
function registerFirefoxContentScript(options) {
let oldRegistration = contentScriptRegistrations[options.id];
const oldRegistration = contentScriptRegistrations[options.id];
if (oldRegistration) oldRegistration.unregister();
browser.contentScripts.register({
@@ -121,10 +121,10 @@ async function submitVote(type: number, UUID: string, category: string) {
Config.config.userID = userID;
}
let typeSection = (type !== undefined) ? "&type=" + type : "&category=" + category;
const typeSection = (type !== undefined) ? "&type=" + type : "&category=" + category;
//publish this vote
let response = await asyncRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + typeSection);
const response = await asyncRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + typeSection);
if (response.ok) {
return {
@@ -146,7 +146,7 @@ async function submitVote(type: number, UUID: string, category: string) {
}
async function asyncRequestToServer(type: string, address: string, data = {}) {
let serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress;
const serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress;
return await (sendRequestToCustomServer(type, serverAddress + address, data));
}
@@ -162,8 +162,8 @@ async function sendRequestToCustomServer(type: string, url: string, data = {}) {
// If GET, convert JSON to parameters
if (type.toLowerCase() === "get") {
for (const key in data) {
let seperator = url.includes("?") ? "&" : "?";
let value = (typeof(data[key]) === "string") ? data[key]: JSON.stringify(data[key]);
const seperator = url.includes("?") ? "&" : "?";
const value = (typeof(data[key]) === "string") ? data[key]: JSON.stringify(data[key]);
url += seperator + key + "=" + value;
}