Skip to content

Commit d61629d

Browse files
committed
cherry-pick and modify from use eslint to config standardjs of branch v1.1.x
1 parent 7c5129a commit d61629d

Some content is hidden

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

81 files changed

+5395
-5829
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
root = true
33

44
[*]
5-
indent_style = tab
6-
indent_size = 4
5+
indent_style = space
6+
indent_size = 2
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true

.eslintignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.eslintrc

Lines changed: 60 additions & 248 deletions
Large diffs are not rendered by default.

index.android.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import React from 'react';
2-
import {AppRegistry} from 'react-native';
3-
import Noder from './src';
1+
import React from 'react'
2+
import {AppRegistry} from 'react-native'
3+
import Noder from './src'
44

5-
6-
AppRegistry.registerComponent('noder', () => Noder);
5+
AppRegistry.registerComponent('noder', () => Noder)

index.ios.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ import React from 'react'
22
import {AppRegistry} from 'react-native'
33
import Noder from './src'
44

5-
65
AppRegistry.registerComponent('noder', () => Noder)

index.web.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import 'babel-polyfill';
2-
import 'fetch-detector';
3-
import 'fetch-ie8';
4-
import {AppRegistry} from 'react-native';
5-
import Noder from './src';
1+
import 'babel-polyfill'
2+
import 'fetch-detector'
3+
import 'fetch-ie8'
4+
import {AppRegistry} from 'react-native'
5+
import Noder from './src'
66

7+
AppRegistry.registerComponent('noder', () => Noder)
78

8-
AppRegistry.registerComponent('noder', () => Noder);
9-
10-
var app = document.createElement('div');
11-
document.body.appendChild(app);
9+
var app = document.createElement('div')
10+
document.body.appendChild(app)
1211

1312
AppRegistry.runApplication('noder', {
14-
rootTag: app
15-
});
13+
rootTag: app
14+
})

package.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"push-android-prod": "code-push release-react Noder android --deploymentName Production",
2626
"push-ios-prod": "code-push release-react Noder ios --deploymentName Production",
2727
"push-key": "code-push deployment ls Noder -k",
28-
"i-taobao": "npm i --registry=https://registry.npm.taobao.org"
28+
"i-taobao": "npm i --registry=https://registry.npm.taobao.org",
29+
"standard": "eslint --fix '**/*.js'"
2930
},
3031
"dependencies": {
3132
"fetch-detector": "^1.0.0",
@@ -68,7 +69,12 @@
6869
"coffee-script": "^1.9.2",
6970
"dev-ip": "^1.0.1",
7071
"eslint": "^3.19.0",
72+
"eslint-config-standard": "^10.2.0",
73+
"eslint-config-standard-react": "^4.3.0",
74+
"eslint-plugin-flowtype": "^2.30.4",
75+
"eslint-plugin-promise": "^3.5.0",
7176
"eslint-plugin-react": "^6.10.3",
77+
"eslint-plugin-standard": "^3.0.1",
7278
"file-loader": "^0.9.0",
7379
"gulp": "^3.9.1",
7480
"gulp-replace": "^0.5.4",
@@ -82,6 +88,8 @@
8288
"react-test-renderer": "16.0.0-alpha.6",
8389
"redux-devtools": "^3.3.1",
8490
"run-sequence": "^1.2.2",
91+
"snazzy": "^7.0.0",
92+
"standard": "^10.0.1",
8593
"url-loader": "^0.5.7",
8694
"webdriver-manager": "^12.0.6",
8795
"webpack": "^1.13.2",
@@ -95,5 +103,16 @@
95103
"node": ">= 6.11.1",
96104
"npm": ">= 3.x"
97105
},
98-
"bundleId": "org.reactjs.native.example.noder"
106+
"bundleId": "org.reactjs.native.example.noder",
107+
"standard": {
108+
"ignore": [],
109+
"globals": [
110+
"__DEV__"
111+
],
112+
"parser": "babel-eslint",
113+
"plugins": [
114+
"flowtype",
115+
"react"
116+
]
117+
}
99118
}

src/actions/index.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ import * as utils from './utils'
33
import * as message from './message'
44
import * as topic from './topic'
55

6-
76
export default {
8-
...user,
9-
...utils,
10-
...message,
11-
...topic
7+
...user,
8+
...utils,
9+
...message,
10+
...topic
1211
}
13-
14-

src/actions/message.js

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@ import {createAction} from 'redux-actions'
22
import * as types from '../constants/ActionTypes'
33
import * as messageService from '../services/messageService'
44

