Team-Gigabyte / quotobot

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