Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 86ddefe

Browse files
authored
Merge pull request #1083 from plotly/pjs156
Packages + plotly.js + version bump
2 parents 3156cad + 06ddb29 commit 86ddefe

File tree

164 files changed

+1123
-1127
lines changed

Some content is hidden

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

164 files changed

+1123
-1127
lines changed

‎.babelrc‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
2-
"presets": ["@babel/react", "@babel/env"],
2+
"presets": [
3+
[
4+
"@babel/preset-react",
5+
{
6+
"runtime": "automatic"
7+
}
8+
],
9+
"@babel/env"
10+
],
311
"plugins": [
412
"@babel/plugin-proposal-object-rest-spread",
513
[

‎.eslintrc‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@
110110
"radix": ["error"],
111111
"react/jsx-no-duplicate-props": ["error"],
112112
"react/jsx-no-undef": ["error"],
113-
"react/jsx-uses-react": ["error"],
113+
"react/jsx-uses-react": ["off"],
114114
"react/jsx-uses-vars": ["error"],
115115
"react/no-did-update-set-state": ["error"],
116116
"react/no-direct-mutation-state": ["error"],
117117
"react/no-is-mounted": ["error"],
118118
"react/no-unknown-property": ["error"],
119119
"react/prefer-es6-class": ["error", "always"],
120-
"react/prop-types": "error",
120+
"react/prop-types": ["error"],
121+
"react/react-in-jsx-scope": ["off"],
121122
"valid-jsdoc": ["error"],
122123
"yoda": ["error"],
123124
"spaced-comment": ["error", "always", {

‎.storybook/webpack.config.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,23 @@ module.exports = async ({config, mode}) => {
66
use: ['style-loader', 'css-loader', 'sass-loader'],
77
include: path.resolve(__dirname, '../'),
88
});
9+
config.module.rules.push({
10+
test: /\.js?$/,
11+
use: {
12+
loader: 'babel-loader',
13+
options: {
14+
presets: [
15+
[
16+
'@babel/preset-react',
17+
{
18+
runtime: 'automatic',
19+
},
20+
],
21+
'@babel/env',
22+
],
23+
},
24+
},
25+
exclude: [/node_modules/],
26+
});
927
return config;
1028
};

‎dev/App.js‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React,{Component} from 'react';
1+
import {Component} from 'react';
22
import {hot} from 'react-hot-loader/root';
33
import plotly from 'plotly.js/dist/plotly-with-meta';
44
import '../src/styles/main.scss';
@@ -16,15 +16,16 @@ import ACCESS_TOKENS from '../accessTokens';
1616

1717
// import {customConfigTest} from '../src/__stories__';
1818

19-
const dataSourceOptions = Object.keys(dataSources).map(name => ({
19+
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
2020
value: name,
2121
label: name,
2222
}));
2323

2424
const config = {mapboxAccessToken: ACCESS_TOKENS.MAPBOX, editable: true};
2525

26+
// eslint-disable-next-line no-unused-vars
2627
const traceTypesConfig = {
27-
traces: _ => [
28+
traces: (_) => [
2829
{
2930
value: 'scatter',
3031
icon: 'scatter',
@@ -66,16 +67,19 @@ const traceTypesConfig = {
6667
complex: true,
6768
};
6869

70+
// eslint-disable-next-line no-unused-vars
6971
const chartHelp = {
7072
area: {
7173
helpDoc: 'https://help.plot.ly/make-an-area-graph/',
7274
examplePlot: () => {
75+
// eslint-disable-next-line no-console
7376
console.log('example bar plot!');
7477
},
7578
},
7679
bar: {
7780
helpDoc: 'https://help.plot.ly/stacked-bar-chart/',
7881
examplePlot: () => {
82+
// eslint-disable-next-line no-console
7983
console.log('example bar plot!');
8084
},
8185
},
@@ -118,12 +122,12 @@ class App extends Component {
118122
this.updateState = this.updateState.bind(this);
119123
}
120124

121-
componentWillMount() {
125+
UNSAFE_componentWillMount() {
122126
// curl https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks \
123127
// | jq '[.[] | .name ]' > mocks.json
124128
fetch('/mocks.json')
125-
.then(response => response.json())
126-
.then(mocks => this.setState({mocks}));
129+
.then((response) => response.json())
130+
.then((mocks) => this.setState({mocks}));
127131
}
128132

129133
loadMock(mockIndex) {
@@ -135,8 +139,8 @@ class App extends Component {
135139
fetch(prefix + mockName, {
136140
headers: new Headers({Accept: 'application/vnd.github.v3.raw'}),
137141
})
138-
.then(response => response.json())
139-
.then(figure => {
142+
.then((response) => response.json())
143+
.then((figure) => {
140144
const {data, layout, frames} = figure;
141145
this.updateState(data, layout, frames, mockIndex);
142146
});
@@ -219,7 +223,7 @@ class App extends Component {
219223
}))}
220224
searchable={true}
221225
searchPromptText="Search for a mock"
222-
onChange={option => this.loadMock(option.value)}
226+
onChange={(option) => this.loadMock(option.value)}
223227
noResultsText={'No Results'}
224228
placeholder={'Search for a mock'}
225229
/>
@@ -234,7 +238,7 @@ class App extends Component {
234238
<AceEditor
235239
mode="json"
236240
theme="textmate"
237-
onChange={json_string => this.setState({json_string})}
241+
onChange={(json_string) => this.setState({json_string})}
238242
value={this.state.json_string}
239243
name="UNIQUE_ID_OF_DIV"
240244
style={{height: '80vh'}}

‎dev/index.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import ReactDOM from 'react-dom';
32
import './styles.css';
43
import App from './App';

‎examples/custom/src/App.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React,{Component} from 'react';
1+
import {Component} from 'react';
22
import plotly from 'plotly.js/dist/plotly';
33
import PlotlyEditor from 'react-chart-editor';
44
import CustomEditor from './CustomEditor';
@@ -9,7 +9,7 @@ const dataSources = {
99
col2: [4, 3, 2], // eslint-disable-line no-magic-numbers
1010
col3: [17, 13, 9], // eslint-disable-line no-magic-numbers
1111
};
12-
const dataSourceOptions = Object.keys(dataSources).map(name => ({
12+
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
1313
value: name,
1414
label: name,
1515
}));

‎examples/custom/src/CustomEditor.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React,{Component} from 'react';
1+
import {Component} from 'react';
22
import {
33
Flaglist,
44
ColorPicker,
@@ -47,19 +47,28 @@ export default class CustomEditor extends Component {
4747
label="Dropdown"
4848
attr="xaxis.title"
4949
show
50-
options={[{label: 'Yes', value: 'yes'}, {label: 'No', value: 'no'}]}
50+
options={[
51+
{label: 'Yes', value: 'yes'},
52+
{label: 'No', value: 'no'},
53+
]}
5154
/>
5255
<Radio
5356
label="Radio"
5457
attr="yaxis.title"
5558
show
56-
options={[{label: 'Yes', value: 'yes'}, {label: 'No', value: 'no'}]}
59+
options={[
60+
{label: 'Yes', value: 'yes'},
61+
{label: 'No', value: 'no'},
62+
]}
5763
/>
5864
<Flaglist
5965
label="Flaglist"
6066
attr="title.font.family"
6167
show
62-
options={[{label: 'Yes', value: 'y'}, {label: 'No', value: 'n'}]}
68+
options={[
69+
{label: 'Yes', value: 'y'},
70+
{label: 'No', value: 'n'},
71+
]}
6372
/>
6473
<ColorPicker label="ColorPicker" attr="plot_bgcolor" show />
6574
<TextEditor attr="title" label="TextEditor default" />

‎examples/custom/src/index.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import ReactDOM from 'react-dom';
32
import './index.css';
43
import App from './App';

‎examples/demo/src/App.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React,{Component} from 'react';
1+
import {Component} from 'react';
22
import plotly from 'plotly.js/dist/plotly';
33
import PlotlyEditor from 'react-chart-editor';
44
import 'react-chart-editor/lib/react-chart-editor.css';
55
import Nav from './Nav';
66
import dataSources from './dataSources';
77

8-
const dataSourceOptions = Object.keys(dataSources).map(name => ({
8+
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
99
value: name,
1010
label: name,
1111
}));
@@ -27,19 +27,19 @@ class App extends Component {
2727
this.loadMock = this.loadMock.bind(this);
2828
}
2929

30-
componentWillMount() {
30+
UNSAFE_componentWillMount() {
3131
fetch('https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks')
32-
.then(response => response.json())
33-
.then(mocks => this.setState({mocks}));
32+
.then((response) => response.json())
33+
.then((mocks) => this.setState({mocks}));
3434
}
3535

3636
loadMock(mockIndex) {
3737
const mock = this.state.mocks[mockIndex];
3838
fetch(mock.url, {
3939
headers: new Headers({Accept: 'application/vnd.github.v3.raw'}),
4040
})
41-
.then(response => response.json())
42-
.then(figure => {
41+
.then((response) => response.json())
42+
.then((figure) => {
4343
this.setState({
4444
currentMockIndex: mockIndex,
4545
data: figure.data,

‎examples/demo/src/Nav.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import PropTypes from 'prop-types';
2-
import React from 'react';
32
import Dropdown from 'react-chart-editor/lib/components/widgets/Dropdown';
43

54
const Nav = ({mocks, currentMockIndex, loadMock}) => (
@@ -20,7 +19,7 @@ const Nav = ({mocks, currentMockIndex, loadMock}) => (
2019
value: i,
2120
}))}
2221
value={currentMockIndex}
23-
onChange={option => loadMock(option)}
22+
onChange={(option) => loadMock(option)}
2423
/>
2524
</div>
2625
</div>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /