Team-Gigabyte / quotobot

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
5 months ago3 years old
Variable 'leagueText' should be initialized on declaration
146    } else {
147        invText = "Available in the Discord developer portal";
148    }
149    let leagueText;150    if (leagueEnabled === false) leagueText = "🚫 League commands will not work"
151    else if (leagueEnabled) leagueText = "✅";
152    else leagueText = "💬 Still trying to start the League API";
Variable 'token' should be initialized on declaration
 25    configFile = { "help-domain": "quotobot.js.org" };
 26}
 27const authorPictures = require("./db/portraits.js");
 28let token; 29if (configFile.token == "your-token-here-inside-these-quotes") {
 30    token = envVars.QBTOKEN;
 31} else if (!configFile.token) { token = envVars.QBTOKEN; }
Variable 'configFile' should be initialized on declaration
 15const bot = new Discord.Client();
 16require("dotenv").config();
 17// config stuff
 18let configFile; 19try {
 20    configFile = require("./config.json");
 21} catch (e) {
Variable 'leagueEnabled' should be initialized on declaration
 41const helpDomain = envVars.QBSTATUS || configFile["help-domain"] || undefined;
 42let helpMessage;
 43// handle starting up the League API
 44let leagueEnabled; 45try {
 46    if (!envVars.QBRGKEY && !configFile.riotKey) {
 47        throw new Error("The Riot key is falsy (usually undefined). Did you put a key?")
Variable 'invText' should be initialized on declaration
140    db.each(randQuoteQuery).then(
141        ({ quote, source }) => console.log(chalk`{blueBright "${quote}" –${source}}`)
142    )
143    let invText;144    if (configFile.clientID) {
145        invText = `https://discordapp.com/oauth2/authorize?client_id=${configFile.clientID}&scope=bot&permissions=${configFile.permissionValue.toString() || "280576"}`;
146    } else {