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/10/14 08:10:10 UTC

[incubator-echarts] branch fix-ut created (now 0d47e96)

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

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


      at 0d47e96  build: move /echarts.*.ts to src/echarts.*.ts . Otherwise if user import from 'echarts.all', it might be confused whether echarts.all.ts or echarts.all.js

This branch includes the following new commits:

     new 444bc08  ts: rename ut file name from js to ts.
     new e8e8bce  ts: (1) Migrate ut to ts (spec/data). (2) ix related typing in src.
     new 4d7f549  fix: fix that throw error if only a few components mounted.
     new 8b34dfb  ts: fix type of converters.
     new 212f3cf  lint: sort eslint for both src, extension-src, test/ut
     new 9f69525  fix: fix ut and fix getViusal bug brought by some of the 5.0 refactor.
     new 199a49e  test: remove unnecessary jsdom dependency (it cause some prepublish issue). Use jest built-in jsdom.
     new 0d47e96  build: move /echarts.*.ts to src/echarts.*.ts . Otherwise if user import from 'echarts.all', it might be confused whether echarts.all.ts or echarts.all.js

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-echarts] 05/08: lint: sort eslint for both src, extension-src, test/ut

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 212f3cf172ec7294b463d12f54f4a5b9b1852ea6
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Oct 13 16:58:13 2020 +0800

    lint: sort eslint for both src, extension-src, test/ut
---
 src/.eslintrc.yaml => .eslintrc-common.yaml |  16 ---
 extension-src/.eslintrc.yaml                | 207 +++------------------------
 src/.eslintrc.yaml                          | 193 +------------------------
 test/ut/.eslintrc.yaml                      | 212 ++++------------------------
 test/ut/tsconfig.json                       |   9 +-
 5 files changed, 53 insertions(+), 584 deletions(-)

diff --git a/src/.eslintrc.yaml b/.eslintrc-common.yaml
similarity index 92%
copy from src/.eslintrc.yaml
copy to .eslintrc-common.yaml
index 36b63c8..1c63140 100644
--- a/src/.eslintrc.yaml
+++ b/.eslintrc-common.yaml
@@ -10,22 +10,6 @@
 # ```
 # Note that it should be "workingDirectories" rather than "WorkingDirectories".
 
-parser: "@typescript-eslint/parser"
-parserOptions:
-    ecmaVersion: 6
-    sourceType: module
-    ecmaFeatures:
-        modules: true
-    project: "tsconfig.json"
-plugins: ["@typescript-eslint"]
-env:
-    browser: true
-    node: true
-    es6: false
-globals:
-    jQuery: true
-    Promise: true
-    __DEV__: true
 rules:
     # Check the rules in: node_modules/@typescript-eslint/eslint-plugin/README.md
     no-console:
diff --git a/extension-src/.eslintrc.yaml b/extension-src/.eslintrc.yaml
index 5667b9c..55b3af0 100644
--- a/extension-src/.eslintrc.yaml
+++ b/extension-src/.eslintrc.yaml
@@ -1,3 +1,15 @@
+# Note:
+# If eslint does not work in VSCode, please check:
+# (1) Whether "@typescript-eslint/eslint-plugin" and "@typescript-eslint/parser"
+# are npm installed locally. Should better in the same version.
+# (2) Whether "VSCode ESlint extension" is installed.
+# (3) If the project folder is not the root folder of your working space, please
+# config the "VSCode ESlint extension" in "settings":
+# ```json
+# "eslint.workingDirectories": [{"mode": "auto"}]
+# ```
+# Note that it should be "workingDirectories" rather than "WorkingDirectories".
+
 parser: "@typescript-eslint/parser"
 parserOptions:
     ecmaVersion: 6
@@ -11,194 +23,7 @@ env:
     node: true
     es6: false
 globals:
-    jQuery: true
-    Promise: true
-rules:
-    # Check the rules in: node_modules/@typescript-eslint/eslint-plugin/README.md
-    no-console:
-        - 2
-        -
-            allow:
-                - "warn"
-                - "error"
-    no-constant-condition: 0
-    comma-dangle: 2
-    no-debugger: 2
-    prefer-const: 1
-    no-dupe-keys: 2
-    no-empty-character-class: 2
-    no-ex-assign: 2
-    no-extra-boolean-cast: 0
-    no-func-assign: 2
-    no-inner-declarations: 2
-    no-invalid-regexp: 2
-    no-negated-in-lhs: 2
-    no-obj-calls: 2
-    no-sparse-arrays: 2
-    no-unreachable: 2
-    use-isnan: 2
-    valid-typeof: 2
-    block-scoped-var: 2
-    curly:
-        - 2
-        - "all"
-    eqeqeq:
-        - 2
-        - "allow-null"
-    guard-for-in: 2
-    no-else-return: 0
-    no-labels:
-        - 2
-        -
-            allowLoop: true
-    no-eval: 2
-    no-extend-native: 2
-    no-extra-bind: 0
-    no-implied-eval: 2
-    no-iterator: 2
-    no-irregular-whitespace: 2
-    no-lone-blocks: 2
-    no-loop-func: 2
-    no-multi-str: 2
-    no-native-reassign: 2
-    no-new-wrappers: 2
-    no-octal: 2
-    no-octal-escape: 2
-    no-proto: 2
-    no-redeclare: 2
-    no-self-compare: 2
-    no-unneeded-ternary: 2
-    no-with: 2
-    radix: 2
-    wrap-iife:
-        - 2
-        - "any"
-    no-delete-var: 2
-    no-dupe-args: 2
-    no-duplicate-case: 2
-    no-label-var: 2
-    no-shadow-restricted-names: 2
-    no-undef: 2
-    no-undef-init: 2
-    "no-use-before-define": "off"
-    "@typescript-eslint/no-use-before-define": 0
-    brace-style:
-        - 2
-        - "stroustrup"
-        - {}
-    comma-spacing:
-        - 2
-        -
-            before: false
-            after: true
-    comma-style:
-        - 2
-        - "last"
-    new-parens: 2
-    no-array-constructor: 2
-    no-multi-spaces:
-        - 1
-        -
-            ignoreEOLComments: true
-            exceptions:
-                Property: true
-    no-new-object: 2
-    no-spaced-func: 2
-    no-trailing-spaces: 2
-    no-extra-parens:
-        - 2
-        - "functions"
-    no-mixed-spaces-and-tabs: 2
-    one-var:
-        - 2
-        - "never"
-    operator-linebreak:
-        - 2
-        - "before"
-        -
-            overrides:
-                "=": "after"
-    "quotes": "off"
-    "@typescript-eslint/quotes":
-        - 2
-        - "single"
-    "semi": "off"
-    "@typescript-eslint/semi":
-        - 2
-        - "always"
-    semi-spacing: 2
-    keyword-spacing: 2
-    key-spacing:
-        - 2
-        -
-            beforeColon: false
-            afterColon: true
-    "space-before-function-paren": "off"
-    "@typescript-eslint/space-before-function-paren":
-        - 2
-        -
-            anonymous: "always"
-            named: "never"
-    space-before-blocks:
-        - 2
-        - "always"
-    computed-property-spacing:
-        - 2
-        - "never"
-    space-in-parens:
-        - 2
-        - "never"
-    space-unary-ops: 2
-    spaced-comment: 0
-
-    max-nested-callbacks:
-        - 1
-        - 5
-    max-depth:
-        - 1
-        - 6
-    max-len:
-        - 2
-        - 120
-        - 4
-        -
-            ignoreUrls: true
-            ignoreComments: true
-    max-params:
-        - 1
-        - 15
-
-    space-infix-ops: 2
-    dot-notation:
-        - 2
-        -
-            allowKeywords: true
-            allowPattern: "^catch$"
-
-    arrow-spacing: 2
-    constructor-super: 2
-    no-confusing-arrow:
-        - 2
-        -
-            allowParens: true
-    no-class-assign: 2
-    no-const-assign: 2
-    # no-dupe-class-members: 2
-    no-this-before-super: 0
-    no-var: 2
-    no-duplicate-imports: 2
-    prefer-rest-params: 0
-    unicode-bom: 2
-    max-statements-per-line: 2
-
-    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
+    jQuery: false
+    Promise: false
+    __DEV__: true
+extends: '../.eslintrc-common.yaml'
diff --git a/src/.eslintrc.yaml b/src/.eslintrc.yaml
index 36b63c8..55b3af0 100644
--- a/src/.eslintrc.yaml
+++ b/src/.eslintrc.yaml
@@ -23,194 +23,7 @@ env:
     node: true
     es6: false
 globals:
-    jQuery: true
-    Promise: true
+    jQuery: false
+    Promise: false
     __DEV__: true
-rules:
-    # Check the rules in: node_modules/@typescript-eslint/eslint-plugin/README.md
-    no-console:
-        - 2
-        -
-            allow:
-                - "warn"
-                - "error"
-    prefer-const: 1
-    no-constant-condition: 0
-    comma-dangle: 2
-    no-debugger: 2
-    no-dupe-keys: 2
-    no-empty-character-class: 2
-    no-ex-assign: 2
-    no-extra-boolean-cast: 0
-    no-func-assign: 2
-    no-inner-declarations: 2
-    no-invalid-regexp: 2
-    no-negated-in-lhs: 2
-    no-obj-calls: 2
-    no-sparse-arrays: 2
-    no-unreachable: 2
-    use-isnan: 2
-    valid-typeof: 2
-    block-scoped-var: 2
-    curly:
-        - 2
-        - "all"
-    eqeqeq:
-        - 2
-        - "allow-null"
-    guard-for-in: 2
-    no-else-return: 0
-    no-labels:
-        - 2
-        -
-            allowLoop: true
-    no-eval: 2
-    no-extend-native: 2
-    no-extra-bind: 0
-    no-implied-eval: 2
-    no-iterator: 2
-    no-irregular-whitespace: 2
-    no-lone-blocks: 2
-    no-loop-func: 2
-    no-multi-str: 2
-    no-native-reassign: 2
-    no-new-wrappers: 2
-    no-octal: 2
-    no-octal-escape: 2
-    no-proto: 2
-    no-redeclare: 2
-    no-self-compare: 2
-    no-unneeded-ternary: 2
-    no-with: 2
-    radix: 2
-    wrap-iife:
-        - 2
-        - "any"
-    no-delete-var: 2
-    no-dupe-args: 2
-    no-duplicate-case: 2
-    no-label-var: 2
-    no-shadow-restricted-names: 2
-    no-undef: 2
-    no-undef-init: 2
-    "no-use-before-define": "off"
-    "@typescript-eslint/no-use-before-define": 0
-    brace-style:
-        - 2
-        - "stroustrup"
-        - {}
-    comma-spacing:
-        - 2
-        -
-            before: false
-            after: true
-    comma-style:
-        - 2
-        - "last"
-    new-parens: 2
-    no-array-constructor: 2
-    no-multi-spaces:
-        - 1
-        -
-            ignoreEOLComments: true
-            exceptions:
-                Property: true
-    no-new-object: 2
-    no-trailing-spaces: 2
-    no-extra-parens:
-        - 2
-        - "functions"
-    no-mixed-spaces-and-tabs: 2
-    one-var:
-        - 2
-        - "never"
-    operator-linebreak:
-        - 2
-        - "before"
-        -
-            overrides:
-                "=": "after"
-    "quotes": "off"
-    "@typescript-eslint/quotes":
-        - 2
-        - "single"
-    "semi": "off"
-    "@typescript-eslint/semi":
-        - 2
-        - "always"
-    semi-spacing: 2
-    keyword-spacing: 2
-    key-spacing:
-        - 2
-        -
-            beforeColon: false
-            afterColon: true
-    "space-before-function-paren": "off"
-    "@typescript-eslint/space-before-function-paren":
-        - 2
-        -
-            anonymous: "always"
-            named: "never"
-    space-before-blocks:
-        - 2
-        - "always"
-    computed-property-spacing:
-        - 2
-        - "never"
-    space-in-parens:
-        - 2
-        - "never"
-    space-unary-ops: 2
-    spaced-comment: 0
-
-    max-nested-callbacks:
-        - 1
-        - 5
-    max-depth:
-        - 1
-        - 6
-    max-len:
-        - 2
-        - 120
-        - 4
-        -
-            ignoreUrls: true
-            ignoreComments: true
-    max-params:
-        - 1
-        - 15
-
-    space-infix-ops: 2
-    dot-notation:
-        - 2
-        -
-            allowKeywords: true
-            allowPattern: "^catch$"
-
-    arrow-spacing: 2
-    constructor-super: 2
-    no-confusing-arrow:
-        - 2
-        -
-            allowParens: true
-    no-class-assign: 2
-    no-const-assign: 2
-    # no-dupe-class-members: 2
-    no-this-before-super: 0
-    no-var: 2
-    no-duplicate-imports: 2
-    prefer-rest-params: 0
-    unicode-bom: 2
-    max-statements-per-line: 2
-
-    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
+extends: '../.eslintrc-common.yaml'
diff --git a/test/ut/.eslintrc.yaml b/test/ut/.eslintrc.yaml
index 2f25b76..eadd55a 100644
--- a/test/ut/.eslintrc.yaml
+++ b/test/ut/.eslintrc.yaml
@@ -1,190 +1,34 @@
+# Note:
+# If eslint does not work in VSCode, please check:
+# (1) Whether "@typescript-eslint/eslint-plugin" and "@typescript-eslint/parser"
+# are npm installed locally. Should better in the same version.
+# (2) Whether "VSCode ESlint extension" is installed.
+# (3) If the project folder is not the root folder of your working space, please
+# config the "VSCode ESlint extension" in "settings":
+# ```json
+# "eslint.workingDirectories": [{"mode": "auto"}]
+# ```
+# Note that it should be "workingDirectories" rather than "WorkingDirectories".
+
+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: "test/ut/tsconfig.json"
+plugins: ["@typescript-eslint"]
 env:
-    browser: true
+    browser: false
     node: true
-    jest: true
     es6: false
 globals:
-    jQuery: true
+    jQuery: false
     Promise: true
