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

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

commit 9494f13daefdcadbd3b08b3f4725cecbed662395
Author: sushuang <sushuang0...@gmail.com>
AuthorDate: Wed Sep 18 16:14:19 2019 +0800

    fix(lint): fix code style by eslint.
---
 extension-src/.eslintrc.yaml                 |  3 ++-
 extension-src/bmap/BMapView.js               |  2 +-
 extension-src/dataTool/gexf.js               | 17 +++++++++--------
 src/.eslintrc.yaml                           |  3 ++-
 src/chart/funnel/funnelLayout.js             | 12 ++++++------
 src/chart/line/LineView.js                   | 12 ++++++------
 src/chart/pie/PieView.js                     |  3 ++-
 src/chart/sunburst/SunburstPiece.js          |  3 ++-
 src/chart/sunburst/sunburstLayout.js         | 14 +++++++-------
 src/component/axisPointer.js                 |  4 ++--
 src/component/axisPointer/BaseAxisPointer.js |  4 ++--
 src/component/dataZoom/DataZoomModel.js      |  6 +++---
 src/component/graphic.js                     |  2 +-
 src/component/toolbox/ToolboxView.js         |  3 ++-
 src/coord/single/singleAxisHelper.js         |  5 ++---
 src/data/helper/completeDimensions.js        |  4 ++--
 src/layout/barPolar.js                       |  3 +--
 src/model/mixin/lineStyle.js                 | 16 ++++++++--------
 src/view/Component.js                        |  8 ++++----
 19 files changed, 64 insertions(+), 60 deletions(-)

diff --git a/extension-src/.eslintrc.yaml b/extension-src/.eslintrc.yaml
index 3c0e1c3..76be321 100644
--- a/extension-src/.eslintrc.yaml
+++ b/extension-src/.eslintrc.yaml
@@ -1,5 +1,6 @@
 parserOptions:
-    ecmaVersion: 3
+    # If using ES Module, ecmaVersion have to be set as `2015`.
+    ecmaVersion: 2015
     sourceType: "module"
 env:
     browser: true