5-
6-
export const getUnreadMessageCount = createAction(types.GET_UNREAD_MESSAGE_COUNT, async()=> {
7-
return await messageService.getUnreadMessageCount()
5+
export const getUnreadMessageCount = createAction(types.GET_UNREAD_MESSAGE_COUNT, async() => {
6+
return await messageService.getUnreadMessageCount()
87
})
98

10-
11-
export const markAsRead = createAction(types.MARK_AS_READ, async()=> {
12-
return await messageService.markAsRead()
9+
export const markAsRead = createAction(types.MARK_AS_READ, async() => {
10+
return await messageService.markAsRead()
1311
}, function (resolved, rejected) {
14-
return {
15-
resolved,
16-
rejected,
17-
sync: 'message'
18-
}
12+
return {
13+
resolved,
14+
rejected,
15+
sync: 'message'
16+
}
1917
})
2018

21-
22-
export const getMessageList = createAction(types.GET_MESSAGES_LIST, async()=> {
23-
return await messageService.getMessages()
24-
}, ()=> {
25-
return {
26-
sync: 'message'
27-
}
19+
export const getMessageList = createAction(types.GET_MESSAGES_LIST, async() => {
20+
return await messageService.getMessages()
21+
}, () => {
22+
return {
23+
sync: 'message'
24+
}
2825
})

src/actions/topic.js

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,62 @@ import * as markdown from 'markdown'
33
import * as types from '../constants/ActionTypes'
44
import * as topicService from '../services/topicService'
55

6-
7-
export const getTopicsByTab = createAction(types.GET_TOPICS_BY_TAB, async(tab, params)=> {
8-
return await topicService.getTopicsByTab(tab, params)
9-
}, (tab)=> {
10-
return {
11-
tab
12-
}
6+
export const getTopicsByTab = createAction(types.GET_TOPICS_BY_TAB, async(tab, params) => {
7+
return await topicService.getTopicsByTab(tab, params)
8+
}, (tab) => {
9+
return {
10+
tab
11+
}
1312
})
1413

15-
16-
export const updateTopicsByTab = createAction(types.UPDATE_TOPICS_BY_TAB, async(tab)=> {
17-
return await topicService.getTopicsByTab(tab, {
18-
page: 1
19-
})
20-
}, (tab)=> {
21-
return {
22-
tab,
23-
sync: 'topic'
24-
}
14+
export const updateTopicsByTab = createAction(types.UPDATE_TOPICS_BY_TAB, async(tab) => {
15+
return await topicService.getTopicsByTab(tab, {
16+
page: 1
17+
})
18+
}, (tab) => {
19+
return {
20+
tab,
21+
sync: 'topic'
22+
}
2523
})
2624

27-
28-
export const getTopicById = createAction(types.GET_TOPIC_BY_ID, topicService.getTopicById, (id)=> {
29-
return {
30-
id,
31-
sync: 'topic'
32-
}
25+
export const getTopicById = createAction(types.GET_TOPIC_BY_ID, topicService.getTopicById, (id) => {
26+
return {
27+
id,
28+
sync: 'topic'
29+
}
3330
})
3431

35-
36-
export const removeTopicCacheById = createAction(types.REMOVE_TOPIC_CACHE_BY_ID, (id)=> {
37-
return {
38-
id
39-
}
32+
export const removeTopicCacheById = createAction(types.REMOVE_TOPIC_CACHE_BY_ID, (id) => {
33+
return {
34+
id
35+
}
4036
})
4137

42-
43-
export const replyTopicById = createAction(types.REPLY_TOPIC_BY_ID, topicService.reply, ({topicId, content, replyId, user}, resolved, rejected)=> {
44-
return {
45-
id: topicId,
46-
content: markdown.parse(content),
47-
replyId,
48-
resolved,
49-
rejected,
50-
user
51-
}
38+
export const replyTopicById = createAction(types.REPLY_TOPIC_BY_ID, topicService.reply, ({topicId, content, replyId, user}, resolved, rejected) => {
39+
return {
40+
id: topicId,
41+
content: markdown.parse(content),
42+
replyId,
43+
resolved,
44+
rejected,
45+
user
46+
}
5247
})
5348

54-
55-
export const upReply = createAction(types.UP_REPLY, topicService.upReply, ({topicId, replyId, userId, resolved, rejected})=> {
56-
return {
57-
id: topicId,
58-
replyId,
59-
userId,
60-
resolved,
61-
rejected
62-
}
49+
export const upReply = createAction(types.UP_REPLY, topicService.upReply, ({topicId, replyId, userId, resolved, rejected}) => {
50+
return {
51+
id: topicId,
52+
replyId,
53+
userId,
54+
resolved,
55+
rejected
56+
}
6357
})
6458

65-
66-
export const publish = createAction(types.PUBLISH, topicService.publish, ({resolved, rejected})=> {
67-
return {
68-
resolved,
69-
rejected
70-
}
59+
export const publish = createAction(types.PUBLISH, topicService.publish, ({resolved, rejected}) => {
60+
return {
61+
resolved,
62+
rejected
63+
}
7164
})

0 commit comments

Comments
 (0)