Skip to content

Commit 73277ab

Browse files
committed
Fix eslint
1 parent b5b7d1f commit 73277ab

File tree

5 files changed

+68
-50
lines changed

5 files changed

+68
-50
lines changed

.eslintrc

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": ["eslint:recommended", "prettier"],
3-
"parser": "babel-eslint",
3+
"parser": "@babel/eslint-parser",
44
"parserOptions": {
5-
"ecmaVersion": 6,
5+
"ecmaVersion": 13,
66
"sourceType": "module",
77
"ecmaFeatures": {
88
"arrowFunctions": true,
@@ -15,6 +15,9 @@
1515
"modules": true,
1616
"templateStrings": true,
1717
"jsx": true
18+
},
19+
"babelOptions": {
20+
"presets": ["@babel/preset-react"]
1821
}
1922
},
2023
"settings": {
@@ -25,24 +28,18 @@
2528
},
2629
"env": {
2730
"browser": true,
28-
"es6": true,
31+
"es2021": true,
2932
"jasmine": true,
3033
"jest": true,
3134
"node": true
3235
},
3336
"globals": {
3437
"jest": true
3538
},
36-
"plugins": [
37-
"react",
38-
"import",
39-
"react-percy"
40-
],
39+
"plugins": ["react", "import", "react-percy", "jsx"],
4140
"overrides": [
4241
{
43-
"files": [
44-
"**/*.percy.{js,jsx}"
45-
],
42+
"files": ["**/*.percy.{js,jsx}"],
4643
"env": {
4744
"react-percy/globals": true
4845
}
@@ -120,20 +117,30 @@
120117
"react/prop-types": "error",
121118
"valid-jsdoc": ["error"],
122119
"yoda": ["error"],
123-
"spaced-comment": ["error", "always", {
124-
"block": {
125-
"exceptions": ["*"]
120+
"spaced-comment": [
121+
"error",
122+
"always",
123+
{
124+
"block": {
125+
"exceptions": ["*"]
126+
}
126127
}
127-
}],
128-
"no-unused-vars": ["error", {
128+
],
129+
"no-unused-vars": [
130+
"error",
131+
{
129132
"args": "after-used",
130133
"argsIgnorePattern": "^_",
131134
"caughtErrorsIgnorePattern": "^e$"
132-
}],
133-
"no-magic-numbers": ["error", {
134-
"ignoreArrayIndexes": true,
135+
}
136+
],
137+
"no-magic-numbers": [
138+
"error",
139+
{
140+
"ignoreArrayIndexes": true,
135141
"ignore": [-1, 0, 1, 2, 3, 100, 10, 0.5]
136-
}],
142+
}
143+
],
137144
"no-underscore-dangle": ["off"]
138145
}
139146
}

babel.config.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-react",
5+
{
6+
"runtime": "automatic"
7+
}
8+
],
9+
"@babel/env"
10+
],
11+
"plugins": [
12+
"react-hot-loader/babel",
13+
"@babel/plugin-proposal-object-rest-spread",
14+
[
15+
"module-resolver",
16+
{
17+
"root": ["./"],
18+
"alias": {
19+
"components": "./src/components",
20+
"lib": "./src/lib",
21+
"styles": "./src/styles"
22+
}
23+
}
24+
]
25+
]
26+
}

dev/App.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -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
},
@@ -122,8 +126,8 @@ class App extends Component {
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'}}

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"devDependencies": {
5454
"@babel/cli": "7.17.10",
5555
"@babel/core": "7.17.12",
56+
"@babel/eslint-parser": "7.17.0",
5657
"@babel/node": "7.17.10",
5758
"@babel/plugin-proposal-object-rest-spread": "7.17.12",
5859
"@babel/polyfill": "7.12.1",
@@ -63,7 +64,6 @@
6364
"@percy/storybook": "3.3.1",
6465
"@storybook/react": "6.2.9",
6566
"autoprefixer": "10.4.7",
66-
"babel-eslint": "10.1.0",
6767
"babel-jest": "26.6.3",
6868
"babel-loader": "8.2.5",
6969
"babel-plugin-module-resolver": "4.1.0",
@@ -74,6 +74,7 @@
7474
"eslint": "8.15.0",
7575
"eslint-config-prettier": "8.5.0",
7676
"eslint-plugin-import": "2.26.0",
77+
"eslint-plugin-jsx": "0.1.0",
7778
"eslint-plugin-react": "7.29.4",
7879
"eslint-plugin-react-percy": "0.2.4",
7980
"fs": "0.0.2",

webpack.config.js

+1-21
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,7 @@ module.exports = {
1010
rules: [
1111
{
1212
test: /\.js?$/,
13-
use: {
14-
loader: 'babel-loader',
15-
options: {
16-
presets: ['@babel/react', '@babel/env'],
17-
plugins: [
18-
'react-hot-loader/babel',
19-
'@babel/plugin-proposal-object-rest-spread',
20-
[
21-
'module-resolver',
22-
{
23-
root: ['./'],
24-
alias: {
25-
components: './src/components',
26-
lib: './src/lib',
27-
styles: './src/styles',
28-
},
29-
},
30-
],
31-
],
32-
},
33-
},
13+
use: 'babel-loader',
3414
exclude: [/node_modules/],
3515
},
3616
{

0 commit comments

Comments
 (0)