You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/03/20 23:48:20 UTC

[incubator-echarts] 02/04: ts: Do the same thing as the last commit to extension-src.

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

sushuang pushed a commit to branch typescript
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit e25f1dcb5c9e00cfc397485eb4d204411052ffba
Author: 100pah <su...@gmail.com>
AuthorDate: Sat Mar 21 07:07:30 2020 +0800

    ts: Do the same thing as the last commit to extension-src.
---
 extension-src/.eslintrc.yaml       | 48 ++++++++++++++++++++++++--------------
 extension-src/bmap/BMapCoordSys.ts |  7 +++---
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/extension-src/.eslintrc.yaml b/extension-src/.eslintrc.yaml
index 76be321..d060c39 100644
--- a/extension-src/.eslintrc.yaml
+++ b/extension-src/.eslintrc.yaml
@@ -1,7 +1,11 @@
+parser: "@typescript-eslint/parser"
 parserOptions:
-    # If using ES Module, ecmaVersion have to be set as `2015`.
-    ecmaVersion: 2015
-    sourceType: "module"
+    ecmaVersion: 6
+    sourceType: module
+    ecmaFeatures:
+        modules: true
+    project: "tsconfig.json"
+plugins: ["@typescript-eslint"]
 env:
     browser: true
     node: true
@@ -10,6 +14,7 @@ globals:
     jQuery: true
     Promise: true
 rules:
+    # Check the rules in: node_modules/@typescript-eslint/eslint-plugin/README.md
     no-console:
         - 2
         -
@@ -32,7 +37,7 @@ rules:
     no-unreachable: 2
     use-isnan: 2
     valid-typeof: 2
-    block-scoped-var: 0
+    block-scoped-var: 2
     curly:
         - 2
         - "all"
@@ -59,7 +64,7 @@ rules:
     no-octal: 2
     no-octal-escape: 2
     no-proto: 2
-    no-redeclare: 0
+    no-redeclare: 2
     no-self-compare: 2
     no-unneeded-ternary: 2
     no-with: 2
@@ -74,12 +79,8 @@ rules:
     no-shadow-restricted-names: 2
     no-undef: 2
     no-undef-init: 2
-    no-unused-vars:
-        - 2
-        -
-            vars: "local"
-            args: "none"
-    no-use-before-define: 0
+    "no-use-before-define": "off"
+    "@typescript-eslint/no-use-before-define": 2
     brace-style:
         - 2
         - "stroustrup"
@@ -95,7 +96,7 @@ rules:
     new-parens: 2
     no-array-constructor: 2
     no-multi-spaces:
-        - 2
+        - 1
         -
             ignoreEOLComments: true
             exceptions:
@@ -116,10 +117,12 @@ rules:
         -
             overrides:
                 "=": "after"
-    quotes:
+    "quotes": "off"
+    "@typescript-eslint/quotes":
         - 2
         - "single"
-    semi:
+    "semi": "off"
+    "@typescript-eslint/semi":
         - 2
         - "always"
     semi-spacing: 2
@@ -129,7 +132,8 @@ rules:
         -
             beforeColon: false
             afterColon: true
-    space-before-function-paren:
+    "space-before-function-paren": "off"
+    "@typescript-eslint/space-before-function-paren":
         - 2
         -
             anonymous: "always"
@@ -178,7 +182,7 @@ rules:
             allowParens: true
     no-class-assign: 2
     no-const-assign: 2
-    no-dupe-class-members: 2
+    # no-dupe-class-members: 2
     no-this-before-super: 0
     no-var: 0
     no-duplicate-imports: 2
@@ -186,4 +190,14 @@ rules:
     unicode-bom: 2
     max-statements-per-line: 2
 
-    no-useless-constructor: 0
\ No newline at end of file
+    no-useless-constructor: 0
+
+    "func-call-spacing": "off"
+    "@typescript-eslint/func-call-spacing": "error"
+
+    "no-unused-vars": "off"
+    "@typescript-eslint/no-unused-vars":
+        - 1
+        -
+            vars: "local"
+            args: "none"
\ No newline at end of file
diff --git a/extension-src/bmap/BMapCoordSys.ts b/extension-src/bmap/BMapCoordSys.ts
index f133a39..034e464 100644
--- a/extension-src/bmap/BMapCoordSys.ts
+++ b/extension-src/bmap/BMapCoordSys.ts
@@ -73,7 +73,7 @@ BMapCoordSys.prototype.dataToPoint = function (data) {
 
 BMapCoordSys.prototype.pointToData = function (pt) {
     var mapOffset = this._mapOffset;
-    var pt = this._bmap.overlayPixelToPoint({
+    pt = this._bmap.overlayPixelToPoint({
         x: pt[0] + mapOffset[0],
         y: pt[1] + mapOffset[1]
     });
@@ -165,6 +165,7 @@ BMapCoordSys.create = function (ecModel, api) {
         if (bmapCoordSys) {
             throw new Error('Only one bmap component can exist');
         }
+        var bmap;
         if (!bmapModel.__bmap) {
             // Not support IE8
             var bmapRoot = root.querySelector('.ec-extension-bmap');
@@ -180,7 +181,7 @@ BMapCoordSys.create = function (ecModel, api) {
             // Not support IE8
             bmapRoot.classList.add('ec-extension-bmap');
             root.appendChild(bmapRoot);
-            var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);
+            bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);
 
             var overlay = new Overlay(viewportRoot);
             bmap.addOverlay(overlay);
@@ -190,7 +191,7 @@ BMapCoordSys.create = function (ecModel, api) {
                 return {offsetLeft: 0, offsetTop: 0};
             };
         }
-        var bmap = bmapModel.__bmap;
+        bmap = bmapModel.__bmap;
 
         // Set bmap options
         // centerAndZoom before layout and render


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org