Skip to content

Commit e53dc19

Browse files
committed
More lint removal from material-ui example.
1 parent 4e629a9 commit e53dc19

File tree

11 files changed

+63
-78
lines changed

11 files changed

+63
-78
lines changed

examples/complete/material/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const firebase = {
1313
export const reduxFirebase = {
1414
userProfile: 'users', // root that user profiles are written to
1515
enableLogging: false, // enable/disable Firebase Database Logging
16-
updateProfileOnLogin: false, // enable/disable updating of profile on login
16+
updateProfileOnLogin: false // enable/disable updating of profile on login
1717
// profileDecorator: (userData) => ({ email: userData.email }) // customize format of user profile
1818
}
1919

examples/complete/material/src/containers/Navbar/Navbar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default class Navbar extends Component {
5252
}
5353

5454
static propTypes = {
55-
auth: PropTypes.object,
5655
account: PropTypes.object,
5756
firebase: PropTypes.object.isRequired
5857
}

examples/complete/material/src/routes/Account/containers/AccountContainer.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import React, { Component } from 'react'
22
import PropTypes from 'prop-types'
33
import Paper from 'material-ui/Paper'
44
import { connect } from 'react-redux'
5-
import { reduxForm } from 'redux-form'
65
import { firebaseConnect, pathToJS, isLoaded } from 'react-redux-firebase'
76
import { reduxFirebase as rfConfig } from 'config'
8-
import { ACCOUNT_FORM_NAME } from 'constants'
97
import { UserIsAuthenticated } from 'utils/router'
108
import defaultUserImageUrl from 'static/User.png'
119
import LoadingSpinner from 'components/LoadingSpinner'
@@ -17,12 +15,15 @@ import classes from './AccountContainer.scss'
1715
@connect( // Map redux state to props
1816
({ firebase }) => ({
1917
auth: pathToJS(firebase, 'auth'),
20-
account: pathToJS(firebase, 'profile'),
18+
account: pathToJS(firebase, 'profile')
2119
})
2220
)
2321
export default class Account extends Component {
2422
static propTypes = {
2523
account: PropTypes.object,
24+
auth: PropTypes.shape({
25+
uid: PropTypes.string
26+
}),
2627
firebase: PropTypes.shape({
2728
update: PropTypes.func.isRequired,
2829
logout: PropTypes.func.isRequired
@@ -43,7 +44,7 @@ export default class Account extends Component {
4344
this.props.firebase
4445
.update(`${rfConfig.userProfile}/${this.props.auth.uid}`, newData)
4546
.catch((err) => {
46-
console.error('Error updating account', err)
47+
console.error('Error updating account', err) // eslint-disable-line no-console
4748
// TODO: Display error to user
4849
})
4950

examples/complete/material/src/routes/Home/containers/HomeContainer.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
isLoaded,
99
pathToJS,
1010
// dataToJS, // needed for full list and once
11-
orderedToJS, // needed for ordered list
11+
orderedToJS // needed for ordered list
1212
// populatedDataToJS // needed for populated list
1313
} from 'react-redux-firebase'
1414
import CircularProgress from 'material-ui/CircularProgress'
@@ -25,17 +25,16 @@ import classes from './HomeContainer.scss'
2525
@firebaseConnect([
2626
// 'todos' // sync full list of todos
2727
// { path: 'todos', type: 'once' } // for loading once instead of binding
28-
{ path: 'todos', queryParams: ['orderByKey', 'limitToLast=8'] } // limit to first 20
28+
{ path: 'todos', queryParams: ['orderByKey', 'limitToLast=8'] } // 8 most recent
2929
// { path: 'todos', populates } // populate
30-
// { path: 'todos', queryParams: ['orderByKey', 'limitToLast=5'] }, // get five most recent (array will need to be inverted)
3130
])
3231
@connect(
3332
({firebase}) => ({
3433
auth: pathToJS(firebase, 'auth'),
3534
account: pathToJS(firebase, 'profile'),
3635
// todos: dataToJS(firebase, 'todos')
3736
// todos: populatedDataToJS(firebase, '/todos', populates), // if populating
38-
todos: orderedToJS(firebase, 'todos'), // if using ordering such as orderByChild
37+
todos: orderedToJS(firebase, 'todos') // if using ordering such as orderByChild
3938
})
4039
)
4140
export default class Home extends Component {
@@ -47,7 +46,11 @@ export default class Home extends Component {
4746
firebase: PropTypes.shape({
4847
set: PropTypes.func.isRequired,
4948
remove: PropTypes.func.isRequired,
50-
push: PropTypes.func.isRequired
49+
push: PropTypes.func.isRequired,
50+
database: PropTypes.oneOfType([
51+
PropTypes.object,
52+
PropTypes.func
53+
])
5154
}),
5255
auth: PropTypes.shape({
5356
uid: PropTypes.string
@@ -67,7 +70,7 @@ export default class Home extends Component {
6770
}
6871

6972
deleteTodo = (id) => {
70-
const { todos, auth, firebase } = this.props
73+
const { auth, firebase } = this.props
7174
if (!auth || !auth.uid) {
7275
return this.setState({ error: 'You must be Logged into Delete' })
7376
}
@@ -100,15 +103,13 @@ export default class Home extends Component {
100103
<div className={classes.container} style={{ color: Theme.palette.primary2Color }}>
101104
{
102105
error
103-
?
104-
<Snackbar
105-
open={!!error}
106-
message={error}
107-
autoHideDuration={4000}
108-
onRequestClose={() => this.setState({ error: null })}
106+
? <Snackbar
107+
open={!!error}
108+
message={error}
109+
autoHideDuration={4000}
110+
onRequestClose={() => this.setState({ error: null })}
109111
/>
110-
:
111-
null
112+
: null
112113
}
113114
<div className={classes.info}>
114115
<span>data loaded from</span>

examples/complete/material/src/routes/Projects/containers/ProjectsContainer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ export default class Projects extends Component {
4141
projects: PropTypes.object,
4242
firebase: PropTypes.object,
4343
auth: PropTypes.object,
44-
children: PropTypes.object,
45-
params: PropTypes.object
44+
children: PropTypes.object
4645
}
4746

4847
state = {
@@ -51,7 +50,7 @@ export default class Projects extends Component {
5150
}
5251

5352
newSubmit = (newProject) => {
54-
const { auth, firebase: { push } } = this.props
53+
const { firebase: { pushWithMeta } } = this.props
5554
return pushWithMeta('projects', newProject)
5655
.then(() => this.setState({ newProjectModal: false }))
5756
.catch(err => {
@@ -72,7 +71,9 @@ export default class Projects extends Component {
7271
}
7372

7473
render () {
75-
if (!isLoaded(this.props.projects, this.props.auth)) {
74+
const { projects, auth } = this.props
75+
76+
if (!isLoaded(projects, auth)) {
7677
return <LoadingSpinner />
7778
}
7879

@@ -82,7 +83,6 @@ export default class Projects extends Component {
8283
return cloneElement(this.props.children, this.props)
8384
}
8485

85-
const { projects, auth } = this.props
8686
const { newProjectModal } = this.state
8787

8888
return (
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
import React, { Component } from 'react'
1+
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import { connect } from 'react-redux'
4-
import { firebaseConnect, isLoaded, dataToJS } from 'react-redux-firebase'
5-
import LoadingSpinner from 'components/LoadingSpinner'
63
import classes from './Project.scss'
74

85
export const Project = ({ projects, params: { projectname } }) => (
96
<div className={classes.container}>
107
{
118
projects[projectname]
12-
?
13-
<div>
14-
<h2>Project Container</h2>
15-
<pre>{JSON.stringify(projects[projectname], null, 2)}</pre>
16-
</div>
17-
:
18-
<div className={classes.empty}>
19-
<span>Project Not Found</span>
20-
</div>
9+
? <div>
10+
<h2>Project Container</h2>
11+
<pre>{JSON.stringify(projects[projectname], null, 2)}</pre>
12+
</div>
13+
: <div className={classes.empty}>
14+
<span>Project Not Found</span>
15+
</div>
2116
}
2217
</div>
2318
)
2419

2520
Project.propTypes = {
2621
projects: PropTypes.object,
27-
params: PropTypes.object.isRequired,
28-
children: PropTypes.object
22+
params: PropTypes.object.isRequired
2923
}
3024

3125
export default Project

examples/complete/material/src/routes/Recover/components/EmailForm/EmailForm.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import { connect } from 'react-redux'
4-
import { Field, reduxForm, submit } from 'redux-form'
5-
import { firebaseConnect, pathToJS, isLoaded } from 'react-redux-firebase'
3+
import { Field, reduxForm } from 'redux-form'
64
import RaisedButton from 'material-ui/RaisedButton'
75
import TextField from 'components/TextField'
8-
import { List, ListItem } from 'material-ui/List'
9-
import AccountCircle from 'material-ui/svg-icons/action/account-circle'
106
import { RECOVER_EMAIL_FORM_NAME } from 'constants'
117
import classes from './EmailForm.scss'
128

139
const required = value => value ? undefined : 'Required'
1410
const email = value =>
15-
value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value) ?
16-
'Invalid email address' : undefined
11+
value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)
12+
? 'Invalid email address' : undefined
1713

1814
export const EmailForm = ({ account, handleSubmit, submitting, pristine, valid }) => (
1915
<form className={classes.container} onSubmit={handleSubmit}>
@@ -39,8 +35,10 @@ EmailForm.propTypes = {
3935
account: PropTypes.shape({
4036
providerData: PropTypes.array
4137
}),
42-
handleSubmit: PropTypes.func.isRequired,
43-
submitting: PropTypes.bool
38+
pristine: PropTypes.bool, // added by redux-form
39+
valid: PropTypes.bool, // added by redux-form
40+
handleSubmit: PropTypes.func.isRequired, // added by redux-form
41+
submitting: PropTypes.bool // added by redux-form
4442
}
4543

4644
export default reduxForm({

examples/complete/material/src/routes/Recover/components/RecoverForm/RecoverForm.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import { connect } from 'react-redux'
4-
import { Field, reduxForm, submit } from 'redux-form'
5-
import { firebaseConnect, pathToJS, isLoaded } from 'react-redux-firebase'
3+
import { Field, reduxForm } from 'redux-form'
64
import RaisedButton from 'material-ui/RaisedButton'
75
import Subheader from 'material-ui/Subheader'
86
import TextField from 'components/TextField'
9-
import { List, ListItem } from 'material-ui/List'
10-
import AccountCircle from 'material-ui/svg-icons/action/account-circle'
117
import { RECOVER_CODE_FORM_NAME } from 'constants'
128
import classes from './RecoverForm.scss'
139

@@ -48,9 +44,11 @@ RecoverForm.propTypes = {
4844
account: PropTypes.shape({
4945
providerData: PropTypes.array
5046
}),
51-
handleSubmit: PropTypes.func,
52-
onRecoverClick: PropTypes.func,
53-
submitting: PropTypes.bool
47+
pristine: PropTypes.bool, // added by redux-form
48+
valid: PropTypes.bool, // added by redux-form
49+
handleSubmit: PropTypes.func, // added by redux-form
50+
submitting: PropTypes.bool, // added by redux-form
51+
onRecoverClick: PropTypes.func
5452
}
5553

5654
export default reduxForm({

examples/complete/material/src/routes/Recover/containers/RecoverContainer.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
import React, { Component } from 'react'
22
import PropTypes from 'prop-types'
3-
import { reduxForm, submit } from 'redux-form'
43
import { firebaseConnect } from 'react-redux-firebase'
5-
import IconButton from 'material-ui/IconButton'
6-
import Paper from 'material-ui/Paper'
7-
import TextField from 'material-ui/TextField'
84
import Snackbar from 'material-ui/Snackbar'
9-
import ContentAdd from 'material-ui/svg-icons/content/add'
10-
import Subheader from 'material-ui/Subheader'
5+
import Paper from 'material-ui/Paper'
116
import RecoverForm from '../components/RecoverForm'
127
import EmailForm from '../components/EmailForm'
13-
import { RECOVER_FORM_NAME } from 'constants'
148

159
@firebaseConnect() // adds this.props.firebase
1610
export default class RecoverContainer extends Component {
11+
static propTypes = {
12+
firebase: PropTypes.object
13+
}
1714
state = {
1815
message: null,
1916
open: false
2017
}
2118

22-
sendRecoveryEmail = ({ email }) => {
23-
return this.props.firebase
19+
sendRecoveryEmail = ({ email }) =>
20+
this.props.firebase
2421
.resetPassword(email)
2522
.then(() => {
2623
this.setState({
@@ -29,11 +26,10 @@ export default class RecoverContainer extends Component {
2926
})
3027
})
3128
.catch((err) => {
32-
console.error('Error updating account', err)
29+
console.error('Error updating account', err) // eslint-disable-line no-console
3330
this.setState({ message: err.message || 'Error' }) // show error snackbar
3431
return Promise.reject(err)
3532
})
36-
}
3733

3834
recoverAccount = ({ code, password }) => {
3935
const {
@@ -44,20 +40,18 @@ export default class RecoverContainer extends Component {
4440
return verifyPasswordResetCode(code)
4541
.then(() => confirmPasswordReset(code, password))
4642
.then((res) => {
47-
this.setState({
48-
message: 'Password Changed Successfully'
49-
})
43+
this.setState({ message: 'Password Changed Successfully' })
5044
})
5145
.catch((err) => {
52-
console.error('Error updating account', err)
46+
console.error('Error updating account', err) // eslint-disable-line no-console
5347
this.setState({ message: err.message }) // show error snackbar
5448
return Promise.reject(err)
5549
})
5650
}
5751

58-
render() {
52+
render () {
5953
return (
60-
<div className="flex-column-center">
54+
<div className='flex-column-center'>
6155
<Paper style={{ marginTop: '3rem' }}>
6256
<EmailForm onSubmit={this.sendRecoveryEmail} />
6357
</Paper>
@@ -68,7 +62,7 @@ export default class RecoverContainer extends Component {
6862
open={!!this.state.message}
6963
message={this.state.message || 'Error'}
7064
autoHideDuration={4000}
71-
onRequestClose={() => this.setState({ message: null})}
65+
onRequestClose={() => this.setState({ message: null })}
7266
/>
7367
</div>
7468
)

examples/complete/material/src/routes/Recover/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { RECOVER_PATH as path } from 'constants'
22

33
export default (store) => ({
4-
path: 'recover',
4+
path: path,
55
/* Async getComponent is only invoked when route matches */
66
getComponent (nextState, cb) {
77
/* Webpack - use 'require.ensure' to create a split point

0 commit comments

Comments
 (0)