Skip to content

Commit

Permalink
update prettier and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
boygirl committed Jun 23, 2021
1 parent c0d3346 commit 4dfc137
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 215 deletions.
12 changes: 4 additions & 8 deletions package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 2 additions & 11 deletions packages/victory-axis/src/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 4 additions & 6 deletions packages/victory-bar/src/path-helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 2 additions & 10 deletions packages/victory-box-plot/src/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 2 additions & 8 deletions packages/victory-brush-container/src/brush-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 4 additions & 13 deletions packages/victory-brush-line/src/victory-brush-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 2 additions & 7 deletions packages/victory-chart/src/victory-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 4 additions & 21 deletions packages/victory-core/src/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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"]);
Expand Down
12 changes: 2 additions & 10 deletions packages/victory-core/src/victory-label/victory-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions packages/victory-core/src/victory-util/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 17 additions & 15 deletions packages/victory-create-container/src/create-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down
9 changes: 2 additions & 7 deletions packages/victory-group/src/victory-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
36 changes: 6 additions & 30 deletions packages/victory-polar-axis/src/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions packages/victory-stack/src/victory-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 4dfc137

Please sign in to comment.