Fix some eslint issues in form builder code
authorMatthias Schmidt <gravatronics@live.com>
Sun, 6 Dec 2020 13:56:02 +0000 (14:56 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 15 Dec 2020 17:23:04 +0000 (18:23 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Dialog.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Form/Builder/Dialog.ts

index a52823d536f9d7dfd387fd5bb4622017464fff39..27351c1d9b196a594cab6c62d2d20cae984dbbee 100644 (file)
@@ -24,7 +24,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Ui/Dialog", "../../A
             this._options = Core.extend({
                 actionParameters: {},
                 destroyOnClose: false,
-                usesDboAction: this._className.match(/\w+\\data\\/),
+                usesDboAction: new RegExp(/\w+\\data\\/).test(this._className),
             }, options);
             this._options.dialog = Core.extend(this._options.dialog || {}, {
                 onClose: this._dialogOnClose.bind(this),
@@ -117,7 +117,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Ui/Dialog", "../../A
             }
             this._additionalSubmitButtons = Array.from(dialogData.content.querySelectorAll(':not(.formSubmit) button[type="submit"]'));
             this._additionalSubmitButtons.forEach((submit) => {
-                submit.addEventListener("click", (ev) => {
+                submit.addEventListener("click", () => {
                     // Mark the button that was clicked so that the button data handlers know
                     // which data needs to be submitted.
                     this._additionalSubmitButtons.forEach((button) => {
index 580a20645bcf6b2e18c36e718ed9db96ed9ce92a..1fe3a786fe21129f0cad904638f56bec84967085 100644 (file)
@@ -10,7 +10,7 @@
 
 import * as Core from "../../Core";
 import UiDialog from "../../Ui/Dialog";
-import { DialogCallbackObject, DialogCallbackSetup, DialogData, DialogOptions } from "../../Ui/Dialog/Data";
+import { DialogCallbackObject, DialogCallbackSetup, DialogData } from "../../Ui/Dialog/Data";
 import * as Ajax from "../../Ajax";
 import { AjaxCallbackObject, AjaxCallbackSetup, DatabaseObjectActionResponse, RequestOptions } from "../../Ajax/Data";
 import FormBuilderManager from "./Manager";
@@ -46,7 +46,7 @@ class FormBuilderDialog implements AjaxCallbackObject, DialogCallbackObject {
       {
         actionParameters: {},
         destroyOnClose: false,
-        usesDboAction: this._className.match(/\w+\\data\\/),
+        usesDboAction: new RegExp(/\w+\\data\\/).test(this._className),
       },
       options,
     ) as FormBuilderDialogOptions;
@@ -164,7 +164,7 @@ class FormBuilderDialog implements AjaxCallbackObject, DialogCallbackObject {
       dialogData.content.querySelectorAll(':not(.formSubmit) button[type="submit"]'),
     );
     this._additionalSubmitButtons.forEach((submit) => {
-      submit.addEventListener("click", (ev) => {
+      submit.addEventListener("click", () => {
         // Mark the button that was clicked so that the button data handlers know
         // which data needs to be submitted.
         this._additionalSubmitButtons.forEach((button) => {
@@ -205,7 +205,7 @@ class FormBuilderDialog implements AjaxCallbackObject, DialogCallbackObject {
   /**
    * Destroys the dialog form.
    */
-  public destroy(ignoreDialog: boolean = false): void {
+  public destroy(ignoreDialog = false): void {
     if (this._formId !== "") {
       if (FormBuilderManager.hasForm(this._formId)) {
         FormBuilderManager.unregisterForm(this._formId);
@@ -231,7 +231,7 @@ class FormBuilderDialog implements AjaxCallbackObject, DialogCallbackObject {
   /**
    * Opens the dialog form.
    */
-  public open() {
+  public open(): void {
     if (UiDialog.getDialog(this._dialogId)) {
       UiDialog.open(this);
     } else {