Skip to content

Commit

Permalink
explicit printWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
boygirl committed Jun 23, 2021
1 parent 4dfc137 commit 844109c
Show file tree
Hide file tree
Showing 281 changed files with 8,831 additions and 2,739 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
max_line_length = 80

[*.md]
trim_trailing_whitespace = false
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ module.exports = {
"import/no-unresolved": [2, { ignore: ["victory*"] }],
"max-statements": 0,
complexity: ["error", { max: 16 }],
"no-magic-numbers": ["error", { ignore: [-1, 0, 0.5, 1, 2, 90, 180, 270, 360] }]
"no-magic-numbers": [
"error",
{ ignore: [-1, 0, 0.5, 1, 2, 90, 180, 270, 360] }
]
},
overrides: [
{
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"arrowParens": "always",
"trailingComma": "none"
"trailingComma": "none",
"printWidth": 80
}
5 changes: 4 additions & 1 deletion config/karma/karma.conf.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
var path = require("path");

var MAIN_PATH = path.join(process.cwd(), "test/client/main.js");
var POLYFILL_PATH = path.join(path.dirname(require.resolve("core-js/package.json")), "es6/**/*.js");
var POLYFILL_PATH = path.join(
path.dirname(require.resolve("core-js/package.json")),
"es6/**/*.js"
);
var PREPROCESSORS = {};
PREPROCESSORS[MAIN_PATH] = ["webpack"];
PREPROCESSORS[POLYFILL_PATH] = ["webpack"];
Expand Down
5 changes: 4 additions & 1 deletion config/karma/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ var path = require("path");
var webpackCfg = require("../webpack/webpack.config.test");

var MAIN_PATH = path.join(process.cwd(), "test/client/main.js");
var POLYFILL_PATH = path.join(path.dirname(require.resolve("core-js/package.json")), "es6/**/*.js");
var POLYFILL_PATH = path.join(
path.dirname(require.resolve("core-js/package.json")),
"es6/**/*.js"
);
var PREPROCESSORS = {};
PREPROCESSORS[MAIN_PATH] = ["webpack"];
PREPROCESSORS[POLYFILL_PATH] = ["webpack"];
Expand Down
35 changes: 28 additions & 7 deletions demo/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,38 @@ const MAP = {
"/group": { component: GroupDemo, name: "GroupDemo" },
"/voronoi": { component: VoronoiDemo, name: "VoronoiDemo" },
"/tooltip": { component: TooltipDemo, name: "TooltipDemo" },
"/zoom-container": { component: ZoomContainerDemo, name: "ZoomContainerDemo" },
"/voronoi-container": { component: VoronoiContainerDemo, name: "VoronoiContainerDemo" },
"/cursor-container": { component: CursorContainerDemo, name: "CursorContainerDemo" },
"/brush-container": { component: BrushContainerDemo, name: "BrushContainerDemo" },
"/zoom-container": {
component: ZoomContainerDemo,
name: "ZoomContainerDemo"
},
"/voronoi-container": {
component: VoronoiContainerDemo,
name: "VoronoiContainerDemo"
},
"/cursor-container": {
component: CursorContainerDemo,
name: "CursorContainerDemo"
},
"/brush-container": {
component: BrushContainerDemo,
name: "BrushContainerDemo"
},
"/animation": { component: AnimationDemo, name: "AnimationDemo" },
"/selection-container": { component: SelectionDemo, name: "SelectionDemo" },
"/create-container": { component: CreateContainerDemo, name: "CreateContainerDemo" },
"/create-container": {
component: CreateContainerDemo,
name: "CreateContainerDemo"
},
"/polar": { component: PolarDemo, name: "PolarDemo" },
"/immutable": { component: ImmutableDemo, name: "ImmutableDemo" },
"/external-events": { component: ExternalEventsDemo, name: "ExternalEventsDemo" },
"/victory-brush-line": { component: VictoryBrushLineDemo, name: "BrushLineDemo" },
"/external-events": {
component: ExternalEventsDemo,
name: "ExternalEventsDemo"
},
"/victory-brush-line": {
component: VictoryBrushLineDemo,
name: "BrushLineDemo"
},
"/performance": { component: PerformanceDemo, name: "PerformanceDemo" },
"/debug": { component: DebugDemo, name: "DebugDemo" },
"/label": { component: VictoryLabelDemo, name: "LabelDemo" },
Expand Down
42 changes: 30 additions & 12 deletions demo/js/components/accessibility-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,25 @@ export default class App extends React.Component {
}
q3Component={
<Border
ariaLabel={({ datum }) => `${datum.x} q3 value is ${datum._q3}`}
ariaLabel={({ datum }) =>
`${datum.x} q3 value is ${datum._q3}`
}
tabIndex={({ index }) => index + 6.1}
/>
}
medianComponent={
<LineSegment
ariaLabel={({ datum }) => `${datum.x} median value is ${datum._median}`}
ariaLabel={({ datum }) =>
`${datum.x} median value is ${datum._median}`
}
tabIndex={({ index }) => index + 5.1}
/>
}
q1Component={
<Border
ariaLabel={({ datum }) => `${datum.x} q1 value is ${datum._q1}`}
ariaLabel={({ datum }) =>
`${datum.x} q1 value is ${datum._q1}`
}
tabIndex={({ index }) => index + 6.2}
/>
}
Expand All @@ -152,7 +158,9 @@ export default class App extends React.Component {
data={accessibilityAreaData.a}
dataComponent={
<Area
ariaLabel={({ data }) => `area chart stack ${data[0]._stack}`}
ariaLabel={({ data }) =>
`area chart stack ${data[0]._stack}`
}
tabIndex={20}
/>
}
Expand All @@ -161,7 +169,9 @@ export default class App extends React.Component {
data={accessibilityAreaData.b}
dataComponent={
<Area
ariaLabel={({ data }) => `area chart stack ${data[0]._stack}`}
ariaLabel={({ data }) =>
`area chart stack ${data[0]._stack}`
}
tabIndex={20.1}
/>
}
Expand All @@ -170,7 +180,9 @@ export default class App extends React.Component {
data={accessibilityAreaData.c}
dataComponent={
<Area
ariaLabel={({ data }) => `area chart stack ${data[0]._stack}`}
ariaLabel={({ data }) =>
`area chart stack ${data[0]._stack}`
}
tabIndex={20.2}
/>
}
Expand All @@ -179,7 +191,9 @@ export default class App extends React.Component {
data={accessibilityAreaData.d}
dataComponent={
<Area
ariaLabel={({ data }) => `area chart stack ${data[0]._stack}`}
ariaLabel={({ data }) =>
`area chart stack ${data[0]._stack}`
}
tabIndex={20.3}
/>
}
Expand All @@ -206,9 +220,9 @@ export default class App extends React.Component {
ariaLabel={({ data }) =>
data.map(
(dataPoint, i) =>
`data point ${i + 1} x value is ${dataPoint.x} and y value is ${
dataPoint.y
}`
`data point ${i + 1} x value is ${
dataPoint.x
} and y value is ${dataPoint.y}`
)
}
/>
Expand Down Expand Up @@ -246,7 +260,9 @@ export default class App extends React.Component {
data={accessibilityScatterData}
dataComponent={
<Point
ariaLabel={({ datum }) => `scatter point x: ${datum.x}, y:${datum.y}`}
ariaLabel={({ datum }) =>
`scatter point x: ${datum.x}, y:${datum.y}`
}
tabIndex={({ index }) => index + 28}
/>
}
Expand All @@ -263,7 +279,9 @@ export default class App extends React.Component {
data={accessibilityVoronoiData}
dataComponent={
<Voronoi
ariaLabel={({ datum }) => `voronoi chart, x ${datum.x}, y ${datum.y}`}
ariaLabel={({ datum }) =>
`voronoi chart, x ${datum.x}, y ${datum.y}`
}
tabIndex={({ index }) => index + 35}
/>
}
Expand Down
15 changes: 12 additions & 3 deletions demo/js/components/animation-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,25 @@ export default class App extends React.Component {
<VictoryArea data={this.state.areaTransitionData} />
</VictoryChart>

<VictoryStack style={style} animate theme={VictoryTheme.material} colorScale={"warm"}>
<VictoryStack
style={style}
animate
theme={VictoryTheme.material}
colorScale={"warm"}
>
{this.state.multiTransitionData.map((data, index) => {
return <VictoryArea key={index} data={data} interpolation={"basis"} />;
return (
<VictoryArea key={index} data={data} interpolation={"basis"} />
);
})}
</VictoryStack>

<VictoryChart style={style} animate theme={VictoryTheme.material}>
<VictoryStack colorScale={"warm"}>
{this.state.multiTransitionData.map((data, index) => {
return <VictoryArea key={index} data={data} interpolation={"basis"} />;
return (
<VictoryArea key={index} data={data} interpolation={"basis"} />
);
})}
</VictoryStack>
</VictoryChart>
Expand Down
15 changes: 12 additions & 3 deletions demo/js/components/create-container-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ const Charts = ({ behaviors }) => {
<CustomContainer
voronoiDimension="x"
labels={({ datum }) => `y: ${datum.y}`}
labelComponent={<VictoryTooltip cornerRadius={0} flyoutStyle={{ fill: "white" }} />}
labelComponent={
<VictoryTooltip
cornerRadius={0}
flyoutStyle={{ fill: "white" }}
/>
}
selectedDomain={{ x: [1.5, 2] }}
/>
}
Expand Down Expand Up @@ -139,7 +144,9 @@ const Charts = ({ behaviors }) => {
{/* C */}
<VictoryChart
style={chartStyle}
containerComponent={<CustomContainer selectedDomain={{ x: [0, 0] }} />}
containerComponent={
<CustomContainer selectedDomain={{ x: [0, 0] }} />
}
>
<VictoryGroup style={chartStyle}>
<VictoryScatter
Expand Down Expand Up @@ -196,7 +203,9 @@ const Charts = ({ behaviors }) => {
{/* D */}
<VictoryStack
style={chartStyle}
containerComponent={<CustomContainer selectedDomain={{ x: [1.5, 2.5], y: [-3, 4] }} />}
containerComponent={
<CustomContainer selectedDomain={{ x: [1.5, 2.5], y: [-3, 4] }} />
}
>
<VictoryBar
style={{
Expand Down
21 changes: 16 additions & 5 deletions demo/js/components/debug-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ class App extends React.Component {
alignItems: "center",
justifyContent: "center"
};
const chartStyle = { parent: { border: "1px solid #ccc", margin: "2%", maxWidth: "40%" } };
const chartStyle = {
parent: { border: "1px solid #ccc", margin: "2%", maxWidth: "40%" }
};
return (
<div style={containerStyle}>
<VictoryChart style={chartStyle} containerComponent={<VictoryZoomContainer />}>
<VictoryChart
style={chartStyle}
containerComponent={<VictoryZoomContainer />}
>
<VictoryStack colorScale="warm">
<VictoryGroup
data={[
Expand Down Expand Up @@ -84,10 +89,14 @@ class App extends React.Component {
<VictoryChart
horizontal
style={chartStyle}
containerComponent={<VictoryVoronoiContainer labels={() => "HELLO"} />}
containerComponent={
<VictoryVoronoiContainer labels={() => "HELLO"} />
}
>
<VictoryBar
style={{ data: { fill: ({ active }) => (active ? "red" : "black") } }}
style={{
data: { fill: ({ active }) => (active ? "red" : "black") }
}}
data={[
{ x: 0, y: 3.5, y0: 2.5 },
{ x: 0, y: 11, y0: 5 },
Expand All @@ -98,7 +107,9 @@ class App extends React.Component {
]}
/>
<VictoryScatter
style={{ data: { fill: ({ active }) => (active ? "black" : "red") } }}
style={{
data: { fill: ({ active }) => (active ? "black" : "red") }
}}
data={[
{ x: 0, y: 3.5 },
{ x: 0, y: 11 },
Expand Down
26 changes: 21 additions & 5 deletions demo/js/components/draggable-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { VictoryAxis } from "Packages/victory-axis/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryBrushLine } from "Packages/victory-brush-line/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryClipContainer, Point, Selection } from "Packages/victory-core/src/index";
import {
VictoryClipContainer,
Point,
Selection
} from "Packages/victory-core/src/index";
import { VictoryZoomContainer } from "Packages/victory-zoom-container/src/index";
import { VictoryBrushContainer } from "Packages/victory-brush-container/src/index";

Expand Down Expand Up @@ -61,14 +65,22 @@ class DraggablePoint extends React.Component {
onMouseUp: (evt, targetProps) => {
return [
{
mutation: () => Object.assign({}, targetProps, { dragging: false, active: false })
mutation: () =>
Object.assign({}, targetProps, {
dragging: false,
active: false
})
}
];
},
onMouseLeave: (evt, targetProps) => {
return [
{
mutation: () => Object.assign({}, targetProps, { dragging: false, active: false })
mutation: () =>
Object.assign({}, targetProps, {
dragging: false,
active: false
})
}
];
}
Expand Down Expand Up @@ -100,7 +112,9 @@ class App extends React.Component {
}

onPointChange(point) {
const newPoints = this.state.points.map((p) => (p.name === point.name ? point : p));
const newPoints = this.state.points.map((p) =>
p.name === point.name ? point : p
);
this.setState({ points: newPoints });
}

Expand Down Expand Up @@ -170,7 +184,9 @@ class App extends React.Component {
))}
<VictoryScatter
data={points}
dataComponent={<DraggablePoint onPointChange={this.onPointChange.bind(this)} />}
dataComponent={
<DraggablePoint onPointChange={this.onPointChange.bind(this)} />
}
style={{
data: {
fill: "skyBlue",
Expand Down
Loading

0 comments on commit 844109c

Please sign in to comment.