cityssm / general-licence-manager

Initialization in variable declarations against recommended approach JS-0119
Anti-pattern
Minor
a month ago3 months old
Variable 'sql' should be initialized on declaration
 64    };
 65}
 66export default function getReportData(reportName, reportParameters = {}) {
 67    let sql; 68    let sqlParameters = [];
 69    const customReport = getCustomReport(reportName);
 70    if (customReport) {
Variable 'relatedLicence' should be initialized on declaration
12    return '';
13}
14export default function handler(request, response) {
15    let relatedLicence;16    if ((request.query.relatedLicenceId ?? '') !== '') {
17        relatedLicence = getLicence(request.query.relatedLicenceId);
18    }
Variable 'licenceCategoriesList' should be initialized on declaration
 2import database_getLicenceCategories from '../database/getLicenceCategories.js';
 3import database_getLicenceCategory from '../database/getLicenceCategory.js';
 4const debug = Debug('general-licence-manager:cache');
 5let licenceCategoriesList; 6const licenceCategoriesMap = new Map();
 7export function getLicenceCategories() {
 8    if (licenceCategoriesList === undefined) {
Variable '_a' should be initialized on declaration
 1;
 2(() => {
 3    function togglePanel(clickEvent) {
 4        var _a; 5        clickEvent.preventDefault();
 6        const panelBlockElements = (_a = clickEvent.currentTarget
 7            .closest('.panel')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.panel-block');
Variable '_d' should be initialized on declaration
 16      <em>Loading records...</em>
 17      </p>`;
 18        cityssm.postJSON(`${glm.urlPrefix}/licences/doSearch`, formElement, (rawResponseJSON) => {
 19            var _a, _b, _c, _d, _e, _f, _g, _h; 20            const licenceResults = rawResponseJSON;
 21            const licenceList = licenceResults.licences;
 22            if (licenceList.length === 0) {