Skip to content

Commit 968015e

Browse files
committed
Prettier update
1 parent 3901f56 commit 968015e

File tree

92 files changed

+284
-295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+284
-295
lines changed

src/DefaultEditor.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ class DefaultEditor extends Component {
3333
}
3434

3535
hasTransforms() {
36-
return this.context.fullData.some(d => TRANSFORMABLE_TRACES.includes(d.type));
36+
return this.context.fullData.some((d) => TRANSFORMABLE_TRACES.includes(d.type));
3737
}
3838

3939
hasAxes() {
4040
return (
4141
Object.keys(this.context.fullLayout._subplots).filter(
42-
type =>
42+
(type) =>
4343
!['cartesian', 'mapbox'].includes(type) &&
4444
this.context.fullLayout._subplots[type].length > 0
4545
).length > 0
@@ -63,15 +63,15 @@ class DefaultEditor extends Component {
6363
}
6464

6565
hasColorbars() {
66-
return this.context.fullData.some(d => traceHasColorbar({}, d));
66+
return this.context.fullData.some((d) => traceHasColorbar({}, d));
6767
}
6868

6969
hasLegend() {
70-
return this.context.fullData.some(t => t.showlegend !== undefined); // eslint-disable-line no-undefined
70+
return this.context.fullData.some((t) => t.showlegend !== undefined); // eslint-disable-line no-undefined
7171
}
7272

7373
hasMaps() {
74-
return this.context.fullData.some(d =>
74+
return this.context.fullData.some((d) =>
7575
[...TRACE_TO_AXIS.geo, ...TRACE_TO_AXIS.mapbox].includes(d.type)
7676
);
7777
}

src/EditorControls.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class EditorControls extends Component {
3131
constructor(props, context) {
3232
super(props, context);
3333

34-
this.localize = key => localizeString(this.props.dictionaries || {}, this.props.locale, key);
34+
this.localize = (key) => localizeString(this.props.dictionaries || {}, this.props.locale, key);
3535

3636
// we only need to compute this once.
3737
if (this.props.plotly) {
@@ -107,7 +107,7 @@ class EditorControls extends Component {
107107
props = shamefullyCreateSplitStyleProps(graphDiv, attr, traceIndex, splitTraceGroup);
108108
}
109109

110-
props.forEach(p => {
110+
props.forEach((p) => {
111111
if (value !== void 0) {
112112
p.set(value);
113113
}
@@ -429,8 +429,8 @@ EditorControls.defaultProps = {
429429
showFieldTooltips: false,
430430
locale: 'en',
431431
traceTypesConfig: {
432-
categories: _ => categoryLayout(_),
433-
traces: _ => traceTypes(_),
432+
categories: (_) => categoryLayout(_),
433+
traces: (_) => traceTypes(_),
434434
complex: true,
435435
},
436436
fontOptions: DEFAULT_FONTS,

src/__stories__/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const panelsToTest = {
9898
funnelarea: ['GraphCreatePanel', 'StyleTracesPanel'],
9999
};
100100

101-
window.URL.createObjectURL = function() {
101+
window.URL.createObjectURL = function () {
102102
return null;
103103
};
104104

@@ -128,10 +128,10 @@ const panelFixture = (Panel, group, name, figure, customConfig) => {
128128

129129
let stories = storiesOf('Panels', module);
130130

131-
Object.keys(mocks).forEach(m => {
131+
Object.keys(mocks).forEach((m) => {
132132
const selectedPanels = panelsToTest[m] ? panelsToTest[m] : Object.keys(panels);
133133

134-
selectedPanels.forEach(p => {
134+
selectedPanels.forEach((p) => {
135135
const words = p.split(/(?=[A-Z])/);
136136
const panelGroup = words[0];
137137
const panelName = words.slice(1, -1).join(' ');

src/__tests__/syntax-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import fs from 'fs';
33
import glob from 'glob';
44

55
const BLACK_LIST = ['fdescribe', 'fit', 'xdescribe', 'xit', 'it\\.only', 'describe\\.only'];
6-
const REGEXS = BLACK_LIST.map(token => new RegExp(`^\\s*${token}\\(.*`));
6+
const REGEXS = BLACK_LIST.map((token) => new RegExp(`^\\s*${token}\\(.*`));
77

88
describe('Syntax and test validation', () => {
99
describe(`ensures ${BLACK_LIST} is not present in tests`, () => {
1010
const files = glob.sync('!(node_modules|examples)/**/__tests__/*.js');
11-
files.forEach(file =>
11+
files.forEach((file) =>
1212
it(`checks ${file} for test checks`, () => {
1313
const code = fs.readFileSync(file, {encoding: 'utf-8'});
14-
code.split('\n').forEach(line => {
15-
expect(REGEXS.some(re => re.test(line))).toBe(false);
14+
code.split('\n').forEach((line) => {
15+
expect(REGEXS.some((re) => re.test(line))).toBe(false);
1616
});
1717
})
1818
);

src/components/PanelMenuWrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PanelsWithSidebar extends Component {
99
super(props);
1010

1111
const opts = this.computeMenuOptions(props);
12-
const firstSidebarGroup = opts.filter(o => o.panels)[0];
12+
const firstSidebarGroup = opts.filter((o) => o.panels)[0];
1313

1414
this.state = {
1515
group: firstSidebarGroup.name,
@@ -53,7 +53,7 @@ class PanelsWithSidebar extends Component {
5353
let groupIndex;
5454
const childrenArray = sortMenu(React.Children.toArray(children), menuPanelOrder);
5555

56-
childrenArray.forEach(child => {
56+
childrenArray.forEach((child) => {
5757
if (!child) {
5858
return;
5959
}

src/components/containers/MapboxLayersAccordion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MapboxLayersAccordion extends Component {
3030

3131
const addAction = {
3232
label: _('Layer'),
33-
handler: context => {
33+
handler: (context) => {
3434
const {fullContainer, updateContainer} = context;
3535
if (updateContainer) {
3636
const mapboxLayerIndex = Array.isArray(fullContainer.layers)

src/components/containers/PlotlyFold.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class Fold extends Component {
6363
canDelete && typeof deleteContainer === 'function' ? (
6464
<div
6565
className="fold__top__delete js-fold__delete"
66-
onClick={e => {
66+
onClick={(e) => {
6767
e.stopPropagation();
6868
deleteContainer(foldInfo);
6969
}}
@@ -76,7 +76,7 @@ export class Fold extends Component {
7676
<div className="fold__top__moving-controls">
7777
<span
7878
className={`fold__top__moving-controls--up${canMoveUp ? '' : '--disabled'}`}
79-
onClick={e => {
79+
onClick={(e) => {
8080
// prevents fold toggle to happen when clicking on moving arrow controls
8181
e.stopPropagation();
8282

@@ -92,7 +92,7 @@ export class Fold extends Component {
9292
</span>
9393
<span
9494
className={`fold__top__moving-controls--down${canMoveDown ? '' : '--disabled'}`}
95-
onClick={e => {
95+
onClick={(e) => {
9696
// prevents fold toggle to happen when clicking on moving arrow controls
9797
e.stopPropagation();
9898
if (canMoveDown) {
@@ -184,7 +184,7 @@ class PlotlyFold extends Fold {
184184
determineVisibility(nextProps, nextContext) {
185185
this.foldVisible = false;
186186

187-
React.Children.forEach(nextProps.children, child => {
187+
React.Children.forEach(nextProps.children, (child) => {
188188
if (!child || this.foldVisible) {
189189
return;
190190
}

src/components/containers/PlotlyPanel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class Panel extends Component {
4747

4848
toggleFolds() {
4949
const {individualFoldStates} = this.state;
50-
const hasOpen = individualFoldStates.length > 0 && individualFoldStates.some(s => s !== true);
50+
const hasOpen = individualFoldStates.length > 0 && individualFoldStates.some((s) => s !== true);
5151
this.setState({
5252
individualFoldStates: individualFoldStates.map(() => hasOpen),
5353
});
@@ -61,7 +61,7 @@ export class Panel extends Component {
6161
// to get proper number of child folds and initialize component state
6262
let numFolds = 0;
6363

64-
React.Children.forEach(this.props.children, child => {
64+
React.Children.forEach(this.props.children, (child) => {
6565
if (((child && child.type && child.type.plotly_editor_traits) || {}).foldable) {
6666
numFolds++;
6767
}
@@ -114,7 +114,7 @@ export class Panel extends Component {
114114
addAction={this.props.addAction}
115115
allowCollapse={this.props.showExpandCollapse && individualFoldStates.length > 1}
116116
toggleFolds={this.toggleFolds}
117-
hasOpen={individualFoldStates.some(s => s === false)}
117+
hasOpen={individualFoldStates.some((s) => s === false)}
118118
/>
119119
<div className={bem('panel', 'content')}>{newChildren}</div>
120120
</div>

src/components/containers/PlotlySection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class PlotlySection extends Section {
5151
const {isVisible} = unpackPlotProps(nextProps, nextContext);
5252
this.sectionVisible = isVisibleGivenCustomConfig(isVisible, nextProps, nextContext);
5353

54-
React.Children.forEach(nextProps.children, child => {
54+
React.Children.forEach(nextProps.children, (child) => {
5555
if (!child || this.sectionVisible) {
5656
return;
5757
}

src/components/containers/RangeSelectorAccordion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class RangeSelectorAccordion extends Component {
4242

4343
const addAction = {
4444
label: _('Button'),
45-
handler: context => {
45+
handler: (context) => {
4646
const {fullContainer, updateContainer} = context;
4747
if (updateContainer) {
4848
const rangeselectorIndex = Array.isArray(fullContainer.rangeselector.buttons)

src/components/containers/SubplotAccordion.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class SubplotAccordion extends Component {
2222
const subplotFolds = [];
2323

2424
const allCartesianAxisCombinations = data.reduce((acc, curVal, inx) => {
25-
if (TRACE_TO_AXIS.cartesian.some(c => c === curVal.type)) {
25+
if (TRACE_TO_AXIS.cartesian.some((c) => c === curVal.type)) {
2626
const xaxis = 'xaxis' + (curVal.xaxis ? curVal.xaxis.substring(1) : '');
2727
const yaxis = 'yaxis' + (curVal.yaxis ? curVal.yaxis.substring(1) : '');
2828

29-
const existingComboIndex = acc.findIndex(t => t.xaxis === xaxis && t.yaxis === yaxis);
29+
const existingComboIndex = acc.findIndex((t) => t.xaxis === xaxis && t.yaxis === yaxis);
3030
if (existingComboIndex === -1) {
3131
acc.push({
3232
xaxis: xaxis,
@@ -43,7 +43,7 @@ class SubplotAccordion extends Component {
4343
}, []);
4444

4545
allCartesianAxisCombinations.forEach(
46-
d =>
46+
(d) =>
4747
(subplotFolds[d.index[0]] = (
4848
<CartesianSubplotFold
4949
key={d.index[0]}
@@ -84,16 +84,18 @@ class SubplotAccordion extends Component {
8484
}
8585
*/
8686

87-
Object.keys(layout).forEach(layoutKey => {
87+
Object.keys(layout).forEach((layoutKey) => {
8888
const traceIndexes = [];
8989
let subplotName;
9090
if (
91-
['geo', 'mapbox', 'polar', 'gl3d', 'ternary'].some(subplotType => {
91+
['geo', 'mapbox', 'polar', 'gl3d', 'ternary'].some((subplotType) => {
9292
subplotName = getSubplotTitle(layoutKey, subplotType, _);
9393
const trIndex =
9494
SUBPLOT_TO_ATTR[subplotType].layout === layoutKey
95-
? data.findIndex(trace => TRACE_TO_AXIS[subplotType].some(tt => tt === trace.type))
96-
: data.findIndex(trace => trace[SUBPLOT_TO_ATTR[subplotType].data] === layoutKey);
95+
? data.findIndex((trace) =>
96+
TRACE_TO_AXIS[subplotType].some((tt) => tt === trace.type)
97+
)
98+
: data.findIndex((trace) => trace[SUBPLOT_TO_ATTR[subplotType].data] === layoutKey);
9799
if (trIndex !== -1) {
98100
traceIndexes.push(trIndex);
99101
}

src/components/containers/TraceAccordion.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TraceAccordion extends Component {
3030

3131
if (base && base.length && context.fullData.length) {
3232
this.filteredTraces = base.filter((t, i) => {
33-
const fullTrace = props.canGroup ? t : context.fullData.filter(tr => tr.index === i)[0];
33+
const fullTrace = props.canGroup ? t : context.fullData.filter((tr) => tr.index === i)[0];
3434

3535
if (fullTrace) {
3636
const trace = context.data[fullTrace.index];
@@ -54,7 +54,7 @@ class TraceAccordion extends Component {
5454
const dataArrayPositionsByTraceType = {};
5555
const fullDataArrayPositionsByTraceType = {};
5656

57-
this.filteredTraces.forEach(trace => {
57+
this.filteredTraces.forEach((trace) => {
5858
const traceType = plotlyTraceToCustomTrace(trace);
5959
if (!dataArrayPositionsByTraceType[traceType]) {
6060
dataArrayPositionsByTraceType[traceType] = [];
@@ -73,7 +73,7 @@ class TraceAccordion extends Component {
7373
<TraceFold
7474
key={index}
7575
traceIndexes={dataArrayPositionsByTraceType[type]}
76-
name={traceTypes(_).find(t => t.value === type).label}
76+
name={traceTypes(_).find((t) => t.value === type).label}
7777
fullDataArrayPosition={fullDataArrayPositionsByTraceType[type]}
7878
>
7979
{this.props.children}

src/components/containers/TraceRequiredPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {LayoutPanel} from './derived';
55

66
class TraceRequiredPanel extends Component {
77
hasTrace() {
8-
return this.context.fullData.filter(trace => trace.visible).length > 0;
8+
return this.context.fullData.filter((trace) => trace.visible).length > 0;
99
}
1010

1111
render() {

src/components/containers/TransformAccordion.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class TransformAccordion extends Component {
2626

2727
const transformBy =
2828
container.transforms &&
29-
container.transforms.map(tr => {
29+
container.transforms.map((tr) => {
3030
let foldNameSuffix = '';
3131
if (tr.groupssrc) {
3232
const groupssrc =
33-
dataSourceOptions && dataSourceOptions.find(d => d.value === tr.groupssrc);
33+
dataSourceOptions && dataSourceOptions.find((d) => d.value === tr.groupssrc);
3434
foldNameSuffix = `: ${groupssrc && groupssrc.label ? groupssrc.label : tr.groupssrc}`;
3535
} else if (tr.targetsrc) {
3636
const targetsrc =
37-
dataSourceOptions && dataSourceOptions.find(d => d.value === tr.targetsrc);
37+
dataSourceOptions && dataSourceOptions.find((d) => d.value === tr.targetsrc);
3838
foldNameSuffix = `: ${targetsrc && targetsrc.label ? targetsrc.label : tr.targetsrc}`;
3939
}
4040
return foldNameSuffix;
@@ -47,8 +47,9 @@ class TransformAccordion extends Component {
4747
<TransformFold
4848
key={i}
4949
transformIndex={i}
50-
name={`${transformTypes.filter(({type}) => type === tr.type)[0].label}${transformBy &&
51-
transformBy[i]}`}
50+
name={`${transformTypes.filter(({type}) => type === tr.type)[0].label}${
51+
transformBy && transformBy[i]
52+
}`}
5253
canDelete={true}
5354
>
5455
{children}
@@ -58,16 +59,16 @@ class TransformAccordion extends Component {
5859
// cannot have 2 Split transforms on one trace:
5960
// https://github.com/plotly/plotly.js/issues/1742
6061
const addActionOptions =
61-
container.transforms && container.transforms.some(t => t.type === 'groupby')
62-
? transformTypes.filter(t => t.type !== 'groupby')
62+
container.transforms && container.transforms.some((t) => t.type === 'groupby')
63+
? transformTypes.filter((t) => t.type !== 'groupby')
6364
: transformTypes;
6465

6566
const addAction = {
6667
label: _('Transform'),
6768
handler: addActionOptions.map(({label, type}) => {
6869
return {
6970
label,
70-
handler: context => {
71+
handler: (context) => {
7172
const {fullContainer, updateContainer} = context;
7273
if (updateContainer) {
7374
const transformIndex = Array.isArray(fullContainer.transforms)

src/components/containers/UpdateMenuAccordion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class UpdateMenuAccordion extends Component {
2222
buttons: _('Buttons'),
2323
};
2424
const menuType = localizedType[upd.type] || localizedType.dropdown;
25-
const activeBtn = upd.buttons.filter(b => b._index === upd.active)[0];
25+
const activeBtn = upd.buttons.filter((b) => b._index === upd.active)[0];
2626
const foldName = menuType + (activeBtn ? ': ' + activeBtn.label : '');
2727

2828
return (

src/components/containers/__tests__/AnnotationAccordion-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ describe('<AnnotationAccordion>', () => {
6060
</LayoutPanel>
6161
</TestEditor>
6262
);
63-
editor
64-
.find('.js-fold__delete')
65-
.at(0)
66-
.simulate('click');
63+
editor.find('.js-fold__delete').at(0).simulate('click');
6764

6865
const update = beforeDeleteAnnotation.mock.calls[0][0];
6966
expect(update.annotationIndex).toBe(0);

src/components/containers/__tests__/Layout-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {connectLayoutToPlot} from 'lib';
77
import {mount} from 'enzyme';
88

99
const Layouts = [PlotlyPanel, PlotlyFold, PlotlySection].map(connectLayoutToPlot);
10-
const Editor = props => <TestEditor {...{onUpdate: jest.fn(), ...props}} />;
10+
const Editor = (props) => <TestEditor {...{onUpdate: jest.fn(), ...props}} />;
1111

12-
Layouts.forEach(Layout => {
12+
Layouts.forEach((Layout) => {
1313
describe(`<${Layout.displayName}>`, () => {
1414
it(`wraps container with fullValue pointing to gd._fullLayout`, () => {
1515
const wrapper = mount(

src/components/containers/__tests__/TraceAccordion-test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ describe('<TraceAccordion>', () => {
5151
</TestEditor>
5252
);
5353

54-
editor
55-
.find('.js-fold__delete')
56-
.at(0)
57-
.simulate('click');
54+
editor.find('.js-fold__delete').at(0).simulate('click');
5855

5956
expect(beforeDeleteTrace).toBeCalled();
6057
const update = beforeDeleteTrace.mock.calls[0][0];

0 commit comments

Comments
 (0)