diff --git a/package-scripts.js b/package-scripts.js index 73a495e6a..c6d0f81ca 100644 --- a/package-scripts.js +++ b/package-scripts.js @@ -8,13 +8,11 @@ module.exports = { default: "webpack-dev-server --config ./config/webpack/demo/webpack.config.dev.js --colors --content-base demo/js" }, - hot: - "webpack-dev-server --config ./config/webpack/demo/webpack.config.hot.js --colors --inline --hot --content-base demo/js", + hot: "webpack-dev-server --config ./config/webpack/demo/webpack.config.hot.js --colors --inline --hot --content-base demo/js", test: "webpack-dev-server --config ./config/webpack/webpack.config.test.js --colors" }, karma: { - ci: - "karma start --browsers ChromeHeadlessCustom,Firefox ./config/karma/karma.conf.coverage.js", + ci: "karma start --browsers ChromeHeadlessCustom,Firefox ./config/karma/karma.conf.coverage.js", cov: "karma start ./config/karma/karma.conf.coverage.js", default: "karma start ./config/karma/karma.conf.js" }, @@ -51,10 +49,8 @@ module.exports = { default: npsUtils.series.nps("lint", "test") }, watch: { - es: - "lerna exec --parallel -- cross-env BABEL_ENV=es babel src --out-dir es --copy-files --watch", - lib: - "lerna exec --parallel -- cross-env BABEL_ENV=lib babel src --out-dir lib --copy-files --watch", + es: "lerna exec --parallel -- cross-env BABEL_ENV=es babel src --out-dir es --copy-files --watch", + lib: "lerna exec --parallel -- cross-env BABEL_ENV=lib babel src --out-dir lib --copy-files --watch", default: npsUtils.concurrent.nps("watch.es", "watch.lib") }, clean: { diff --git a/package.json b/package.json index 0b80503b4..eade25843 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "mocha": "^5.0.0", "nps": "^5.9.0", "nps-utils": "^1.5.0", - "prettier": "^2.0.0", + "prettier": "^2.3.1", "prop-types": "^15.5.8", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/packages/victory-axis/src/helper-methods.js b/packages/victory-axis/src/helper-methods.js index c9b1e5219..c222d1fe9 100644 --- a/packages/victory-axis/src/helper-methods.js +++ b/packages/victory-axis/src/helper-methods.js @@ -183,17 +183,8 @@ const getDefaultOrientations = (axis, originSign, horizontal) => { }; const getStandaloneOffset = (props, calculatedValues) => { - const { - style, - scale, - orientation, - padding, - axis, - ticks, - stringTicks, - isVertical, - labelPadding - } = calculatedValues; + const { style, scale, orientation, padding, axis, ticks, stringTicks, isVertical, labelPadding } = + calculatedValues; const { polar, horizontal } = props; const sharedProps = { scale: { [axis]: scale }, polar, horizontal, ticks, stringTicks }; const xPadding = orientation === "right" ? padding.right : padding.left; diff --git a/packages/victory-bar/src/path-helper-methods.js b/packages/victory-bar/src/path-helper-methods.js index 4b4a040b9..5c562e9f7 100644 --- a/packages/victory-bar/src/path-helper-methods.js +++ b/packages/victory-bar/src/path-helper-methods.js @@ -271,9 +271,8 @@ export const getVerticalPolarBarPath = (props, cornerRadius) => { const getTopPath = () => { const { topRight, topLeft } = cornerRadius; const arcLength = r2 * Math.abs(end - start); - const { rightMoves, rightCoords, rightMiddle, leftMoves, leftCoords, leftMiddle } = getPathData( - "top" - ); + const { rightMoves, rightCoords, rightMiddle, leftMoves, leftCoords, leftMiddle } = + getPathData("top"); let moves; let coords; if (topRight === topLeft || arcLength < 2 * topRight + 2 * topLeft) { @@ -305,9 +304,8 @@ export const getVerticalPolarBarPath = (props, cornerRadius) => { const getBottomPath = () => { const { bottomRight, bottomLeft } = cornerRadius; const arcLength = r1 * Math.abs(end - start); - const { rightMoves, rightCoords, rightMiddle, leftMoves, leftCoords, leftMiddle } = getPathData( - "bottom" - ); + const { rightMoves, rightCoords, rightMiddle, leftMoves, leftCoords, leftMiddle } = + getPathData("bottom"); let moves; let coords; if (bottomRight === bottomLeft || arcLength < 2 * bottomRight + 2 * bottomLeft) { diff --git a/packages/victory-box-plot/src/helper-methods.js b/packages/victory-box-plot/src/helper-methods.js index 34751aafe..31a78648e 100644 --- a/packages/victory-box-plot/src/helper-methods.js +++ b/packages/victory-box-plot/src/helper-methods.js @@ -209,16 +209,8 @@ const getCalculatedValues = (props) => { // eslint-disable-next-line complexity const getWhiskerProps = (props, type) => { - const { - horizontal, - style, - boxWidth, - whiskerWidth, - datum, - scale, - index, - disableInlineStyles - } = props; + const { horizontal, style, boxWidth, whiskerWidth, datum, scale, index, disableInlineStyles } = + props; const { min, max, q1, q3, x, y } = props.positions; const boxValue = type === "min" ? q1 : q3; const whiskerValue = type === "min" ? min : max; diff --git a/packages/victory-brush-container/src/brush-helpers.js b/packages/victory-brush-container/src/brush-helpers.js index 5b8afc36a..7f75c1f7b 100644 --- a/packages/victory-brush-container/src/brush-helpers.js +++ b/packages/victory-brush-container/src/brush-helpers.js @@ -179,14 +179,8 @@ const Helpers = { // eslint-disable-next-line max-statements, complexity onMouseDown(evt, targetProps) { evt.preventDefault(); - const { - handleWidth, - cachedBrushDomain, - domain, - allowResize, - allowDrag, - allowDraw - } = targetProps; + const { handleWidth, cachedBrushDomain, domain, allowResize, allowDrag, allowDraw } = + targetProps; const brushDimension = this.getDimension(targetProps); const defaultBrushArea = !allowResize && !targetProps.defaultBrushArea ? "move" : targetProps.defaultBrushArea; diff --git a/packages/victory-brush-line/src/victory-brush-line.js b/packages/victory-brush-line/src/victory-brush-line.js index ab4affeff..7e1147c55 100644 --- a/packages/victory-brush-line/src/victory-brush-line.js +++ b/packages/victory-brush-line/src/victory-brush-line.js @@ -199,13 +199,8 @@ export default class VictoryBrushLine extends React.Component { }, onMouseDown: (evt, targetProps) => { evt.preventDefault(); - const { - allowResize, - allowDrag, - allowDraw, - activeBrushes, - brushDomain - } = targetProps; + const { allowResize, allowDrag, allowDraw, activeBrushes, brushDomain } = + targetProps; const dimension = getDimension(targetProps); // Don't trigger events for static brushes @@ -373,12 +368,8 @@ export default class VictoryBrushLine extends React.Component { return []; }, onMouseUp(evt, targetProps) { - const { - onBrushDomainChange, - brushDomain, - allowResize, - activeBrushes - } = targetProps; + const { onBrushDomainChange, brushDomain, allowResize, activeBrushes } = + targetProps; // if the mouse hasn't moved since a mouseDown event, select the whole domain region const mutatedProps = { isPanning: false, diff --git a/packages/victory-chart/src/victory-chart.js b/packages/victory-chart/src/victory-chart.js index 215ee77d9..977abb2f9 100644 --- a/packages/victory-chart/src/victory-chart.js +++ b/packages/victory-chart/src/victory-chart.js @@ -135,13 +135,8 @@ export default class VictoryChart extends React.Component { const props = this.state && this.state.nodesWillExit ? this.state.oldProps || this.props : this.props; const modifiedProps = Helpers.modifyProps(props, fallbackProps, "chart"); - const { - eventKey, - containerComponent, - groupComponent, - standalone, - externalEventMutations - } = modifiedProps; + const { eventKey, containerComponent, groupComponent, standalone, externalEventMutations } = + modifiedProps; const axes = props.polar ? modifiedProps.defaultPolarAxes : modifiedProps.defaultAxes; const childComponents = getChildComponents(modifiedProps, axes); const calculatedProps = getCalculatedProps(modifiedProps, childComponents); diff --git a/packages/victory-core/src/victory-container/victory-container.js b/packages/victory-core/src/victory-container/victory-container.js index 3c5d74a5e..d079fcbbf 100644 --- a/packages/victory-core/src/victory-container/victory-container.js +++ b/packages/victory-core/src/victory-container/victory-container.js @@ -112,16 +112,8 @@ export default class VictoryContainer extends React.Component { } renderContainer(props, svgProps, style) { - const { - title, - desc, - portalComponent, - className, - width, - height, - portalZIndex, - responsive - } = props; + const { title, desc, portalComponent, className, width, height, portalZIndex, responsive } = + props; const children = this.getChildren(props); const dimensions = responsive ? { width: "100%", height: "100%" } : { width, height }; const divStyle = assign( @@ -172,17 +164,8 @@ export default class VictoryContainer extends React.Component { } render() { - const { - width, - height, - responsive, - events, - title, - desc, - tabIndex, - preserveAspectRatio, - role - } = this.props; + const { width, height, responsive, events, title, desc, tabIndex, preserveAspectRatio, role } = + this.props; const style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]); diff --git a/packages/victory-core/src/victory-label/victory-label.js b/packages/victory-core/src/victory-label/victory-label.js index 749620709..9570dda58 100644 --- a/packages/victory-core/src/victory-label/victory-label.js +++ b/packages/victory-core/src/victory-label/victory-label.js @@ -268,16 +268,8 @@ const getInlineXOffset = (calculatedProps, textElements, index) => { }; const getChildBackgrounds = (calculatedProps, tspanValues) => { - const { - dy, - dx, - transform, - backgroundStyle, - backgroundPadding, - backgroundComponent, - inline, - y - } = calculatedProps; + const { dy, dx, transform, backgroundStyle, backgroundPadding, backgroundComponent, inline, y } = + calculatedProps; const textElements = tspanValues.map((current, i) => { const previous = getSingleValue(tspanValues, i - 1); diff --git a/packages/victory-core/src/victory-transition/victory-transition.js b/packages/victory-core/src/victory-transition/victory-transition.js index 8613b7858..ba1bef998 100644 --- a/packages/victory-core/src/victory-transition/victory-transition.js +++ b/packages/victory-core/src/victory-transition/victory-transition.js @@ -61,12 +61,8 @@ export default class VictoryTransition extends React.Component { } else { const oldChildren = React.Children.toArray(props.children); const nextChildren = React.Children.toArray(nextProps.children); - const { - nodesWillExit, - nodesWillEnter, - childrenTransitions, - nodesShouldEnter - } = Transitions.getInitialTransitionState(oldChildren, nextChildren); + const { nodesWillExit, nodesWillEnter, childrenTransitions, nodesShouldEnter } = + Transitions.getInitialTransitionState(oldChildren, nextChildren); return { nodesWillExit, nodesWillEnter, diff --git a/packages/victory-core/src/victory-util/wrapper.js b/packages/victory-core/src/victory-util/wrapper.js index f5f27fcbf..502ba2385 100644 --- a/packages/victory-core/src/victory-util/wrapper.js +++ b/packages/victory-core/src/victory-util/wrapper.js @@ -123,12 +123,8 @@ export default { isContinuous(child) || (child.props.children && isContinuous(child.props.children)) ); }); - const { - nodesWillExit, - nodesWillEnter, - childrenTransitions, - nodesShouldEnter - } = Transitions.getInitialTransitionState(oldChildren, nextChildren); + const { nodesWillExit, nodesWillEnter, childrenTransitions, nodesShouldEnter } = + Transitions.getInitialTransitionState(oldChildren, nextChildren); this.setState({ nodesWillExit, diff --git a/packages/victory-create-container/src/create-container.js b/packages/victory-create-container/src/create-container.js index c8c69852b..74fc712dd 100644 --- a/packages/victory-create-container/src/create-container.js +++ b/packages/victory-create-container/src/create-container.js @@ -110,26 +110,28 @@ const checkBehaviorName = (behavior, behaviors) => { } }; -const makeCreateContainerFunction = (mixinMap, Container) => (behaviorA, behaviorB, ...invalid) => { - // eslint-disable-line - const behaviors = keys(mixinMap); +const makeCreateContainerFunction = + (mixinMap, Container) => + (behaviorA, behaviorB, ...invalid) => { + // eslint-disable-line + const behaviors = keys(mixinMap); - checkBehaviorName(behaviorA, behaviors); - checkBehaviorName(behaviorB, behaviors); + checkBehaviorName(behaviorA, behaviors); + checkBehaviorName(behaviorB, behaviors); - if (invalid.length) { - Log.warn("too many arguments given to createContainer (maximum accepted: 2)."); - } + if (invalid.length) { + Log.warn("too many arguments given to createContainer (maximum accepted: 2)."); + } - const firstMixins = mixinMap[behaviorA]; - const secondMixins = mixinMap[behaviorB] || []; + const firstMixins = mixinMap[behaviorA]; + const secondMixins = mixinMap[behaviorB] || []; - if (!firstMixins) { - return Container; - } + if (!firstMixins) { + return Container; + } - return combineContainerMixins([...firstMixins, ...secondMixins], Container); -}; + return combineContainerMixins([...firstMixins, ...secondMixins], Container); + }; const createContainer = makeCreateContainerFunction( { diff --git a/packages/victory-group/src/victory-group.js b/packages/victory-group/src/victory-group.js index ce0f2625f..5daf85bf0 100644 --- a/packages/victory-group/src/victory-group.js +++ b/packages/victory-group/src/victory-group.js @@ -112,13 +112,8 @@ export default class VictoryGroup extends React.Component { const props = this.state && this.state.nodesWillExit ? this.state.oldProps || this.props : this.props; const modifiedProps = Helpers.modifyProps(props, fallbackProps, role); - const { - eventKey, - containerComponent, - standalone, - groupComponent, - externalEventMutations - } = modifiedProps; + const { eventKey, containerComponent, standalone, groupComponent, externalEventMutations } = + modifiedProps; const childComponents = React.Children.toArray(modifiedProps.children); const calculatedProps = getCalculatedProps(modifiedProps, childComponents); const newChildren = this.getNewChildren(modifiedProps, childComponents, calculatedProps); diff --git a/packages/victory-polar-axis/src/helper-methods.js b/packages/victory-polar-axis/src/helper-methods.js index 5283a6a6e..0496fa2d2 100644 --- a/packages/victory-polar-axis/src/helper-methods.js +++ b/packages/victory-polar-axis/src/helper-methods.js @@ -110,16 +110,8 @@ const getAxisAngle = (props) => { //eslint-disable-next-line max-params const getTickProps = (props, calculatedValues, tickValue, index) => { - const { - axisType, - radius, - scale, - style, - stringTicks, - ticks, - tickFormat, - origin - } = calculatedValues; + const { axisType, radius, scale, style, stringTicks, ticks, tickFormat, origin } = + calculatedValues; const text = tickFormat(tickValue, index, ticks); const tick = stringTicks ? stringTicks[index] : tickValue; const { tickStyle } = getEvaluatedStyles(style, { @@ -163,16 +155,8 @@ const getTickProps = (props, calculatedValues, tickValue, index) => { //eslint-disable-next-line max-params const getTickLabelProps = (props, calculatedValues, tickValue, index) => { - const { - axisType, - radius, - tickFormat, - style, - scale, - ticks, - stringTicks, - origin - } = calculatedValues; + const { axisType, radius, tickFormat, style, scale, ticks, stringTicks, origin } = + calculatedValues; const text = tickFormat(tickValue, index, ticks); const tick = stringTicks ? stringTicks[index] : tickValue; const { labelStyle } = getEvaluatedStyles(style, { @@ -220,16 +204,8 @@ const getTickLabelProps = (props, calculatedValues, tickValue, index) => { //eslint-disable-next-line max-params const getGridProps = (props, calculatedValues, tickValue, index) => { - const { - axisType, - radius, - style, - scale, - stringTicks, - ticks, - tickFormat, - origin - } = calculatedValues; + const { axisType, radius, style, scale, stringTicks, ticks, tickFormat, origin } = + calculatedValues; const text = tickFormat(tickValue, index, ticks); const { startAngle, endAngle, innerRadius = 0 } = props; const tick = stringTicks ? stringTicks[index] : tickValue; diff --git a/packages/victory-stack/src/victory-stack.js b/packages/victory-stack/src/victory-stack.js index b35a08290..a7910a797 100644 --- a/packages/victory-stack/src/victory-stack.js +++ b/packages/victory-stack/src/victory-stack.js @@ -142,13 +142,8 @@ export default class VictoryStack extends React.Component { const props = this.state && this.state.nodesWillExit ? this.state.oldProps || this.props : this.props; const modifiedProps = Helpers.modifyProps(props, fallbackProps, role); - const { - eventKey, - containerComponent, - standalone, - groupComponent, - externalEventMutations - } = modifiedProps; + const { eventKey, containerComponent, standalone, groupComponent, externalEventMutations } = + modifiedProps; const childComponents = React.Children.toArray(modifiedProps.children); const calculatedProps = getCalculatedProps(modifiedProps, childComponents); const newChildren = this.getNewChildren(modifiedProps, childComponents, calculatedProps); diff --git a/packages/victory-tooltip/src/victory-tooltip.js b/packages/victory-tooltip/src/victory-tooltip.js index 8c0cc4300..34ce18857 100644 --- a/packages/victory-tooltip/src/victory-tooltip.js +++ b/packages/victory-tooltip/src/victory-tooltip.js @@ -333,16 +333,8 @@ export default class VictoryTooltip extends React.Component { // eslint-disable-next-line complexity getFlyoutCenter(props, dimensions) { - const { - x, - y, - dx, - dy, - pointerLength, - orientation, - constrainToVisibleArea, - centerOffset - } = props; + const { x, y, dx, dy, pointerLength, orientation, constrainToVisibleArea, centerOffset } = + props; const { height, width } = dimensions; const xSign = orientation === "left" ? -1 : 1; const ySign = orientation === "bottom" ? -1 : 1; @@ -387,14 +379,8 @@ export default class VictoryTooltip extends React.Component { } getDimensions(props, labelSize) { - const { - orientation, - pointerLength, - pointerWidth, - flyoutHeight, - flyoutWidth, - flyoutPadding - } = props; + const { orientation, pointerLength, pointerWidth, flyoutHeight, flyoutWidth, flyoutPadding } = + props; const cornerRadius = Helpers.evaluateProp(props.cornerRadius, props); const getHeight = () => { const calculatedHeight = labelSize.height + flyoutPadding.top + flyoutPadding.bottom; @@ -512,13 +498,8 @@ export default class VictoryTooltip extends React.Component { // Overridden in victory-core-native renderTooltip(props) { const evaluatedProps = this.getEvaluatedProps(props); - const { - flyoutComponent, - labelComponent, - groupComponent, - active, - renderInPortal - } = evaluatedProps; + const { flyoutComponent, labelComponent, groupComponent, active, renderInPortal } = + evaluatedProps; if (!active) { return renderInPortal ? {null} : null; } diff --git a/packages/victory-voronoi/src/voronoi.js b/packages/victory-voronoi/src/voronoi.js index 071b1b9ce..3f1c090ca 100644 --- a/packages/victory-voronoi/src/voronoi.js +++ b/packages/victory-voronoi/src/voronoi.js @@ -29,17 +29,8 @@ const evaluateProps = (props) => { const Voronoi = (props) => { props = evaluateProps(props); - const { - ariaLabel, - role, - shapeRendering, - className, - events, - transform, - style, - size, - tabIndex - } = props; + const { ariaLabel, role, shapeRendering, className, events, transform, style, size, tabIndex } = + props; const voronoiPath = getVoronoiPath(props); const sharedProps = { "aria-label": ariaLabel, diff --git a/packages/victory-zoom-container/src/zoom-helpers.js b/packages/victory-zoom-container/src/zoom-helpers.js index b7d49a69d..3c3f809a3 100644 --- a/packages/victory-zoom-container/src/zoom-helpers.js +++ b/packages/victory-zoom-container/src/zoom-helpers.js @@ -235,15 +235,8 @@ const RawZoomHelpers = { // eslint-disable-next-line max-params, max-statements onMouseMove(evt, targetProps, eventKey, ctx) { if (targetProps.panning && targetProps.allowPan) { - const { - scale, - startX, - startY, - onZoomDomainChange, - zoomDomain, - zoomDimension, - horizontal - } = targetProps; + const { scale, startX, startY, onZoomDomainChange, zoomDomain, zoomDimension, horizontal } = + targetProps; const parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt); const { x, y } = Selection.getSVGEventCoordinates(evt, parentSVG); const originalDomain = this.getDomain(targetProps); diff --git a/yarn.lock b/yarn.lock index cc9102849..45542765b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11971,10 +11971,10 @@ prettier@^1.16.4: version "1.19.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" -prettier@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" - integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== +prettier@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.1.tgz#76903c3f8c4449bc9ac597acefa24dc5ad4cbea6" + integrity sha512-p+vNbgpLjif/+D+DwAZAbndtRrR0md0MwfmOVN9N+2RgyACMT+7tfaRnT+WDPkqnuVwleyuBIG2XBxKDme3hPA== pretty-error@^2.1.1: version "2.1.1"