Skip to content

Commit c51a975

Browse files
authored
Merge pull request #709 from plotly/prettier-100
change prettier line width to 100 chars
2 parents 7ed2ae5 + 7a7d92a commit c51a975

File tree

111 files changed

+602
-1969
lines changed

Some content is hidden

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

111 files changed

+602
-1969
lines changed

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"bracketSpacing": false,
4-
"trailingComma": "es5"
4+
"trailingComma": "es5",
5+
"printWidth": 100
56
}

src/DefaultEditor.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ class DefaultEditor extends Component {
3131
}
3232

3333
hasTransforms() {
34-
return this.context.fullData.some(d =>
35-
TRANSFORMABLE_TRACES.includes(d.type)
36-
);
34+
return this.context.fullData.some(d => TRANSFORMABLE_TRACES.includes(d.type));
3735
}
3836

3937
hasAxes() {
@@ -75,27 +73,17 @@ class DefaultEditor extends Component {
7573
{logo ? logo : null}
7674
<GraphCreatePanel group={_('Graph')} name={_('Create')} />
7775
<GraphSubplotsPanel group={_('Graph')} name={_('Subplots')} />
78-
{this.hasTransforms() && (
79-
<GraphTransformsPanel group={_('Graph')} name={_('Transforms')} />
80-
)}
76+
{this.hasTransforms() && <GraphTransformsPanel group={_('Graph')} name={_('Transforms')} />}
8177
<StyleTracesPanel group={_('Style')} name={_('Traces')} />
8278
<StyleLayoutPanel group={_('Style')} name={_('Layout')} />
83-
{this.hasAxes() && (
84-
<StyleAxesPanel group={_('Style')} name={_('Axes')} />
85-
)}
79+
{this.hasAxes() && <StyleAxesPanel group={_('Style')} name={_('Axes')} />}
8680
<StyleLegendPanel group={_('Style')} name={_('Legend')} />
87-
{this.hasColorbars() && (
88-
<StyleColorbarsPanel group={_('Style')} name={_('Color Bars')} />
89-
)}
81+
{this.hasColorbars() && <StyleColorbarsPanel group={_('Style')} name={_('Color Bars')} />}
9082
<StyleNotesPanel group={_('Style')} name={_('Annotations')} />
9183
<StyleShapesPanel group={_('Style')} name={_('Shapes')} />
9284
<StyleImagesPanel group={_('Style')} name={_('Images')} />
93-
{this.hasSliders() && (
94-
<StyleSlidersPanel group={_('Style')} name={_('Sliders')} />
95-
)}
96-
{this.hasMenus() && (
97-
<StyleUpdateMenusPanel group={_('Style')} name={_('Menus')} />
98-
)}
85+
{this.hasSliders() && <StyleSlidersPanel group={_('Style')} name={_('Sliders')} />}
86+
{this.hasMenus() && <StyleUpdateMenusPanel group={_('Style')} name={_('Menus')} />}
9987
{this.props.children ? this.props.children : null}
10088
</PanelMenuWrapper>
10189
);

src/EditorControls.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class EditorControls extends Component {
2121
constructor(props, context) {
2222
super(props, context);
2323

24-
this.localize = key =>
25-
localizeString(this.props.dictionaries || {}, this.props.locale, key);
24+
this.localize = key => localizeString(this.props.dictionaries || {}, this.props.locale, key);
2625

2726
// we only need to compute this once.
2827
if (this.props.plotly) {
@@ -85,12 +84,7 @@ class EditorControls extends Component {
8584
const value = payload.update[attr];
8685

8786
if (splitTraceGroup) {
88-
props = shamefullyCreateSplitStyleProps(
89-
graphDiv,
90-
attr,
91-
traceIndex,
92-
splitTraceGroup
93-
);
87+
props = shamefullyCreateSplitStyleProps(graphDiv, attr, traceIndex, splitTraceGroup);
9488
}
9589

9690
props.forEach(p => {
@@ -262,17 +256,11 @@ class EditorControls extends Component {
262256
break;
263257

264258
case EDITOR_ACTIONS.DELETE_TRANSFORM:
265-
if (
266-
isNumeric(payload.transformIndex) &&
267-
payload.traceIndex < graphDiv.data.length
268-
) {
259+
if (isNumeric(payload.transformIndex) && payload.traceIndex < graphDiv.data.length) {
269260
if (graphDiv.data[payload.traceIndex].transforms.length === 1) {
270261
delete graphDiv.data[payload.traceIndex].transforms;
271262
} else {
272-
graphDiv.data[payload.traceIndex].transforms.splice(
273-
payload.transformIndex,
274-
1
275-
);
263+
graphDiv.data[payload.traceIndex].transforms.splice(payload.transformIndex, 1);
276264
}
277265
if (this.props.onUpdate) {
278266
this.props.onUpdate(
@@ -285,9 +273,7 @@ class EditorControls extends Component {
285273
break;
286274

287275
default:
288-
throw new Error(
289-
this.localize('must specify an action type to handleEditorUpdate')
290-
);
276+
throw new Error(this.localize('must specify an action type to handleEditorUpdate'));
291277
}
292278
}
293279

src/PlotlyEditor.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ class PlotlyEditor extends Component {
2929
srcConverters={this.props.srcConverters}
3030
makeDefaultTrace={this.props.makeDefaultTrace}
3131
glByDefault={this.props.glByDefault}
32-
mapBoxAccess={Boolean(
33-
this.props.config && this.props.config.mapboxAccessToken
34-
)}
32+
mapBoxAccess={Boolean(this.props.config && this.props.config.mapboxAccessToken)}
3533
fontOptions={this.props.fontOptions}
3634
>
3735
{this.props.children}
3836
</EditorControls>
3937
)}
40-
<div
41-
className="plotly_editor_plot"
42-
style={{width: '100%', height: '100%'}}
43-
>
38+
<div className="plotly_editor_plot" style={{width: '100%', height: '100%'}}>
4439
<this.PlotComponent
4540
data={this.props.data}
4641
layout={this.props.layout}

src/__percy__/panels.percy.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ const panelFixture = (Panel, group, name, figure) => {
5252
const snapshotWidth = 500;
5353

5454
Object.keys(mocks).forEach(m => {
55-
const selectedPanels = panelsToTest[m]
56-
? panelsToTest[m]
57-
: Object.keys(panels);
55+
const selectedPanels = panelsToTest[m] ? panelsToTest[m] : Object.keys(panels);
5856

5957
selectedPanels.forEach(p => {
6058
const words = p.split(/(?=[A-Z])/);

src/__tests__/syntax-test.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22
import fs from 'fs';
33
import glob from 'glob';
44

5-
const BLACK_LIST = [
6-
'fdescribe',
7-
'fit',
8-
'xdescribe',
9-
'xit',
10-
'it\\.only',
11-
'describe\\.only',
12-
];
5+
const BLACK_LIST = ['fdescribe', 'fit', 'xdescribe', 'xit', 'it\\.only', 'describe\\.only'];
136
const REGEXS = BLACK_LIST.map(token => new RegExp(`^\\s*${token}\\(.*`));
147

158
describe('Syntax and test validation', () => {

src/components/PanelMenuWrapper.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ class PanelsWithSidebar extends Component {
3030
}
3131

3232
renderSection(section, i) {
33-
if (
34-
section.type &&
35-
(section.type.plotly_editor_traits || {}).sidebar_element
36-
) {
33+
if (section.type && (section.type.plotly_editor_traits || {}).sidebar_element) {
3734
return cloneElement(section, {key: i});
3835
}
3936
return (

src/components/containers/AnnotationAccordion.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ class AnnotationAccordion extends Component {
1717
const content =
1818
annotations.length &&
1919
annotations.map((ann, i) => (
20-
<AnnotationFold
21-
key={i}
22-
annotationIndex={i}
23-
name={ann.text}
24-
canDelete={canAdd}
25-
>
20+
<AnnotationFold key={i} annotationIndex={i} name={ann.text} canDelete={canAdd}>
2621
{children}
2722
</AnnotationFold>
2823
));

src/components/containers/FoldEmpty.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ export default class FoldEmpty extends Component {
1313
</div>
1414
) : null}
1515
{messagePrimary ? (
16-
<div className="fold__content__empty__message__primary">
17-
{messagePrimary}
18-
</div>
16+
<div className="fold__content__empty__message__primary">{messagePrimary}</div>
1917
) : null}
2018
{messageSecondary ? (
21-
<div className="fold__content__empty__message__secondary">
22-
{messageSecondary}
23-
</div>
19+
<div className="fold__content__empty__message__secondary">{messageSecondary}</div>
2420
) : null}
2521
{children ? children : null}
2622
</div>

src/components/containers/Modal.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ const ModalHeader = ({title, handleClose}) => (
66
<div className="modal__header">
77
{title ? <div className="modal__header__title">{title}</div> : null}
88
{handleClose ? (
9-
<div
10-
className="modal__header__close"
11-
onClick={handleClose ? () => handleClose() : null}
12-
>
9+
<div className="modal__header__close" onClick={handleClose ? () => handleClose() : null}>
1310
<CloseIcon />
1411
</div>
1512
) : null}
1613
</div>
1714
);
1815

19-
const ModalContent = ({children}) => (
20-
<div className="modal__content">{children}</div>
21-
);
16+
const ModalContent = ({children}) => <div className="modal__content">{children}</div>;
2217

2318
class Modal extends Component {
2419
constructor(props) {
@@ -50,16 +45,10 @@ class Modal extends Component {
5045
return (
5146
<div className={classes}>
5247
<div className="modal__card">
53-
<ModalHeader
54-
title={title}
55-
handleClose={() => this.context.handleClose()}
56-
/>
48+
<ModalHeader title={title} handleClose={() => this.context.handleClose()} />
5749
<ModalContent>{children}</ModalContent>
5850
</div>
59-
<div
60-
className="modal__backdrop"
61-
onClick={() => this.context.handleClose()}
62-
/>
51+
<div className="modal__backdrop" onClick={() => this.context.handleClose()} />
6352
</div>
6453
);
6554
}

0 commit comments

Comments
 (0)