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

Commit 2f5d5bc

Browse files
committed
refactor(naming): use @xxx for local import
1 parent 40bc04f commit 2f5d5bc

File tree

367 files changed

+557
-532
lines changed

Some content is hidden

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

367 files changed

+557
-532
lines changed

.babelrc

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
{
2+
"presets": [
3+
["next/babel"]
4+
],
5+
"env": {
6+
"development": {
7+
"plugins": ["inline-dotenv"]
8+
},
9+
"production": {
10+
"presets": [
11+
["next/babel", {
12+
"preset-env": {
13+
"targets": {
14+
"ie": "11"
15+
},
16+
"debug": false
17+
}
18+
}]
19+
]
20+
},
21+
"test": {
22+
"plugins": ["inline-dotenv"]
23+
}
24+
},
225
"plugins": [
26+
"add-react-displayname",
327
["@babel/plugin-proposal-decorators", { "legacy": true }],
428
"transform-inline-environment-variables",
529
[
@@ -26,31 +50,16 @@
2650
["module-resolver", {
2751
"root": ["./"],
2852
"alias": {
29-
"containers":"./containers",
30-
"components":"./components",
31-
"config":"./config",
32-
"stores":"./stores",
33-
"schemas":"./containers/schemas",
34-
"utils":"./utils",
35-
"Img": "./components/Img",
36-
"SvgIcons": "./components/SvgIcons"
53+
"@containers":"./containers",
54+
"@components":"./components",
55+
"@config":"./config",
56+
"@stores":"./stores",
57+
"@model":"./stores/SharedModel",
58+
"@utils":"./utils",
59+
"@schemas":"./containers/schemas",
60+
"@Img": "./components/Img",
61+
"@SvgIcons": "./components/SvgIcons"
3762
}
3863
}]
39-
],
40-
"env": {
41-
"development": {
42-
"presets": ["next/babel"],
43-
"plugins": ["inline-dotenv"]
44-
},
45-
"local": {
46-
"presets": ["next/babel"],
47-
},
48-
"production": {
49-
"presets": ["next/babel"]
50-
},
51-
"test": {
52-
"presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]],
53-
"plugins": ["inline-dotenv"]
54-
}
55-
}
64+
]
5665
}

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
extends: ['airbnb', 'plugin:react/recommended', 'prettier', 'prettier/react'],
3-
plugins: ['prettier', 'react', 'cypress'],
3+
plugins: ['prettier', 'react', 'cypress', 'react-hooks'],
44
parser: 'babel-eslint',
55
parserOptions: {
66
ecmaVersion: 2016,
@@ -21,6 +21,8 @@ module.exports = {
2121
},
2222
},
2323
rules: {
24+
// import/resolver 暂时识别不了 @xxx, 暂时关闭该检测
25+
'import/no-extraneous-dependencies': 0,
2426
'arrow-body-style': 0,
2527
// need for _store init
2628
'no-underscore-dangle': 0,
@@ -57,5 +59,7 @@ module.exports = {
5759
trailingComma: 'es5',
5860
},
5961
],
62+
'react-hooks/rules-of-hooks': 'error',
63+
'react-hooks/exhaustive-deps': 'warn',
6064
},
6165
}

components/AdderCell/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { ICON_CMD } from 'config'
10+
import { ICON_CMD } from '@config'
1111

12-
import { makeDebugger } from 'utils'
12+
import { makeDebugger } from '@utils'
1313
import { AddWrapper, AddIcon, AddText } from './styles'
1414

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

components/AdderCell/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { animate } from 'utils'
3+
import { animate } from '@utils'
44
import Img from '../../Img'
55

66
export const AddWrapper = styled.div`

components/AvatarsRow/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Tooltip } from 'antd'
1111

1212
import { ATATARS_LIST_LENGTH } from 'config/general'
1313

14-
import { makeDebugger, prettyNum } from 'utils'
14+
import { makeDebugger, prettyNum } from '@utils'
1515
import { Avatars, AvatarsItem, AvatarsImg, AvatarsMore } from './styles'
1616

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

components/AvatarsRow/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { theme, cs } from 'utils'
3+
import { theme, cs } from '@utils'
44

55
export const Avatars = styled.ul`
66
${cs.flex()};

components/BannerCountBrief/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { makeDebugger, toPercentNum } from 'utils'
10+
import { makeDebugger, toPercentNum } from '@utils'
1111

1212
import {
1313
Result,

components/BaseStyled/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components'
2-
import { theme } from 'utils'
2+
import { theme } from '@utils'
33

44
export const Center = styled.div`
55
/* display: flex;*/

components/CategoriesCell/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import PropTypes from 'prop-types'
99
import R from 'ramda'
1010
import { Icon } from 'antd'
1111

12-
import { ICON_CMD } from 'config'
12+
import { ICON_CMD } from '@config'
1313

14-
import { uid, Trans } from 'utils'
14+
import { uid, Trans } from '@utils'
1515
import AdderCell from '../AdderCell'
1616

1717
import {

components/CategoriesCell/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { animate } from 'utils'
3+
import { animate } from '@utils'
44
import Img from '../../Img'
55

66
export const UnsetText = styled.div`

components/ColorCell/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { makeDebugger } from 'utils'
10+
import { makeDebugger } from '@utils'
1111

1212
import { ColorCell, ColorDot /* ColorTitle */ } from './styles'
1313
/* eslint-disable no-unused-vars */

components/CommunityCell/CommunitiesLogoList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22

3-
// import { ICON_CMD } from 'config'
4-
import { uid } from 'utils'
3+
// import { ICON_CMD } from '@config'
4+
import { uid } from '@utils'
55
import { Wrapper, CommunityLogo } from './styles/communities_logo_list'
66

77
const tooltipOffset = JSON.stringify({ top: 1 })

components/CommunityCell/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import R from 'ramda'
99
import PropTypes from 'prop-types'
1010
import ReactTooltip from 'react-tooltip'
1111

12-
import { ICON_CMD } from 'config'
12+
import { ICON_CMD } from '@config'
1313

14-
import { uid, makeDebugger } from 'utils'
14+
import { uid, makeDebugger } from '@utils'
1515
import AdderCell from '../AdderCell'
1616
import CommunitiesLogoList from './CommunitiesLogoList'
1717

components/CommunityCell/styles/communities_logo_list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { theme } from 'utils'
3+
import { theme } from '@utils'
44
import Img from '../../Img'
55

66
export const Wrapper = styled.div`

components/CommunityCell/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { animate } from 'utils'
3+
import { animate } from '@utils'
44
import Img from '../../Img'
55

66
export const Wrapper = styled.div`

components/CommunityMatrix/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import R from 'ramda'
99
import PropTypes from 'prop-types'
1010
import ReactTooltip from 'react-tooltip'
1111

12-
import { ICON_CMD } from 'config'
12+
import { ICON_CMD } from '@config'
1313

14-
import { makeDebugger, uid } from 'utils'
14+
import { makeDebugger, uid } from '@utils'
1515
import {
1616
MatrixWrapper,
1717
CommunityLogo,

components/CommunityMatrix/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { cs } from 'utils'
3+
import { cs } from '@utils'
44
import Img from '../../Img'
55

66
export const MatrixWrapper = styled.div`

components/ContentFilter/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99
import { Button, Row, Col, Tag } from 'antd'
10-
import { ICON_CMD } from 'config'
11-
import { makeDebugger, isEmptyValue } from 'utils'
10+
import { ICON_CMD } from '@config'
11+
import { makeDebugger, isEmptyValue } from '@utils'
1212
import Popover from '../Popover'
1313

1414
import {

components/ContentFilter/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { theme } from 'utils'
3+
import { theme } from '@utils'
44
import Img from '../../Img'
55

66
export const Wrapper = styled.div`

components/ContentsCountCell/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { makeDebugger } from 'utils'
10+
import { makeDebugger } from '@utils'
1111
import { Wrapper, Content, Label, Count } from './styles'
1212

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

components/ContentsCountCell/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components'
22

33
// import Img from '../../Img'
4-
// import { theme } from 'utils'
4+
// import { theme } from '@utils'
55

66
export const Wrapper = styled.div`
77
display: flex;

components/FileUploader/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { ASSETS_ENDPOINT } from 'config'
11-
import { makeDebugger } from 'utils'
10+
import { ASSETS_ENDPOINT } from '@config'
11+
import { makeDebugger } from '@utils'
1212
import { FileUploaderWrapper, InputFile } from './styles'
1313

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

components/FocusLine/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from 'react'
88
import R from 'ramda'
99
import PropTypes from 'prop-types'
1010

11-
import { makeDebugger } from 'utils'
11+
import { makeDebugger } from '@utils'
1212
import { Wrapper, Icon, TextWrapper, Text, Focus } from './styles'
1313

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

components/FocusLine/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { theme, cs } from 'utils'
3+
import { theme, cs } from '@utils'
44
import Img from '../../Img'
55

66
export const Wrapper = styled.div`

components/Footer/index.js

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

77
import React from 'react'
88

9-
import { makeDebugger } from 'utils'
9+
import { makeDebugger } from '@utils'
1010
import {
1111
Container,
1212
BaseInfo,

components/Footer/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components'
2-
import { cs, theme } from 'utils'
2+
import { cs, theme } from '@utils'
33

44
const Link = styled.a`
55
text-decoration: none;

components/FormInputer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types'
99
import { Input, InputNumber } from 'antd'
1010
import R from 'ramda'
1111

12-
import { makeDebugger } from 'utils'
12+
import { makeDebugger } from '@utils'
1313
import FormItem from '../FormItem'
1414
import { FormInput, Note } from './styles'
1515

components/FormInputer/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components'
2-
// import { Img } from 'components'
2+
// import { Img } from '@components'
33

44
export const FormInput = styled.div`
55
width: 250px;

components/FormItem/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react'
88
import PropTypes from 'prop-types'
99

10-
import { makeDebugger } from 'utils'
10+
import { makeDebugger } from '@utils'
1111

1212
import { FormItemWrapper, FormLable, ChildWrapper } from './styles'
1313

components/FormItem/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components'
2-
// import { Img } from 'components'
2+
// import { Img } from '@components'
33

44
export const FormItemWrapper = styled.div`
55
display: flex;

components/FormSelector/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import R from 'ramda'
99
import PropTypes from 'prop-types'
1010
import { Select } from 'antd'
1111

12-
import { uid, makeDebugger } from 'utils'
12+
import { uid, makeDebugger } from '@utils'
1313
import FormItem from '../FormItem'
1414
import { Note } from './styles'
1515

components/FormSelector/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components'
2-
// import { Img } from 'components'
2+
// import { Img } from '@components'
33

44
export const SelectorWrapper = styled.div`
55
display: flex;

components/GAWraper/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import Router from 'next/router'
33

4-
import { GA } from 'utils'
4+
import { GA } from '@utils'
55

66
Router.onRouteChangeComplete = url => {
77
GA.pageview(url)

components/JobsTable/index.js

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

11-
import { makeDebugger, cutFrom } from 'utils'
11+
import { makeDebugger, cutFrom } from '@utils'
1212
import Pagi from '../Pagi'
1313
import { TableLoading } from '../LoadingEffects'
1414
import { Space } from '../BaseStyled'

components/JobsTable/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import { theme } from 'utils'
3+
import { theme } from '@utils'
44
import { Img } from '../..'
55

66
export const Wrapper = styled.div`

0 commit comments

Comments
 (0)