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

Commit 0658eff

Browse files
committed
refactor: move constants to @constant
1 parent 32e8e6f commit 0658eff

File tree

71 files changed

+565
-475
lines changed

Some content is hidden

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

71 files changed

+565
-475
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"alias": {
5353
"@containers":"./containers",
5454
"@components":"./components",
55+
"@constant": "./utils/constant/",
5556
"@config":"./config",
5657
"@stores":"./stores",
5758
"@model":"./stores/SharedModel",

.eslintrc.js

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,6 @@
11
module.exports = {
2-
extends: ['airbnb', 'plugin:react/recommended', 'prettier', 'prettier/react'],
3-
plugins: ['prettier', 'react', 'cypress', 'react-hooks'],
4-
parser: 'babel-eslint',
5-
parserOptions: {
6-
ecmaVersion: 2016,
7-
sourceType: 'module',
8-
ecmaFeatures: {
9-
jsx: true,
10-
},
11-
},
12-
env: {
13-
es6: true,
14-
node: true,
15-
jest: true,
16-
'cypress/globals': true,
17-
},
18-
settings: {
19-
'import/resolver': {
20-
'babel-module': {},
21-
},
22-
},
2+
extends: ['@groupher/eslint-config-web'],
233
rules: {
24-
// import/resolver 暂时识别不了 @xxx, 暂时关闭该检测
25-
'import/no-extraneous-dependencies': 0,
26-
'arrow-body-style': 0,
27-
// need for _store init
28-
'no-underscore-dangle': 0,
29-
// heavilly used in store.actions
30-
'no-param-reassign': 0,
31-
// heavilly used in store.views
32-
'no-use-before-define': 0,
33-
// force-return is unneeded
34-
'consistent-return': 0,
35-
'no-shadow': 0,
36-
// error could be object for parse by upfloor
37-
'prefer-promise-reject-errors': 0,
38-
'react/jsx-no-bind': 0,
39-
// allow JSX in js files
40-
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
41-
'react/forbid-prop-types': 0,
42-
// no need sort
43-
'react/sort-comp': 0,
44-
'react/prop-types': [1, { skipUndeclared: true }],
45-
'jsx-a11y/href-no-hash': 'off',
46-
'jsx-a11y/no-static-element-interactions': 0,
47-
'jsx-a11y/click-events-have-key-events': 0,
48-
49-
// for cypress test usage
50-
'no-unused-expressions': 0,
51-
52-
'prettier/prettier': [
53-
'error',
54-
{
55-
singleQuote: true,
56-
semi: false,
57-
tabWidth: 2,
58-
bracketSpacing: true,
59-
trailingComma: 'es5',
60-
},
61-
],
62-
'react-hooks/rules-of-hooks': 'error',
63-
'react-hooks/exhaustive-deps': 'warn',
4+
'import/order': 0,
645
},
656
}

components/ReposTable/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import React from 'react'
88
import T from 'prop-types'
99
import { Table, Button } from 'antd'
1010

11-
import { buildLog, TYPE } from '@utils'
11+
import { TYPE } from '@constant'
12+
import { buildLog } from '@utils'
13+
1214
import Pagi from '../Pagi'
1315
import { TableLoading } from '../LoadingEffects'
1416
import { Space } from '../BaseStyled'

components/VideosTable/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import React from 'react'
88
import T from 'prop-types'
99
import { Table, Button } from 'antd'
1010

11-
import { buildLog, cutFrom, TYPE } from '@utils'
12-
import { OperationWrapper } from './styles'
11+
import { TYPE } from '@constant'
12+
import { buildLog, cutFrom } from '@utils'
1313

1414
import Pagi from '../Pagi'
1515
import { TableLoading } from '../LoadingEffects'
@@ -19,6 +19,8 @@ import CommunityCell from '../CommunityCell'
1919
import TagsCell from '../TagsCell'
2020
import TimeStampCell from '../TimeStampCell'
2121

22+
import { OperationWrapper } from './styles'
23+
2224
/* eslint-disable no-unused-vars */
2325
const log = buildLog('c:VideosTable:index')
2426
/* eslint-enable no-unused-vars */

containers/AccountEditor/logic.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
import R from 'ramda'
22
import { useEffect } from 'react'
33

4-
import {
5-
asyncSuit,
6-
buildLog,
7-
send,
8-
EVENT,
9-
ERR,
10-
TYPE,
11-
meteorState,
12-
} from '@utils'
4+
import { EVENT, ERR, TYPE } from '@constant'
5+
import { asyncSuit, buildLog, send, meteorState } from '@utils'
136

147
import S from './schema'
158

containers/AccountViewer/logic.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// import R from 'ramda'
22
import { useEffect } from 'react'
3-
import { asyncSuit, buildLog, ERR, send, EVENT, TYPE, Global } from '@utils'
3+
4+
import { EVENT, ERR, TYPE } from '@constant'
5+
import { asyncSuit, buildLog, send, Global } from '@utils'
46

57
import S from './schema'
68

containers/ArticleViwer/PostViewer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react'
22
import TimeAgo from 'timeago-react'
3-
// import CommentsList from '@components/CommentsList'
4-
import { MarkDownPreviewer, PostLoading } from '@components'
3+
54
import { ICON_CMD } from '@config'
6-
import { TYPE } from '@utils'
5+
import { TYPE } from '@constant'
6+
import { MarkDownPreviewer, PostLoading } from '@components'
7+
78
import Comments from '../Comments'
89

910
import {

containers/ArticleViwer/logic.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import R from 'ramda'
22
import { useEffect } from 'react'
33

4-
import { asyncSuit, buildLog, EVENT, TYPE } from '@utils'
4+
import { EVENT, TYPE } from '@constant'
5+
import { asyncSuit, buildLog } from '@utils'
6+
57
import S from './schema'
68

79
/* eslint-disable no-unused-vars */

containers/ArticleViwer/store.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import { types as t, getParent } from 'mobx-state-tree'
77
import R from 'ramda'
88

9-
import { markStates, buildLog, TYPE } from '@utils'
9+
import { TYPE } from '@constant'
10+
import { markStates, buildLog } from '@utils'
11+
1012
/* eslint-disable no-unused-vars */
1113
const log = buildLog('S:ArticleViwerStore')
1214
/* eslint-enable no-unused-vars */

containers/Banner/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
import React from 'react'
88

9-
import { buildLog, connectStore, ROUTE } from '@utils'
9+
import { ROUTE } from '@constant'
10+
import { buildLog, connectStore } from '@utils'
11+
1012
import CommunityBanner from '../CommunityBanner'
1113
import CommunitiesBanner from '../CommunitiesBanner'
1214
import UsersBanner from '../UsersBanner'

0 commit comments

Comments
 (0)