Skip to content

Commit 5d9c681

Browse files
authored
Merge pull request #23 from pokiujf/eslint_config_and_fix
Eslint config and fix
2 parents 2331b9a + f6b5193 commit 5d9c681

29 files changed

+194
-161
lines changed

client/.eslintrc.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
---
2-
parser: babel-eslint
2+
extends: react-app
33

44
env:
55
browser: true
66
es6: true
7-
jasmine: true
7+
jest: true
88
node: true
99

10-
ecmaFeatures:
11-
jsx: true
12-
13-
plugins:
14-
- react
15-
16-
extends:
17-
- airbnb-base
18-
1910
globals:
2011
context: false
2112
jest: true
2213

2314
rules:
24-
import/no-named-as-default: 0
25-
import/prefer-default-export: 0
26-
no-console: 0
27-
no-param-reassign: 0
28-
no-shadow: 0 # FIXME extract generic Edit component
29-
no-unused-vars: 0 # FIXME
30-
react/jsx-uses-react: 2
15+
jsx-a11y/href-no-hash: 0
16+
jsx-a11y/alt-text: 0

client/package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
"jsonapi-serializer": "^3.5.2",
2222
"lodash": "^4.17.4",
2323
"object-path-immutable": "^0.5.1",
24+
"prop-types": "^15.5.10",
2425
"qs": "^6.4.0",
2526
"react": "^15.4.2",
2627
"react-addons-css-transition-group": "^15.5.2",
2728
"react-addons-transition-group": "^15.5.2",
2829
"react-dom": "^15.4.2",
2930
"react-redux": "^5.0.3",
30-
"react-router": "~3.0.2",
31+
"react-router": "^4.1.1",
3132
"react-router-redux": "^4.0.8",
3233
"react-ultimate-pagination": "^1.0.1",
3334
"reactstrap": "^4.5.0",
@@ -48,15 +49,16 @@
4849
"enzyme": "^2.7.1",
4950
"enzyme-to-json": "^1.5.0",
5051
"eslint": "^3.19.0",
51-
"eslint-config-airbnb": "^14.1.0",
52-
"eslint-plugin-import": "^2.2.0",
53-
"eslint-plugin-jsx-a11y": "^4.0.0",
54-
"eslint-plugin-react": "^6.10.3",
52+
"eslint-config-react-app": "^1.0.4",
53+
"eslint-plugin-flowtype": "^2.33.0",
54+
"eslint-plugin-import": "^2.3.0",
55+
"eslint-plugin-jsx-a11y": "^5.0.3",
56+
"eslint-plugin-react": "^7.0.1",
5557
"extract-text-webpack-plugin": "^2.1.0",
5658
"html-webpack-plugin": "^2.28.0",
5759
"jest": "^19.0.2",
5860
"node-sass": "^4.5.0",
59-
"react-addons-test-utils": "^15.4.2",
61+
"react-test-renderer": "^15.5.4",
6062
"sass-loader": "^6.0.3",
6163
"shx": "^0.2.2",
6264
"style-loader": "^0.13.2",

client/src/api/client.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
get,
66
groupBy,
77
keys,
8-
pick,
98
set,
109
values,
1110
zipObject,
@@ -21,6 +20,7 @@ export const client = axios.create({
2120
Accept: 'application/vnd.api+json',
2221
'Content-Type': 'application/vnd.api+json',
2322
},
23+
paramsSerializer: params => qs.stringify(params, { format: 'RFC1738', arrayFormat: 'brackets' }),
2424
});
2525

2626
client.interceptors.response.use(
@@ -47,10 +47,6 @@ client.interceptors.request.use(
4747
error => Promise.reject(error),
4848
);
4949

50-
const stringifyParams = params => qs.stringify(params, { format: 'RFC1738', arrayFormat: 'brackets' });
51-
52-
export const withParams = (url, params) => `${url}?${stringifyParams(params)}`;
53-
5450
export const normalizeResponse = (response) => {
5551
const { data = [], included = [] } = response.data;
5652
const dataByType = groupBy(castArray(data).concat(included), 'type');

client/src/components/App.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React, { Component } from 'react';
2-
import { Link } from 'react-router';
32
import { connect } from 'react-redux';
4-
import { isEmpty } from 'lodash';
5-
import { Collapse, Container, Navbar, NavbarToggler, Nav, NavItem, NavLink, NavDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
3+
import { Container, Navbar, Nav, NavItem, NavLink, NavDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
64

75
import { getUser, logout } from '../store/auth';
86

@@ -17,12 +15,12 @@ export class App extends Component {
1715
};
1816

1917
toggle = () => this.setState({
20-
isOpen: !this.state.isOpen
18+
isOpen: !this.state.isOpen,
2119
});
2220

2321
render() {
2422
const { user } = this.props;
25-
const userIsAdmin = user.roles.includes('admin')
23+
const userIsAdmin = user.roles.includes('admin');
2624

2725
return (
2826
<div>

client/src/components/Auth/Login.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
22
import { connect } from 'react-redux';
33
import { replace } from 'react-router-redux';
44
import { SubmissionError } from 'redux-form';
@@ -8,7 +8,6 @@ import LoginForm from './LoginForm';
88
import { login } from '../../store/auth';
99

1010
export class Login extends Component {
11-
// eslint-disable-next-line class-methods-use-this
1211
componentWillMount() {
1312
localStorage.clear();
1413
}

client/src/components/Auth/LoginForm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React, { Component, PropTypes } from 'react';
2-
import { isEmpty } from 'lodash';
1+
import React, { Component } from 'react';
32
import { Field, reduxForm } from 'redux-form';
43
import { Alert, Button, Form } from 'reactstrap';
54

client/src/components/Categories/CategoryForm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React, { Component, PropTypes } from 'react';
2-
import { isEmpty } from 'lodash';
1+
import React, { Component } from 'react';
32
import { Field, reduxForm } from 'redux-form';
43
import { Button, Form, Col, Row } from 'reactstrap';
54

client/src/components/Categories/CategoryList.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React, { Component, PropTypes } from 'react';
2-
import { find, keyBy } from 'lodash';
1+
import React, { Component } from 'react';
32

43
import { Loading } from '../UI';
54
import { withResourceList } from '../../hocs';

client/src/components/Dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
22
import { Link } from 'react-router';
33
import { connect } from 'react-redux';
4-
import { get, find, keyBy } from 'lodash';
4+
import { get } from 'lodash';
55

66
import { fetchList, getList, getMap } from '../store/api';
77

client/src/components/Posts/PostEdit.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
22
import { push } from 'react-router-redux';
33
import { connect } from 'react-redux';
4-
import { get, find, omit } from 'lodash';
54

65
import { ErrorAlert, Loading, EditHeader } from '../UI';
76
import { withResource } from '../../hocs';

0 commit comments

Comments
 (0)