Commit 76dd62c7bc80726e67731b97d6d277840c8f6c00

Authored by tmcdeveloper
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.
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
1 1 import React from 'react';
2   -import { Row, Col, ListGroup, ListGroupItem, Input, Alert } from 'react-bootstrap';
  2 +import { Input } from 'react-bootstrap';
3 3 import { insertDocument } from '../../api/documents/methods.js';
4 4  
5 5 const handleInsertDocument = (event) => {
... ...
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 }) =&gt; (
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
1   -import React from 'react';
2 1 import { composeWithTracker } from 'react-komposer';
3 2 import { Documents } from '../../api/documents/documents.js';
4 3 import { DocumentsList } from '../components/documents-list.js';
... ...
imports/ui/layouts/app.js
... ... @@ -3,6 +3,9 @@ import { Grid } from &#39;react-bootstrap&#39;;
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
1 1 import React from 'react';
2   -import { Row, Col, Input, Button } from 'react-bootstrap';
  2 +import { Row, Col } from 'react-bootstrap';
3 3 import DocumentsList from '../containers/documents-list.js';
4 4 import { AddDocument } from '../components/add-document.js';
5 5  
... ...
imports/ui/pages/index.js
1 1 import React from 'react';
2   -import { Jumbotron, Button } from 'react-bootstrap';
  2 +import { Jumbotron } from 'react-bootstrap';
3 3  
4 4 export const Index = () => (
5 5 <Jumbotron className="text-center">
... ...
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
1 1 import React from 'react';
2   -import { browserHistory } from 'react-router';
3 2 import { Alert } from 'react-bootstrap';
4 3  
5 4 export const NotFound = () => (
... ...
imports/ui/pages/reset-password.js
... ... @@ -43,3 +43,7 @@ with your new password.
43 43 </Row>;
44 44 }
45 45 }
  46 +
  47 +ResetPassword.propTypes = {
  48 + params: React.PropTypes.object,
  49 +};
... ...
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 {
... ...
... ... @@ -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": {
... ...