From cc5ba8ff79213b9c373b574a24b90e186bdf48f6 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 21 Apr 2022 16:31:51 +0200 Subject: [PATCH] chore: eslint --- frontend/src/lib/event-manager/event-manager.js | 4 ++-- .../src/lib/storage-manager/storage-manager.js | 2 +- frontend/src/utils/alerts/alerts.js | 2 +- frontend/src/utils/async-form/async-form.js | 6 +++--- frontend/src/utils/async-table/async-table.js | 6 +++--- frontend/src/utils/check-all/check-all.js | 4 ++-- frontend/src/utils/course-teaser/course-teaser.js | 2 +- frontend/src/utils/exam-correct/exam-correct.js | 14 +++++++------- frontend/src/utils/form/auto-submit-input.js | 2 +- frontend/src/utils/inputs/checkrange.js | 2 +- frontend/src/utils/mass-input/mass-input.js | 2 +- frontend/src/utils/modal/modal.js | 12 ++++++------ 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/frontend/src/lib/event-manager/event-manager.js b/frontend/src/lib/event-manager/event-manager.js index a69965a6f..7b464c176 100644 --- a/frontend/src/lib/event-manager/event-manager.js +++ b/frontend/src/lib/event-manager/event-manager.js @@ -43,7 +43,7 @@ export class EventManager { } removeAllEventListenersFromUtil() { - this._debugLog('removeAllEventListenersFromUtil',); + this._debugLog('removeAllEventListenersFromUtil'); for (let eventWrapper of this._registeredListeners) { let element = eventWrapper.element; element.removeEventListener(eventWrapper.eventType, eventWrapper.eventHandler); @@ -73,7 +73,7 @@ export class EventWrapper { _eventType; _eventHandler; _element; - _options + _options; constructor(_eventType, _eventHandler, _element, _options) { if(!_eventType || !_eventHandler || !_element) { diff --git a/frontend/src/lib/storage-manager/storage-manager.js b/frontend/src/lib/storage-manager/storage-manager.js index d9ef366ec..75cb54fe9 100644 --- a/frontend/src/lib/storage-manager/storage-manager.js +++ b/frontend/src/lib/storage-manager/storage-manager.js @@ -469,7 +469,7 @@ export class StorageManager { }, body: JSON.stringify(requestBody), }).then( - (response) => response.json() + (response) => response.json(), ).then((response) => { console.log('storage-manager got key from response:', response, 'with options:', options); if (response.salt !== requestBody.salt || response.timestamp !== requestBody.timestamp) { diff --git a/frontend/src/utils/alerts/alerts.js b/frontend/src/utils/alerts/alerts.js index a88fd1f19..0131a6e41 100644 --- a/frontend/src/utils/alerts/alerts.js +++ b/frontend/src/utils/alerts/alerts.js @@ -165,7 +165,7 @@ export class Alerts { this._elevateAlerts(); } - } + }; _createAlertElement(type, content, icon = 'info-circle') { const alertElement = document.createElement('div'); diff --git a/frontend/src/utils/async-form/async-form.js b/frontend/src/utils/async-form/async-form.js index 482cdb634..d226a546b 100644 --- a/frontend/src/utils/async-form/async-form.js +++ b/frontend/src/utils/async-form/async-form.js @@ -95,13 +95,13 @@ export class AsyncForm { headers: headers, body: body, }).then( - (response) => response.json() + (response) => response.json(), ).then( - (response) => this._processResponse(response[0]) + (response) => this._processResponse(response[0]), ).catch(() => { const failureMessage = this._app.i18n.get('asyncFormFailure'); this._processResponse({ content: failureMessage }); this._element.classList.remove(ASYNC_FORM_LOADING_CLASS); }); - } + }; } diff --git a/frontend/src/utils/async-table/async-table.js b/frontend/src/utils/async-table/async-table.js index 1734de1b1..a8b85e19f 100644 --- a/frontend/src/utils/async-table/async-table.js +++ b/frontend/src/utils/async-table/async-table.js @@ -383,7 +383,7 @@ export class AsyncTable { url = window.location.origin + window.location.pathname + url; } this._updateTableFrom(url); - } + }; _getClickDestination(el) { if (!el.matches('a') && !el.querySelector('a')) { @@ -407,7 +407,7 @@ export class AsyncTable { } this._updateTableFrom(url.href); - } + }; // fetches new sorted element from url with params and replaces contents of current element _updateTableFrom(url, callback, isPopState) { @@ -458,7 +458,7 @@ export class AsyncTable { callback(this._element); this._windowStorage.remove('cssIdPrefix'); } - }).catch((err) => console.error(err) + }).catch((err) => console.error(err), ).finally(() => this._element.classList.remove(ASYNC_TABLE_LOADING_CLASS)); } diff --git a/frontend/src/utils/check-all/check-all.js b/frontend/src/utils/check-all/check-all.js index 83c3a5070..35695d6f3 100644 --- a/frontend/src/utils/check-all/check-all.js +++ b/frontend/src/utils/check-all/check-all.js @@ -102,7 +102,7 @@ class CheckAllColumn { _table; _column; - _eventManager + _eventManager; _checkAllCheckbox; _checkboxId = 'check-all-checkbox-' + Math.floor(Math.random() * 100000); @@ -146,7 +146,7 @@ class CheckAllColumn { _updateCheckAllCheckboxState() { const allChecked = this._column.every(cell => - cell.tagName == 'TH' || cell.querySelector(CHECKBOX_SELECTOR).checked + cell.tagName == 'TH' || cell.querySelector(CHECKBOX_SELECTOR).checked, ); this._checkAllCheckbox.checked = allChecked; } diff --git a/frontend/src/utils/course-teaser/course-teaser.js b/frontend/src/utils/course-teaser/course-teaser.js index 31d8cf225..717435d43 100644 --- a/frontend/src/utils/course-teaser/course-teaser.js +++ b/frontend/src/utils/course-teaser/course-teaser.js @@ -13,7 +13,7 @@ const COURSE_TEASER_CHEVRON_CLASS = 'course-teaser__chevron'; export class CourseTeaser { _element; - _eventManager + _eventManager; constructor(element) { if (!element) { diff --git a/frontend/src/utils/exam-correct/exam-correct.js b/frontend/src/utils/exam-correct/exam-correct.js index f078f9825..e99e2a83c 100644 --- a/frontend/src/utils/exam-correct/exam-correct.js +++ b/frontend/src/utils/exam-correct/exam-correct.js @@ -133,7 +133,7 @@ export class ExamCorrect { this._cIndices = new Map( [...this._element.querySelectorAll('[uw-exam-correct-header]')] - .map((header) => [header.getAttribute('uw-exam-correct-header'), header.cellIndex]) + .map((header) => [header.getAttribute('uw-exam-correct-header'), header.cellIndex]), ); if (this._resultSelect && this._resultGradeSelect) { @@ -220,9 +220,9 @@ export class ExamCorrect { headers: EXAM_CORRECT_HEADERS, body: JSON.stringify(body), }).then( - (response) => response.json() + (response) => response.json(), ).then( - (response) => this._processResponse(body, response, body.user) + (response) => this._processResponse(body, response, body.user), ).catch((error) => { console.error('Error while validating user input', error); }); @@ -312,9 +312,9 @@ export class ExamCorrect { headers: EXAM_CORRECT_HEADERS, body: JSON.stringify(body), }).then( - (response) => response.json() + (response) => response.json(), ).then( - (response) => this._processResponse(body, response, user, undefined, { results: results, result: result }) + (response) => this._processResponse(body, response, user, undefined, { results: results, result: result }), ).catch((error) => { console.error('Error while processing response', error); }); @@ -553,8 +553,8 @@ export class ExamCorrect { headers: EXAM_CORRECT_HEADERS, body: JSON.stringify(body), }).then( - (response) => response.json() - ).then((response) => this._processResponse(body, response, userElem.getAttribute(EXAM_CORRECT_USER_ATTR), row, { results: results.partResults, result: results.result }) + (response) => response.json(), + ).then((response) => this._processResponse(body, response, userElem.getAttribute(EXAM_CORRECT_USER_ATTR), row, { results: results.partResults, result: results.result }), ).catch(console.error); } diff --git a/frontend/src/utils/form/auto-submit-input.js b/frontend/src/utils/form/auto-submit-input.js index 291a1d3aa..4d031f854 100644 --- a/frontend/src/utils/form/auto-submit-input.js +++ b/frontend/src/utils/form/auto-submit-input.js @@ -50,7 +50,7 @@ export class AutoSubmitInput { this._element.classList.remove(AUTO_SUBMIT_INPUT_INITIALIZED_CLASS); } - autoSubmit = () => { + autoSubmit() { this._form.submit(); } } diff --git a/frontend/src/utils/inputs/checkrange.js b/frontend/src/utils/inputs/checkrange.js index ee6441b95..1957c0fee 100644 --- a/frontend/src/utils/inputs/checkrange.js +++ b/frontend/src/utils/inputs/checkrange.js @@ -14,7 +14,7 @@ const CHECKBOX_SELECTOR = '[type="checkbox"]'; export class CheckRange { _lastCheckedCell = null; _element; - _tableIndices + _tableIndices; _columns = new Array(); constructor(element) { diff --git a/frontend/src/utils/mass-input/mass-input.js b/frontend/src/utils/mass-input/mass-input.js index 4969e8c14..95089161d 100644 --- a/frontend/src/utils/mass-input/mass-input.js +++ b/frontend/src/utils/mass-input/mass-input.js @@ -206,7 +206,7 @@ export class MassInput { if (this._massInputFormSubmitHandler) { return this._massInputFormSubmitHandler(event); } - } + }; _getMassInputSubmitButtons() { return Array.from(this._element.querySelectorAll('button[type="submit"][name][value], .' + MASS_INPUT_SUBMIT_BUTTON_CLASS)); diff --git a/frontend/src/utils/modal/modal.js b/frontend/src/utils/modal/modal.js index 6b8e28a17..2dc74e8fe 100644 --- a/frontend/src/utils/modal/modal.js +++ b/frontend/src/utils/modal/modal.js @@ -29,7 +29,7 @@ const MODALS_WRAPPER_OPEN_CLASS = 'modals-wrapper--open'; }) export class Modal { - _eventManager + _eventManager; _element; _app; @@ -123,18 +123,18 @@ export class Modal { _onTriggerClicked = (event) => { event.preventDefault(); this._open(); - } + }; _onCloseClicked = (event) => { event.preventDefault(); this._close(); - } + }; _onKeyUp = (event) => { if (event.key === 'Escape') { this._close(); } - } + }; _open() { this._element.classList.add(MODAL_OPEN_CLASS); @@ -162,9 +162,9 @@ export class Modal { url: url, headers: MODAL_HEADERS, }).then( - (response) => this._app.htmlHelpers.parseResponse(response) + (response) => this._app.htmlHelpers.parseResponse(response), ).then( - (response) => this._processResponse(response.element) + (response) => this._processResponse(response.element), ); }