You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2022/03/30 17:52:39 UTC

[myfaces-tobago] branch tobago-5.x updated: style: TypeScript

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new 1501e36  style: TypeScript
1501e36 is described below

commit 1501e3623c43da32a6ae8bd557450a44e2926c28
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Mar 30 19:51:57 2022 +0200

    style: TypeScript
---
 tobago-theme/.eslintrc.js                                      | 10 +++++-----
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js       |  4 ++--
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map   |  2 +-
 tobago-theme/tobago-theme-standard/src/main/ts/tobago-focus.ts |  3 ++-
 .../tobago-theme-standard/src/main/ts/tobago-overlay.ts        |  4 ++--
 tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts  |  2 +-
 .../src/main/ts/tobago-select-many-checkbox.ts                 | 10 ++++------
 tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts |  2 +-
 8 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/tobago-theme/.eslintrc.js b/tobago-theme/.eslintrc.js
index 5f52acf..d637876 100644
--- a/tobago-theme/.eslintrc.js
+++ b/tobago-theme/.eslintrc.js
@@ -35,8 +35,8 @@ module.exports = {
     "no-irregular-whitespace": "warn",
     "no-constant-condition": "warn",
     "no-inner-declarations": "warn",
-    "@typescript-eslint/ban-ts-comment": "warn",
-    "@typescript-eslint/no-implied-eval": "warn",
+    "@typescript-eslint/ban-ts-comment": "error",
+    "@typescript-eslint/no-implied-eval": "error",
     "@typescript-eslint/unbound-method": "warn",
     "@typescript-eslint/no-unsafe-call": "warn",
     "@typescript-eslint/no-unsafe-assignment": "warn",
@@ -64,10 +64,10 @@ module.exports = {
     "@typescript-eslint/no-unnecessary-type-assertion": ["warn"],
     "@typescript-eslint/no-empty-function": "warn",
     "@typescript-eslint/no-inferrable-types": "warn",
-    "@typescript-eslint/restrict-plus-operands": "warn",
+    "@typescript-eslint/restrict-plus-operands": "error",
     "@typescript-eslint/no-unsafe-return": "warn",
     "@typescript-eslint/quotes": [
-      "warn",
+      "error",
       "double"
     ],
     "@typescript-eslint/semi": [
@@ -75,7 +75,7 @@ module.exports = {
       "always"
     ],
     "max-len": [
-      "warn",
+      "error",
       {
         "code": 120
       }
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index 15b9885..992cf1e 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
 /*!
     * Bootstrap v5.1.3 (https://getbootstrap.com/)
     * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
     * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
     */
-const Ne="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},De=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},Me=e=>{const t=Re(e);return t?document.querySelector(t):null},je=e=>{e.dispatchEvent(new Event(Ne))},He=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
+const Ne="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},De=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},Me=e=>{const t=Re(e);return t?document.querySelector(t):null},je=e=>{e.dispatchEvent(new Event(Ne))},He=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
 //# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 6869df2..72011a7 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-focus.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-focus.ts
index 30f648c..de47e96 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-focus.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-focus.ts
@@ -112,7 +112,8 @@ export class Focus extends HTMLElement {
   private get focusableElement(): HTMLElement {
     const root = this.getRootNode() as ShadowRoot | Document;
     const elements: NodeListOf<HTMLElement> = root.querySelectorAll(
-        `input:not([type='hidden']):not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),textarea:not([disabled]):not([tabindex='-1'])`);
+      "input:not([type='hidden']):not([disabled]):not([tabindex='-1']),"
+      + "select:not([disabled]):not([tabindex='-1']),textarea:not([disabled]):not([tabindex='-1'])");
 
     for (const element of elements) {
       if (this.isVisible(element)) {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-overlay.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-overlay.ts
index ec5249f..0314bad 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-overlay.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-overlay.ts
@@ -41,8 +41,8 @@ class Overlay extends HTMLElement {
 
   render(): void {
     const icon = this.error
-        ? `<i class="bi-flash fs-1"></i>`
-        : `<span class="spinner-border"></span>`;
+        ? "<i class='bi-flash fs-1'></i>"
+        : "<span class='spinner-border'></span>";
 
     this.insertAdjacentHTML("afterbegin", `<div>${icon}</div>`);
   }
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
index c7272a1..80f920a 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-page.ts
@@ -108,7 +108,7 @@ export class Page extends HTMLElement {
     });
   }
 
-  beforeSubmit(event: Event, decoupled: boolean = false): void {
+  beforeSubmit(event: Event, decoupled = false): void {
     this.submitActive = true;
     if (!decoupled) {
       this.body.insertAdjacentHTML("beforeend", `<tobago-overlay for='${this.id}'></tobago-overlay>`);
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-checkbox.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-checkbox.ts
index c0a62a9..e3e02f1 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-checkbox.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-checkbox.ts
@@ -28,12 +28,10 @@ class SelectManyCheckbox extends HTMLElement {
       input.addEventListener("focus", Focus.setLastFocusId);
 
       if (input.readOnly) {
-        input.addEventListener("click", preventClick);
-      }
-
-      function preventClick(event: MouseEvent): void {
-        // in the "readonly" case, prevent the default, which is changing the "checked" state
-        event.preventDefault();
+        input.addEventListener("click", (event: MouseEvent) => {
+          // in the "readonly" case, prevent the default, which is changing the "checked" state
+          event.preventDefault();
+        });
       }
     }
   }
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
index 8c27341..1bcfade 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
@@ -486,7 +486,7 @@ Type: ${data.type}`);
 
   isColumnRendered(): boolean[] {
     const hidden = document.getElementById(this.id + "::rendered");
-    return JSON.parse(hidden.getAttribute("value"));
+    return JSON.parse(hidden.getAttribute("value")) as boolean[];
   }
 
   addHeaderFillerWidth(): void {