Skip to content

Commit 6f6f0a0

Browse files
committed
ts,tsx code format
1 parent c9fa8af commit 6f6f0a0

Some content is hidden

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

66 files changed

+307
-306
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ module.exports = {
8484
'@typescript-eslint/space-before-function-paren': [2],
8585
'@typescript-eslint/keyword-spacing': [2, ],
8686
'@typescript-eslint/comma-spacing': 2,
87-
'@typescript-eslint/type-annotation-spacing': 2
87+
'@typescript-eslint/type-annotation-spacing': 2,
88+
'@typescript-eslint/ban-types': 0
8889
}
8990
}

src/components/editor/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const toolbarOptions = [
2929
interface IEditor {
3030
disabled?: boolean
3131
value: string
32-
onChange(text: string): Function
32+
onChange(text: string): () => void
3333
}
3434

3535
export default class QuillEditorComponent extends React.Component<IEditor> {
@@ -49,7 +49,7 @@ export default class QuillEditorComponent extends React.Component<IEditor> {
4949

5050
$editor: HTMLDivElement = null
5151

52-
componentDidMount() {
52+
componentDidMount () {
5353
const { onChange } = this.props
5454
const { $editor } = this
5555
this.quillEditor = new Quill($editor, this.quillOptions)
@@ -59,7 +59,7 @@ export default class QuillEditorComponent extends React.Component<IEditor> {
5959
if (_html === '<p><br></p>') {
6060
_html = ''
6161
}
62-
if(this.oldVal !== _html) {
62+
if (this.oldVal !== _html) {
6363
this.oldVal = _html
6464
onChange && onChange(_html)
6565
}
@@ -70,13 +70,13 @@ export default class QuillEditorComponent extends React.Component<IEditor> {
7070
changeEditorText = () => {
7171
const { value } = this.props
7272
// 赋值
73-
if(this.oldVal !== value && value !== undefined && this.quillEditor) {
73+
if (this.oldVal !== value && value !== undefined && this.quillEditor) {
7474
this.quillEditor.root.innerHTML = value
7575
this.oldVal = value
7676
}
7777
}
7878

79-
render(){
79+
render () {
8080
const { disabled } = this.props
8181
this.changeEditorText()
8282

src/components/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface ILoadingProps {
77

88
export default class Loading extends React.Component<ILoadingProps> {
99

10-
render() {
10+
render () {
1111
const { size = 'default' } = this.props
1212

1313
return (

src/pages/article/articleCreate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export default class ArticleCreate extends React.Component<IProps> {
2929
this.props.history.push(`/home/blog-article/${id}`)
3030
}
3131

32-
componentDidMount() {
32+
componentDidMount () {
3333
this.props.articleCreateStore.getInitData()
3434
}
3535

36-
render(){
36+
render () {
3737
const { mainData, typeList, tagList, tagChange, inputChange, save } = this.props.articleCreateStore
3838

3939
return <React.Fragment>

src/pages/article/articleCreateStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ class articleCreateStore {
4444
})
4545
}
4646

47-
@action save = (cb: Function) => {
47+
@action save = (cb: (args: any) => void) => {
4848
this.loading = true
4949

5050
$http.post(GRAPHQL_API, {
5151
query: postArticle,
5252
variables: {input: this.mainData}
5353
}).then((res: any) => {
54-
const {article:{id}} = res.data
54+
const {article: {id}} = res.data
5555
cb(id)
5656
runInAction(() => {
5757
this.loading = false

src/pages/article/articleEdit.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export default class ArticleEdit extends React.Component<IProps> {
2525
this.props.history.go(-1)
2626
}
2727

28-
componentDidMount() {
28+
componentDidMount () {
2929
const {id}: any = this.props.match.params
3030
this.props.articleEditStore.getDetail(id)
3131
}
3232

33-
render(){
33+
render () {
3434
const { mainData, typeList, tagList, tagChange, inputChange, update } = this.props.articleEditStore
3535

3636
return <React.Fragment>

src/pages/article/articleList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ export default class ArticleList extends React.Component<IProps> {
5252
render: (text: string, record, index) => <Button size="small" type="primary" onClick={() => this.viewDetail(record)}>详情</Button>,
5353
}]
5454

55-
viewDetail(data: IArticle) {
55+
viewDetail (data: IArticle) {
5656
this.props.history.push(`/home/blog-article/${data.id}`)
5757
}
5858

5959
create = () => {
6060
this.props.history.push('/home/blog-articleCreate')
6161
}
6262

63-
componentDidMount() {
63+
componentDidMount () {
6464
this.props.articleListStore.search()
6565
}
6666

67-
render(){
67+
render () {
6868
const { value, loading, list, meta, createdAt, inputChange, search, clear } = this.props.articleListStore
6969

7070
return <React.Fragment>

src/pages/article/articleListStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class articleListStore {
2828

2929

3030
@action inputChange = (value: any, type: string) => {
31-
if(type === 'createdAt') {
31+
if (type === 'createdAt') {
3232
this.createdAt = value
3333
const range = value
3434
this.value[type] = range.map((d: Moment, index: number) => {
@@ -55,7 +55,7 @@ class articleListStore {
5555
@action search = (pagination: any = {}, filters: any, orders: any) => {
5656
this.value['page'] = pagination.current || 1
5757

58-
if(orders && Object.keys(orders).length > 0) {
58+
if (orders && Object.keys(orders).length > 0) {
5959
this.value.order[orders.field] = orders.order === 'ascend' ? 'ASC' : 'DESC'
6060
}
6161

src/pages/articleType/articleTypeCreate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export default class ArticleTypeCreate extends React.Component<IProps> {
1616
this.props.history.push(`/home/blog-type/${id}`)
1717
}
1818

19-
componentDidMount() {
19+
componentDidMount () {
2020
//
2121
}
2222

23-
render(){
23+
render () {
2424
const { mainData, inputChange, save } = this.props.articleTypeCreateStore
2525

2626
return <React.Fragment>

src/pages/articleType/articleTypeCreateStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class articleTypeCreateStore {
1717
query: postArticleType,
1818
variables: this.mainData
1919
}).then((res: any) => {
20-
const {articleType:{id}} = res.data
20+
const {articleType: {id}} = res.data
2121
cb(id)
2222
runInAction(() => {
2323
this.loading = false

0 commit comments

Comments
 (0)