Commit 76dd62c7bc80726e67731b97d6d277840c8f6c00
1 parent
f0c912bf1f
Exists in
master
fix eslint error with React and clean up
- Fix eslint throwing a tantrum about React globals. - Update components to include propTypes. - Remove unnecessary imports. - Complete move to airbnb style guide.
Showing
13 changed files
with
30 additions
and
16 deletions
Show diff stats
imports/startup/client/routes.js
1 | 1 | import React from 'react'; |
2 | 2 | import { render } from 'react-dom'; |
3 | -import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router'; | |
3 | +import { Router, Route, IndexRoute, browserHistory } from 'react-router'; | |
4 | 4 | |
5 | 5 | import { App } from '../../ui/layouts/app'; |
6 | 6 | import { Documents } from '../../ui/pages/documents'; | ... | ... |
imports/ui/components/add-document.js
imports/ui/components/app-navigation.js
1 | 1 | import React from 'react'; |
2 | -import { Navbar, Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap'; | |
2 | +import { Navbar } from 'react-bootstrap'; | |
3 | 3 | import { Link } from 'react-router'; |
4 | 4 | import { PublicNavigation } from './public-navigation'; |
5 | 5 | import { AuthenticatedNavigation } from './authenticated-navigation'; |
... | ... | @@ -23,3 +23,7 @@ export class AppNavigation extends React.Component { |
23 | 23 | </Navbar>; |
24 | 24 | } |
25 | 25 | } |
26 | + | |
27 | +AppNavigation.propTypes = { | |
28 | + hasUser: React.PropTypes.object, | |
29 | +}; | ... | ... |
imports/ui/components/documents-list.js
1 | 1 | import React from 'react'; |
2 | -import { Row, Col, ListGroup, Alert } from 'react-bootstrap'; | |
2 | +import { ListGroup, Alert } from 'react-bootstrap'; | |
3 | 3 | import { Document } from './document.js'; |
4 | 4 | |
5 | 5 | export const DocumentsList = ({ documents }) => ( |
... | ... | @@ -10,3 +10,7 @@ export const DocumentsList = ({ documents }) => ( |
10 | 10 | </ListGroup> : |
11 | 11 | <Alert bsStyle="warning">No documents yet.</Alert> |
12 | 12 | ); |
13 | + | |
14 | +DocumentsList.propTypes = { | |
15 | + documents: React.PropTypes.array, | |
16 | +}; | ... | ... |
imports/ui/containers/documents-list.js
imports/ui/layouts/app.js
... | ... | @@ -3,6 +3,9 @@ import { Grid } from 'react-bootstrap'; |
3 | 3 | import AppNavigation from '../containers/app-navigation'; |
4 | 4 | |
5 | 5 | export const App = React.createClass({ |
6 | + propTypes: { | |
7 | + children: React.PropTypes.element.isRequired, | |
8 | + }, | |
6 | 9 | contextTypes: { |
7 | 10 | router() { |
8 | 11 | return React.PropTypes.func.isRequired; | ... | ... |
imports/ui/pages/documents.js
imports/ui/pages/index.js
imports/ui/pages/login.js
1 | 1 | import React from 'react'; |
2 | 2 | import { Link } from 'react-router'; |
3 | -import { Row, Col, PageHeader, Input, Button } from 'react-bootstrap'; | |
3 | +import { Row, Col, Input, Button } from 'react-bootstrap'; | |
4 | 4 | import { handleLogin } from '../../modules/login'; |
5 | 5 | |
6 | 6 | export class Login extends React.Component { | ... | ... |
imports/ui/pages/not-found.js
imports/ui/pages/reset-password.js
imports/ui/pages/signup.js
1 | 1 | import React from 'react'; |
2 | 2 | import { Link } from 'react-router'; |
3 | -import { Row, Col, PageHeader, Input, Button } from 'react-bootstrap'; | |
3 | +import { Row, Col, Input, Button } from 'react-bootstrap'; | |
4 | 4 | import { handleSignup } from '../../modules/signup'; |
5 | 5 | |
6 | 6 | export class Signup extends React.Component { | ... | ... |
package.json
... | ... | @@ -22,7 +22,8 @@ |
22 | 22 | ], |
23 | 23 | "extends": [ |
24 | 24 | "airbnb/base", |
25 | - "plugin:meteor/guide" | |
25 | + "plugin:meteor/guide", | |
26 | + "plugin:react/recommended" | |
26 | 27 | ], |
27 | 28 | "globals": { |
28 | 29 | "$": false, |
... | ... | @@ -39,11 +40,11 @@ |
39 | 40 | "rules": {} |
40 | 41 | }, |
41 | 42 | "devDependencies": { |
42 | - "chimp": "^0.33.0", | |
43 | - "eslint": "^2.6.0", | |
44 | - "eslint-config-airbnb": "^6.2.0", | |
45 | - "eslint-plugin-meteor": "^3.4.0", | |
46 | - "eslint-plugin-react": "^4.2.3", | |
43 | + "chimp": "^0.33.1", | |
44 | + "eslint": "^2.8.0", | |
45 | + "eslint-config-airbnb": "^7.0.0", | |
46 | + "eslint-plugin-meteor": "^3.5.2", | |
47 | + "eslint-plugin-react": "^4.3.0", | |
47 | 48 | "faker": "^3.1.0" |
48 | 49 | }, |
49 | 50 | "dependencies": { | ... | ... |