You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/05/06 06:22:09 UTC

[echarts] 01/03: chore: enhance the script compatibility in Windows and fix some lint errors.

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

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

commit 5162c4f2a8f371ea3d305b6d40a0b007592f4978
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu May 6 14:10:21 2021 +0800

    chore: enhance the script compatibility in Windows and fix some lint errors.
---
 package.json                                      |  8 ++++----
 src/chart/funnel/FunnelSeries.ts                  |  2 --
 src/chart/funnel/FunnelView.ts                    |  3 +--
 src/chart/helper/Line.ts                          |  2 +-
 src/chart/line/install.ts                         |  5 ++---
 src/chart/sankey/SankeySeries.ts                  |  6 ++----
 src/component/axisPointer/CartesianAxisPointer.ts |  3 +--
 src/component/axisPointer/PolarAxisPointer.ts     |  6 +++---
 src/component/dataZoom/SliderZoomView.ts          |  3 +--
 src/component/marker/MarkLineView.ts              | 20 ++++++++++++++++----
 src/component/marker/MarkerView.ts                |  7 +++++--
 src/component/radar/install.ts                    |  4 ++--
 src/component/timeline/SliderTimelineModel.ts     |  4 +++-
 src/component/toolbox/feature/DataView.ts         |  2 ++
 src/component/toolbox/feature/SaveAsImage.ts      |  4 +++-
 15 files changed, 46 insertions(+), 33 deletions(-)

diff --git a/package.json b/package.json
index 0e49490..b4a20f5 100644
--- a/package.json
+++ b/package.json
@@ -57,10 +57,10 @@
     "test:dts": "node build/testDts.js",
     "mktest": "node test/build/mktest.js",
     "mktest:help": "node test/build/mktest.js -h",
