Skip to content

Commit e03ed1a

Browse files
authored
Merge pull request #1025 from plotly/renovate/prettier-2.x
Update dependency prettier to v2
2 parents dbb8627 + 6cc24f9 commit e03ed1a

File tree

94 files changed

+288
-300
lines changed

Some content is hidden

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

94 files changed

+288
-300
lines changed

.prettierrc

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"postcss-combine-duplicated-selectors": "8.1.0",
8787
"postcss-custom-properties": "8.0.11",
8888
"postcss-remove-root": "0.0.2",
89-
"prettier": "1.19.1",
89+
"prettier": "2.0.2",
9090
"react": "16.13.1",
9191
"react-ace": "7.0.5",
9292
"react-dom": "16.13.1",

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>

0 commit comments

Comments
 (0)