Skip to content

Commit 30e5a68

Browse files
authored
Merge pull request #72 from cesine/more_lint
use eslint:recommended
2 parents da35fb6 + f735423 commit 30e5a68

43 files changed

Lines changed: 674 additions & 427 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"presets": ["es2015", "react"],
33
"env": {
44
"test": {
5-
"plugins": [ "babel-plugin-rewire" ]
65
}
76
}
87
}

.eslintrc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
22
"parser": "babel-eslint",
33
"extends": [
4-
"standard",
5-
"standard-react"
4+
"eslint:recommended",
5+
"plugin:mocha/recommended",
6+
"plugin:react/recommended"
67
],
78
"plugins": [
8-
"babel",
9-
"react",
10-
"promise"
9+
"mocha",
10+
"react"
1111
],
1212
"env": {
13-
"mocha" : true
13+
"mocha": true,
14+
"node": true
1415
},
1516
"globals": {
16-
"document": false,
17-
"expect": false,
18-
"navigator": false,
19-
"sinon": false,
20-
"window": false
17+
"Symbol": false
2118
},
2219
"rules": {}
2320
}

app/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global window, document */
12
import 'babel-polyfill'
23
import { browserHistory } from 'react-router'
34
import Immutable from 'immutable'
@@ -17,6 +18,7 @@ if (window.__REDUX_STATE__) {
1718
reduxState[key] = Immutable.fromJS(val)
1819
})
1920
} catch (e) {
21+
// eslint-disable-next-line no-console
2022
console.error(e)
2123
}
2224
}
@@ -27,4 +29,4 @@ ReactDOM.render((
2729
<Provider store={store}>
2830
{ createRoutes(browserHistory) }
2931
</Provider>
30-
), document.getElementById('root'))
32+
), document.getElementById('root'))

app/components/App/index.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ import { FieldDBObject } from 'fielddb/api/FieldDBObject'
33
import Helmet from 'react-helmet'
44
import Q from 'q'
55
import React, { Component } from 'react'
6+
import PropTypes from 'prop-types'
67

