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 2019/09/25 15:46:52 UTC

[myfaces-tobago] branch master updated: lint - code style

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 73aa8d7  lint - code style
73aa8d7 is described below

commit 73aa8d71a1a94d91c6a66bca16a14840ea69ac9b
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Sep 25 17:46:25 2019 +0200

    lint - code style
    
    issue: TOBAGO-1633: TS refactoring
---
 tobago-theme/pom.xml                               |  4 +--
 .../src/main/npm/package.json                      |  2 ++
 .../src/main/npm/ts/tobago-overlay.ts              | 22 +++++++--------
 .../src/main/npm/ts/tobago-reload.ts               | 10 +++----
 .../src/main/npm/ts/tobago-split-layout.ts         | 31 +++++++++++-----------
 .../src/main/npm/ts/tobago-tree.ts                 |  2 +-
 6 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/tobago-theme/pom.xml b/tobago-theme/pom.xml
index 8ee4aab..6e4b815 100644
--- a/tobago-theme/pom.xml
+++ b/tobago-theme/pom.xml
@@ -259,13 +259,13 @@
             </configuration>
           </execution>
           <execution>
-            <id>step #5b: ts-compile</id>
+            <id>step #5b: ts-lint + ts-compile</id>
             <goals>
               <goal>npm</goal>
             </goals>
             <phase>generate-resources</phase>
             <configuration>
-              <arguments>run ts-compile</arguments>
+              <arguments>run ts</arguments>
             </configuration>
           </execution>
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/package.json b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
index 39892f9..756a9e8 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/package.json
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
@@ -23,6 +23,8 @@
     "css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/tobago-theme.scss css/tobago.css",
     "css-prefix": "postcss --config postcss.config.js --replace \"css/*.css\" \"!css/*.min.css\"",
     "css-minify": "cleancss --level 1 --source-map --source-map-inline-sources --output css/tobago.min.css css/tobago.css",
+    "ts": "npm-run-all --parallel ts-lint ts-compile",
+    "ts-lint": "tslint --project tsconfig.json --config tslint.json",
     "ts-compile": "tsc",
     "js-minify": "uglifyjs --compress typeofs=false,drop_console=true --mangle --source-map includeSources --output js/tobago.min.js js/tobago-myfaces.js js/tobago-deltaspike.js js/tobago-polyfill.js js/ext-bootstrap.js js/tobago-listener.js js/tobago-core.js js/tobago-dropdown.js js/tobago-calendar.js js/tobago-command.js js/tobago-file.js js/tobago-focus.js js/tobago-header-footer.js js/tobago-in.js js/tobago-jsf.js js/tobago-overlay.js js/tobago-panel.js js/tobago-popover.js js/tobago [...]
     "test": "jest"
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-overlay.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-overlay.ts
index 19b1f0d..abe76ce 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-overlay.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-overlay.ts
@@ -53,6 +53,17 @@ export class Overlay {
 
   overlay: HTMLDivElement;
 
+  static destroy(id: string) {
+    console.debug("----> get overlay " + id);
+    const overlay = Overlay.overlayMap.get(id);
+    if (overlay) {
+      overlay.overlay.remove();
+      Overlay.overlayMap.delete(id);
+    } else {
+      console.warn("Overlay not found for id='" + id + "'");
+    }
+  }
+
   constructor(element: HTMLElement, ajax = false, error = false, waitOverlayDelay?) {
 
     this.element = element;
@@ -110,17 +121,6 @@ export class Overlay {
     Overlay.overlayMap.set(element.id, this);
     console.debug("----> set overlay " + element.id);
   }
-
-  static destroy(id: string) {
-    console.debug("----> get overlay " + id);
-    const overlay = Overlay.overlayMap.get(id);
-    if (overlay) {
-      overlay.overlay.remove();
-      Overlay.overlayMap.delete(id);
-    } else {
-      console.warn("Overlay not found for id='" + id + "'");
-    }
-  }
 }
 
 Config.set("Tobago.waitOverlayDelay", 1000);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-reload.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-reload.ts
index 9b591c2..ddc65e3 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-reload.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-reload.ts
@@ -27,16 +27,16 @@ export class ReloadManager {
    */
   private timeouts: Map<string, number>;
 
-  private constructor() {
-    this.timeouts = new Map<string, number>();
-  }
-
   static init = function (element: HTMLElement): void {
     for (const reload of DomUtils.selfOrQuerySelectorAll(element, "[data-tobago-reload]")) {
       ReloadManager.instance.schedule(reload.id, Number(reload.dataset["tobagoReload"]));
     }
   };
 
+  private constructor() {
+    this.timeouts = new Map<string, number>();
+  }
+
   public schedule(id: string, reloadMillis: number) {
     if (reloadMillis > 0) {
 
@@ -63,7 +63,7 @@ export class ReloadManager {
       console.debug("adding reload timeout '" + timeout + "' for #'" + id + "'");
       this.timeouts.set(id, timeout);
     }
-  };
+  }
 
 }
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
index f6ad67e..1a660ed 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
@@ -85,13 +85,13 @@ class SplitLayout extends HTMLElement {
     } else {
       previousArea.style.height = String(event.pageY - this.offset) + "px";
     }
-  };
+  }
 
   stop(event: MouseEvent): void {
     document.removeEventListener("mousemove", this.move.bind(this)); // fixme remove the real added
     document.removeEventListener("mouseup", this.stop.bind(this)); // fixme remove the real added
     SplitLayoutMousedown.remove();
-  };
+  }
 }
 
 /**
@@ -107,20 +107,6 @@ class SplitLayoutMousedown {
 
   private data: SplitLayoutMousedownData;
 
-  private constructor(data: SplitLayoutMousedownData | string) {
-    this.data = typeof data === "string" ? JSON.parse(data) : data;
-  }
-
-  get splitter(): HTMLElement {
-    return document.getElementById(this.data.splitLayoutId).getElementsByClassName(
-        this.data.horizontal ? "tobago-splitLayout-horizontal" : "tobago-splitLayout-vertical")
-        .item(this.data.splitterIndex) as HTMLElement;
-  }
-
-  get previous(): HTMLElement {
-    return DomUtils.previousElementSibling(this.splitter);
-  }
-
   static save(event: MouseEvent, splitter: HTMLElement): SplitLayoutMousedown {
     const horizontal = splitter.classList.contains("tobago-splitLayout-horizontal");
     const previous = DomUtils.previousElementSibling(splitter);
@@ -152,6 +138,19 @@ class SplitLayoutMousedown {
     return -1;
   }
 
+  private constructor(data: SplitLayoutMousedownData | string) {
+    this.data = typeof data === "string" ? JSON.parse(data) : data;
+  }
+
+  get splitter(): HTMLElement {
+    return document.getElementById(this.data.splitLayoutId).getElementsByClassName(
+        this.data.horizontal ? "tobago-splitLayout-horizontal" : "tobago-splitLayout-vertical")
+        .item(this.data.splitterIndex) as HTMLElement;
+  }
+
+  get previous(): HTMLElement {
+    return DomUtils.previousElementSibling(this.splitter);
+  }
 }
 
 document.addEventListener("DOMContentLoaded", function (event) {
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tree.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tree.ts
index 016f7ac..b5056f4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tree.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tree.ts
@@ -24,7 +24,7 @@ export class Tree extends HTMLElement {
   }
 
   connectedCallback() {
-  };
+  }
 
   get isSheet(): boolean {
     // TODO if sheet is implemented as custom element use: