From badab789b7e0ef2c0a09deb189317711c2cf2901 Mon Sep 17 00:00:00 2001 From: Akash Gundapuneni Date: Mon, 18 May 2026 15:41:17 +0200 Subject: [PATCH] Eslint erros and warnings --- frontend/eslint.config.js | 5 ++++ frontend/src/assets/assessmentScore.js | 27 +++++++---------- frontend/src/assets/utils.js | 2 +- frontend/src/auth/Register.vue | 5 +++- frontend/src/auth/ResetPassword.vue | 5 +++- frontend/src/auth/TwoFactorSettingsModal.vue | 2 +- frontend/src/auth/TwoFactorVerifyEmail.vue | 2 +- frontend/src/basic/Modal.vue | 26 ++++++++--------- frontend/src/basic/download/DownloadSet.vue | 2 +- .../src/basic/download/DownloadSingle.vue | 2 +- frontend/src/basic/editor/CommandEditor.vue | 2 +- frontend/src/basic/form/Collapsible.vue | 2 +- frontend/src/basic/form/File.vue | 2 +- frontend/src/basic/form/JsonTextarea.vue | 1 + frontend/src/basic/form/Select.vue | 2 +- .../src/basic/modal/ConfigurationModal.vue | 8 ++--- frontend/src/basic/modal/ConfirmModal.vue | 1 + .../src/basic/modal/GeneralSettingStep.vue | 2 +- frontend/src/basic/modal/InformationModal.vue | 2 +- frontend/src/basic/modal/PasswordModal.vue | 6 +++- frontend/src/basic/modal/PlaceholdersStep.vue | 1 + frontend/src/basic/modal/StepperModal.vue | 8 ++--- .../basic/modal/configuration/Placeholder.vue | 10 +++---- .../src/basic/modal/skills/InputGroup.vue | 2 +- .../src/components/annotator/Annotator.vue | 2 +- .../components/annotator/pdfViewer/Adder.vue | 3 +- .../components/common/FloatingInfoPanel.vue | 2 +- .../components/dashboard/SessionOverview.vue | 2 +- .../src/components/dashboard/Settings.vue | 2 +- .../src/components/dashboard/Workflows.vue | 2 +- .../dashboard/projects/ExportModal.vue | 6 ++-- .../settings/ChangeUserSettingsModal.vue | 2 +- .../dashboard/study/BulkAssignmentModal.vue | 8 ++--- .../dashboard/study/SingleAssignmentModal.vue | 1 + .../dashboard/submission/PublishModal.vue | 29 +++++++++---------- .../dashboard/templates/TemplateModal.vue | 1 - .../dashboard/workflows/WorkflowEditModal.vue | 4 +-- .../editor/template/TemplateEditor.vue | 3 +- .../src/components/stepmodal/StepModal.vue | 1 + .../stepmodal/placeholders/Comparison.vue | 2 +- .../stepmodal/placeholders/Text.vue | 2 +- frontend/src/components/study/Assessment.vue | 3 +- frontend/src/components/study/FinishModal.vue | 2 +- frontend/src/components/study/ReportItem.vue | 1 + frontend/src/components/study/ReportModal.vue | 21 +++++++------- frontend/src/components/study/StudyModal.vue | 1 + frontend/src/main.js | 4 +-- 47 files changed, 124 insertions(+), 107 deletions(-) diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index a7bd954ee..c25ee3472 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -18,6 +18,11 @@ export default [ ...pluginVue.configs['flat/recommended'], eslintConfigPrettier, { + languageOptions: { + globals: { + APP_VERSION: 'readonly', + }, + }, rules: { 'no-unused-vars': [ 'error', diff --git a/frontend/src/assets/assessmentScore.js b/frontend/src/assets/assessmentScore.js index 16f533426..0cef35242 100644 --- a/frontend/src/assets/assessmentScore.js +++ b/frontend/src/assets/assessmentScore.js @@ -119,26 +119,21 @@ export function calculateAssessmentScore(config, scores = {}) { rubric_max = Number(rubric_max) || 0; // 5. Compute rubric raw score according to calculation - let rubric_raw_score = 0; const sumCrit = crit_scores.reduce((acc, v) => acc + v, 0); - - if (!crit_scores.length) { - rubric_raw_score = 0; - } else if (calc === "sum") { - rubric_raw_score = sumCrit; - } else if (calc === "min") { - rubric_raw_score = Math.min(sumCrit, rubric_max); - } else if (calc === "max") { - const base = Number(rubric.defaultPoints) || 0; - let computed = base + sumCrit; - if (computed < 0) computed = 0; - rubric_raw_score = computed; - } else { + const rubric_raw_score = (() => { + if (!crit_scores.length) return 0; + if (calc === "sum") return sumCrit; + if (calc === "min") return Math.min(sumCrit, rubric_max); + if (calc === "max") { + const base = Number(rubric.defaultPoints) || 0; + const computed = base + sumCrit; + return computed < 0 ? 0 : computed; + } warnings.push( `Unknown calculation '${calc}' for rubric '${rubric_name}', falling back to 'sum'.` ); - rubric_raw_score = sumCrit; - } + return sumCrit; + })(); // 6. Clamp rubric score let rubric_score = rubric_raw_score; diff --git a/frontend/src/assets/utils.js b/frontend/src/assets/utils.js index 93e774009..fdaa99feb 100644 --- a/frontend/src/assets/utils.js +++ b/frontend/src/assets/utils.js @@ -1,4 +1,4 @@ -import { FileSaver } from "file-saver"; // DO NOT delete this import, required for window.saveAs to work +import "file-saver"; // DO NOT delete this import, required for window.saveAs to work import Papa from "papaparse"; import yaml from "js-yaml"; diff --git a/frontend/src/auth/Register.vue b/frontend/src/auth/Register.vue index 8b4e08f24..8d79eaee4 100644 --- a/frontend/src/auth/Register.vue +++ b/frontend/src/auth/Register.vue @@ -260,7 +260,10 @@ export default { const p = this.formData.password || ""; return p.length >= 8 && !/^\s*$/.test(p) - && !/[\x00-\x1F\x7F]/.test(p) + && ![...p].some((c) => { + const codePoint = c.codePointAt(0) || 0; + return codePoint <= 31 || codePoint === 127; + }) && ![...p].some((c) => (c.codePointAt(0) || 0) > 0xFFFF); }, validTerms() { diff --git a/frontend/src/auth/ResetPassword.vue b/frontend/src/auth/ResetPassword.vue index 638b4734b..a5a311e5e 100644 --- a/frontend/src/auth/ResetPassword.vue +++ b/frontend/src/auth/ResetPassword.vue @@ -123,7 +123,10 @@ export default { const p = this.formData.newPassword || ""; return p.length >= 8 && !/^\s*$/.test(p) - && !/[\x00-\x1F\x7F]/.test(p) + && ![...p].some((c) => { + const codePoint = c.codePointAt(0) || 0; + return codePoint <= 31 || codePoint === 127; + }) && ![...p].some((c) => (c.codePointAt(0) || 0) > 0xFFFF); }, validConfirmPassword() { diff --git a/frontend/src/auth/TwoFactorSettingsModal.vue b/frontend/src/auth/TwoFactorSettingsModal.vue index 15d13d303..febea7f31 100644 --- a/frontend/src/auth/TwoFactorSettingsModal.vue +++ b/frontend/src/auth/TwoFactorSettingsModal.vue @@ -558,7 +558,7 @@ export default { margin: 1, }); this.totpQrCodeError = false; - } catch (error) { + } catch (_error) { this.totpQrCode = null; this.totpQrCodeError = true; } diff --git a/frontend/src/auth/TwoFactorVerifyEmail.vue b/frontend/src/auth/TwoFactorVerifyEmail.vue index f16c526f8..2a011f941 100644 --- a/frontend/src/auth/TwoFactorVerifyEmail.vue +++ b/frontend/src/auth/TwoFactorVerifyEmail.vue @@ -294,7 +294,7 @@ export default { this.errorMessage = response.data.message || "Failed to resend code. Please try again."; } - } catch (error) { + } catch (_error) { this.showError = true; this.errorMessage = "Failed to resend code. Please try again."; } finally { diff --git a/frontend/src/basic/Modal.vue b/frontend/src/basic/Modal.vue index 408ddb28a..aa8fb2633 100644 --- a/frontend/src/basic/Modal.vue +++ b/frontend/src/basic/Modal.vue @@ -149,9 +149,9 @@ export default { progress: false, progressData: null, progressId: null, - _suspendedByChild: false, - _closeRequestHandled: false, - _hideWaiting: false, + suspendedByChild: false, + closeRequestHandled: false, + hideWaiting: false, isShown: false, }; }, @@ -234,8 +234,8 @@ export default { data: {name: this.name, props: this.props} }); } - if (this._hideWaiting) { - this._hideWaiting = false; + if (this.hideWaiting) { + this.hideWaiting = false; this.hide(); } }, @@ -252,16 +252,16 @@ export default { this.modal.show(); }, handleCloseClick() { - this._closeRequestHandled = false; + this.closeRequestHandled = false; this.$emit('close-requested'); this.$nextTick(() => { - if (!this._closeRequestHandled) { + if (!this.closeRequestHandled) { this.close(); } }); }, markCloseRequestHandled() { - this._closeRequestHandled = true; + this.closeRequestHandled = true; }, close() { this.hide(); @@ -270,7 +270,7 @@ export default { if (this.isShown) { this.modal.hide(); } else { - this._hideWaiting = true; + this.hideWaiting = true; } this.resumeParentModal(); }, @@ -285,20 +285,20 @@ export default { } }, suspendParentModal() { - if (!this.parentModal || this.parentModal._suspendedByChild) return; + if (!this.parentModal || this.parentModal.suspendedByChild) return; const el = this.parentModal.$refs && this.parentModal.$refs.Modal; if (el) { el.classList.add('nested-suspended'); } - this.parentModal._suspendedByChild = true; + this.parentModal.suspendedByChild = true; }, resumeParentModal() { - if (!this.parentModal || !this.parentModal._suspendedByChild) return; + if (!this.parentModal || !this.parentModal.suspendedByChild) return; const el = this.parentModal.$refs && this.parentModal.$refs.Modal; if (el) { el.classList.remove('nested-suspended'); } - this.parentModal._suspendedByChild = false; + this.parentModal.suspendedByChild = false; } } }; diff --git a/frontend/src/basic/download/DownloadSet.vue b/frontend/src/basic/download/DownloadSet.vue index a86e648c7..d2019aae0 100644 --- a/frontend/src/basic/download/DownloadSet.vue +++ b/frontend/src/basic/download/DownloadSet.vue @@ -1,5 +1,5 @@