78
FieldDBObject.todo = function () {}
89
FieldDBObject.warn = function () {}
910
FieldDBObject.confirm = function (message, optionalLocale) {
1011
const deferred = Q.defer()
11-
console.warn('Not confirming: ', message)
12+
// console.warn('Not confirming: ', message)
1213
deferred.reject({
1314
message: message,
1415
optionalLocale: optionalLocale,
1516
response: null
1617
})
1718
return deferred.promise
1819
}
19-
FieldDBObject.prompt = function (message, optionalLocale, providedInput) {
20+
FieldDBObject.prompt = function (message, optionalLocale) {
2021
const deferred = Q.defer()
21-
console.warn('Not prompting: ', message)
22+
// console.warn('Not prompting: ', message)
2223
deferred.reject({
2324
message: message,
2425
optionalLocale: optionalLocale,
@@ -47,18 +48,18 @@ class App extends Component {
4748
htmlAttributes={{
4849
'lang': 'en'
4950
}}
50-
/>
51+
/>
5152
{this.props.children}
5253
</div>
5354
)
5455
}
5556
}
5657

5758
App.propTypes = {
58-
children: React.PropTypes.object.isRequired
59+
children: PropTypes.object.isRequired
5960
}
6061

61-
function mapStateToProps (state) {
62+
function mapStateToProps () {
6263
return {}
6364
}
6465

app/components/App/routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import CorpusMaskContainer from '../CorpusMask'
77
import UserMaskContainer from '../UserMask'
88
import SearchContainer from '../Search'
99

10-
export default function (history) {
10+
export default function Routes(history) {
1111
return (
1212
<Router history={history}>
1313
<Route path='/' component={App}>

app/components/App/store.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ const logger = createLogger({
99
level: 'info',
1010
collapsed: false,
1111
logger: console,
12-
predicate: (getState, action) => true
12+
predicate: () => true
1313
})
1414

1515
let middlewares = [
1616
thunkMiddleware,
1717
apiMiddleware
1818
]
1919

20+
// By default: debug all state changes if in development mode
2021
if (process.env.NODE_ENV !== 'production') {
2122
middlewares = [...middlewares, logger]
2223
}

app/components/Corpora/Corpora.jsx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react'
2+
import PropTypes from 'prop-types'
23
import { Link } from 'react-router'
34
import { List } from 'immutable'
45

@@ -8,38 +9,38 @@ class Corpora extends Component {
89
<div className={this.props.className}>
910
<h1>Corpora</h1>
1011
{
11-
this.props.corpora.map((connection) => {
12-
let website = connection.get('website') || ''
13-
if (connection.get('searchKeywords')) {
14-
website = `${website}/search/${connection.get('searchKeywords')}`
15-
} else {
16-
website = `${website}/search`
17-
}
18-
return (
19-
<div className='media' key={connection.get('dbname')}>
20-
<Link to={website} className='pull-left'>
21-
<img src={'https://secure.gravatar.com/avatar/' + connection.get('gravatar') + '.jpg?s=96&d=retro&r=pg'} alt='Corpus image' className='media-object' />
22-
</Link>
23-
<div className='media-body'>
24-
<h4 className='media-heading'>
25-
<Link to={website}>
26-
{connection.get('title')}
12+
this.props.corpora.map((connection) => {
13+
let website = connection.get('website') || ''
14+
if (connection.get('searchKeywords')) {
15+
website = `${website}/search/${connection.get('searchKeywords')}`
16+
} else {
17+
website = `${website}/search`
18+
}
19+
return (
20+
<div className='media' key={connection.get('dbname')}>
21+
<Link to={website} className='pull-left'>
22+
<img src={'https://secure.gravatar.com/avatar/' + connection.get('gravatar') + '.jpg?s=96&d=retro&r=pg'} alt='Corpus image' className='media-object' />
2723
</Link>
28-
</h4>
29-
<p>{connection.get('description')}</p>
30-
</div>
31-
</div>
32-
)
33-
})
34-
}
24+
<div className='media-body'>
25+
<h4 className='media-heading'>
26+
<Link to={website}>
27+
{connection.get('title')}
28+
</Link>
29+
</h4>
30+
<p>{connection.get('description')}</p>
31+
</div>
32+
</div>
33+
)
34+
})
35+
}
3536
</div>
3637
)
3738
}
3839
}
3940

4041
Corpora.propTypes = {
41-
corpora: React.PropTypes.instanceOf(List).isRequired,
42-
className: React.PropTypes.string.isRequired
42+
corpora: PropTypes.instanceOf(List).isRequired,
43+
className: PropTypes.string.isRequired
4344
}
4445

4546
export default Corpora

app/components/Corpora/Corpora.test.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import { expect } from 'chai'
12
import Immutable from 'immutable'
23
import { Link } from 'react-router'
34
import React from 'react'
45
import { shallow } from 'enzyme'
56

67
import Corpora from './Corpora.jsx'
78

9+
function renderDoc (props) {
10+
return shallow(<Corpora {...props} />)
11+
}
12+
813
describe('Component::Corpora', function () {
9-
let props
14+
let props;
15+
1016
beforeEach(function () {
1117
props = {
1218
corpora: Immutable.fromJS([
@@ -27,12 +33,9 @@ describe('Component::Corpora', function () {
2733
])
2834
}
2935
})
30-
function renderDoc () {
31-
return shallow(<Corpora {...props} />)
32-
}
3336

3437
it('renders corpora', function () {
35-
let doc = renderDoc()
38+
let doc = renderDoc(props)
3639
let corpusMaskComps = doc.find(Link)
3740

3841
expect(corpusMaskComps.length).to.equal(props.corpora.size * 2)

app/components/Corpora/CorporaContainer.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { expect } from 'chai'
12
import Immutable from 'immutable'
23
import React from 'react'
34
import { shallow } from 'enzyme'
5+
import sinon from 'sinon'
46

57
import Corpora from './Corpora.jsx'
68
import { CorpusMaskContainer } from './index.jsx'

app/components/Corpora/actions.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect } from 'chai'
12
import { CALL_API } from 'middleware/api'
23

34
import * as actionCreator from './actions'

0 commit comments

Comments
 (0)