diff --git a/extension-src/bmap/BMapView.js b/extension-src/bmap/BMapView.js
index b6ee812..b69149e 100644
--- a/extension-src/bmap/BMapView.js
+++ b/extension-src/bmap/BMapView.js
@@ -104,7 +104,7 @@ export default echarts.extendComponentView({
         /* map 3.0 */
         var originalStyle2 = bMapModel.__mapStyle2;
 
-        var newMapStyle2 = bMapModel.get('mapStyleV2') || {}; 
+        var newMapStyle2 = bMapModel.get('mapStyleV2') || {};
         // FIXME, Not use JSON methods
         var mapStyleStr2 = JSON.stringify(newMapStyle2);
         if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
diff --git a/extension-src/dataTool/gexf.js b/extension-src/dataTool/gexf.js
index ef3d0a6..8883e1a 100644
--- a/extension-src/dataTool/gexf.js
+++ b/extension-src/dataTool/gexf.js
@@ -99,7 +99,7 @@ function parseNodes(parent, attributesMap) {
             // z
         }
         if (vizColorDom) {
-            node.itemStyle.normal.color = 'rgb(' +[
+            node.itemStyle.normal.color = 'rgb(' + [
                 getAttr(vizColorDom, 'r') | 0,
                 getAttr(vizColorDom, 'g') | 0,
                 getAttr(vizColorDom, 'b') | 0
@@ -130,7 +130,7 @@ function parseNodes(parent, attributesMap) {
                             attValue = parseFloat(attValue);
                             break;
                         case 'boolean':
-                            attValue = attValue.toLowerCase() == 'true';
+                            attValue = attValue.toLowerCase() === 'true';
                             break;
                         default:
                     }
@@ -189,16 +189,17 @@ function getAttr(el, attrName) {
     return el.getAttribute(attrName);
 }
 
-function getChildByTagName (parent, tagName) {
+function getChildByTagName(parent, tagName) {
     var node = parent.firstChild;
 
     while (node) {
         if (
-            node.nodeType != 1 ||
-            node.nodeName.toLowerCase() != tagName.toLowerCase()
+            node.nodeType !== 1
+            || node.nodeName.toLowerCase() !== tagName.toLowerCase()
         ) {
             node = node.nextSibling;
-        } else {
+        }
+        else {
             return node;
         }
     }
@@ -206,11 +207,11 @@ function getChildByTagName (parent, tagName) {
     return null;
 }
 
-function getChildrenByTagName (parent, tagName) {
+function getChildrenByTagName(parent, tagName) {
     var node = parent.firstChild;
     var children = [];
     while (node) {
-        if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {
+        if (node.nodeName.toLowerCase() === tagName.toLowerCase()) {
             children.push(node);
         }
         node = node.nextSibling;
diff --git a/src/.eslintrc.yaml b/src/.eslintrc.yaml
index 3c0e1c3..76be321 100644
--- a/src/.eslintrc.yaml
+++ b/src/.eslintrc.yaml
@@ -1,5 +1,6 @@
 parserOptions:
-    ecmaVersion: 3
+    # If using ES Module, ecmaVersion have to be set as `2015`.
+    ecmaVersion: 2015
     sourceType: "module"
 env:
     browser: true
diff --git a/src/chart/funnel/funnelLayout.js b/src/chart/funnel/funnelLayout.js
index 1d67436..9922a6b 100644
--- a/src/chart/funnel/funnelLayout.js
+++ b/src/chart/funnel/funnelLayout.js
@@ -104,7 +104,7 @@ function labelLayout(data) {
                 x2 = x1 - labelLineLen;
                 textX = x2 - 5;
                 textAlign = 'right';
-            } 
+            }
             else if (labelPosition === 'right') {
                 // Right side
                 x1 = (points[1][0] + points[2][0]) / 2;
@@ -112,7 +112,7 @@ function labelLayout(data) {
                 x2 = x1 + labelLineLen;
                 textX = x2 + 5;
                 textAlign = 'left';
-            } 
+            }
             else if (labelPosition === 'rightTop') {
                 // RightTop side
                 x1 = points[1][0];
@@ -120,7 +120,7 @@ function labelLayout(data) {
                 x2 = x1 + labelLineLen;
                 textX = x2 + 5;
                 textAlign = 'top';
-            } 
+            }
             else if (labelPosition === 'rightBottom') {
                 // RightBottom side
                 x1 = points[2][0];
@@ -128,7 +128,7 @@ function labelLayout(data) {
                 x2 = x1 + labelLineLen;
                 textX = x2 + 5;
                 textAlign = 'bottom';
-            } 
+            }
             else if (labelPosition === 'leftTop') {
                 // LeftTop side
                 x1 = points[0][0];
@@ -136,7 +136,7 @@ function labelLayout(data) {
                 x2 = x1 - labelLineLen;
                 textX = x2 - 5;
                 textAlign = 'right';
-            } 
+            }
             else if (labelPosition === 'leftBottom') {
                 // LeftBottom side
                 x1 = points[3][0];
@@ -144,7 +144,7 @@ function labelLayout(data) {
                 x2 = x1 - labelLineLen;
                 textX = x2 - 5;
                 textAlign = 'right';
-            } 
+            }
             else {
                 // Right side
                 x1 = (points[1][0] + points[2][0]) / 2;
diff --git a/src/chart/line/LineView.js b/src/chart/line/LineView.js
index 501f026..fb81921 100644
--- a/src/chart/line/LineView.js
+++ b/src/chart/line/LineView.js
@@ -787,11 +787,11 @@ export default ChartView.extend({
             }
         });
 
-        this._polyline
-            = this._polygon
-            = this._coordSys
-            = this._points
-            = this._stackedOnPoints
-            = this._data = null;
+        this._polyline =
+            this._polygon =
+            this._coordSys =
+            this._points =
+            this._stackedOnPoints =
+            this._data = null;
     }
 });
\ No newline at end of file
diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js
index b766c3d..69e6903 100644
--- a/src/chart/pie/PieView.js
+++ b/src/chart/pie/PieView.js
@@ -141,7 +141,8 @@ piePieceProto.updateData = function (data, idx, 
firstCreate) {
         if (animationTypeUpdate === 'expansion') {
             // Sectors are set to be target shape and an overlaying clipPath 
is used for animation
             sector.setShape(sectorShape);
-        } else {
+        }
+        else {
             // Transition animation from the old shape
             graphic.updateProps(sector, {
                 shape: sectorShape
diff --git a/src/chart/sunburst/SunburstPiece.js 
b/src/chart/sunburst/SunburstPiece.js
index 4c920c1..79ca4c3 100644
--- a/src/chart/sunburst/SunburstPiece.js
+++ b/src/chart/sunburst/SunburstPiece.js
@@ -292,7 +292,8 @@ SunburstPieceProto._updateLabel = function (seriesModel, 
visualColor, state) {
         else if (rotate < -Math.PI / 2) {
             rotate += Math.PI;
         }
-    } else if (typeof rotateType === 'number') {
+    }
+    else if (typeof rotateType === 'number') {
         rotate = rotateType * Math.PI / 180;
     }
     label.attr('rotation', rotate);
diff --git a/src/chart/sunburst/sunburstLayout.js 
b/src/chart/sunburst/sunburstLayout.js
index 7b9be2c..ae39073 100644
--- a/src/chart/sunburst/sunburstLayout.js
+++ b/src/chart/sunburst/sunburstLayout.js
@@ -21,7 +21,7 @@
 import { parsePercent } from '../../util/number';
 import * as zrUtil from 'zrender/src/core/util';
 
-var PI2 = Math.PI * 2;
+// var PI2 = Math.PI * 2;
 var RADIAN = Math.PI / 180;
 
 export default function (seriesType, ecModel, api, payload) {
@@ -74,8 +74,8 @@ export default function (seriesType, ecModel, api, payload) {
         var stillShowZeroSum = seriesModel.get('stillShowZeroSum');
 
         // In the case some sector angle is smaller than minAngle
-        var restAngle = PI2;
-        var valueSumLargerThanMinAngle = 0;
+        // var restAngle = PI2;
+        // var valueSumLargerThanMinAngle = 0;
 
         var dir = clockwise ? 1 : -1;
 
@@ -99,11 +99,11 @@ export default function (seriesType, ecModel, api, payload) 
{
                     ? unitRadian : (value * unitRadian);
                 if (angle < minAngle) {
                     angle = minAngle;
-                    restAngle -= minAngle;
-                }
-                else {
-                    valueSumLargerThanMinAngle += value;
+                    // restAngle -= minAngle;
                 }
+                // else {
+                //     valueSumLargerThanMinAngle += value;
+                // }
 
                 endAngle = startAngle + dir * angle;
 
diff --git a/src/component/axisPointer.js b/src/component/axisPointer.js
index 27ad981..7877103 100644
--- a/src/component/axisPointer.js
+++ b/src/component/axisPointer.js
@@ -51,8 +51,8 @@ echarts.registerPreprocessor(function (option) {
 echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function 
(ecModel, api) {
     // Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
     // allAxesInfo should be updated when setOption performed.
-    ecModel.getComponent('axisPointer').coordSysAxesInfo
-        = axisPointerModelHelper.collect(ecModel, api);
+    ecModel.getComponent('axisPointer').coordSysAxesInfo =
+        axisPointerModelHelper.collect(ecModel, api);
 });
 
 // Broadcast to all views.
diff --git a/src/component/axisPointer/BaseAxisPointer.js 
b/src/component/axisPointer/BaseAxisPointer.js
index 6b206bb..f97ee57 100644
--- a/src/component/axisPointer/BaseAxisPointer.js
+++ b/src/component/axisPointer/BaseAxisPointer.js
@@ -128,8 +128,8 @@ BaseAxisPointer.prototype = {
         }
         this._lastGraphicKey = graphicKey;
 
-        var moveAnimation = this._moveAnimation
-            = this.determineAnimation(axisModel, axisPointerModel);
+        var moveAnimation = this._moveAnimation =
+            this.determineAnimation(axisModel, axisPointerModel);
 
         if (!group) {
             group = this._group = new graphic.Group();
diff --git a/src/component/dataZoom/DataZoomModel.js 
b/src/component/dataZoom/DataZoomModel.js
index 9c5f6a5..99f5b1c 100644
--- a/src/component/dataZoom/DataZoomModel.js
+++ b/src/component/dataZoom/DataZoomModel.js
@@ -382,9 +382,9 @@ var DataZoomModel = echarts.extendComponentModel({
         }
         if (this._autoThrottle) {
             var globalOption = this.ecModel.option;
-            this.option.throttle
-                = (globalOption.animation && 
globalOption.animationDurationUpdate > 0)
-                ? 100 : 20;
+            this.option.throttle = (
+                globalOption.animation && globalOption.animationDurationUpdate 
> 0
+            ) ? 100 : 20;
         }
     },
 
diff --git a/src/component/graphic.js b/src/component/graphic.js
index 457cc4c..92674a7 100644
--- a/src/component/graphic.js
+++ b/src/component/graphic.js
@@ -402,7 +402,7 @@ echarts.extendComponentView({
                 };
 
             // PENDING
-            // Currently, when `bounding: 'all'`, the union bounding rect of 
the group 
+            // Currently, when `bounding: 'all'`, the union bounding rect of 
the group
             // does not include the rect of [0, 0, group.width, group.height], 
which
             // is probably weird for users. Should we make a break change for 
it?
             layoutUtil.positionElement(
diff --git a/src/component/toolbox/ToolboxView.js 
b/src/component/toolbox/ToolboxView.js
index 78d2139..35c3fc3 100644
--- a/src/component/toolbox/ToolboxView.js
+++ b/src/component/toolbox/ToolboxView.js
@@ -185,7 +185,8 @@ export default echarts.extendComponentView({
                             path.setStyle({
                                 text: titles[iconName],
                                 textPosition: 
iconStyleEmphasisModel.get('textPosition') || 'bottom',
-                                textFill: 
iconStyleEmphasisModel.get('textFill') || hoverStyle.fill || hoverStyle.stroke 
|| '#000',
+                                textFill: 
iconStyleEmphasisModel.get('textFill')
+                                    || hoverStyle.fill || hoverStyle.stroke || 
'#000',
                                 textAlign: 
iconStyleEmphasisModel.get('textAlign') || 'center',
                                 textBackgroundColor: 
iconStyleEmphasisModel.get('textBackgroundColor'),
                                 textBorderRadius: 
iconStyleEmphasisModel.get('textBorderRadius'),
diff --git a/src/coord/single/singleAxisHelper.js 
b/src/coord/single/singleAxisHelper.js
index 60ac90b..fa44fda 100644
--- a/src/coord/single/singleAxisHelper.js
+++ b/src/coord/single/singleAxisHelper.js
@@ -57,9 +57,8 @@ export function layout(axisModel, opt) {
 
     var directionMap = {top: -1, bottom: 1, right: 1, left: -1};
 
-    layout.labelDirection = layout.tickDirection
-        = layout.nameDirection
-        = directionMap[axisPosition];
+    layout.labelDirection = layout.tickDirection =
+        layout.nameDirection = directionMap[axisPosition];
 
     if (axisModel.get('axisTick.inside')) {
         layout.tickDirection = -layout.tickDirection;
diff --git a/src/data/helper/completeDimensions.js 
b/src/data/helper/completeDimensions.js
index 0034094..7bdddd9 100644
--- a/src/data/helper/completeDimensions.js
+++ b/src/data/helper/completeDimensions.js
@@ -153,8 +153,8 @@ function completeDimensions(sysDims, source, opt) {
             // `coordDimIndex` should not be set directly.
             sysDimItemDimsDef = sysDimItem.dimsDef;
             sysDimItemOtherDims = sysDimItem.otherDims;
-            sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex
-                = sysDimItem.dimsDef = sysDimItem.otherDims = null;
+            sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex =
+                sysDimItem.dimsDef = sysDimItem.otherDims = null;
         }
 
         var dataDims = encodeDef.get(coordDim);
diff --git a/src/layout/barPolar.js b/src/layout/barPolar.js
index a5536ee..88d7641 100644
--- a/src/layout/barPolar.js
+++ b/src/layout/barPolar.js
@@ -63,8 +63,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
         var axisKey = getAxisKey(polar, baseAxis);
 
         var stackId = getSeriesStackId(seriesModel);
-        var columnLayoutInfo
-            = barWidthAndOffset[axisKey][stackId];
+        var columnLayoutInfo = barWidthAndOffset[axisKey][stackId];
         var columnOffset = columnLayoutInfo.offset;
         var columnWidth = columnLayoutInfo.width;
         var valueAxis = polar.getOtherAxis(baseAxis);
diff --git a/src/model/mixin/lineStyle.js b/src/model/mixin/lineStyle.js
index 1889875..99b3f7c 100644
--- a/src/model/mixin/lineStyle.js
+++ b/src/model/mixin/lineStyle.js
@@ -34,7 +34,7 @@ var getLineStyle = makeStyleMapper(
 export default {
     getLineStyle: function (excludes) {
         var style = getLineStyle(this, excludes);
-        // Always set lineDash whether dashed, otherwise we can not 
+        // Always set lineDash whether dashed, otherwise we can not
         // erase the previous style when assigning to el.style.
         style.lineDash = this.getLineDash(style.lineWidth);
         return style;
@@ -47,15 +47,15 @@ export default {
         var lineType = this.get('type');
         var dotSize = Math.max(lineWidth, 2);
         var dashSize = lineWidth * 4;
-        return (lineType === 'solid' || lineType == null) 
-            // Use `false` but not `null` for the solid line here, because 
`null` might be 
-            // ignored when assigning to `el.style`. e.g., when setting 
`lineStyle.type` as 
-            // `'dashed'` and `emphasis.lineStyle.type` as `'solid'` in graph 
series, the 
-            // `lineDash` gotten form the latter one is not able to erase that 
from the former 
+        return (lineType === 'solid' || lineType == null)
+            // Use `false` but not `null` for the solid line here, because 
`null` might be
+            // ignored when assigning to `el.style`. e.g., when setting 
`lineStyle.type` as
+            // `'dashed'` and `emphasis.lineStyle.type` as `'solid'` in graph 
series, the
+            // `lineDash` gotten form the latter one is not able to erase that 
from the former
             // one if using `null` here according to the emhpsis strategy in 
`util/graphic.js`.
             ? false
-            : lineType === 'dashed' 
-            ? [dashSize, dashSize] 
+            : lineType === 'dashed'
+            ? [dashSize, dashSize]
             : [dotSize, dotSize];
     }
 };
\ No newline at end of file
diff --git a/src/view/Component.js b/src/view/Component.js
index 180c502..c5bfc77 100644
--- a/src/view/Component.js
+++ b/src/view/Component.js
@@ -57,10 +57,10 @@ Component.prototype = {
 };
 
 var componentProto = Component.prototype;
-componentProto.updateView
-    = componentProto.updateLayout
-    = componentProto.updateVisual
-    = function (seriesModel, ecModel, api, payload) {
+componentProto.updateView =
+    componentProto.updateLayout =
+    componentProto.updateVisual =
+    function (seriesModel, ecModel, api, payload) {
         // Do nothing;
     };
 // Enable Component.extend.


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

Reply via email to