diff --git a/eslint.config.mjs b/eslint.config.mjs index d889345662..729daef21e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,7 @@ -import eslint from "@eslint/js"; +import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; import pluginPromise from 'eslint-plugin-promise' +import globals from 'globals'; const config = tseslint.config( { @@ -10,6 +11,10 @@ const config = tseslint.config( projectService: true, tsconfigRootDir: import.meta.dirname, }, + globals: { + ...globals.browser, + ...globals.jquery, + }, }, extends: [ eslint.configs.recommended, @@ -19,6 +24,7 @@ const config = tseslint.config( rules: { 'no-console': 'off', 'no-debugger': 'off', + '@typescript-eslint/no-deprecated': 'warn', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-inferrable-types': 'off', '@typescript-eslint/no-this-alias': 'off', diff --git a/web/typescript/backend/AdminIndex.ts b/web/typescript/backend/AdminIndex.ts index 615900745d..6bf18cffc6 100644 --- a/web/typescript/backend/AdminIndex.ts +++ b/web/typescript/backend/AdminIndex.ts @@ -8,14 +8,14 @@ class AdminIndex { private initDelSite() { let $delForm = $(".delSiteCaller"); - $delForm.find("button").click(function (ev) { + $delForm.find("button").on("click", function (ev) { ev.preventDefault(); let $button = $(this); bootbox.confirm(__t('admin', 'consDeleteConfirm'), function (result) { if (result) { let $input = $('').attr("name", $button.attr("name")).attr("value", $button.attr("value")); $delForm.append($input); - $delForm.submit(); + $delForm.trigger("submit"); } }); }); diff --git a/web/typescript/backend/MemberPetitionRespond.ts b/web/typescript/backend/MemberPetitionRespond.ts index ae2ae97fb3..d7d343efd3 100644 --- a/web/typescript/backend/MemberPetitionRespond.ts +++ b/web/typescript/backend/MemberPetitionRespond.ts @@ -12,7 +12,7 @@ export class MemberPetitionRespond { ckeditor = new AntragsgruenEditor($textarea.attr("id")), editor = ckeditor.getEditor(); - $textarea.parents("form").submit(() => { + $textarea.parents("form").on("submit", () => { $textarea.parent().find("textarea").val(editor.getData()); }); }); diff --git a/web/typescript/backend/ProposedProcedureExport.ts b/web/typescript/backend/ProposedProcedureExport.ts index 7e73baa6ee..c0278e82ab 100644 --- a/web/typescript/backend/ProposedProcedureExport.ts +++ b/web/typescript/backend/ProposedProcedureExport.ts @@ -18,6 +18,6 @@ export class ProposedProcedureExport { this.$widget.find("li.checkbox").on("click", function (ev) { ev.stopPropagation(); }); - this.$widget.find("input[type=checkbox]").change(this.recalcLinks.bind(this)).trigger("change"); + this.$widget.find("input[type=checkbox]").on("change", this.recalcLinks.bind(this)).trigger("change"); } } diff --git a/web/typescript/backend/ProposedProcedureOverview.ts b/web/typescript/backend/ProposedProcedureOverview.ts index 7f4cb708be..0b6baa8e1e 100644 --- a/web/typescript/backend/ProposedProcedureOverview.ts +++ b/web/typescript/backend/ProposedProcedureOverview.ts @@ -131,7 +131,7 @@ export class ProposedProcedureOverview { $td = $btn.parents('td').first(); $td.addClass('writing'); - $td.find('textarea').focus(); + $td.find('textarea').trigger("focus");; } private submitComment($commentTd: JQuery) { diff --git a/web/typescript/backend/UserList.ts b/web/typescript/backend/UserList.ts index e4bea5296c..55ecbb6ebd 100644 --- a/web/typescript/backend/UserList.ts +++ b/web/typescript/backend/UserList.ts @@ -14,7 +14,7 @@ export class UserList { if (result) { let id = $button.data("id"); $form.append(''); - $form.submit(); + $form.trigger("submit"); } }); }); diff --git a/web/typescript/frontend/AccountEdit.ts b/web/typescript/frontend/AccountEdit.ts index 7e30796e99..d3737b7a3b 100644 --- a/web/typescript/frontend/AccountEdit.ts +++ b/web/typescript/frontend/AccountEdit.ts @@ -18,7 +18,7 @@ class AccountEdit { ev.preventDefault(); $changeRow.removeClass("hidden"); $emailExisting.addClass("hidden"); - $changeRow.find("input").focus(); + $changeRow.find("input").trigger("focus");; }); } diff --git a/web/typescript/frontend/CopyUrlToClipboard.ts b/web/typescript/frontend/CopyUrlToClipboard.ts index 14e539f8d1..915b15cc47 100644 --- a/web/typescript/frontend/CopyUrlToClipboard.ts +++ b/web/typescript/frontend/CopyUrlToClipboard.ts @@ -9,7 +9,7 @@ export class CopyUrlToClipboard { clipboard.on('success', () => { $widget.find(".form-group").addClass("has-success has-feedback"); $widget.find(".clipboard-done").removeClass("hidden"); - $button.focus(); + $button.trigger("focus"); }); clipboard.on('error', () => { diff --git a/web/typescript/frontend/DeadlineDebugBar.ts b/web/typescript/frontend/DeadlineDebugBar.ts index f7629ed64b..09bdcdc4cf 100644 --- a/web/typescript/frontend/DeadlineDebugBar.ts +++ b/web/typescript/frontend/DeadlineDebugBar.ts @@ -2,9 +2,9 @@ export class DeadlineDebugBar { constructor(private $widget: JQuery) { const csrf = $widget.find('> input[name=_csrf]').val(); - $widget.submit(ev => ev.preventDefault()); + $widget.on("submit", ev => ev.preventDefault()); - $widget.find('.closeCol button').click(() => { + $widget.find('.closeCol button').on("click", () => { $.post($widget.attr('action'), { '_csrf': csrf, 'action': 'close' @@ -21,8 +21,8 @@ export class DeadlineDebugBar { $picker.datetimepicker({ locale: $picker.find('input').data('locale') }); - - $widget.find('.setTime').click(() => { + + $widget.find('.setTime').on("click", () => { const time = $picker.find('input').val(); $.post($widget.attr('action'), { '_csrf': csrf, @@ -37,4 +37,4 @@ export class DeadlineDebugBar { }); }); } -} \ No newline at end of file +} diff --git a/web/typescript/frontend/InitiatorForm.ts b/web/typescript/frontend/InitiatorForm.ts index 17ee96ec5f..0115c1a577 100644 --- a/web/typescript/frontend/InitiatorForm.ts +++ b/web/typescript/frontend/InitiatorForm.ts @@ -205,7 +205,7 @@ export class InitiatorForm { } private initMinSupporters() { - this.$editforms.submit((ev) => { + this.$editforms.on("submit", (ev) => { if ($('#personTypeOrga').prop('checked')) { return; } @@ -278,9 +278,9 @@ export class InitiatorForm { if ($row.next().hasClass('adderRow')) { let $newEl = $($('#newSupporterTemplate').data('html')); this.$supporterAdderRow.before($newEl); - $newEl.find('input[type=text]').first().focus(); + $newEl.find('input[type=text]').first().trigger("focus"); } else { - $row.next().find('input[type=text]').first().focus(); + $row.next().find('input[type=text]').first().trigger("focus"); } } else if (ev.keyCode == 8) { // Backspace $row = $(ev.target).parents('.supporterRow'); diff --git a/web/typescript/frontend/LineNumberHighlighting.ts b/web/typescript/frontend/LineNumberHighlighting.ts index 7c13bad3c2..beccb91302 100644 --- a/web/typescript/frontend/LineNumberHighlighting.ts +++ b/web/typescript/frontend/LineNumberHighlighting.ts @@ -13,7 +13,7 @@ export class LineNumberHighlighting { $panel.addClass("active"); panelIsOpen = true; - $lineInput.focus(); + $lineInput.trigger("focus");; window.setTimeout(() => { $lineInput.val(ev.key); }, 1); diff --git a/web/typescript/frontend/MergeInit.ts b/web/typescript/frontend/MergeInit.ts index 8d32689e52..d3ae209090 100644 --- a/web/typescript/frontend/MergeInit.ts +++ b/web/typescript/frontend/MergeInit.ts @@ -52,10 +52,10 @@ export class MergeInit { private initAllCheckbox() { this.recalcAllCheckbox(); - this.$allCheckbox.change(() => { + this.$allCheckbox.on("change", () => { this.$checkboxes.prop("checked", this.$allCheckbox.prop("checked")); }); - this.$checkboxes.change(() => { + this.$checkboxes.on("change", () => { this.recalcAllCheckbox(); }); } diff --git a/web/typescript/frontend/MergeSingleAmendment.ts b/web/typescript/frontend/MergeSingleAmendment.ts index 383a345f17..6f61261577 100644 --- a/web/typescript/frontend/MergeSingleAmendment.ts +++ b/web/typescript/frontend/MergeSingleAmendment.ts @@ -26,18 +26,18 @@ class MergeSingleAmendment { "3": this.$form.find("> .step_3") }; - this.$checkCollisions.click((ev) => { + this.$checkCollisions.on("click", (ev) => { ev.preventDefault(); this.loadCollisions(); }); - this.$steps["1"].find(".goto_2").click((ev) => { + this.$steps["1"].find(".goto_2").on("click", (ev) => { ev.preventDefault(); this.gotoStep("2"); }); this.$affectedParagraphs.each((i, el) => { this.initAffectedParagraph(el); }); - this.$form.submit(this.onSubmit.bind(this)); + this.$form.on("submit", this.onSubmit.bind(this)); this.gotoStep("1"); } @@ -58,14 +58,14 @@ class MergeSingleAmendment { private initAffectedParagraph(el) { let $paragraph = $(el); - $paragraph.find(".versionSelector input").change(() => { + $paragraph.find(".versionSelector input").on("change", () => { if ($paragraph.find(".versionSelector input:checked").val() == "modified") { $paragraph.removeClass("originalVersion").addClass("modifiedVersion"); } else { $paragraph.addClass("originalVersion").removeClass("modifiedVersion"); } }).trigger("change"); - $paragraph.find(".modifySelector input").change(() => { + $paragraph.find(".modifySelector input").on("change", () => { if ($paragraph.find(".modifySelector input").prop("checked")) { $paragraph.addClass("changed").removeClass("unchanged"); } else { diff --git a/web/typescript/frontend/MotionMergeAmendmentsPublic.ts b/web/typescript/frontend/MotionMergeAmendmentsPublic.ts index adbb6578a8..7593ccd9b7 100644 --- a/web/typescript/frontend/MotionMergeAmendmentsPublic.ts +++ b/web/typescript/frontend/MotionMergeAmendmentsPublic.ts @@ -85,7 +85,7 @@ export class MotionMergeAmendmentsPublic { $toggle.prop('checked', (state == '1')); } } - $toggle.change(() => { + $toggle.on("change", () => { let active: boolean = $toggle.prop('checked'); if (localStorage) { localStorage.setItem('merging-draft-auto-update', (active ? '1' : '0')); @@ -97,6 +97,6 @@ export class MotionMergeAmendmentsPublic { } }).trigger('change'); - this.$updateWidget.find('#updateBtn').click(this.reload.bind(this, true)); + this.$updateWidget.find('#updateBtn').on("click", this.reload.bind(this, true)); } } diff --git a/web/typescript/frontend/UserNotificationsForm.ts b/web/typescript/frontend/UserNotificationsForm.ts index 287a8b1adc..2d37318a1e 100644 --- a/web/typescript/frontend/UserNotificationsForm.ts +++ b/web/typescript/frontend/UserNotificationsForm.ts @@ -1,6 +1,6 @@ export class UserNotificationsForm { constructor(private $widget: JQuery) { - $(".notiComment input").change((ev) => { + $(".notiComment input").on("change", (ev) => { if ($(ev.currentTarget).prop("checked")) { $(".commentSettings").removeClass("hidden"); } else { @@ -8,7 +8,7 @@ export class UserNotificationsForm { } }).trigger("change"); - $(".notiAmendment input").change((ev) => { + $(".notiAmendment input").on("change", (ev) => { if ($(ev.currentTarget).prop("checked")) { $(".amendmentSettings").removeClass("hidden"); } else { diff --git a/web/typescript/shared/AmendmentEditSinglePara.ts b/web/typescript/shared/AmendmentEditSinglePara.ts index d88c285ea6..9d807194f3 100644 --- a/web/typescript/shared/AmendmentEditSinglePara.ts +++ b/web/typescript/shared/AmendmentEditSinglePara.ts @@ -85,7 +85,7 @@ export class AmendmentEditSinglePara { $textarea.parent().find("textarea.consolidated").val(editor.getData()); } }); - $textarea.focus(); + $textarea.trigger("focus");; } private setModifyable() {