Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 83a24ed

Browse files
committed
chore(dev): rm prefix of eslint, format proj
1 parent 86f0a95 commit 83a24ed

File tree

69 files changed

+2421
-2569
lines changed

Some content is hidden

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

69 files changed

+2421
-2569
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// see details:
2+
// https://github.com/groupher/eslint-config-web/blob/master/index.js
13
module.exports = {
24
extends: ['@groupher/eslint-config-web'],
35
}

components/Hooks/useShortcut.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,39 @@ const useShortcut = (combination, onKeyDownFn, onKeyUpFn) => {
99
import('keyboardjs').then(setKeyboardJs)
1010
}, [])
1111

12-
useEffect(
13-
() => {
14-
if (!keyboardJs) {
15-
return
16-
}
17-
18-
const down = event => {
19-
set([true, event])
20-
if (onKeyDownFn) onKeyDownFn()
21-
}
22-
const up = event => {
23-
set([false, event])
24-
if (onKeyUpFn) onKeyUpFn()
12+
useEffect(() => {
13+
if (!keyboardJs) {
14+
return
15+
}
16+
17+
const down = event => {
18+
set([true, event])
19+
if (onKeyDownFn) onKeyDownFn()
20+
}
21+
const up = event => {
22+
set([false, event])
23+
if (onKeyUpFn) onKeyUpFn()
24+
}
25+
26+
// support multi combination in array style
27+
if (Array.isArray(combination)) {
28+
for (let i = 0; i < combination.length; i += 1) {
29+
keyboardJs.bind(combination[i], down, up)
2530
}
31+
} else {
32+
keyboardJs.bind(combination, down, up)
33+
}
2634

27-
// support multi combination in array style
35+
return () => {
2836
if (Array.isArray(combination)) {
2937
for (let i = 0; i < combination.length; i += 1) {
30-
keyboardJs.bind(combination[i], down, up)
38+
keyboardJs.unbind(combination[i], down, up)
3139
}
3240
} else {
33-
keyboardJs.bind(combination, down, up)
34-
}
35-
36-
return () => {
37-
if (Array.isArray(combination)) {
38-
for (let i = 0; i < combination.length; i += 1) {
39-
keyboardJs.unbind(combination[i], down, up)
40-
}
41-
} else {
42-
keyboardJs.unbind(combination, down, up)
43-
}
41+
keyboardJs.unbind(combination, down, up)
4442
}
45-
},
46-
[combination, keyboardJs, onKeyDownFn, onKeyUpFn]
47-
)
43+
}
44+
}, [combination, keyboardJs, onKeyDownFn, onKeyUpFn])
4845

4946
return state
5047
}

components/Pagi/MobilePagination.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ const MobilePagination = ({ current, pageSize, total, onChange }) => (
2929
</Button>
3030
</React.Fragment>
3131
)}
32-
{current !== 1 &&
33-
current < Math.floor(total / pageSize) && (
34-
<CurPageNumber>{current}</CurPageNumber>
35-
)}
32+
{current !== 1 && current < Math.floor(total / pageSize) && (
33+
<CurPageNumber>{current}</CurPageNumber>
34+
)}
3635

3736
{current <= Math.floor(total / pageSize) && (
3837
<Button type="primary" ghost onClick={onChange.bind(this, current + 1)}>

containers/AccountEditor/logic.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,15 @@ const ErrSolver = [
149149
// init & uninit
150150
// ###############################
151151
export const useInit = _store =>
152-
useEffect(
153-
() => {
154-
store = _store
155-
// log('effect init')
156-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
157-
store.copyAccountInfo()
158-
159-
return () => {
160-
// log('effect uninit')
161-
sr71$.stop()
162-
sub$.unsubscribe()
163-
}
164-
},
165-
[_store]
166-
)
152+
useEffect(() => {
153+
store = _store
154+
// log('effect init')
155+
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
156+
store.copyAccountInfo()
157+
158+
return () => {
159+
// log('effect uninit')
160+
sr71$.stop()
161+
sub$.unsubscribe()
162+
}
163+
}, [_store])

containers/AccountViewer/logic.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,15 @@ export const loadUserInfo = user => {
104104
// init & uninit
105105
// ###############################
106106
export const useInit = (_store, user) => {
107-
useEffect(
108-
() => {
109-
store = _store
110-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
107+
useEffect(() => {
108+
store = _store
109+
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
111110

112-
loadUserInfo(user)
111+
loadUserInfo(user)
113112

114-
return () => {
115-
sr71$.stop()
116-
sub$.unsubscribe()
117-
}
118-
},
119-
[_store, user]
120-
)
113+
return () => {
114+
sr71$.stop()
115+
sub$.unsubscribe()
116+
}
117+
}, [_store, user])
121118
}

containers/ArticleAuthorCard/Header.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ const Header = ({ title, user: { id, viewerHasFollowed }, isSelfViewing }) => (
1010
<Wrapper>
1111
<Title>{title}</Title>
1212
<FollowWrapper>
13-
{id &&
14-
!isSelfViewing && (
15-
<FollowButton
16-
hasFollowd={viewerHasFollowed}
17-
userId={id}
18-
onFollow={onFollow}
19-
onUndoFollow={onUndoFollow}
20-
/>
21-
)}
13+
{id && !isSelfViewing && (
14+
<FollowButton
15+
hasFollowd={viewerHasFollowed}
16+
userId={id}
17+
onFollow={onFollow}
18+
onUndoFollow={onUndoFollow}
19+
/>
20+
)}
2221
</FollowWrapper>
2322
</Wrapper>
2423
)

containers/ArticleAuthorCard/logic.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,16 @@ const ErrSolver = [
9191
// init & uninit
9292
// ###############################
9393
export const useInit = (_store, user) => {
94-
useEffect(
95-
() => {
96-
store = _store
94+
useEffect(() => {
95+
store = _store
9796

98-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
99-
loadUser(user)
97+
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
98+
loadUser(user)
10099

101-
return () => {
102-
// log('effect uninit')
103-
sr71$.stop()
104-
sub$.unsubscribe()
105-
}
106-
},
107-
[_store, user]
108-
)
100+
return () => {
101+
// log('effect uninit')
102+
sr71$.stop()
103+
sub$.unsubscribe()
104+
}
105+
}, [_store, user])
109106
}

containers/ArticleAuthorCard/store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* ArticleAuthorCard store
3-
*
4-
*/
2+
* ArticleAuthorCard store
3+
*
4+
*/
55

66
import { types as t, getParent } from 'mobx-state-tree'
77
import R from 'ramda'

containers/ArticleBanner/logic.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,15 @@ const ErrSolver = [
148148
// init & uninit
149149
// ###############################
150150
export const useInit = _store => {
151-
useEffect(
152-
() => {
153-
store = _store
154-
// log('effect init')
155-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
156-
157-
return () => {
158-
// log('effect uninit')
159-
sr71$.stop()
160-
sub$.unsubscribe()
161-
}
162-
},
163-
[_store]
164-
)
151+
useEffect(() => {
152+
store = _store
153+
// log('effect init')
154+
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
155+
156+
return () => {
157+
// log('effect uninit')
158+
sr71$.stop()
159+
sub$.unsubscribe()
160+
}
161+
}, [_store])
165162
}

containers/ArticleBanner/store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* ArticleBanner store
3-
*
4-
*/
2+
* ArticleBanner store
3+
*
4+
*/
55

66
import { types as t, getParent } from 'mobx-state-tree'
77
// import R from 'ramda'

0 commit comments

Comments
 (0)