-rules:
-    no-console:
-        - 2
-        -
-            allow:
-                - "warn"
-                - "error"
-    no-constant-condition: 0
-    comma-dangle: 2
-    no-debugger: 2
-    no-dupe-keys: 2
-    no-empty-character-class: 2
-    no-ex-assign: 2
-    no-extra-boolean-cast: 0
-    no-func-assign: 2
-    no-inner-declarations: 2
-    no-invalid-regexp: 2
-    no-negated-in-lhs: 2
-    no-obj-calls: 2
-    no-sparse-arrays: 2
-    no-unreachable: 2
-    use-isnan: 2
-    valid-typeof: 2
-    block-scoped-var: 0
-    curly:
-        - 2
-        - "all"
-    eqeqeq:
-        - 2
-        - "allow-null"
-    guard-for-in: 2
-    no-else-return: 0
-    no-labels:
-        - 2
-        -
-            allowLoop: true
-    no-eval: 2
-    no-extend-native: 2
-    no-extra-bind: 0
-    no-implied-eval: 2
-    no-iterator: 2
-    no-irregular-whitespace: 2
-    no-lone-blocks: 2
-    no-loop-func: 2
-    no-multi-str: 2
-    no-native-reassign: 2
-    no-new-wrappers: 2
-    no-octal: 2
-    no-octal-escape: 2
-    no-proto: 2
-    no-redeclare: 0
-    no-self-compare: 2
-    no-unneeded-ternary: 2
-    no-with: 2
-    radix: 2
-    wrap-iife:
-        - 2
-        - "any"
-    no-delete-var: 2
-    no-dupe-args: 2
-    no-duplicate-case: 2
-    no-label-var: 2
-    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
-    brace-style:
-        - 2
-        - "stroustrup"
-        - {}
-    comma-spacing:
-        - 2
-        -
-            before: false
-            after: true
-    comma-style:
-        - 2
-        - "last"
-    new-parens: 2
-    no-array-constructor: 2
-    no-multi-spaces:
-        - 2
-        -
-            ignoreEOLComments: true
-            exceptions:
-                Property: true
-    no-new-object: 2
-    no-spaced-func: 2
-    no-trailing-spaces: 2
-    no-extra-parens:
-        - 2
-        - "functions"
-    no-mixed-spaces-and-tabs: 2
-    one-var:
-        - 2
-        - "never"
-    operator-linebreak:
-        - 2
-        - "before"
-        -
-            overrides:
-                "=": "after"
-    quotes:
-        - 2
-        - "single"
-    semi:
-        - 2
-        - "always"
-    semi-spacing: 2
-    keyword-spacing: 2
-    key-spacing:
-        - 2
-        -
-            beforeColon: false
-            afterColon: true
-    space-before-function-paren:
-        - 2
-        -
-            anonymous: "always"
-            named: "never"
-    space-before-blocks:
-        - 2
-        - "always"
-    computed-property-spacing:
-        - 2
-        - "never"
-    space-in-parens:
-        - 2
-        - "never"
-    space-unary-ops: 2
-    spaced-comment: 0
-
-    max-nested-callbacks:
-        - 1
-        - 5
-    max-depth:
-        - 1
-        - 6
-    max-len:
-        - 2
-        - 120
-        - 4
-        -
-            ignoreUrls: true
-            ignoreComments: true
-    max-params:
-        - 1
-        - 15
-
-    space-infix-ops: 2
-    dot-notation:
-        - 2
-        -
-            allowKeywords: true
-            allowPattern: "^catch$"
-
-    arrow-spacing: 2
-    constructor-super: 2
-    no-confusing-arrow:
-        - 2
-        -
-            allowParens: true
-    no-class-assign: 2
-    no-const-assign: 2
-    no-dupe-class-members: 2
-    no-this-before-super: 0
-    no-var: 0
-    no-duplicate-imports: 2
-    prefer-rest-params: 0
-    unicode-bom: 2
-    max-statements-per-line: 2
-
-    no-useless-constructor: 0
\ No newline at end of file
+    __DEV__: true
+    describe: true
+    beforeEach: true
+    afterEach: true
+    it: true
+    expect: true
+extends: '../../.eslintrc-common.yaml'
diff --git a/test/ut/tsconfig.json b/test/ut/tsconfig.json
index e9b0b8c..08c1487 100644
--- a/test/ut/tsconfig.json
+++ b/test/ut/tsconfig.json
@@ -1,13 +1,16 @@
 {
     "compilerOptions": {
         "target": "ES3",
-        "noImplicitAny": true,
-        "strictBindCallApply": true,
 
+        "noImplicitAny": true,
         "noImplicitThis": true,
+        "strictBindCallApply": true,
+        "removeComments": true,
 
         // https://github.com/ezolenko/rollup-plugin-typescript2/issues/12#issuecomment-536173372
-        "moduleResolution": "Node",
+        "moduleResolution": "node",
+
+        "importHelpers": true,
 
         "pretty": true
     },


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


[incubator-echarts] 01/08: ts: rename ut file name from js to ts.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 444bc08bc6a403fac3b771a8da7c9a5bc0836d19
Author: 100pah <su...@gmail.com>
AuthorDate: Mon Oct 12 14:49:59 2020 +0800

    ts: rename ut file name from js to ts.
---
 test/ut/core/{extendExpect.js => extendExpect.ts}                         | 0
 test/ut/core/{setup.js => setup.ts}                                       | 0
 test/ut/core/{utHelper.js => utHelper.ts}                                 | 0
 test/ut/spec/api/{containPixel.test.js => containPixel.test.ts}           | 0
 test/ut/spec/api/{converter.test.js => converter.test.ts}                 | 0
 test/ut/spec/api/{getVisual.test.js => getVisual.test.ts}                 | 0
 test/ut/spec/component/dataZoom/{helper.test.js => helper.test.ts}        | 0
 test/ut/spec/component/graphic/{setOption.test.js => setOption.test.ts}   | 0
 test/ut/spec/component/helper/{sliderMove.test.js => sliderMove.test.ts}  | 0
 test/ut/spec/component/visualMap/{setOption.test.js => setOption.test.ts} | 0
 test/ut/spec/data/{List.test.js => List.test.ts}                          | 0
 .../spec/data/{completeDimensions.test.js => completeDimensions.test.ts}  | 0
 test/ut/spec/data/{dataValueHelper.test.js => dataValueHelper.test.ts}    | 0
 test/ut/spec/model/{Component.test.js => Component.test.ts}               | 0
 test/ut/spec/model/{Global.test.js => Global.test.ts}                     | 0
 .../model/{timelineMediaOptions.test.js => timelineMediaOptions.test.ts}  | 0
 test/ut/spec/scale/{interval.test.js => interval.test.ts}                 | 0
 test/ut/spec/util/{graphic.test.js => graphic.test.ts}                    | 0
 test/ut/spec/util/{layout.test.js => layout.test.ts}                      | 0
 test/ut/spec/util/{model.test.js => model.test.ts}                        | 0
 test/ut/spec/util/{number.test.js => number.test.ts}                      | 0
 21 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/test/ut/core/extendExpect.js b/test/ut/core/extendExpect.ts
similarity index 100%
rename from test/ut/core/extendExpect.js
rename to test/ut/core/extendExpect.ts
diff --git a/test/ut/core/setup.js b/test/ut/core/setup.ts
similarity index 100%
rename from test/ut/core/setup.js
rename to test/ut/core/setup.ts
diff --git a/test/ut/core/utHelper.js b/test/ut/core/utHelper.ts
similarity index 100%
rename from test/ut/core/utHelper.js
rename to test/ut/core/utHelper.ts
diff --git a/test/ut/spec/api/containPixel.test.js b/test/ut/spec/api/containPixel.test.ts
similarity index 100%
rename from test/ut/spec/api/containPixel.test.js
rename to test/ut/spec/api/containPixel.test.ts
diff --git a/test/ut/spec/api/converter.test.js b/test/ut/spec/api/converter.test.ts
similarity index 100%
rename from test/ut/spec/api/converter.test.js
rename to test/ut/spec/api/converter.test.ts
diff --git a/test/ut/spec/api/getVisual.test.js b/test/ut/spec/api/getVisual.test.ts
similarity index 100%
rename from test/ut/spec/api/getVisual.test.js
rename to test/ut/spec/api/getVisual.test.ts
diff --git a/test/ut/spec/component/dataZoom/helper.test.js b/test/ut/spec/component/dataZoom/helper.test.ts
similarity index 100%
rename from test/ut/spec/component/dataZoom/helper.test.js
rename to test/ut/spec/component/dataZoom/helper.test.ts
diff --git a/test/ut/spec/component/graphic/setOption.test.js b/test/ut/spec/component/graphic/setOption.test.ts
similarity index 100%
rename from test/ut/spec/component/graphic/setOption.test.js
rename to test/ut/spec/component/graphic/setOption.test.ts
diff --git a/test/ut/spec/component/helper/sliderMove.test.js b/test/ut/spec/component/helper/sliderMove.test.ts
similarity index 100%
rename from test/ut/spec/component/helper/sliderMove.test.js
rename to test/ut/spec/component/helper/sliderMove.test.ts
diff --git a/test/ut/spec/component/visualMap/setOption.test.js b/test/ut/spec/component/visualMap/setOption.test.ts
similarity index 100%
rename from test/ut/spec/component/visualMap/setOption.test.js
rename to test/ut/spec/component/visualMap/setOption.test.ts
diff --git a/test/ut/spec/data/List.test.js b/test/ut/spec/data/List.test.ts
similarity index 100%
rename from test/ut/spec/data/List.test.js
rename to test/ut/spec/data/List.test.ts
diff --git a/test/ut/spec/data/completeDimensions.test.js b/test/ut/spec/data/completeDimensions.test.ts
similarity index 100%
rename from test/ut/spec/data/completeDimensions.test.js
rename to test/ut/spec/data/completeDimensions.test.ts
diff --git a/test/ut/spec/data/dataValueHelper.test.js b/test/ut/spec/data/dataValueHelper.test.ts
similarity index 100%
rename from test/ut/spec/data/dataValueHelper.test.js
rename to test/ut/spec/data/dataValueHelper.test.ts
diff --git a/test/ut/spec/model/Component.test.js b/test/ut/spec/model/Component.test.ts
similarity index 100%
rename from test/ut/spec/model/Component.test.js
rename to test/ut/spec/model/Component.test.ts
diff --git a/test/ut/spec/model/Global.test.js b/test/ut/spec/model/Global.test.ts
similarity index 100%
rename from test/ut/spec/model/Global.test.js
rename to test/ut/spec/model/Global.test.ts
diff --git a/test/ut/spec/model/timelineMediaOptions.test.js b/test/ut/spec/model/timelineMediaOptions.test.ts
similarity index 100%
rename from test/ut/spec/model/timelineMediaOptions.test.js
rename to test/ut/spec/model/timelineMediaOptions.test.ts
diff --git a/test/ut/spec/scale/interval.test.js b/test/ut/spec/scale/interval.test.ts
similarity index 100%
rename from test/ut/spec/scale/interval.test.js
rename to test/ut/spec/scale/interval.test.ts
diff --git a/test/ut/spec/util/graphic.test.js b/test/ut/spec/util/graphic.test.ts
similarity index 100%
rename from test/ut/spec/util/graphic.test.js
rename to test/ut/spec/util/graphic.test.ts
diff --git a/test/ut/spec/util/layout.test.js b/test/ut/spec/util/layout.test.ts
similarity index 100%
rename from test/ut/spec/util/layout.test.js
rename to test/ut/spec/util/layout.test.ts
diff --git a/test/ut/spec/util/model.test.js b/test/ut/spec/util/model.test.ts
similarity index 100%
rename from test/ut/spec/util/model.test.js
rename to test/ut/spec/util/model.test.ts
diff --git a/test/ut/spec/util/number.test.js b/test/ut/spec/util/number.test.ts
similarity index 100%
rename from test/ut/spec/util/number.test.js
rename to test/ut/spec/util/number.test.ts


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


[incubator-echarts] 03/08: fix: fix that throw error if only a few components mounted.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4d7f549d94fa1e660a60734d578af3c294817310
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Oct 13 01:20:46 2020 +0800

    fix: fix that throw error if only a few components mounted.
---
 src/model/Global.ts   |  6 ++++--
 src/util/component.ts | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/model/Global.ts b/src/model/Global.ts
index b1f5dfb..0b97c8d 100644
--- a/src/model/Global.ts
+++ b/src/model/Global.ts
@@ -258,7 +258,7 @@ class GlobalModel extends Model<ECUnitOption> {
             // (1) for normal merge, `{xxx: null/undefined}` are the same meaning as `{xxx: []}`.
             // (2) some preprocessor may convert some of `{xxx: null/undefined}` to `{xxx: []}`.
             replaceMergeMainTypeMap.each(function (val, mainTypeInReplaceMerge) {
-                if (!newCmptTypeMap.get(mainTypeInReplaceMerge)) {
+                if (ComponentModel.hasClass(mainTypeInReplaceMerge) && !newCmptTypeMap.get(mainTypeInReplaceMerge)) {
                     newCmptTypes.push(mainTypeInReplaceMerge);
                     newCmptTypeMap.set(mainTypeInReplaceMerge, true);
                 }
@@ -755,7 +755,9 @@ class GlobalModel extends Model<ECUnitOption> {
         const componentsMap = this._componentsMap;
         const componentTypes: string[] = [];
         componentsMap.each(function (components, componentType) {
-            componentTypes.push(componentType);
+            if (ComponentModel.hasClass(componentType)) {
+                componentTypes.push(componentType);
+            }
         });
 
         (ComponentModel as ComponentModelConstructor).topologicalTravel(
diff --git a/src/util/component.ts b/src/util/component.ts
index 0c3e7c5..5433337 100644
--- a/src/util/component.ts
+++ b/src/util/component.ts
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
 import {parseClassType, ClassManager} from './clazz';
 import { ComponentOption, ComponentMainType, ComponentSubType, ComponentFullType } from './types';
 import { Dictionary } from 'zrender/src/core/types';
+import { makePrintable } from './log';
 
 // A random offset
 let base = Math.round(Math.random() * 10);
@@ -127,15 +128,15 @@ export function enableTopologicalTravel<T>(
 
         const result = makeDepndencyGraph(fullNameList);
         const graph = result.graph;
-        const stack = result.noEntryList;
+        const noEntryList = result.noEntryList;
 
         const targetNameSet: {[cmtpMainType: string]: boolean} = {};
         zrUtil.each(targetNameList, function (name) {
             targetNameSet[name] = true;
         });
 
-        while (stack.length) {
-            const currComponentType = stack.pop();
+        while (noEntryList.length) {
+            const currComponentType = noEntryList.pop();
             const currVertex = graph[currComponentType];
             const isInTargetNameSet = !!targetNameSet[currComponentType];
             if (isInTargetNameSet) {
@@ -149,13 +150,17 @@ export function enableTopologicalTravel<T>(
         }
 
         zrUtil.each(targetNameSet, function () {
-            throw new Error('Circle dependency may exists');
+            let errMsg = '';
+            if (__DEV__) {
+                errMsg = makePrintable('Circle dependency may exists: ', targetNameSet, targetNameList, fullNameList);
+            }
+            throw new Error(errMsg);
         });
 
         function removeEdge(succComponentType: ComponentMainType): void {
             graph[succComponentType].entryCount--;
             if (graph[succComponentType].entryCount === 0) {
-                stack.push(succComponentType);
+                noEntryList.push(succComponentType);
             }
         }
 


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


[incubator-echarts] 07/08: test: remove unnecessary jsdom dependency (it cause some prepublish issue). Use jest built-in jsdom.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 199a49e06a42dcf58cf6ed8422c132e81b86e447
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Oct 14 13:51:44 2020 +0800

    test: remove unnecessary jsdom dependency (it cause some prepublish issue). Use jest built-in jsdom.
---
 package.json           |  2 --
 test/ut/core/setup.ts  | 10 +++++-----
 test/ut/jest.config.js | 19 +++++++++----------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/package.json b/package.json
index dc5d55f..9863ad8 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,6 @@
     "@babel/types": "^7.10.5",
     "@microsoft/api-extractor": "7.7.2",
     "@types/jest": "^26.0.14",
-    "@types/jsdom": "^16.2.4",
     "@typescript-eslint/eslint-plugin": "^2.15.0",
     "@typescript-eslint/parser": "^2.18.0",
     "canvas": "^2.6.0",
@@ -58,7 +57,6 @@
     "husky": "^4.2.5",
     "jest": "^24.9.0",
     "jest-canvas-mock": "^2.2.0",
-    "jsdom": "^15.2.1",
     "jshint": "2.10.2",
     "lodash.debounce": "^4.0.8",
     "open": "6.4.0",
diff --git a/test/ut/core/setup.ts b/test/ut/core/setup.ts
index 7150e8e..479ea92 100644
--- a/test/ut/core/setup.ts
+++ b/test/ut/core/setup.ts
@@ -17,12 +17,12 @@
 * under the License.
 */
 
-import { JSDOM } from 'jsdom';
+// import { JSDOM } from 'jsdom';
 import { Image } from 'canvas';
 
-const { window } = new JSDOM();
+// const { window } = new JSDOM();
 
-(global as any).window = window;
-(global as any).navigator = window.navigator;
-(global as any).document = window.document;
+// (global as any).window = window;
+// (global as any).navigator = window.navigator;
+// (global as any).document = window.document;
 (global as any).Image = Image;
diff --git a/test/ut/jest.config.js b/test/ut/jest.config.js
index 6e22d94..a5fc425 100644
--- a/test/ut/jest.config.js
+++ b/test/ut/jest.config.js
@@ -19,7 +19,7 @@
 
 module.exports = {
     preset: 'ts-jest',
-    testEnvironment: 'node',
+    testEnvironment: 'jsdom',
     rootDir: __dirname,
     collectCoverage: true,
     setupFiles: [
@@ -33,14 +33,13 @@ module.exports = {
         '__DEV__': true
     },
     testMatch: [
-        '**/spec/api/containPixel.test.ts'
-        // '**/spec/api/*.test.ts',
-        // '**/spec/component/**/*.test.ts',
-        // '**/spec/data/*.test.ts',
-        // '**/spec/model/*.test.ts',
-        // '**/spec/scale/*.test.ts',
-        // '**/spec/util/*.test.ts',
-        // '!**/spec/api/containPixel.test.ts',
-        // '!**/spec/component/graphic/setOption.test.ts'
+        '**/spec/api/*.test.ts',
+        '**/spec/component/**/*.test.ts',
+        '**/spec/data/*.test.ts',
+        '**/spec/model/*.test.ts',
+        '**/spec/scale/*.test.ts',
+        '**/spec/util/*.test.ts',
+        '!**/spec/api/containPixel.test.ts',
+        '!**/spec/component/graphic/setOption.test.ts'
     ]
 };


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


[incubator-echarts] 02/08: ts: (1) Migrate ut to ts (spec/data). (2) ix related typing in src.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e8e8bcedf5ad4368c04d4759bc3cdc26f6b0ecc8
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Oct 13 00:18:59 2020 +0800

    ts: (1) Migrate ut to ts (spec/data). (2) ix related typing in src.
---
 src/chart/map/MapSeries.ts                   |   2 +-
 src/coord/geo/GeoModel.ts                    |   8 +-
 src/coord/geo/geoCreator.ts                  |  14 +-
 src/data/helper/dimensionHelper.ts           |   3 -
 src/util/types.ts                            |   2 +-
 test/ut/core/extendExpect.ts                 |   4 +-
 test/ut/core/setup.ts                        |  16 +--
 test/ut/core/utHelper.ts                     | 208 +++++++++++----------------
 test/ut/jest.config.js                       |  29 ++--
 test/ut/spec/data/List.test.ts               |  61 ++++----
 test/ut/spec/data/completeDimensions.test.ts | 127 +++++++++-------
 test/ut/spec/data/dataValueHelper.test.ts    |  54 ++++---
 test/ut/tsconfig.json                        |  20 +++
 13 files changed, 290 insertions(+), 258 deletions(-)

diff --git a/src/chart/map/MapSeries.ts b/src/chart/map/MapSeries.ts
index 0354b4d..47a7e8f 100644
--- a/src/chart/map/MapSeries.ts
+++ b/src/chart/map/MapSeries.ts
@@ -86,7 +86,7 @@ export interface MapSeriesOption extends
     data?: OptionDataValueNumeric[] | OptionDataValueNumeric[][] | MapDataItemOption[]
 
 
-    nameProperty: string;
+    nameProperty?: string;
 }
 
 class MapSeries extends SeriesModel<MapSeriesOption> {
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index fdfa649..d874a36 100644
--- a/src/coord/geo/GeoModel.ts
+++ b/src/coord/geo/GeoModel.ts
@@ -72,8 +72,10 @@ export interface GeoCommonOptionMixin extends RoamOptionMixin {
     ///// Layout with center and size
     // If you wan't to put map in a fixed size box with right aspect ratio
     // This two properties may more conveninet
-    layoutCenter?: number[];
-    layoutSize?: number;
+    // Like: `40` or `'50%'`.
+    layoutCenter?: (number | string)[];
+    // Like: `40` or `'50%'`.
+    layoutSize?: number | string;
 
     // Define left-top, right-bottom coords to control view
     // For example, [ [180, 90], [-180, -90] ]
@@ -94,7 +96,7 @@ export interface GeoOption extends
     show?: boolean;
     silent?: boolean;
 
-    regions: RegoinOption[];
+    regions?: RegoinOption[];
 
     stateAnimation?: AnimationOptionMixin
 
diff --git a/src/coord/geo/geoCreator.ts b/src/coord/geo/geoCreator.ts
index 46ac7ad..b692094 100644
--- a/src/coord/geo/geoCreator.ts
+++ b/src/coord/geo/geoCreator.ts
@@ -59,8 +59,8 @@ function resizeGeo(this: Geo, geoModel: ComponentModel<GeoOption | MapSeriesOpti
 
     const rect = this.getBoundingRect();
 
-    let center = geoModel.get('layoutCenter');
-    let size = geoModel.get('layoutSize');
+    const centerOption = geoModel.get('layoutCenter');
+    const sizeOption = geoModel.get('layoutSize');
 
     const viewWidth = api.getWidth();
     const viewHeight = api.getHeight();
@@ -68,13 +68,15 @@ function resizeGeo(this: Geo, geoModel: ComponentModel<GeoOption | MapSeriesOpti
     const aspect = rect.width / rect.height * this.aspectScale;
 
     let useCenterAndSize = false;
+    let center: number[];
+    let size: number;
 
-    if (center && size) {
+    if (centerOption && sizeOption) {
         center = [
-            numberUtil.parsePercent(center[0], viewWidth),
-            numberUtil.parsePercent(center[1], viewHeight)
+            numberUtil.parsePercent(centerOption[0], viewWidth),
+            numberUtil.parsePercent(centerOption[1], viewHeight)
         ];
-        size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight));
+        size = numberUtil.parsePercent(sizeOption, Math.min(viewWidth, viewHeight));
 
         if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
             useCenterAndSize = true;
diff --git a/src/data/helper/dimensionHelper.ts b/src/data/helper/dimensionHelper.ts
index 98805ac..b38062d 100644
--- a/src/data/helper/dimensionHelper.ts
+++ b/src/data/helper/dimensionHelper.ts
@@ -100,9 +100,6 @@ export function summarizeDimensions(data: List): DimensionSummary {
 
     notExtraCoordDimMap.each(function (v, coordDim) {
         const dimArr = encode[coordDim];
-        // ??? FIXME extra coord should not be set in dataDimsOnCoord.
-        // But should fix the case that radar axes: simplify the logic
-        // of `completeDimension`, remove `extraPrefix`.
         encodeFirstDimNotExtra[coordDim] = dimArr[0];
         // Not necessary to remove duplicate, because a data
         // dim canot on more than one coordDim.
diff --git a/src/util/types.ts b/src/util/types.ts
index 77ed47e..cc869e6 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -353,7 +353,7 @@ export interface DataVisualDimensions {
 
 export type DimensionDefinition = {
     type?: ListDimensionType,
-    name: DimensionName,
+    name?: DimensionName,
     displayName?: string
 };
 export type DimensionDefinitionLoose = DimensionDefinition['name'] | DimensionDefinition;
diff --git a/test/ut/core/extendExpect.ts b/test/ut/core/extendExpect.ts
index 736476c..c71b53e 100644
--- a/test/ut/core/extendExpect.ts
+++ b/test/ut/core/extendExpect.ts
@@ -18,13 +18,13 @@
 * under the License.
 */
 
+import { isValueFinite } from './utHelper';
 
-const utHelper = require('./utHelper');
 
 // Setup expectes
 expect.extend({
     toBeFinite(received) {
-        const passed = utHelper.isValueFinite(received);
+        const passed = isValueFinite(received);
         return {
             message: passed
                 ? () => `expected ${received} not to be finite`
diff --git a/test/ut/core/setup.ts b/test/ut/core/setup.ts
index b3d483f..7150e8e 100644
--- a/test/ut/core/setup.ts
+++ b/test/ut/core/setup.ts
@@ -17,12 +17,12 @@
 * under the License.
 */
 
-const jsdom = require('jsdom');
-const Canvas = require('canvas');
-const {JSDOM} = jsdom;
-const {window} = new JSDOM();
+import { JSDOM } from 'jsdom';
+import { Image } from 'canvas';
 
-global.window = window;
-global.navigator = window.navigator;
-global.document = window.document;
-global.Image = Canvas.Image;
+const { window } = new JSDOM();
+
+(global as any).window = window;
+(global as any).navigator = window.navigator;
+(global as any).document = window.document;
+(global as any).Image = Image;
diff --git a/test/ut/core/utHelper.ts b/test/ut/core/utHelper.ts
index 3e10126..e485471 100755
--- a/test/ut/core/utHelper.ts
+++ b/test/ut/core/utHelper.ts
@@ -17,146 +17,109 @@
 * under the License.
 */
 
-/**
- * @public
- * @type {Object}
- */
-var echarts = require('../../../index');
-
-var utHelper = {};
-
-var nativeSlice = Array.prototype.slice;
-
-utHelper.createChart = function (width, height, theme, opts) {
-    var el = document.createElement('div');
+import { init, EChartsType } from '../../../src/echarts';
+import {
+    curry as zrUtilCurry,
+    bind as zrUtilBind,
+    extend as zrUtilExtend
+} from 'zrender/src/core/util';
+import { ComponentMainType } from '../../../src/util/types';
+import Group from 'zrender/src/graphic/Group';
+import Element from 'zrender/src/Element';
+
+
+export function createChart(params: {
+    width?: number,
+    height?: number,
+    theme?: Parameters<typeof init>[1],
+    opts?: Parameters<typeof init>[2]
+}): EChartsType {
+    const el = document.createElement('div');
     el.style.cssText = [
         'visibility:hidden',
-        'width:' + (width || '500') + 'px',
-        'height:' + (height || '400') + 'px',
+        'width:' + (params.width || '500') + 'px',
+        'height:' + (params.height || '400') + 'px',
         'position:absolute',
         'bottom:0',
         'right:0'
     ].join(';');
-    var chart = echarts.init(el, theme, opts);
+    const chart = init(el, params.theme, params.opts);
     return chart;
 };
 
-/**
- * @public
- */
-utHelper.removeChart = function (chart) {
+export function removeChart(chart: EChartsType): void {
     chart.dispose();
 };
 
-/**
- * @param {*} target
- * @param {*} source
- */
-utHelper.extend = function (target, source) {
-    for (var key in source) {
-        if (source.hasOwnProperty(key)) {
-            target[key] = source[key];
-        }
-    }
-    return target;
-};
+export const extend = zrUtilExtend;
 
-/**
- * @public
- */
-utHelper.g = function (id) {
+export function g(id: string): HTMLElement {
     return document.getElementById(id);
-};
+}
 
-/**
- * @public
- */
-utHelper.removeEl = function (el) {
-    var parent = utHelper.parentEl(el);
+export function removeEl(el: HTMLElement): void {
+    const parent = utHelper.parentEl(el);
     parent && parent.removeChild(el);
-};
+}
 
-/**
- * @public
- */
-utHelper.parentEl = function (el) {
+export function parentEl(el: HTMLElement): HTMLElement {
     //parentElement for ie.
-    return el.parentElement || el.parentNode;
-};
+    return el.parentElement || el.parentNode as HTMLElement;
+}
 
-/**
- * 得到head
- *
- * @public
- */
-utHelper.getHeadEl = function (s) {
+export function getHeadEl(): HTMLElement {
     return document.head
         || document.getElementsByTagName('head')[0]
         || document.documentElement;
-};
-
-/**
- * @public
- */
-utHelper.curry = function (func) {
-    var args = nativeSlice.call(arguments, 1);
-    return function () {
-        return func.apply(this, args.concat(nativeSlice.call(arguments)));
-    };
-};
-
-/**
- * @public
- */
-utHelper.bind = function (func, context) {
-    var args = nativeSlice.call(arguments, 2);
-    return function () {
-        return func.apply(context, args.concat(nativeSlice.call(arguments)));
-    };
-};
-
-/**
- * @public
- */
-utHelper.isValueFinite = function (val) {
-    return val != null && val !== '' && isFinite(val);
-};
-
-/**
- * @public
- * @param {Array.<string>} deps
- * @param {Array.<Function>} testFnList
- * @param {Function} done All done callback.
- */
-utHelper.resetAMDLoaderEachTest = function (deps, testFnList, done) {
-    var i = -1;
-    next();
-
-    function next() {
-        i++;
-        if (testFnList.length <= i) {
-            done();
-            return;
-        }
-
-        utHelper.resetAMDLoader(function () {
-            global.require(deps, function () {
-                testFnList[i].apply(null, arguments);
-                next();
-            });
-        });
-    }
-};
-
-utHelper.getGraphicElements = function (chartOrGroup, mainType, index) {
-    if (chartOrGroup.type === 'group') {
-        return chartOrGroup.children();
+}
+
+export const curry = zrUtilCurry;
+
+export const bind = zrUtilBind;
+
+export function isValueFinite(val: unknown): boolean {
+    return val != null && val !== '' && isFinite(val as number);
+}
+
+// /**
+//  * @public
+//  * @param {Array.<string>} deps
+//  * @param {Array.<Function>} testFnList
+//  * @param {Function} done All done callback.
+//  */
+// export function resetAMDLoaderEachTest(deps, testFnList, done) {
+//     const i = -1;
+//     next();
+
+//     function next() {
+//         i++;
+//         if (testFnList.length <= i) {
+//             done();
+//             return;
+//         }
+
+//         utHelper.resetAMDLoader(function () {
+//             global.require(deps, function () {
+//                 testFnList[i].apply(null, arguments);
+//                 next();
+//             });
+//         });
+//     }
+// };
+
+export function getGraphicElements(
+    chartOrGroup: EChartsType | Group,
+    mainType: ComponentMainType,
+    index: number
+): Element[] {
+    if ((chartOrGroup as Group).type === 'group') {
+        return (chartOrGroup as Group).children();
     }
     else {
-        var viewGroup = utHelper.getViewGroup(chartOrGroup, mainType, index);
+        const viewGroup = utHelper.getViewGroup(chartOrGroup, mainType, index);
         if (viewGroup) {
-            var list = [viewGroup];
-            viewGroup.traverse(function (el) {
+            const list = [viewGroup];
+            viewGroup.traverse(function (el: Element) {
                 list.push(el);
             });
             return list;
@@ -165,13 +128,16 @@ utHelper.getGraphicElements = function (chartOrGroup, mainType, index) {
             return [];
         }
     }
-};
-
-utHelper.getViewGroup = function (chart, mainType, index) {
-    var component = chart.getModel().getComponent(mainType, index);
+}
+
+export function getViewGroup(
+    chart: EChartsType,
+    mainType: ComponentMainType,
+    index: number
+): Group {
+    const component = chart.getModel().getComponent(mainType, index);
     return component ? chart[
         mainType === 'series' ? '_chartsMap' : '_componentsMap'
     ][component.__viewId].group : null;
-};
+}
 
-module.exports = utHelper;
diff --git a/test/ut/jest.config.js b/test/ut/jest.config.js
index 5ba7fea..6e22d94 100644
--- a/test/ut/jest.config.js
+++ b/test/ut/jest.config.js
@@ -17,27 +17,30 @@
 * under the License.
 */
 
-const path = require('path');
-
 module.exports = {
+    preset: 'ts-jest',
     testEnvironment: 'node',
-    rootDir: path.resolve(__dirname, '../../'),
+    rootDir: __dirname,
     collectCoverage: true,
     setupFiles: [
         'jest-canvas-mock',
-        '<rootDir>/test/ut/core/setup.js'
+        '<rootDir>/core/setup.ts'
     ],
     setupFilesAfterEnv: [
-        '<rootDir>/test/ut/core/extendExpect.js'
+        '<rootDir>/core/extendExpect.ts'
     ],
+    globals: {
+        '__DEV__': true
+    },
     testMatch: [
-        '**/spec/api/*.test.js',
-        '**/spec/component/**/*.test.js',
-        '**/spec/data/*.test.js',
-        '**/spec/model/*.test.js',
-        '**/spec/scale/*.test.js',
-        '**/spec/util/*.test.js',
-        '!**/spec/api/containPixel.test.js',
-        '!**/spec/component/graphic/setOption.test.js'
+        '**/spec/api/containPixel.test.ts'
+        // '**/spec/api/*.test.ts',
+        // '**/spec/component/**/*.test.ts',
+        // '**/spec/data/*.test.ts',
+        // '**/spec/model/*.test.ts',
+        // '**/spec/scale/*.test.ts',
+        // '**/spec/util/*.test.ts',
+        // '!**/spec/api/containPixel.test.ts',
+        // '!**/spec/component/graphic/setOption.test.ts'
     ]
 };
diff --git a/test/ut/spec/data/List.test.ts b/test/ut/spec/data/List.test.ts
index 6061311..c60e804 100644
--- a/test/ut/spec/data/List.test.ts
+++ b/test/ut/spec/data/List.test.ts
@@ -17,14 +17,19 @@
 * specific language governing permissions and limitations
 * under the License.
 */
-const Source = require('../../../../lib/data/Source');
-const List = require('../../../../lib/data/List');
+
+import List from '../../../../src/data/List';
+import Model from '../../../../src/model/Model';
+import { createSourceFromSeriesDataOption } from '../../../../src/data/Source';
+
+
+
 describe('List', function () {
 
     describe('Data Manipulation', function () {
 
         it('initData 1d', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([10, 20, 30]);
             expect(list.get('x', 0)).toEqual(10);
             expect(list.get('x', 1)).toEqual(20);
@@ -33,41 +38,41 @@ describe('List', function () {
         });
 
         it('initData 2d', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([[10, 15], [20, 25], [30, 35]]);
             expect(list.get('x', 1)).toEqual(20);
             expect(list.get('y', 1)).toEqual(25);
         });
 
         it('initData 2d yx', function () {
-            var list = new List(['y', 'x']);
+            const list = new List(['y', 'x'], new Model());
             list.initData([[10, 15], [20, 25], [30, 35]]);
             expect(list.get('x', 1)).toEqual(25);
             expect(list.get('y', 1)).toEqual(20);
         });
 
         it('Data with option 1d', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([1, {
                 value: 2,
                 somProp: 'foo'
             }]);
-            expect(list.getItemModel(1).get('somProp')).toEqual('foo');
-            expect(list.getItemModel(0).get('somProp')).toBeNull();
+            expect(list.getItemModel(1).get('somProp' as any)).toEqual('foo');
+            expect(list.getItemModel(0).get('somProp' as any)).toBeNull();
         });
 
         it('Empty data', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([1, '-']);
             expect(list.get('y', 1)).toBeNaN();
         });
 
         it('getRawValue', function () {
-            var list1 = new List(['x', 'y']);
+            const list1 = new List(['x', 'y'], new Model());
             // here construct a new list2 because if we only use one list
             // to call initData() twice, list._chunkCount will be accumulated
             // to 1 instead of 0.
-            var list2 = new List(['x', 'y']);
+            const list2 = new List(['x', 'y'], new Model());
 
             list1.initData([1, 2, 3]);
             expect(list1.getItemModel(1).option).toEqual(2);
@@ -77,22 +82,22 @@ describe('List', function () {
         });
 
         it('indexOfRawIndex', function () {
-            var list = new List(['x']);
+            const list = new List(['x'], new Model());
             list.initData([]);
             expect(list.indexOfRawIndex(1)).toEqual(-1);
 
-            var list1 = new List(['x']);
+            const list1 = new List(['x'], new Model());
             list1.initData([0]);
             expect(list1.indexOfRawIndex(0)).toEqual(0);
             expect(list1.indexOfRawIndex(1)).toEqual(-1);
 
-            var list2 = new List(['x']);
+            const list2 = new List(['x'], new Model());
             list2.initData([0, 1, 2, 3]);
             expect(list2.indexOfRawIndex(1)).toEqual(1);
             expect(list2.indexOfRawIndex(2)).toEqual(2);
             expect(list2.indexOfRawIndex(5)).toEqual(-1);
 
-            var list3 = new List(['x']);
+            const list3 = new List(['x'], new Model());
             list3.initData([0, 1, 2, 3, 4]);
             expect(list3.indexOfRawIndex(2)).toEqual(2);
             expect(list3.indexOfRawIndex(3)).toEqual(3);
@@ -105,29 +110,29 @@ describe('List', function () {
         });
 
         it('getDataExtent', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([1, 2, 3]);
             expect(list.getDataExtent('x')).toEqual([1, 3]);
             expect(list.getDataExtent('y')).toEqual([1, 3]);
         });
 
         it('Data types', function () {
-            var list = new List([{
+            const list = new List([{
                 name: 'x',
                 type: 'int'
             }, {
                 name: 'y',
                 type: 'float'
-            }]);
+            }], new Model());
             list.initData([[1.1, 1.1]]);
             expect(list.get('x', 0)).toEqual(1);
             expect(list.get('y', 0)).toBeCloseTo(1.1, 5);
         });
 
         it('map', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([[10, 15], [20, 25], [30, 35]]);
-            expect(list.map(['x', 'y'], function (x, y) {
+            expect(list.map(['x', 'y'], function (x: number, y: number) {
                 return [x + 2, y + 2];
             }).mapArray('x', function (x) {
                 return x;
@@ -135,7 +140,7 @@ describe('List', function () {
         });
 
         it('mapArray', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([[10, 15], [20, 25], [30, 35]]);
             expect(list.mapArray(['x', 'y'], function (x, y) {
                 return [x, y];
@@ -143,7 +148,7 @@ describe('List', function () {
         });
 
         it('filterSelf', function () {
-            var list = new List(['x', 'y']);
+            const list = new List(['x', 'y'], new Model());
             list.initData([[10, 15], [20, 25], [30, 35]]);
             expect(list.filterSelf(['x', 'y'], function (x, y) {
                 return x < 30 && x > 10;
@@ -153,14 +158,14 @@ describe('List', function () {
         });
 
         it('dataProvider', function () {
-            var list = new List(['x', 'y']);
-            var typedArray = new Float32Array([10, 10, 20, 20]);
-            var source = Source.seriesDataToSource(typedArray);
+            const list = new List(['x', 'y'], new Model());
+            const typedArray = new Float32Array([10, 10, 20, 20]);
+            const source = createSourceFromSeriesDataOption(typedArray);
             list.initData({
                 count: function () {
                     return typedArray.length / 2;
                 },
-                getItem: function (idx) {
+                getItem: function (idx: number) {
                     return [typedArray[idx * 2], typedArray[idx * 2 + 1]];
                 },
                 getSource: function () {
@@ -177,7 +182,7 @@ describe('List', function () {
 
     describe('Data read', function () {
         it('indicesOfNearest', function () {
-            var list = new List(['value']);
+            const list = new List(['value'], new Model());
             // ---- index: 0   1   2   3   4   5   6   7
             list.initData([10, 20, 30, 35, 40, 40, 35, 50]);
 
@@ -194,4 +199,4 @@ describe('List', function () {
             expect(list.indicesOfNearest('value', 50.5, 0.5)).toEqual([7]);
         });
     });
-});
\ No newline at end of file
+});
diff --git a/test/ut/spec/data/completeDimensions.test.ts b/test/ut/spec/data/completeDimensions.test.ts
index eb9c308..9395d0c 100644
--- a/test/ut/spec/data/completeDimensions.test.ts
+++ b/test/ut/spec/data/completeDimensions.test.ts
@@ -1,4 +1,3 @@
-
 /*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
@@ -17,19 +16,27 @@
 * specific language governing permissions and limitations
 * under the License.
 */
-const completeDimensions = require('../../../../lib/data/helper/completeDimensions');
-const Source = require('../../../../lib/data/Source');
-const types = require('../../../../lib/util/types');
+
+
+import completeDimensions from '../../../../src/data/helper/completeDimensions';
+import { createSource } from '../../../../src/data/Source';
+import { SOURCE_FORMAT_ARRAY_ROWS, SERIES_LAYOUT_BY_COLUMN } from '../../../../src/util/types';
+
+type ParametersOfCompleteDimensions = Parameters<typeof completeDimensions>;
 
 describe('completeDimensions', function () {
 
-    function doCompleteDimensions(completeDimensions, sysDims, data, opt) {
-        var result = completeDimensions(sysDims, data, opt);
+    function doCompleteDimensions(
+        sysDims: ParametersOfCompleteDimensions[0],
+        data: ParametersOfCompleteDimensions[1],
+        opt: ParametersOfCompleteDimensions[2]
+    ) {
+        const result = completeDimensions(sysDims, data, opt);
         if (result) {
-            for (var i = 0; i < result.length; i++) {
-                var item = result[i];
-                if (item && item.hasOwnProperty('dimsDef') && item.dimsDef == null) {
-                    delete item.dimsDef;
+            for (let i = 0; i < result.length; i++) {
+                const item = result[i];
+                if (item && item.hasOwnProperty('dimsDef') && (item as any).dimsDef == null) {
+                    delete (item as any).dimsDef;
                 }
             }
         }
@@ -37,12 +44,12 @@ describe('completeDimensions', function () {
     }
 
     it('namesMoreThanDimCount', function () {
-        var sysDims = [
+        const sysDims = [
             {
                 'name': 'x',
-                'type': 'ordinal',
+                'type': 'ordinal' as const,
                 'otherDims': {
-                    'tooltip': false,
+                    'tooltip': false as const,
                     'itemName': 0
                 },
                 'dimsDef': [
@@ -51,7 +58,7 @@ describe('completeDimensions', function () {
             },
             {
                 'name': 'y',
-                'type': 'float',
+                'type': 'float' as const,
                 'dimsDef': [
                     'open',
                     'close',
@@ -61,14 +68,20 @@ describe('completeDimensions', function () {
             }
         ];
 
-        var source = new Source({
-            data: [],
-            fromDataset: true,
-            sourceFormat: types.SOURCE_FORMAT_ARRAY_ROWS,
-            dimensionsDetectCount: 11
-        });
+        const source = createSource(
+            [
+                [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
+            ],
+            {
+                seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,
+                sourceHeader: 0,
+                dimensions: void 0
+            },
+            SOURCE_FORMAT_ARRAY_ROWS,
+            null
+        )
 
-        var opt = {
+        const opt = {
             'dimsDef': [
                 {
                     'name': 'date',
@@ -133,7 +146,7 @@ describe('completeDimensions', function () {
             'dimCount': 5
         };
 
-        var result = [
+        const result: unknown = [
             {
                 'otherDims': {
                     'tooltip': false,
@@ -240,13 +253,18 @@ describe('completeDimensions', function () {
             }
         ];
 
-        expect(doCompleteDimensions(completeDimensions, sysDims, source, opt)).toEqual(result);
+        expect(doCompleteDimensions(sysDims, source, opt)).toEqual(result);
     });
 
 
     it('differentData', function () {
-        function doTest(sysDims, data, opt, result) {
-            expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
+        function doTest(
+            sysDims: ParametersOfCompleteDimensions[0],
+            data: ParametersOfCompleteDimensions[1],
+            opt: ParametersOfCompleteDimensions[2],
+            result: unknown
+        ) {
+            expect(doCompleteDimensions(sysDims, data, opt)).toEqual(result);
         }
 
         // test dimcount
@@ -372,11 +390,16 @@ describe('completeDimensions', function () {
 
 
     it('differentSysDims', function () {
-        function doTest(sysDims, data, opt, result) {
-            expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
+        function doTest(
+            sysDims: ParametersOfCompleteDimensions[0],
+            data: ParametersOfCompleteDimensions[1],
+            opt: ParametersOfCompleteDimensions[2],
+            result: unknown
+        ) {
+            expect(doCompleteDimensions(sysDims, data, opt)).toEqual(result);
         }
 
-        var data = [
+        const data = [
             ['iw', 332, 4434, 323, 59],
             ['vrr', 44, 11, 144, 55]
         ];
@@ -414,13 +437,14 @@ describe('completeDimensions', function () {
         );
 
         doTest(
-            [{name: 'time', type: 'time', stackable: false}, 'value'], data, null,
+            [{name: 'time', type: 'time' as const}, 'value'],
+            data,
+            null,
             [
                 {
                     'otherDims': {},
                     'name': 'time',
                     'type': 'time',
-                    'stackable': false,
                     'coordDimIndex': 0,
                     'ordinalMeta': undefined,
                     'coordDim': 'time'
@@ -580,11 +604,16 @@ describe('completeDimensions', function () {
 
 
     it('dimsDef', function () {
-        function doTest(sysDims, data, opt, result) {
-            expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
+        function doTest(
+            sysDims: ParametersOfCompleteDimensions[0],
+            data: ParametersOfCompleteDimensions[1],
+            opt: ParametersOfCompleteDimensions[2],
+            result: unknown
+        ) {
+            expect(doCompleteDimensions(sysDims, data, opt)).toEqual(result);
         }
 
-        var data = [['iw', 332, 4434, 323, 59], ['vrr', 44, 11, 144, 55]];
+        const data = [['iw', 332, 4434, 323, 59], ['vrr', 44, 11, 144, 55]];
         doTest(
             ['x', 'y', 'value'], data,
             {dimsDef: ['挨克思', null, '歪溜']},
@@ -615,7 +644,7 @@ describe('completeDimensions', function () {
 
         doTest(
             ['x', 'y', 'value'], data,
-            {dimsDef: ['挨克思', null, {type: 'ordinal'}]}, // no name but only type
+            {dimsDef: ['挨克思', null, {type: 'ordinal' as const}]}, // no name but only type
             [
                 {
                     'otherDims': {},
@@ -642,7 +671,7 @@ describe('completeDimensions', function () {
         );
 
         doTest(
-            [{name: 'time', type: 'time', stackable: false}, 'value'], data,
+            [{name: 'time', type: 'time' as const}, 'value'], data,
             {dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}]},
             [
                 {
@@ -650,7 +679,6 @@ describe('completeDimensions', function () {
                     'displayName': '泰亩',
                     'name': '泰亩',
                     'type': 'ordinal',
-                    'stackable': false,
                     'ordinalMeta': undefined,
                     'coordDimIndex': 0,
                     'coordDim': 'time'
@@ -676,11 +704,16 @@ describe('completeDimensions', function () {
 
 
     it('encodeDef', function () {
-        function doTest(sysDims, data, opt, result) {
-            expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
+        function doTest(
+            sysDims: ParametersOfCompleteDimensions[0],
+            data: ParametersOfCompleteDimensions[1],
+            opt: ParametersOfCompleteDimensions[2],
+            result: unknown
+        ) {
+            expect(doCompleteDimensions(sysDims, data, opt)).toEqual(result);
         }
 
-        var data = [['iw', 332, 4434, 323, 'd8', 59], ['vrr', 44, 11, 144, '-', 55]];
+        const data = [['iw', 332, 4434, 323, 'd8', 59], ['vrr', 44, 11, 144, '-', 55]];
 
         doTest(
             null, data,
@@ -744,7 +777,7 @@ describe('completeDimensions', function () {
         );
 
         doTest(
-            ['x', {name: 'y', type: 'time', stackable: false}, 'z'], data,
+            ['x', {name: 'y', type: 'time' as const}, 'z'], data,
             {
                 dimsDef: ['挨克思', null, '歪溜'],
                 encodeDef: {
@@ -769,7 +802,6 @@ describe('completeDimensions', function () {
                     'coordDimIndex': 0,
                     'name': 'y',
                     'type': 'time',
-                    'stackable': false,
                     'ordinalMeta': undefined
                 },
                 {
@@ -785,14 +817,13 @@ describe('completeDimensions', function () {
         );
 
         doTest(
-            [{name: 'time', type: 'time', stackable: false}, 'value'], data,
+            [{name: 'time', type: 'time' as const}, 'value'], data,
             {
                 // dimsDef type 'ordinal' has higher priority then sysDims type 'time'.
                 dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}],
                 encodeDef: {
                     tooltip: 2
-                },
-                extraPrefix: 'aaa'
+                }
             },
             [
                 {
@@ -800,7 +831,6 @@ describe('completeDimensions', function () {
                     'displayName': '泰亩',
                     'name': '泰亩',
                     'type': 'ordinal',
-                    'stackable': false,
                     'ordinalMeta': undefined,
                     'coordDimIndex': 0,
                     'coordDim': 'time'
@@ -817,15 +847,13 @@ describe('completeDimensions', function () {
         );
 
         doTest(
-            [{name: 'time', type: 'time', stackable: false}, 'value'], data,
+            [{name: 'time', type: 'time' as const}, 'value'], data,
             {
                 // dimsDef type 'ordinal' has higher priority then sysDims type 'time'.
                 dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}],
                 encodeDef: {
                     tooltip: 2
-                },
-                extraPrefix: 'aaa',
-                extraFromZero: true
+                }
             },
             [
                 {
@@ -833,7 +861,6 @@ describe('completeDimensions', function () {
                     'displayName': '泰亩',
                     'name': '泰亩',
                     'type': 'ordinal',
-                    'stackable': false,
                     'ordinalMeta': undefined,
                     'coordDimIndex': 0,
                     'coordDim': 'time'
diff --git a/test/ut/spec/data/dataValueHelper.test.ts b/test/ut/spec/data/dataValueHelper.test.ts
index 2ab3b30..729395c 100644
--- a/test/ut/spec/data/dataValueHelper.test.ts
+++ b/test/ut/spec/data/dataValueHelper.test.ts
@@ -18,7 +18,8 @@
 */
 
 
-const dataValueHelper = require('../../../../lib/data/helper/dataValueHelper');
+import * as dataValueHelper from '../../../../src/data/helper/dataValueHelper';
+
 
 const NO_SUCH_CASE = 'NO_SUCH_CASE';
 
@@ -35,7 +36,15 @@ const TAG = {
     BothIncmpr_NotEQ: 'BothIncmpr_NotEQ',
     L_Incmpr_R_NumberOrString: 'L_Incmpr_R_NumberOrString',
     R_Incmpr_L_NumberOrString: 'R_Incmpr_L_NumberOrString'
-};
+} as const;
+
+type CaseTag = typeof TAG[keyof typeof TAG];
+
+type Operation = 'lt' | 'lte' | 'gt' | 'gte' | 'eq' | 'ne';
+type Order = 'asc' | 'desc';
+type Incomparable = 'min' | 'max';
+
+
 const tagRevertPairs = [
     ['BothNumeric_AtLeastOneNumber_L_LT_R', 'BothNumeric_AtLeastOneNumber_L_GT_R'],
     ['BothString_L_LT_R', 'BothString_L_GT_R'],
@@ -44,7 +53,7 @@ const tagRevertPairs = [
     ['BothNumeric_OneNumber_NumericEQ', 'BothNumeric_OneNumber_NumericEQ'],
     ['BothIncmpr_NotEQ', 'BothIncmpr_NotEQ'],
     ['L_Incmpr_R_NumberOrString', 'R_Incmpr_L_NumberOrString']
-];
+] as const;
 
 const filterResultMap = {
     BothNumeric_AtLeastOneNumber_L_LT_R: {
@@ -127,7 +136,7 @@ const filterResultMap = {
         eq: false,
         ne: true
     }
-};
+} as const;
 
 const sortResultMap = {
     BothNumeric_AtLeastOneNumber_L_LT_R: {
@@ -190,12 +199,11 @@ const sortResultMap = {
         desc_incmprmin: -1,
         desc_incmprmax: 1
     }
-};
+} as const;
+
+type EvaluateFunction = (lval: unknown, rval: unknown, caseTag: CaseTag) => void;
 
-/**
- * @param {(lval: unknown, rval: unknown, caseTag: TAG) => void} evalFn
- */
-function eachRelationalComparisonCase(evalFn) {
+function eachRelationalComparisonCase(evalFn: EvaluateFunction) {
 
     const FULL_WIDTH_SPACE = String.fromCharCode(12288);
 
@@ -300,7 +308,7 @@ function eachRelationalComparisonCase(evalFn) {
 
         equalOtherTypes: function () {
             const emptyObj = {};
-            const emptyArr = [];
+            const emptyArr = [] as unknown[];
             const date = new Date(2012, 5, 12);
             const fn = function () {};
             expectDual(emptyObj, emptyObj, TAG.Strict_EQ);
@@ -310,7 +318,7 @@ function eachRelationalComparisonCase(evalFn) {
         }
     };
 
-    function expectDual(lval, rval, caseTag) {
+    function expectDual(lval: unknown, rval: unknown, caseTag: CaseTag) {
         validateCaseTag(caseTag);
         evalFn(lval, rval, caseTag);
 
@@ -319,11 +327,11 @@ function eachRelationalComparisonCase(evalFn) {
         evalFn(rval, lval, revertedCaseTag);
     }
 
-    function validateCaseTag(caseTag) {
+    function validateCaseTag(caseTag: CaseTag) {
         expect(TAG.hasOwnProperty(caseTag)).toEqual(true);
     }
 
-    function findRevertTag(caseTag) {
+    function findRevertTag(caseTag: CaseTag) {
         for (let i = 0; i < tagRevertPairs.length; i++) {
             const item = tagRevertPairs[i];
             if (item[0] === caseTag) {
@@ -335,18 +343,19 @@ function eachRelationalComparisonCase(evalFn) {
         }
     }
 
-    Object.keys(testerMap).forEach(name => testerMap[name]());
+    Object.keys(testerMap).forEach((name: keyof typeof testerMap) => testerMap[name]());
 }
 
 
 describe('data/helper/dataValueHelper', function () {
 
     describe('filter_relational_comparison', function () {
-        function testFilterComparator(op) {
+
+        function testFilterComparator(op: Operation) {
             it(op + '_filter_comparator', () => {
                 eachRelationalComparisonCase((lval, rval, caseTag) => {
-                    expect(filterResultMap.hasOwnProperty[caseTag]);
-                    expect(filterResultMap[caseTag].hasOwnProperty[op]);
+                    expect(filterResultMap.hasOwnProperty(caseTag));
+                    expect(filterResultMap[caseTag].hasOwnProperty(op));
                     const expectedResult = filterResultMap[caseTag][op];
 
                     if ((op === 'lt' || op === 'lte' || op === 'gt' || op === 'gte')
@@ -358,7 +367,7 @@ describe('data/helper/dataValueHelper', function () {
                     }
                     else {
                         const comparator = dataValueHelper.createFilterComparator(op, rval);
-                        expect(comparator.evaluate(lval, rval)).toEqual(expectedResult);
+                        expect(comparator.evaluate(lval)).toEqual(expectedResult);
                     }
                 });
             });
@@ -372,15 +381,16 @@ describe('data/helper/dataValueHelper', function () {
     });
 
     describe('sort_relational_comparison', function () {
-        function testSortComparator(order, incomparable) {
+
+        function testSortComparator(order: Order, incomparable: Incomparable) {
             const key = order + '_incmpr' + incomparable;
             const SortOrderComparator = dataValueHelper.SortOrderComparator;
             const sortOrderComparator = new SortOrderComparator(order, incomparable);
             it(key + '_sort_comparator', () => {
                 eachRelationalComparisonCase((lval, rval, caseTag) => {
-                    expect(sortResultMap.hasOwnProperty[caseTag]);
-                    expect(sortResultMap[caseTag].hasOwnProperty[key]);
-                    const expectedResult = sortResultMap[caseTag][key];
+                    expect(sortResultMap.hasOwnProperty(caseTag));
+                    expect(sortResultMap[caseTag].hasOwnProperty(key));
+                    const expectedResult = (sortResultMap[caseTag] as any)[key];
                     expect(sortOrderComparator.evaluate(lval, rval)).toEqual(expectedResult);
                 });
             });
diff --git a/test/ut/tsconfig.json b/test/ut/tsconfig.json
new file mode 100644
index 0000000..e9b0b8c
--- /dev/null
+++ b/test/ut/tsconfig.json
@@ -0,0 +1,20 @@
+{
+    "compilerOptions": {
+        "target": "ES3",
+        "noImplicitAny": true,
+        "strictBindCallApply": true,
+
+        "noImplicitThis": true,
+
+        // https://github.com/ezolenko/rollup-plugin-typescript2/issues/12#issuecomment-536173372
+        "moduleResolution": "Node",
+
+        "pretty": true
+    },
+    "include": [
+        "../../src/global.d.ts",
+        "**/*.ts"
+    ],
+    "exclude": [
+    ]
+}
\ No newline at end of file


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


[incubator-echarts] 04/08: ts: fix type of converters.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8b34dfbe1a5e91ee9af06d9b26331aadff409cc7
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Oct 13 11:40:58 2020 +0800

    ts: fix type of converters.
---
 src/coord/CoordinateSystem.ts         |  2 +-
 src/echarts.ts                        | 24 ++++++---
 src/util/types.ts                     | 25 ++++++++--
 test/ut/core/utHelper.ts              |  5 +-
 test/ut/spec/api/containPixel.test.ts | 94 +++++++++++++++++------------------
 test/ut/spec/api/converter.test.ts    | 65 ++++++++++++------------
 6 files changed, 121 insertions(+), 94 deletions(-)

diff --git a/src/coord/CoordinateSystem.ts b/src/coord/CoordinateSystem.ts
index 07ab843..91f7a82 100644
--- a/src/coord/CoordinateSystem.ts
+++ b/src/coord/CoordinateSystem.ts
@@ -71,7 +71,7 @@ export interface CoordinateSystemMaster {
     // null/undefined value.
     convertFromPixel?(
         ecModel: GlobalModel, finder: ParsedModelFinder, pixelValue: number | number[]
-    ): ScaleDataValue | ScaleDataValue[];
+    ): number | number[];
 
     // @param point Point in global pixel coordinate system.
     // The signature of this method should be the same as `CoordinateSystemExecutive`
diff --git a/src/echarts.ts b/src/echarts.ts
index dfbe5a6..8c1bb7e 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -88,7 +88,8 @@ import {
     ComponentMainType,
     ComponentSubType,
     ColorString,
-    SelectChangedPayload
+    SelectChangedPayload,
+    ScaleDataValue
 } from './util/types';
 import Displayable from 'zrender/src/graphic/Displayable';
 import IncrementalDisplayable from 'zrender/src/graphic/IncrementalDisplayable';
@@ -237,7 +238,12 @@ let updateMethods: {
     updateVisual: UpdateMethod,
     updateLayout: UpdateMethod
 };
-let doConvertPixel: (ecIns: ECharts, methodName: string, finder: ModelFinder, value: any) => any;
+let doConvertPixel: (
+    ecIns: ECharts,
+    methodName: string,
+    finder: ModelFinder,
+    value: (number | number[]) | (ScaleDataValue | ScaleDataValue[])
+) => (number | number[]);
 let updateStreamModes: (ecIns: ECharts, ecModel: GlobalModel) => void;
 let doDispatchAction: (this: ECharts, payload: Payload, silent: boolean) => void;
 let flushPendingActions: (this: ECharts, silent: boolean) => void;
@@ -779,7 +785,9 @@ class ECharts extends Eventful {
      * Convert from logical coordinate system to pixel coordinate system.
      * See CoordinateSystem#convertToPixel.
      */
-    convertToPixel(finder: ModelFinder, value: any): number[] {
+    convertToPixel(finder: ModelFinder, value: ScaleDataValue): number;
+    convertToPixel(finder: ModelFinder, value: ScaleDataValue[]): number[];
+    convertToPixel(finder: ModelFinder, value: ScaleDataValue | ScaleDataValue[]): number | number[] {
         return doConvertPixel(this, 'convertToPixel', finder, value);
     }
 
@@ -787,7 +795,9 @@ class ECharts extends Eventful {
      * Convert from pixel coordinate system to logical coordinate system.
      * See CoordinateSystem#convertFromPixel.
      */
-    convertFromPixel(finder: ModelFinder, value: number[]): any {
+    convertFromPixel(finder: ModelFinder, value: number): number;
+    convertFromPixel(finder: ModelFinder, value: number[]): number[];
+    convertFromPixel(finder: ModelFinder, value: number | number[]): number | number[] {
         return doConvertPixel(this, 'convertFromPixel', finder, value);
     }
 
@@ -1614,8 +1624,8 @@ class ECharts extends Eventful {
             ecIns: ECharts,
             methodName: 'convertFromPixel' | 'convertToPixel',
             finder: ModelFinder,
-            value: any
-        ): any {
+            value: (number | number[]) | (ScaleDataValue | ScaleDataValue[])
+        ): (number | number[]) {
             if (ecIns._disposed) {
                 disposedWarning(ecIns.id);
                 return;
@@ -1629,7 +1639,7 @@ class ECharts extends Eventful {
             for (let i = 0; i < coordSysList.length; i++) {
                 const coordSys = coordSysList[i];
                 if (coordSys[methodName]
-                    && (result = coordSys[methodName](ecModel, parsedFinder, value)) != null
+                    && (result = coordSys[methodName](ecModel, parsedFinder, value as any)) != null
                 ) {
                     return result;
                 }
diff --git a/src/util/types.ts b/src/util/types.ts
index cc869e6..7ce3e5f 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -302,12 +302,27 @@ export type OrdinalSortInfo = {
     ordinalNumber: OrdinalNumber,
     beforeSortIndex: number
 };
-export type ParsedValueNumeric = number | OrdinalNumber;
+
+/**
+ * `OptionDataValue` is the primitive value in `series.data` or `dataset.source`.
+ * `OptionDataValue` are parsed (see `src/data/helper/dataValueHelper.parseDataValue`)
+ * into `ParsedValue` and stored into `data/List` storage.
+ * Note:
+ * (1) The term "parse" does not mean `src/scale/Scale['parse']`.
+ * (2) If a category dimension is not mapped to any axis, its raw value will NOT be
+ * parsed to `OrdinalNumber` but keep the original `OrdinalRawValue` in `src/data/List` storage.
+ */
 export type ParsedValue = ParsedValueNumeric | OrdinalRawValue;
-// FIXME:TS better name?
-// This is not `OptionDataPrimitive` because the "dataProvider parse"
-// will not be performed. But "scale parse" will be performed.
-export type ScaleDataValue = ParsedValue | Date;
+export type ParsedValueNumeric = number | OrdinalNumber;
+/**
+ * `ScaleDataValue` means that the user input primitive value to `src/scale/Scale`.
+ * (For example, used in `axis.min`, `axis.max`, `convertToPixel`).
+ * Note:
+ * `ScaleDataValue` is a little different from `OptionDataValue`, because it will not go through
+ * `src/data/helper/dataValueHelper.parseDataValue`, but go through `src/scale/Scale['parse']`.
+ */
+export type ScaleDataValue = ParsedValueNumeric | OrdinalRawValue | Date;
+
 export interface ScaleTick {
     value: number
 };
diff --git a/test/ut/core/utHelper.ts b/test/ut/core/utHelper.ts
index e485471..509438c 100755
--- a/test/ut/core/utHelper.ts
+++ b/test/ut/core/utHelper.ts
@@ -17,7 +17,10 @@
 * under the License.
 */
 
-import { init, EChartsType } from '../../../src/echarts';
+// PENDING: should resolve that no `.ts` suffix.
+// @ts-ignore
+import { init, EChartsType } from '../../../echarts.all.ts';
+
 import {
     curry as zrUtilCurry,
     bind as zrUtilBind,
diff --git a/test/ut/spec/api/containPixel.test.ts b/test/ut/spec/api/containPixel.test.ts
index c0c03ad..ec99628 100755
--- a/test/ut/spec/api/containPixel.test.ts
+++ b/test/ut/spec/api/containPixel.test.ts
@@ -18,16 +18,18 @@
 * under the License.
 */
 
-/* jshint maxlen:200 */
+import { createChart, removeChart } from '../../core/utHelper';
+import { EChartsType, registerMap } from '../../../../src/echarts';
+import { GeoJSON } from '../../../../src/coord/geo/geoTypes';
+
 
-const echarts = require('../../../../lib/echarts');
-const utHelper = require('../../core/utHelper');
 
 describe('api/containPixel', function () {
-    var testGeoJson1 = {
+    const testGeoJson1: GeoJSON = {
         'type': 'FeatureCollection',
         'features': [
             {
+                'type': 'Feature',
                 'geometry': {
                     'type': 'Polygon',
                     'coordinates': [
@@ -59,10 +61,11 @@ describe('api/containPixel', function () {
         ]
     };
 
-    var testGeoJson2 = {
+    const testGeoJson2: GeoJSON = {
         'type': 'FeatureCollection',
         'features': [
             {
+                'type': 'Feature',
                 'geometry': {
                     'type': 'Polygon',
                     'coordinates': [
@@ -94,26 +97,23 @@ describe('api/containPixel', function () {
         ]
     };
 
-    var chart = '';
-    var createResult = '';
+    let chart: EChartsType;
+
     beforeEach(function () {
-        createResult = utHelper.createChart(context, echarts);
-        chart = createResult.charts[0];
+        chart = createChart({
+            width: 200,
+            height: 150
+        });
     });
 
     afterEach(function () {
-        utHelper.removeChart(createResult);
+        removeChart(chart);
     });
 
 
     it('geo', function () {
-        context.width = 200;
-        context.height = 150;
-        createResult = utHelper.createChart(context, echarts);
-        chart = createResult.charts[0];
-
-        echarts.registerMap('test1', testGeoJson1);
-        echarts.registerMap('test2', testGeoJson2);
+        registerMap('test1', testGeoJson1);
+        registerMap('test2', testGeoJson2);
 
         chart.setOption({
             geo: [
@@ -149,8 +149,8 @@ describe('api/containPixel', function () {
             ]
         });
 
-        var width = chart.getWidth();
-        var height = chart.getWidth();
+        const width = chart.getWidth();
+        const height = chart.getWidth();
 
         expect(chart.containPixel('geo', [15, 30])).toEqual(true);
         expect(chart.containPixel('geo', [9.5, 30])).toEqual(false);
@@ -161,12 +161,8 @@ describe('api/containPixel', function () {
 
 
     it('map', function () {
-        context.width = 200;
-        context.height = 150;
-        createResult = utHelper.createChart(context, echarts);
-        chart = createResult.charts[0];
-        echarts.registerMap('test1', testGeoJson1);
-        echarts.registerMap('test2', testGeoJson2);
+        registerMap('test1', testGeoJson1);
+        registerMap('test2', testGeoJson2);
 
         chart.setOption({
             series: [
@@ -190,7 +186,7 @@ describe('api/containPixel', function () {
             ]
         });
 
-        var width = chart.getWidth();
+        const width = chart.getWidth();
 
         expect(chart.containPixel('series', [15, 30])).toEqual(true);
         expect(chart.containPixel('series', [9.5, 30])).toEqual(false);
@@ -200,7 +196,7 @@ describe('api/containPixel', function () {
 
 
     it('cartesian', function () {
-        echarts.registerMap('test1', testGeoJson1);
+        registerMap('test1', testGeoJson1);
 
         chart.setOption({
             geo: [ // Should not affect grid converter.
@@ -268,38 +264,38 @@ describe('api/containPixel', function () {
                 {
                     id: 'k1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[1000, 700]]
                 },
                 {
                     id: 'k2',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[100, 800]]
                 },
                 {
                     id: 'j1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[100, 800]],
                     xAxisIndex: 1
                 },
                 {
                     id: 'i1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [],
                     xAxisId: 'x2',
                     yAxisId: 'y1'
@@ -307,7 +303,7 @@ describe('api/containPixel', function () {
             ]
         });
 
-        var width = chart.getWidth();
+        const width = chart.getWidth();
 
         expect(chart.containPixel('grid', [15, 30])).toEqual(true);
         expect(chart.containPixel('grid', [9.5, 30])).toEqual(false);
@@ -336,7 +332,7 @@ describe('api/containPixel', function () {
     //         ]
     //     });
 
-    //     var height = chart.getHeight();
+    //     const height = chart.getHeight();
 
     //     expect(chart.containPixel('series', [40, height / 2])).toEqual(false);
     //     expect(chart.containPixel('series', [40, height / 2 + 10])).toEqual(true);
@@ -345,8 +341,8 @@ describe('api/containPixel', function () {
 
 
     // it('pieAndGeo', function () {
-    //     echarts.registerMap('test1', testGeoJson1);
-    //     echarts.registerMap('test2', testGeoJson2);
+    //     registerMap('test1', testGeoJson1);
+    //     registerMap('test2', testGeoJson2);
 
     //     chart.setOption({
     //         geo: [
@@ -394,7 +390,7 @@ describe('api/containPixel', function () {
 
 
     it('graph', function () {
-        echarts.registerMap('test1', testGeoJson1);
+        registerMap('test1', testGeoJson1);
 
         chart.setOption({
             geo: [ // Should not affect graph converter.
@@ -426,4 +422,4 @@ describe('api/containPixel', function () {
     });
 
 
-});
\ No newline at end of file
+});
diff --git a/test/ut/spec/api/converter.test.ts b/test/ut/spec/api/converter.test.ts
index 946dd61..4183ab3 100755
--- a/test/ut/spec/api/converter.test.ts
+++ b/test/ut/spec/api/converter.test.ts
@@ -18,13 +18,14 @@
 * under the License.
 */
 
-/* jshint maxlen:200 */
-var utHelper = require('../../core/utHelper');
-var echarts = require('../../../../index');
+
+import { EChartsType, registerMap } from '../../../../src/echarts';
+import { GeoJSON } from '../../../../src/coord/geo/geoTypes';
+
 
 describe('api/converter', function () {
 
-    var DELTA = 1E-3;
+    const DELTA = 1E-3;
 
     function pointEquals(p1, p2) {
         if (p1 instanceof Array && p2 instanceof Array) {
@@ -35,10 +36,11 @@ describe('api/converter', function () {
         }
     }
 
-    var testGeoJson1 = {
+    const testGeoJson1: GeoJSON = {
         'type': 'FeatureCollection',
         'features': [
             {
+                'type': 'Feature',
                 'geometry': {
                     'type': 'Polygon',
                     'coordinates': [
@@ -70,10 +72,11 @@ describe('api/converter', function () {
         ]
     };
 
-    var testGeoJson2 = {
+    const testGeoJson2: GeoJSON = {
         'type': 'FeatureCollection',
         'features': [
             {
+                'type': 'Feature',
                 'geometry': {
                     'type': 'Polygon',
                     'coordinates': [
@@ -104,10 +107,10 @@ describe('api/converter', function () {
             }
         ]
     };
-    echarts.registerMap('converter_test_geo_1', testGeoJson1);
-    echarts.registerMap('converter_test_geo_2', testGeoJson2);
+    registerMap('converter_test_geo_1', testGeoJson1);
+    registerMap('converter_test_geo_2', testGeoJson2);
 
-    var chart;
+    let chart: EChartsType;
     beforeEach(function () {
         chart = utHelper.createChart();
     });
@@ -153,8 +156,8 @@ describe('api/converter', function () {
             ]
         });
 
-        var width = chart.getWidth();
-        var height = chart.getHeight();
+        const width = chart.getWidth();
+        const height = chart.getHeight();
 
         expect(pointEquals(chart.convertToPixel('geo', [5000, 3000]), [width - 20, height - 40])).toEqual(true);
         expect(pointEquals(chart.convertFromPixel('geo', [width - 20, height - 40]), [5000, 3000])).toEqual(true);
@@ -283,38 +286,38 @@ describe('api/converter', function () {
                 {
                     id: 'k1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[1000, 700]]
                 },
                 {
                     id: 'k2',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[100, 800]]
                 },
                 {
                     id: 'j1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [[100, 800]],
                     xAxisIndex: 1
                 },
                 {
                     id: 'i1',
                     type: 'scatter',
-                    left: 0,
-                    right: 0,
-                    top: 0,
-                    bottom: 0,
+                    // left: 0,
+                    // right: 0,
+                    // top: 0,
+                    // bottom: 0,
                     data: [],
                     xAxisId: 'x2',
                     yAxisId: 'y1'
@@ -322,8 +325,8 @@ describe('api/converter', function () {
             ]
         });
 
-        var width = chart.getWidth();
-        var height = chart.getHeight();
+        const width = chart.getWidth();
+        const height = chart.getHeight();
 
         expect(pointEquals(chart.convertToPixel({seriesIndex: 1}, [-500, 6000]), [10, height - 40])).toEqual(true);
         expect(pointEquals(chart.convertFromPixel({seriesIndex: 1}, [10, height - 40]), [-500, 6000])).toEqual(true);
@@ -386,8 +389,8 @@ describe('api/converter', function () {
             ]
         });
 
-        var width = chart.getWidth();
-        var height = chart.getHeight();
+        const width = chart.getWidth();
+        const height = chart.getHeight();
 
         expect(pointEquals(chart.convertToPixel({seriesIndex: 0}, [2000, 3500]), [10 + (width - 30) / 2, 30 + (height - 70) / 2])).toEqual(true);
         expect(pointEquals(chart.convertFromPixel({seriesIndex: 0}, [10 + (width - 30) / 2, 30 + (height - 70) / 2]), [2000, 3500])).toEqual(true);


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


[incubator-echarts] 06/08: fix: fix ut and fix getViusal bug brought by some of the 5.0 refactor.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9f69525f98828e87bde25118cac6412c48676220
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Oct 14 00:50:16 2020 +0800

    fix: fix ut and fix getViusal bug brought by some of the 5.0 refactor.
---
 package.json                       |  7 +++--
 src/util/model.ts                  | 17 +++++++++--
 test/ut/.eslintrc.yaml             |  2 +-
 test/ut/core/utHelper.ts           |  9 +++---
 test/ut/spec/api/converter.test.ts | 61 +++++++++++++++++++++++++++-----------
 test/ut/spec/api/getVisual.test.ts | 48 +++++++++++-------------------
 test/ut/tsconfig.json              |  1 +
 7 files changed, 87 insertions(+), 58 deletions(-)

diff --git a/package.json b/package.json
index ac87f3e..dc5d55f 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
     "help": "node build/build.js --help",
     "test:visual": "node test/runTest/server.js",
     "test:visual:report": "node test/runTest/genReport.js",
-    "test": "node build/build.js --prepublish && jest --config test/ut/jest.config.js",
+    "test": "jest --config test/ut/jest.config.js",
     "test:single": "jest --config test/ut/jest.config.js --coverage=false -t",
     "mktest": "node test/build/mktest.js",
     "mktest:help": "node test/build/mktest.js -h",
@@ -42,9 +42,10 @@
     "@babel/core": "7.3.4",
     "@babel/types": "^7.10.5",
     "@microsoft/api-extractor": "7.7.2",
+    "@types/jest": "^26.0.14",
+    "@types/jsdom": "^16.2.4",
     "@typescript-eslint/eslint-plugin": "^2.15.0",
     "@typescript-eslint/parser": "^2.18.0",
-    "husky": "^4.2.5",
     "canvas": "^2.6.0",
     "chalk": "^3.0.0",
     "chokidar": "^3.4.0",
@@ -54,6 +55,7 @@
     "fs-extra": "0.26.7",
     "glob": "7.0.0",
     "globby": "11.0.0",
+    "husky": "^4.2.5",
     "jest": "^24.9.0",
     "jest-canvas-mock": "^2.2.0",
     "jsdom": "^15.2.1",
@@ -71,6 +73,7 @@
     "serve-handler": "6.1.1",
     "slugify": "1.3.4",
     "socket.io": "2.2.0",
+    "ts-jest": "^26.4.1",
     "typescript": "3.8.3",
     "uglify-js": "^3.10.0"
   }
diff --git a/src/util/model.ts b/src/util/model.ts
index 972373f..35af503 100644
--- a/src/util/model.ts
+++ b/src/util/model.ts
@@ -795,7 +795,12 @@ export type ParsedModelFinder = ParsedModelFinderKnown & {
 export function parseFinder(
     ecModel: GlobalModel,
     finderInput: ModelFinder,
-    opt?: {defaultMainType?: ComponentMainType, includeMainTypes?: ComponentMainType[]}
+    opt?: {
+        // If no main type specified, use this main type.
+        defaultMainType?: ComponentMainType,
+        // If pervided, types out of this list will be ignored.
+        includeMainTypes?: ComponentMainType[]
+    }
 ): ParsedModelFinder {
     let finder: ModelFinderObject;
     if (isString(finderInput)) {
@@ -807,9 +812,9 @@ export function parseFinder(
         finder = finderInput;
     }
 
-    const defaultMainType = opt ? opt.defaultMainType : null;
     const queryOptionMap = createHashMap<QueryReferringUserOption, ComponentMainType>();
     const result = {} as ParsedModelFinder;
+    let mainTypeSpecified = false;
 
     each(finder, function (value, key) {
         // Exclude 'dataIndex' and other illgal keys.
@@ -825,16 +830,22 @@ export function parseFinder(
         if (
             !mainType
             || !queryType
-            || (mainType !== defaultMainType && value == null)
             || (opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0)
         ) {
             return;
         }
 
+        mainTypeSpecified = mainTypeSpecified || !!mainType;
+
         const queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});
         queryOption[queryType] = value as any;
     });
 
+    const defaultMainType = opt ? opt.defaultMainType : null;
+    if (!mainTypeSpecified && defaultMainType) {
+        queryOptionMap.set(defaultMainType, {});
+    }
+
     queryOptionMap.each(function (queryOption, mainType) {
         const queryResult = queryReferringComponents(
             ecModel,
diff --git a/test/ut/.eslintrc.yaml b/test/ut/.eslintrc.yaml
index eadd55a..d906da2 100644
--- a/test/ut/.eslintrc.yaml
+++ b/test/ut/.eslintrc.yaml
@@ -19,7 +19,7 @@ parserOptions:
     project: "test/ut/tsconfig.json"
 plugins: ["@typescript-eslint"]
 env:
-    browser: false
+    browser: true
     node: true
     es6: false
 globals:
diff --git a/test/ut/core/utHelper.ts b/test/ut/core/utHelper.ts
index 509438c..38eadad 100755
--- a/test/ut/core/utHelper.ts
+++ b/test/ut/core/utHelper.ts
@@ -31,12 +31,13 @@ import Group from 'zrender/src/graphic/Group';
 import Element from 'zrender/src/Element';
 
 
-export function createChart(params: {
+export function createChart(params?: {
     width?: number,
     height?: number,
     theme?: Parameters<typeof init>[1],
     opts?: Parameters<typeof init>[2]
 }): EChartsType {
+    params = params || {};
     const el = document.createElement('div');
     el.style.cssText = [
         'visibility:hidden',
@@ -61,7 +62,7 @@ export function g(id: string): HTMLElement {
 }
 
 export function removeEl(el: HTMLElement): void {
-    const parent = utHelper.parentEl(el);
+    const parent = parentEl(el);
     parent && parent.removeChild(el);
 }
 
@@ -119,9 +120,9 @@ export function getGraphicElements(
         return (chartOrGroup as Group).children();
     }
     else {
-        const viewGroup = utHelper.getViewGroup(chartOrGroup, mainType, index);
+        const viewGroup = getViewGroup(chartOrGroup, mainType, index);
         if (viewGroup) {
-            const list = [viewGroup];
+            const list: Element[] = [viewGroup];
             viewGroup.traverse(function (el: Element) {
                 list.push(el);
             });
diff --git a/test/ut/spec/api/converter.test.ts b/test/ut/spec/api/converter.test.ts
index 4183ab3..0e7def4 100755
--- a/test/ut/spec/api/converter.test.ts
+++ b/test/ut/spec/api/converter.test.ts
@@ -1,4 +1,3 @@
-
 /*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
@@ -21,19 +20,23 @@
 
 import { EChartsType, registerMap } from '../../../../src/echarts';
 import { GeoJSON } from '../../../../src/coord/geo/geoTypes';
+import { createChart } from '../../core/utHelper';
 
 
 describe('api/converter', function () {
 
     const DELTA = 1E-3;
 
-    function pointEquals(p1, p2) {
+    function pointEquals(p1: number | number[], p2: number | number[]): boolean {
         if (p1 instanceof Array && p2 instanceof Array) {
             return Math.abs(p1[0] - p2[0]) < DELTA && Math.abs(p1[1] - p2[1]) < DELTA;
         }
-        else {
+        else if (typeof p1 === 'number' && typeof p2 === 'number') {
             return Math.abs(p1 - p2) < DELTA;
         }
+        else {
+            throw Error('Iillegal p1 or p2');
+        }
     }
 
     const testGeoJson1: GeoJSON = {
@@ -112,7 +115,7 @@ describe('api/converter', function () {
 
     let chart: EChartsType;
     beforeEach(function () {
-        chart = utHelper.createChart();
+        chart = createChart();
     });
 
     afterEach(function () {
@@ -328,17 +331,33 @@ describe('api/converter', function () {
         const width = chart.getWidth();
         const height = chart.getHeight();
 
-        expect(pointEquals(chart.convertToPixel({seriesIndex: 1}, [-500, 6000]), [10, height - 40])).toEqual(true);
-        expect(pointEquals(chart.convertFromPixel({seriesIndex: 1}, [10, height - 40]), [-500, 6000])).toEqual(true);
-
-        expect(pointEquals(chart.convertToPixel({seriesId: 'i1'}, [300, 900]), [width - 20, height - 40])).toEqual(true);
-        expect(pointEquals(chart.convertFromPixel({seriesId: 'i1'}, [width - 20, height - 40]), [300, 900])).toEqual(true);
-
-        expect(pointEquals(chart.convertToPixel({xAxisIndex: 2, yAxisId: 'y1'}, [300, 900]), [width - 20, height - 40])).toEqual(true);
-        expect(pointEquals(chart.convertFromPixel({xAxisIndex: 2, yAxisId: 'y1'}, [width - 20, height - 40]), [300, 900])).toEqual(true);
-
-        expect(pointEquals(chart.convertToPixel({gridId: 'g1'}, [300, 900]), [width - 20, height - 40])).toEqual(true);
-        expect(pointEquals(chart.convertFromPixel({gridId: 'g1'}, [width - 20, height - 40]), [300, 900])).toEqual(true);
+        expect(
+            pointEquals(chart.convertToPixel({seriesIndex: 1}, [-500, 6000]), [10, height - 40])
+        ).toEqual(true);
+        expect(
+            pointEquals(chart.convertFromPixel({seriesIndex: 1}, [10, height - 40]), [-500, 6000])
+        ).toEqual(true);
+
+        expect(
+            pointEquals(chart.convertToPixel({seriesId: 'i1'}, [300, 900]), [width - 20, height - 40])
+        ).toEqual(true);
+        expect(
+            pointEquals(chart.convertFromPixel({seriesId: 'i1'}, [width - 20, height - 40]), [300, 900])
+        ).toEqual(true);
+
+        expect(
+            pointEquals(chart.convertToPixel({xAxisIndex: 2, yAxisId: 'y1'}, [300, 900]), [width - 20, height - 40])
+        ).toEqual(true);
+        expect(
+            pointEquals(chart.convertFromPixel({xAxisIndex: 2, yAxisId: 'y1'}, [width - 20, height - 40]), [300, 900])
+        ).toEqual(true);
+
+        expect(
+            pointEquals(chart.convertToPixel({gridId: 'g1'}, [300, 900]), [width - 20, height - 40])
+        ).toEqual(true);
+        expect(
+            pointEquals(chart.convertFromPixel({gridId: 'g1'}, [width - 20, height - 40]), [300, 900])
+        ).toEqual(true);
 
         expect(pointEquals(chart.convertToPixel({xAxisId: 'x0'}, 3000), width / 2)).toEqual(true);
         expect(pointEquals(chart.convertFromPixel({xAxisId: 'x0'}, width / 2), 3000)).toEqual(true);
@@ -392,8 +411,16 @@ describe('api/converter', function () {
         const width = chart.getWidth();
         const height = chart.getHeight();
 
-        expect(pointEquals(chart.convertToPixel({seriesIndex: 0}, [2000, 3500]), [10 + (width - 30) / 2, 30 + (height - 70) / 2])).toEqual(true);
-        expect(pointEquals(chart.convertFromPixel({seriesIndex: 0}, [10 + (width - 30) / 2, 30 + (height - 70) / 2]), [2000, 3500])).toEqual(true);
+        expect(
+            pointEquals(
+                chart.convertToPixel({seriesIndex: 0}, [2000, 3500]), [10 + (width - 30) / 2, 30 + (height - 70) / 2]
+            )
+        ).toEqual(true);
+        expect(
+            pointEquals(
+                chart.convertFromPixel({seriesIndex: 0}, [10 + (width - 30) / 2, 30 + (height - 70) / 2]), [2000, 3500]
+            )
+        ).toEqual(true);
 
         expect(pointEquals(chart.convertToPixel({seriesId: 'k2'}, [100, 500]), [10, height - 40])).toEqual(true);
         expect(pointEquals(chart.convertFromPixel({seriesId: 'k2'}, [10, height - 40]), [100, 500])).toEqual(true);
diff --git a/test/ut/spec/api/getVisual.test.ts b/test/ut/spec/api/getVisual.test.ts
index 1214b06..de3d747 100755
--- a/test/ut/spec/api/getVisual.test.ts
+++ b/test/ut/spec/api/getVisual.test.ts
@@ -18,20 +18,20 @@
 * under the License.
 */
 
-const utHelper = require('../../core/utHelper');
+import { createChart } from '../../core/utHelper';
+import { EChartsType } from '../../../../src/echarts';
 
-/* jshint maxlen:200 */
-describe('api/getVisual', function () {
 
+describe('api/getVisual', function () {
 
     // TODO
     // test each chart type, which may set visual on view which can not get from List.
     // each of which should test visual map.
     // symbol and symbolSize should be tested.
 
-    var chart;
+    let chart: EChartsType;
     beforeEach(function () {
-        chart = utHelper.createChart();
+        chart = createChart();
     });
 
     afterEach(function () {
@@ -44,7 +44,7 @@ describe('api/getVisual', function () {
             color: ['#000', '#111', '#222'],
             visualMap: {
                 seriesIndex: 3,
-                demension: 1,
+                dimension: 1,
                 min: 0,
                 max: 10000,
                 inRange: {
@@ -62,9 +62,7 @@ describe('api/getVisual', function () {
                     type: 'scatter',
                     data: [[10, 7]],
                     itemStyle: {
-                        normal: {
-                            color: '#fff'
-                        }
+                        color: '#fff'
                     }
                 },
                 {
@@ -75,16 +73,12 @@ describe('api/getVisual', function () {
                         {
                             value: [333, 222],
                             itemStyle: {
-                                normal: {
-                                    color: '#ff0'
-                                }
+                                color: '#ff0'
                             }
                         }
                     ],
                     itemStyle: {
-                        normal: {
-                            color: '#eee'
-                        }
+                        color: '#eee'
                     }
                 },
                 {
@@ -95,16 +89,12 @@ describe('api/getVisual', function () {
                         {
                             value: [333, 9999],
                             itemStyle: {
-                                normal: {
-                                    color: '#ff0'
-                                }
+                                color: 'red'
                             }
                         }
                     ],
                     itemStyle: {
-                        normal: {
-                            color: '#eee'
-                        }
+                        color: '#eee'
                     }
                 }
             ]
@@ -118,7 +108,7 @@ describe('api/getVisual', function () {
         expect(chart.getVisual({dataIndex: 1, seriesId: 'k2'}, 'color')).toEqual('#ff0');
         expect(chart.getVisual({seriesId: 'k2'}, 'color')).toEqual('#eee');
 
-        expect(chart.getVisual({dataIndex: 1, seriesId: 'k3'}, 'color')).toEqual('rgba(255,0,0,1)');
+        expect(chart.getVisual({dataIndex: 1, seriesId: 'k3'}, 'color')).toEqual('red');
         expect(chart.getVisual({seriesId: 'k3'}, 'color')).toEqual('#eee');
     });
 
@@ -145,16 +135,12 @@ describe('api/getVisual', function () {
                         {
                             value: [50, 222],
                             itemStyle: {
-                                normal: {
-                                    color: '#ff0'
-                                }
+                                color: '#ff0'
                             }
                         }
                     ],
                     itemStyle: {
-                        normal: {
-                            color: '#eee'
-                        }
+                        color: '#eee'
                     }
                 }
             ]
@@ -167,7 +153,7 @@ describe('api/getVisual', function () {
 
 
     // it('pie', function () {
-    //     var chart = this.chart;
+    //     const chart = this.chart;
 
     //     chart.setOption({
     //         series: [
@@ -187,7 +173,7 @@ describe('api/getVisual', function () {
     //         ]
     //     });
 
-    //     var height = chart.getHeight();
+    //     const height = chart.getHeight();
 
     //     expect(chart.containPixel('series', [40, height / 2])).toEqual(false);
     //     expect(chart.containPixel('series', [40, height / 2 + 10])).toEqual(true);
@@ -196,7 +182,7 @@ describe('api/getVisual', function () {
 
 
     // it('graph', function () {
-    //     var chart = this.chart;
+    //     const chart = this.chart;
 
     //     chart.setOption({
     //         series: [
diff --git a/test/ut/tsconfig.json b/test/ut/tsconfig.json
index 08c1487..ff8304b 100644
--- a/test/ut/tsconfig.json
+++ b/test/ut/tsconfig.json
@@ -6,6 +6,7 @@
         "noImplicitThis": true,
         "strictBindCallApply": true,
         "removeComments": true,
+        "sourceMap": true,
 
         // https://github.com/ezolenko/rollup-plugin-typescript2/issues/12#issuecomment-536173372
         "moduleResolution": "node",


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


[incubator-echarts] 08/08: build: move /echarts.*.ts to src/echarts.*.ts . Otherwise if user import from 'echarts.all', it might be confused whether echarts.all.ts or echarts.all.js

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0d47e96910199d660735e33dccbe494ad32f58d1
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Oct 14 14:06:16 2020 +0800

    build: move /echarts.*.ts to src/echarts.*.ts . Otherwise if user import from 'echarts.all', it might be confused whether echarts.all.ts or echarts.all.js
---
 build/config.js          |   5 +-
 build/pre-publish.js     |  32 +++---
 echarts.all.ts           | 272 -----------------------------------------------
 echarts.blank.ts         |  23 ----
 echarts.common.ts        |  44 --------
 echarts.simple.ts        |  27 -----
 index.d.ts               |   2 +-
 test/ut/core/utHelper.ts |   6 +-
 8 files changed, 21 insertions(+), 390 deletions(-)

diff --git a/build/config.js b/build/config.js
index 1d94ce8..06e88db 100644
--- a/build/config.js
+++ b/build/config.js
@@ -106,13 +106,12 @@ exports.createECharts = function (opt = {}) {
         output = nodePath.resolve(output);
     }
     else {
-        input = nodePath.resolve(ecDir, `echarts${srcType}.ts`);
+        input = nodePath.resolve(ecDir, `src/echarts${srcType}.ts`);
         output = nodePath.resolve(ecDir, `dist/echarts${postfixLang}${postfixType}.js`);
     }
 
     const include = [
-        nodePath.resolve(ecDir, 'src/**/*.ts'),
-        nodePath.resolve(ecDir, 'echarts*.ts')
+        nodePath.resolve(ecDir, 'src/**/*.ts')
     ];
 
     return {
diff --git a/build/pre-publish.js b/build/pre-publish.js
index 12577ca..b3c4b7d 100644
--- a/build/pre-publish.js
+++ b/build/pre-publish.js
@@ -53,11 +53,7 @@ const autoGeneratedFileAlert = `
 
 const mainSrcGlobby = {
     patterns: [
-        'src/**/*.ts',
-        'echarts.all.ts',
-        'echarts.blank.ts',
-        'echarts.common.ts',
-        'echarts.simple.ts'
+        'src/**/*.ts'
     ],
     cwd: ecDir
 };
@@ -99,10 +95,10 @@ const compileWorkList = [
             fsExtra.removeSync(nodePath.resolve(ecDir, 'index.simple.js'));
         },
         after: async function () {
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.all.js'), nodePath.resolve(ecDir, 'index.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.blank.js'), nodePath.resolve(ecDir, 'index.blank.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.common.js'), nodePath.resolve(ecDir, 'index.common.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.simple.js'), nodePath.resolve(ecDir, 'index.simple.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.all.js'), nodePath.resolve(ecDir, 'index.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.blank.js'), nodePath.resolve(ecDir, 'index.blank.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.common.js'), nodePath.resolve(ecDir, 'index.common.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.simple.js'), nodePath.resolve(ecDir, 'index.simple.js'));
             fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, 'lib'));
 
             transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.js'), 'lib');
@@ -141,10 +137,10 @@ const compileWorkList = [
             fsExtra.removeSync(nodePath.resolve(ecDir, 'echarts.simple.js'));
         },
         after: async function () {
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.all.js'), nodePath.resolve(ecDir, 'echarts.all.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.blank.js'), nodePath.resolve(ecDir, 'echarts.blank.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.common.js'), nodePath.resolve(ecDir, 'echarts.common.js'));
-            fs.renameSync(nodePath.resolve(tmpDir, 'echarts.simple.js'), nodePath.resolve(ecDir, 'echarts.simple.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.all.js'), nodePath.resolve(ecDir, 'echarts.all.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.blank.js'), nodePath.resolve(ecDir, 'echarts.blank.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.common.js'), nodePath.resolve(ecDir, 'echarts.common.js'));
+            fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.simple.js'), nodePath.resolve(ecDir, 'echarts.simple.js'));
             fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, 'esm'));
 
             transformRootFolderInEntry(nodePath.resolve(ecDir, 'echarts.all.js'), 'esm');
@@ -280,14 +276,18 @@ async function tsCompile(compilerOptionsOverride, srcPathList) {
 }
 
 /**
- * Transform `src` root in the entry file to `esm` or `lib`
+ * Transform import/require path in the entry file to `esm` or `lib`.
  */
 function transformRootFolderInEntry(entryFile, replacement) {
     let code = fs.readFileSync(entryFile, 'utf-8');
     // Simple regex replacement
     // TODO More robust way?
-    code = code.replace(/([\"\'])\.\/src\//g, `$1./${replacement}/`)
-        .replace(/([\"\'])src\//g, `$1${replacement}/`);
+    assert(
+        !/(import\s+|from\s+|require\(\s*)["']\.\/echarts\./.test(code)
+        && !/(import\s+|from\s+|require\(\s*)["']echarts\./.test(code),
+        'Import echarts.xxx.ts is not supported.'
+    );
+    code = code.replace(/((import\s+|from\s+|require\(\s*)["'])\.\//g, `$1./${replacement}/`);
     fs.writeFileSync(
         entryFile,
         // Also transform zrender.
diff --git a/echarts.all.ts b/echarts.all.ts
deleted file mode 100644
index 0cd0e89..0000000
--- a/echarts.all.ts
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-export * from './src/echarts';
-export * from './src/export';
-
-import './src/component/dataset';
-import './src/component/transform';
-
-// ----------------------------------------------
-// All of the modules that are allowed to be
-// imported are listed below.
-//
-// Users MUST NOT import other modules that are
-// not included in this list.
-// ----------------------------------------------
-
-
-
-// ----------------
-// Charts (series)
-// ----------------
-
-
-
-// All of the series types, for example:
-// chart.setOption({
-//     series: [{
-//         type: 'line' // or 'bar', 'pie', ...
-//     }]
-// });
-
-import './src/chart/line';
-import './src/chart/bar';
-import './src/chart/pie';
-import './src/chart/scatter';
-import './src/chart/radar';
-import './src/chart/map';
-import './src/chart/tree';
-import './src/chart/treemap';
-import './src/chart/graph';
-import './src/chart/gauge';
-import './src/chart/funnel';
-import './src/chart/parallel';
-import './src/chart/sankey';
-import './src/chart/boxplot';
-import './src/chart/candlestick';
-import './src/chart/effectScatter';
-import './src/chart/lines';
-import './src/chart/heatmap';
-import './src/chart/pictorialBar';
-import './src/chart/themeRiver';
-import './src/chart/sunburst';
-import './src/chart/custom';
-
-
-
-// -------------------
-// Coordinate systems
-// -------------------
-
-
-
-// All of the axis modules have been included in the
-// coordinate system module below, do not need to
-// make extra import.
-
-// `cartesian` coordinate system. For some historical
-// reasons, it is named as grid, for example:
-// chart.setOption({
-//     grid: {...},
-//     xAxis: {...},
-//     yAxis: {...},
-//     series: [{...}]
-// });
-import './src/component/grid';
-
-// `polar` coordinate system, for example:
-// chart.setOption({
-//     polar: {...},
-//     radiusAxis: {...},
-//     angleAxis: {...},
-//     series: [{
-//         coordinateSystem: 'polar'
-//     }]
-// });
-import './src/component/polar';
-
-// `geo` coordinate system, for example:
-// chart.setOption({
-//     geo: {...},
-//     series: [{
-//         coordinateSystem: 'geo'
-//     }]
-// });
-import './src/component/geo';
-
-// `singleAxis` coordinate system (notice, it is a coordinate system
-// with only one axis, work for chart like theme river), for example:
-// chart.setOption({
-//     singleAxis: {...}
-//     series: [{type: 'themeRiver', ...}]
-// });
-import './src/component/singleAxis';
-
-// `parallel` coordinate system, only work for parallel series, for example:
-// chart.setOption({
-//     parallel: {...},
-//     parallelAxis: [{...}, ...],
-//     series: [{
-//         type: 'parallel'
-//     }]
-// });
-import './src/component/parallel';
-
-// `calendar` coordinate system. for example,
-// chart.setOptionp({
-//     calendar: {...},
-//     series: [{
-//         coordinateSystem: 'calendar'
-//     }]
-// );
-import './src/component/calendar';
-
-
-
-// ------------------
-// Other components
-// ------------------
-
-
-
-// `graphic` component, for example:
-// chart.setOption({
-//     graphic: {...}
-// });
-import './src/component/graphic';
-
-// `toolbox` component, for example:
-// chart.setOption({
-//     toolbox: {...}
-// });
-import './src/component/toolbox';
-
-// `tooltip` component, for example:
-// chart.setOption({
-//     tooltip: {...}
-// });
-import './src/component/tooltip';
-
-// `axisPointer` component, for example:
-// chart.setOption({
-//     tooltip: {axisPointer: {...}, ...}
-// });
-// Or
-// chart.setOption({
-//     axisPointer: {...}
-// });
-import './src/component/axisPointer';
-
-// `brush` component, for example:
-// chart.setOption({
-//     brush: {...}
-// });
-// Or
-// chart.setOption({
-//     tooltip: {feature: {brush: {...}}
-// })
-import './src/component/brush';
-
-// `title` component, for example:
-// chart.setOption({
-//     title: {...}
-// });
-import './src/component/title';
-
-// `timeline` component, for example:
-// chart.setOption({
-//     timeline: {...}
-// });
-import './src/component/timeline';
-
-// `markPoint` component, for example:
-// chart.setOption({
-//     series: [{markPoint: {...}}]
-// });
-import './src/component/markPoint';
-
-// `markLine` component, for example:
-// chart.setOption({
-//     series: [{markLine: {...}}]
-// });
-import './src/component/markLine';
-
-// `markArea` component, for example:
-// chart.setOption({
-//     series: [{markArea: {...}}]
-// });
-import './src/component/markArea';
-
-// `legend` component scrollable, for example:
-// chart.setOption({
-//     legend: {type: 'scroll'}
-// });
-import './src/component/legendScroll';
-
-// `legend` component not scrollable. for example:
-// chart.setOption({
-//     legend: {...}
-// });
-import './src/component/legend';
-
-// `dataZoom` component including both `dataZoomInside` and `dataZoomSlider`.
-import './src/component/dataZoom';
-
-// `dataZoom` component providing drag, pinch, wheel behaviors
-// inside coodinate system, for example:
-// chart.setOption({
-//     dataZoom: {type: 'inside'}
-// });
-import './src/component/dataZoomInside';
-
-// `dataZoom` component providing a slider bar, for example:
-// chart.setOption({
-//     dataZoom: {type: 'slider'}
-// });
-import './src/component/dataZoomSlider';
-
-// `dataZoom` component including both `visualMapContinuous` and `visualMapPiecewise`.
-import './src/component/visualMap';
-
-// `visualMap` component providing continuous bar, for example:
-// chart.setOption({
-//     visualMap: {type: 'continuous'}
-// });
-import './src/component/visualMapContinuous';
-
-// `visualMap` component providing pieces bar, for example:
-// chart.setOption({
-//     visualMap: {type: 'piecewise'}
-// });
-import './src/component/visualMapPiecewise';
-
-
-
-// -----------------
-// Render engines
-// -----------------
-
-
-
-// Provide IE 6,7,8 compatibility.
-// import 'zrender/src/vml/vml';
-
-// Render via SVG rather than canvas.
-import 'zrender/src/svg/svg';
diff --git a/echarts.blank.ts b/echarts.blank.ts
deleted file mode 100644
index 41faa5a..0000000
--- a/echarts.blank.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-export * from './src/echarts';
-export * from './src/export';
-
-import './src/component/dataset';
diff --git a/echarts.common.ts b/echarts.common.ts
deleted file mode 100644
index 760c9f5..0000000
--- a/echarts.common.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-export * from './src/echarts';
-export * from './src/export';
-
-import './src/component/dataset';
-
-import './src/chart/line';
-import './src/chart/bar';
-import './src/chart/pie';
-import './src/chart/scatter';
-import './src/component/graphic';
-import './src/component/tooltip';
-import './src/component/axisPointer';
-import './src/component/legendScroll';
-
-import './src/component/grid';
-import './src/component/title';
-
-import './src/component/markPoint';
-import './src/component/markLine';
-import './src/component/markArea';
-import './src/component/dataZoom';
-import './src/component/toolbox';
-
-// import 'zrender/src/vml/vml';
-import 'zrender/src/svg/svg';
\ No newline at end of file
diff --git a/echarts.simple.ts b/echarts.simple.ts
deleted file mode 100644
index 4968b75..0000000
--- a/echarts.simple.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-export * from './src/echarts';
-
-import './src/component/dataset';
-
-import './src/chart/line';
-import './src/chart/bar';
-import './src/chart/pie';
-import './src/component/gridSimple';
\ No newline at end of file
diff --git a/index.d.ts b/index.d.ts
index 603e951..fb3704e 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -22,6 +22,6 @@
 /// Make sure run it before edit this file.                         ///
 ///////////////////////////////////////////////////////////////////////
 
-export * from './types/echarts.all';
+export * from './types/src/echarts.all';
 
 export {EChartsFullOption as EChartsOption} from './types/src/option';
\ No newline at end of file
diff --git a/test/ut/core/utHelper.ts b/test/ut/core/utHelper.ts
index 38eadad..dcfdb1b 100755
--- a/test/ut/core/utHelper.ts
+++ b/test/ut/core/utHelper.ts
@@ -17,9 +17,7 @@
 * under the License.
 */
 
-// PENDING: should resolve that no `.ts` suffix.
-// @ts-ignore
-import { init, EChartsType } from '../../../echarts.all.ts';
+import { init, EChartsType } from '../../../src/echarts.all';
 
 import {
     curry as zrUtilCurry,
@@ -120,7 +118,7 @@ export function getGraphicElements(
         return (chartOrGroup as Group).children();
     }
     else {
-        const viewGroup = getViewGroup(chartOrGroup, mainType, index);
+        const viewGroup = getViewGroup(chartOrGroup as EChartsType, mainType, index);
         if (viewGroup) {
             const list: Element[] = [viewGroup];
             viewGroup.traverse(function (el: Element) {


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