use template literals

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-27 10:49:51 -04:00
parent ce4c00de2c
commit 610bc7eaf5
3 changed files with 73 additions and 71 deletions

View File

@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let svgElementToHighlight; let svgElementToHighlight;
// eslint-disable-next-line no-constant-condition // eslint-disable-next-line no-constant-condition
while (true) { while (true) {
svgElementToHighlight = mapContainerElement.querySelector('#' + svgId); svgElementToHighlight = mapContainerElement.querySelector(`#${svgId}`);
if (svgElementToHighlight !== null || !svgId.includes('-')) { if (svgElementToHighlight !== null || !svgId.includes('-')) {
break; break;
} }
@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (svgElementToHighlight !== null) { if (svgElementToHighlight !== null) {
// eslint-disable-next-line unicorn/no-null // eslint-disable-next-line unicorn/no-null
svgElementToHighlight.style.fill = ''; svgElementToHighlight.style.fill = '';
svgElementToHighlight.classList.add('highlight', 'is-' + contextualClass); svgElementToHighlight.classList.add('highlight', `is-${contextualClass}`);
const childPathElements = svgElementToHighlight.querySelectorAll('path'); const childPathElements = svgElementToHighlight.querySelectorAll('path');
for (const pathElement of childPathElements) { for (const pathElement of childPathElements) {
// eslint-disable-next-line unicorn/no-null // eslint-disable-next-line unicorn/no-null
@ -134,7 +134,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
} }
// Apply a label // Apply a label
const labelElement = document.querySelector("label[for='" + dateElement.id + "']"); const labelElement = document.querySelector(`label[for='${dateElement.id}']`);
if (labelElement !== null) { if (labelElement !== null) {
(_b = datepickerElement (_b = datepickerElement
.querySelector('.datetimepicker-dummy-input')) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-label', (_c = labelElement.textContent) !== null && _c !== void 0 ? _c : ''); .querySelector('.datetimepicker-dummy-input')) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-label', (_c = labelElement.textContent) !== null && _c !== void 0 ? _c : '');
@ -262,35 +262,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
</p>`; </p>`;
} }
function getSearchResultsPagerHTML(limit, offset, count) { function getSearchResultsPagerHTML(limit, offset, count) {
return ('<div class="level">' + return `<div class="level">
('<div class="level-left">' + <div class="level-left">
'<div class="level-item has-text-weight-bold">' + <div class="level-item has-text-weight-bold">
'Displaying ' + Displaying
(offset + 1).toString() + ${(offset + 1).toString()}
' to ' + to
Math.min(count, limit + offset).toString() + ${Math.min(count, limit + offset).toString()}
' of ' + of
count.toString() + ${count.toString()}
'</div>' + </div>
'</div>') + </div>
('<div class="level-right">' + <div class="level-right">
(offset > 0 ${offset > 0
? `<div class="level-item"> ? `<div class="level-item">
<button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous"> <button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">
<i class="fas fa-arrow-left" aria-hidden="true"></i> <i class="fas fa-arrow-left" aria-hidden="true"></i>
</button> </button>
</div>` </div>`
: '') + : ''}
(limit + offset < count ${limit + offset < count
? `<div class="level-item"> ? `<div class="level-item">
<button class="button is-rounded is-link" data-page="next" type="button" title="Next"> <button class="button is-rounded is-link" data-page="next" type="button" title="Next">
<span>Next</span> <span>Next</span>
<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span> <span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
</button> </button>
</div>` </div>`
: '') + : ''}
'</div>') + </div>
'</div>'); </div>`;
} }
/* /*
* URLs * URLs
@ -300,9 +300,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
return (urlPrefix + return (urlPrefix +
'/' + '/' +
recordTypePlural + recordTypePlural +
(recordId ? '/' + recordId.toString() : '') + (recordId ? `/${recordId.toString()}` : '') +
(recordId && edit ? '/edit' : '') + (recordId && edit ? '/edit' : '') +
(time ? '/?t=' + Date.now().toString() : '')); (time ? `/?t=${Date.now().toString()}` : ''));
} }
function getMapURL(mapId = '', edit = false, time = false) { function getMapURL(mapId = '', edit = false, time = false) {
return getRecordURL('maps', mapId, edit, time); return getRecordURL('maps', mapId, edit, time);

View File

@ -69,7 +69,7 @@ declare const exports: Record<string, unknown> & {
// eslint-disable-next-line no-constant-condition // eslint-disable-next-line no-constant-condition
while (true) { while (true) {
svgElementToHighlight = mapContainerElement.querySelector('#' + svgId) svgElementToHighlight = mapContainerElement.querySelector(`#${svgId}`)
if (svgElementToHighlight !== null || !svgId.includes('-')) { if (svgElementToHighlight !== null || !svgId.includes('-')) {
break break
@ -82,7 +82,7 @@ declare const exports: Record<string, unknown> & {
// eslint-disable-next-line unicorn/no-null // eslint-disable-next-line unicorn/no-null
svgElementToHighlight.style.fill = '' svgElementToHighlight.style.fill = ''
svgElementToHighlight.classList.add('highlight', 'is-' + contextualClass) svgElementToHighlight.classList.add('highlight', `is-${contextualClass}`)
const childPathElements = svgElementToHighlight.querySelectorAll('path') const childPathElements = svgElementToHighlight.querySelectorAll('path')
for (const pathElement of childPathElements) { for (const pathElement of childPathElements) {
@ -215,7 +215,7 @@ declare const exports: Record<string, unknown> & {
// Apply a label // Apply a label
const labelElement = document.querySelector( const labelElement = document.querySelector(
"label[for='" + dateElement.id + "']" `label[for='${dateElement.id}']`
) )
if (labelElement !== null) { if (labelElement !== null) {
@ -392,37 +392,39 @@ declare const exports: Record<string, unknown> & {
offset: number, offset: number,
count: number count: number
): string { ): string {
return ( return `<div class="level">
'<div class="level">' + <div class="level-left">
('<div class="level-left">' + <div class="level-item has-text-weight-bold">
'<div class="level-item has-text-weight-bold">' + Displaying
'Displaying ' + ${(offset + 1).toString()}
(offset + 1).toString() + to
' to ' + ${Math.min(count, limit + offset).toString()}
Math.min(count, limit + offset).toString() + of
' of ' + ${count.toString()}
count.toString() + </div>
'</div>' + </div>
'</div>') + <div class="level-right">
('<div class="level-right">' + ${
(offset > 0 offset > 0
? `<div class="level-item"> ? `<div class="level-item">
<button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous"> <button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous">
<i class="fas fa-arrow-left" aria-hidden="true"></i> <i class="fas fa-arrow-left" aria-hidden="true"></i>
</button> </button>
</div>` </div>`
: '') + : ''
(limit + offset < count }
? `<div class="level-item"> ${
<button class="button is-rounded is-link" data-page="next" type="button" title="Next"> limit + offset < count
<span>Next</span> ? `<div class="level-item">
<span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span> <button class="button is-rounded is-link" data-page="next" type="button" title="Next">
</button> <span>Next</span>
</div>` <span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span>
: '') + </button>
'</div>') + </div>`
'</div>' : ''
) }
</div>
</div>`
} }
/* /*
@ -441,9 +443,9 @@ declare const exports: Record<string, unknown> & {
urlPrefix + urlPrefix +
'/' + '/' +
recordTypePlural + recordTypePlural +
(recordId ? '/' + recordId.toString() : '') + (recordId ? `/${recordId.toString()}` : '') +
(recordId && edit ? '/edit' : '') + (recordId && edit ? '/edit' : '') +
(time ? '/?t=' + Date.now().toString() : '') (time ? `/?t=${Date.now().toString()}` : '')
) )
} }

File diff suppressed because one or more lines are too long