-    "checktype": "./node_modules/.bin/tsc --noEmit",
-    "lint": "./node_modules/.bin/eslint src/**/*.ts extension-src/**/*.ts",
-    "lint:fix": "./node_modules/.bin/eslint --fix src/**/*.ts extension-src/**/*.ts",
-    "lint:dist": "echo 'It might take a while. Please wait ...' && ./node_modules/.bin/jshint --config .jshintrc-dist dist/echarts.js"
+    "checktype": "tsc --noEmit",
+    "lint": "eslint src/**/*.ts extension-src/**/*.ts",
+    "lint:fix": "eslint --fix src/**/*.ts extension-src/**/*.ts",
+    "lint:dist": "echo 'It might take a while. Please wait ...' && jshint --config .jshintrc-dist dist/echarts.js"
   },
   "dependencies": {
     "tslib": "2.0.3",
diff --git a/src/chart/funnel/FunnelSeries.ts b/src/chart/funnel/FunnelSeries.ts
index eb99752..96a7739 100644
--- a/src/chart/funnel/FunnelSeries.ts
+++ b/src/chart/funnel/FunnelSeries.ts
@@ -40,8 +40,6 @@ import {
 } from '../../util/types';
 import GlobalModel from '../../model/Global';
 import List from '../../data/List';
-import ComponentModel from '../../model/Component';
-
 
 type FunnelLabelOption = Omit<SeriesLabelOption, 'position'> & {
     position?: LabelOption['position']
diff --git a/src/chart/funnel/FunnelView.ts b/src/chart/funnel/FunnelView.ts
index ab9b202..77a1aa7 100644
--- a/src/chart/funnel/FunnelView.ts
+++ b/src/chart/funnel/FunnelView.ts
@@ -27,7 +27,6 @@ import List from '../../data/List';
 import { ColorString } from '../../util/types';
 import { setLabelLineStyle, getLabelLineStatesModels } from '../../label/labelGuideHelper';
 import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
-import { retrieveVisualColorForTooltipMarker } from '../../component/tooltip/tooltipMarkup';
 
 const opacityAccessPath = ['itemStyle', 'opacity'] as const;
 
@@ -210,4 +209,4 @@ class FunnelView extends ChartView {
 }
 
 
-export default FunnelView;
\ No newline at end of file
+export default FunnelView;
diff --git a/src/chart/helper/Line.ts b/src/chart/helper/Line.ts
index b2edb27..4ec9df8 100644
--- a/src/chart/helper/Line.ts
+++ b/src/chart/helper/Line.ts
@@ -81,7 +81,7 @@ function createSymbol(name: 'fromSymbol' | 'toSymbol', lineData: LineList, idx:
         ? symbolOffset : [symbolOffset, symbolOffset];
 
     symbolOffsetArr[0] = parsePercent(symbolOffsetArr[0], symbolSizeArr[0]);
-    symbolOffsetArr[1] = parsePercent(retrieve2(symbolOffsetArr[1], symbolOffsetArr[0]),symbolSizeArr[1]);
+    symbolOffsetArr[1] = parsePercent(retrieve2(symbolOffsetArr[1], symbolOffsetArr[0]), symbolSizeArr[1]);
 
     const symbolPath = symbolUtil.createSymbol(
         symbolType,
diff --git a/src/chart/line/install.ts b/src/chart/line/install.ts
index 896079d..e6379e2 100644
--- a/src/chart/line/install.ts
+++ b/src/chart/line/install.ts
@@ -19,7 +19,6 @@
 
 import LineSeries from './LineSeries';
 import LineView from './LineView';
-import LineSeriesModel from './LineSeries';
 
 // In case developer forget to include grid component
 
@@ -37,7 +36,7 @@ export function install(registers: EChartsExtensionInstallRegisters) {
 
     registers.registerVisual({
         seriesType: 'line',
-        reset: function (seriesModel: LineSeriesModel) {
+        reset: function (seriesModel: LineSeries) {
             const data = seriesModel.getData();
             // Visual coding for legend
             const lineStyle = seriesModel.getModel('lineStyle').getLineStyle();
@@ -56,4 +55,4 @@ export function install(registers: EChartsExtensionInstallRegisters) {
         dataSample('line')
     );
 
-}
\ No newline at end of file
+}
diff --git a/src/chart/sankey/SankeySeries.ts b/src/chart/sankey/SankeySeries.ts
index 5d42f98..64825cb 100644
--- a/src/chart/sankey/SankeySeries.ts
+++ b/src/chart/sankey/SankeySeries.ts
@@ -260,9 +260,7 @@ class SankeySeriesModel extends SeriesModel<SankeySeriesOption> {
         }
     }
 
-    optionUpdated() {
-        const option = this.option;
-    }
+    optionUpdated() {}
 
     // Override Series.getDataParams()
     getDataParams(dataIndex: number, dataType: 'node' | 'edge') {
@@ -332,4 +330,4 @@ class SankeySeriesModel extends SeriesModel<SankeySeriesOption> {
     };
 }
 
-export default SankeySeriesModel;
\ No newline at end of file
+export default SankeySeriesModel;
diff --git a/src/component/axisPointer/CartesianAxisPointer.ts b/src/component/axisPointer/CartesianAxisPointer.ts
index a6a10e6..a0ff122 100644
--- a/src/component/axisPointer/CartesianAxisPointer.ts
+++ b/src/component/axisPointer/CartesianAxisPointer.ts
@@ -20,7 +20,6 @@
 import BaseAxisPointer, {AxisPointerElementOptions} from './BaseAxisPointer';
 import * as viewHelper from './viewHelper';
 import * as cartesianAxisHelper from '../../coord/cartesian/cartesianAxisHelper';
-import AxisView from '../axis/AxisView';
 import CartesianAxisModel from '../../coord/cartesian/AxisModel';
 import ExtensionAPI from '../../core/ExtensionAPI';
 import { ScaleDataValue, VerticalAlign, HorizontalAlign, CommonAxisPointerOption } from '../../util/types';
@@ -176,4 +175,4 @@ function getAxisDimIndex(axis: Axis2D) {
     return axis.dim === 'x' ? 0 : 1;
 }
 
-export default CartesianAxisPointer;
\ No newline at end of file
+export default CartesianAxisPointer;
diff --git a/src/component/axisPointer/PolarAxisPointer.ts b/src/component/axisPointer/PolarAxisPointer.ts
index 37e5fbb..0a22034 100644
--- a/src/component/axisPointer/PolarAxisPointer.ts
+++ b/src/component/axisPointer/PolarAxisPointer.ts
@@ -22,8 +22,8 @@ import * as graphic from '../../util/graphic';
 import * as viewHelper from './viewHelper';
 import * as matrix from 'zrender/src/core/matrix';
 import AxisBuilder from '../axis/AxisBuilder';
-import AxisView from '../axis/AxisView';
-import {OptionDataValue,
+import {
+    OptionDataValue,
     ScaleDataValue,
     CommonAxisPointerOption,
     ZRTextAlign,
@@ -191,4 +191,4 @@ const pointerShapeBuilder = {
     }
 };
 
-export default PolarAxisPointer;
\ No newline at end of file
+export default PolarAxisPointer;
diff --git a/src/component/dataZoom/SliderZoomView.ts b/src/component/dataZoom/SliderZoomView.ts
index def6bd6..83039ec 100644
--- a/src/component/dataZoom/SliderZoomView.ts
+++ b/src/component/dataZoom/SliderZoomView.ts
@@ -31,7 +31,6 @@ import {
     LayoutOrient, Payload, ZRTextVerticalAlign, ZRTextAlign, ZRElementEvent, ParsedValue
 } from '../../util/types';
 import SliderZoomModel from './SliderZoomModel';
-import ComponentView from '../../view/Component';
 import { RectLike } from 'zrender/src/core/BoundingRect';
 import Axis from '../../coord/Axis';
 import SeriesModel from '../../model/Series';
@@ -42,7 +41,7 @@ import { createSymbol, symbolBuildProxies } from '../../util/symbol';
 import { deprecateLog } from '../../util/log';
 import { PointLike } from 'zrender/src/core/Point';
 import Displayable from 'zrender/src/graphic/Displayable';
-import {createTextStyle} from "../../label/labelStyle";
+import {createTextStyle} from '../../label/labelStyle';
 
 const Rect = graphic.Rect;
 
diff --git a/src/component/marker/MarkLineView.ts b/src/component/marker/MarkLineView.ts
index 902a574..a1fc0e9 100644
--- a/src/component/marker/MarkLineView.ts
+++ b/src/component/marker/MarkLineView.ts
@@ -401,10 +401,22 @@ class MarkLineView extends MarkerView {
             data.setItemVisual(idx, {
                 symbolKeepAspect: itemModel.get('symbolKeepAspect'),
                 // `0` should be considered as a valid value, so use `retrieve2` instead of `||`
-                symbolOffset: retrieve2(itemModel.get('symbolOffset'), (symbolOffset as (string | number)[])[isFrom ? 0 : 1]),
-                symbolRotate: retrieve2(itemModel.get('symbolRotate', true), (symbolRotate as number[])[isFrom ? 0 : 1]),
-                symbolSize: retrieve2(itemModel.get('symbolSize'), (symbolSize as number[])[isFrom ? 0 : 1]),
-                symbol: retrieve2(itemModel.get('symbol', true), (symbolType as string[])[isFrom ? 0 : 1]),
+                symbolOffset: retrieve2(
+                    itemModel.get('symbolOffset'),
+                    (symbolOffset as (string | number)[])[isFrom ? 0 : 1]
+                ),
+                symbolRotate: retrieve2(
+                    itemModel.get('symbolRotate', true),
+                    (symbolRotate as number[])[isFrom ? 0 : 1]
+                ),
+                symbolSize: retrieve2(
+                    itemModel.get('symbolSize'),
+                    (symbolSize as number[])[isFrom ? 0 : 1]
+                ),
+                symbol: retrieve2(
+                    itemModel.get('symbol', true),
+                    (symbolType as string[])[isFrom ? 0 : 1]
+                ),
                 style
             });
         }
diff --git a/src/component/marker/MarkerView.ts b/src/component/marker/MarkerView.ts
index cfe62cb..9af63e3 100644
--- a/src/component/marker/MarkerView.ts
+++ b/src/component/marker/MarkerView.ts
@@ -73,7 +73,10 @@ abstract class MarkerView extends ComponentView {
 
     blurSeries(seriesModelList: SeriesModel[]) {
         each(seriesModelList, seriesModel => {
-            const markerModel = MarkerModel.getMarkerModelFromSeries(seriesModel, this.type as 'markPoint' | 'markLine' | 'markArea');
+            const markerModel = MarkerModel.getMarkerModelFromSeries(
+                seriesModel,
+                this.type as 'markPoint' | 'markLine' | 'markArea'
+            );
             if (markerModel) {
                 const data = markerModel.getData();
                 data.eachItemGraphicEl(function (el) {
@@ -93,4 +96,4 @@ abstract class MarkerView extends ComponentView {
     ): void;
 }
 
-export default MarkerView;
\ No newline at end of file
+export default MarkerView;
diff --git a/src/component/radar/install.ts b/src/component/radar/install.ts
index 42445b8..d0abe8e 100644
--- a/src/component/radar/install.ts
+++ b/src/component/radar/install.ts
@@ -39,5 +39,5 @@ export function install(registers: EChartsExtensionInstallRegisters) {
             // visual is for unselected data
             data.setVisual('legendSymbol', 'roundRect');
         }
-    })
-}
\ No newline at end of file
+    });
+}
diff --git a/src/component/timeline/SliderTimelineModel.ts b/src/component/timeline/SliderTimelineModel.ts
index 55871bd..618e49c 100644
--- a/src/component/timeline/SliderTimelineModel.ts
+++ b/src/component/timeline/SliderTimelineModel.ts
@@ -101,7 +101,9 @@ class SliderTimelineModel extends TimelineModel {
 
             playIcon: 'path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z', // jshint ignore:line
             stopIcon: 'path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z', // j [...]
+            // eslint-disable-next-line max-len
             nextIcon: 'M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z', // jshint ignore:line
+            // eslint-disable-next-line max-len
             prevIcon: 'M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z', // jshint ignore:line
 
             prevBtnSize: 18,
@@ -152,4 +154,4 @@ interface SliderTimelineModel extends DataFormatMixin {
 
 mixin(SliderTimelineModel, DataFormatMixin.prototype);
 
-export default SliderTimelineModel;
\ No newline at end of file
+export default SliderTimelineModel;
diff --git a/src/component/toolbox/feature/DataView.ts b/src/component/toolbox/feature/DataView.ts
index 15c1742..cf10b17 100644
--- a/src/component/toolbox/feature/DataView.ts
+++ b/src/component/toolbox/feature/DataView.ts
@@ -28,6 +28,8 @@ import { addEventListener } from 'zrender/src/core/event';
 import Axis from '../../../coord/Axis';
 import Cartesian2D from '../../../coord/cartesian/Cartesian2D';
 
+/* global document */
+
 const BLOCK_SPLITER = new Array(60).join('-');
 const ITEM_SPLITER = '\t';
 
diff --git a/src/component/toolbox/feature/SaveAsImage.ts b/src/component/toolbox/feature/SaveAsImage.ts
index f7caa58..6da25ba 100644
--- a/src/component/toolbox/feature/SaveAsImage.ts
+++ b/src/component/toolbox/feature/SaveAsImage.ts
@@ -41,6 +41,8 @@ export interface ToolboxSaveAsImageFeatureOption extends ToolboxFeatureOption {
     lang?: string[]
 }
 
+/* global window, document */
+
 class SaveAsImage extends ToolboxFeature<ToolboxSaveAsImageFeatureOption> {
 
     onclick(ecModel: GlobalModel, api: ExtensionAPI) {
@@ -84,7 +86,7 @@ class SaveAsImage extends ToolboxFeature<ToolboxSaveAsImageFeatureOption> {
                 // otherwise, like `svg` data uri exported by zrender,
                 // there will be an error, for it's not encoded with base64.
                 // (just a url-encoded string through `encodeURIComponent`)
-                base64Encoded && (bstr = atob(bstr));
+                base64Encoded && (bstr = window.atob(bstr));
                 const filename = title + '.' + type;
                 if (window.navigator.msSaveOrOpenBlob) {
                     let n = bstr.length;

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