Skip to content

Commit 6ef0c23

Browse files
fix all eslint-error (ant-design#28)
* run eslint fix * import sorted * fix some warning * fix all eslint-error * fix all eslint-error * fix all eslint error * remove .eslintcache
1 parent 8ae5c0b commit 6ef0c23

File tree

229 files changed

+3313
-3533
lines changed

Some content is hidden

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

229 files changed

+3313
-3533
lines changed

Diff for: .eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/functions/mock/**
22
/scripts
3-
/config
3+
/config
4+
**/node_modules/**
5+
_scripts

Diff for: .eslintrc.js

+8-33
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,14 @@
1+
const fabric = require('@umijs/fabric');
2+
13
module.exports = {
2-
parser: 'babel-eslint',
3-
extends: ['airbnb', 'prettier', 'plugin:compat/recommended'],
4-
env: {
5-
browser: true,
6-
node: true,
7-
es6: true,
8-
mocha: true,
9-
jest: true,
10-
jasmine: true,
4+
...fabric.default,
5+
rules: {
6+
...fabric.default.rules,
7+
'@typescript-eslint/camelcase': 0,
8+
'@typescript-eslint/class-name-casing': 0,
119
},
1210
globals: {
13-
APP_TYPE: true,
11+
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
1412
page: true,
1513
},
16-
rules: {
17-
'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
18-
'react/jsx-wrap-multilines': 0,
19-
'react/prop-types': 0,
20-
'react/forbid-prop-types': 0,
21-
'react/jsx-one-expression-per-line': 0,
22-
'import/no-unresolved': [2, { ignore: ['^@/', '^umi/'] }],
23-
'import/no-extraneous-dependencies': [
24-
2,
25-
{
26-
optionalDependencies: true,
27-
devDependencies: ['**/tests/**.js', '/mock/**.js', '**/**.test.js'],
28-
},
29-
],
30-
'jsx-a11y/no-noninteractive-element-interactions': 0,
31-
'jsx-a11y/click-events-have-key-events': 0,
32-
'jsx-a11y/no-static-element-interactions': 0,
33-
'jsx-a11y/anchor-is-valid': 0,
34-
'linebreak-style': 0,
35-
},
36-
settings: {
37-
polyfills: ['fetch', 'promises', 'url'],
38-
},
3914
};

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ functions/mock
3535

3636
# screenshot
3737
screenshot
38-
.firebase
38+
.firebase
39+
40+
.eslintcache

Diff for: .prettierrc

-14
This file was deleted.

Diff for: .prettierrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const fabric = require('@umijs/fabric');
2+
3+
module.exports = {
4+
...fabric.prettier,
5+
};

Diff for: .stylelintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const fabric = require('@umijs/fabric');
2+
3+
module.exports = {
4+
...fabric.stylelint,
5+
};

Diff for: .stylelintrc.json

-13
This file was deleted.

Diff for: AccountCenter/package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@
1111
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/accountcenter"
1212
},
1313
"dependencies": {
14+
"@ant-design/pro-layout": "^4.5.5",
1415
"antd": "^3.16.3",
16+
"classnames": "^2.2.6",
1517
"dva": "^2.4.0",
18+
"moment": "^2.24.0",
1619
"numeral": "^2.0.6",
1720
"react": "^16.6.3",
21+
"react-router": "^5.0.1",
22+
"redux": "^4.0.1",
1823
"umi-request": "^1.0.0"
1924
},
2025
"devDependencies": {
2126
"umi": "^2.6.9",
22-
"umi-plugin-react": "^1.7.2",
23-
"umi-plugin-block-dev": "^1.0.0"
27+
"umi-plugin-block-dev": "^1.0.0",
28+
"umi-plugin-react": "^1.7.2"
2429
},
2530
"license": "ISC",
2631
"blockConfig": {

Diff for: AccountCenter/src/_mock.ts

+2-65
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ListItemDataType } from './data';
1+
import { ListItemDataType } from './data.d';
22

33
const titles = [
44
'Alipay',
@@ -21,69 +21,6 @@ const avatars = [
2121
'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png', // Webpack
2222
];
2323

24-
const getNotice = [
25-
{
26-
id: 'xxx1',
27-
title: titles[0],
28-
logo: avatars[0],
29-
description: '那是一种内在的东西,他们到达不了,也无法触及的',
30-
updatedAt: new Date(),
31-
member: '科学搬砖组',
32-
href: '',
33-
memberLink: '',
34-
},
35-
{
36-
id: 'xxx2',
37-
title: titles[1],
38-
logo: avatars[1],
39-
description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
40-
updatedAt: new Date('2017-07-24'),
41-
member: '全组都是吴彦祖',
42-
href: '',
43-
memberLink: '',
44-
},
45-
{
46-
id: 'xxx3',
47-
title: titles[2],
48-
logo: avatars[2],
49-
description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
50-
updatedAt: new Date(),
51-
member: '中二少女团',
52-
href: '',
53-
memberLink: '',
54-
},
55-
{
56-
id: 'xxx4',
57-
title: titles[3],
58-
logo: avatars[3],
59-
description: '那时候我只会想自己想要什么,从不想自己拥有什么',
60-
updatedAt: new Date('2017-07-23'),
61-
member: '程序员日常',
62-
href: '',
63-
memberLink: '',
64-
},
65-
{
66-
id: 'xxx5',
67-
title: titles[4],
68-
logo: avatars[4],
69-
description: '凛冬将至',
70-
updatedAt: new Date('2017-07-23'),
71-
member: '高逼格设计天团',
72-
href: '',
73-
memberLink: '',
74-
},
75-
{
76-
id: 'xxx6',
77-
title: titles[5],
78-
logo: avatars[5],
79-
description: '生命就像一盒巧克力,结果往往出人意料',
80-
updatedAt: new Date('2017-07-23'),
81-
member: '骗你来学计算机',
82-
href: '',
83-
memberLink: '',
84-
},
85-
];
86-
8724
const covers = [
8825
'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
8926
'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
@@ -119,7 +56,7 @@ function fakeList(count: number): ListItemDataType[] {
11956
owner: user[i % 10],
12057
title: titles[i % 8],
12158
avatar: avatars[i % 8],
122-
cover: parseInt(i / 4 + '', 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)],
59+
cover: parseInt(`${i / 4}`, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)],
12360
status: ['active', 'exception', 'normal'][i % 3] as
12461
| 'normal'
12562
| 'exception'

Diff for: AccountCenter/src/components/Applications/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { Avatar, Card, Dropdown, Icon, List, Menu, Tooltip } from 'antd';
12
import React, { Component } from 'react';
2-
import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd';
3-
import numeral from 'numeral';
3+
44
import { connect } from 'dva';
5-
import stylesApplications from './index.less';
5+
import numeral from 'numeral';
66
import { ModalState } from '../../model';
7+
import stylesApplications from './index.less';
78

89
export function formatWan(val: number) {
910
const v = val * 1;

Diff for: AccountCenter/src/components/ArticleListContent/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Avatar } from 'antd';
12
import React from 'react';
23
import moment from 'moment';
3-
import { Avatar } from 'antd';
44
import styles from './index.less';
55

66
export interface ApplicationsProps {

Diff for: AccountCenter/src/components/Articles/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { Icon, List, Tag } from 'antd';
12
import React, { Component } from 'react';
2-
import { List, Icon, Tag } from 'antd';
3+
34
import { connect } from 'dva';
45
import ArticleListContent from '../ArticleListContent';
5-
import styles from './index.less';
6+
import { ListItemDataType } from '../../data.d';
67
import { ModalState } from '../../model';
7-
import { ListItemDataType } from '../../data';
8+
import styles from './index.less';
89

910
@connect(({ BLOCK_NAME_CAMEL_CASE }: { BLOCK_NAME_CAMEL_CASE: ModalState }) => ({
1011
list: BLOCK_NAME_CAMEL_CASE.list,

Diff for: AccountCenter/src/components/AvatarList/index.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Avatar, Tooltip } from 'antd';
2+
13
import React from 'react';
2-
import { Tooltip, Avatar } from 'antd';
34
import classNames from 'classnames';
45
import styles from './index.less';
56

@@ -19,10 +20,10 @@ export interface AvatarListProps {
1920
maxLength?: number;
2021
excessItemsStyle?: React.CSSProperties;
2122
style?: React.CSSProperties;
22-
children: React.ReactElement<AvatarItemProps> | Array<React.ReactElement<AvatarItemProps>>;
23+
children: React.ReactElement<AvatarItemProps> | React.ReactElement<AvatarItemProps>[];
2324
}
2425

25-
const avatarSizeToClassName = (size?: SizeType) =>
26+
const avatarSizeToClassName = (size?: SizeType | 'mini') =>
2627
classNames(styles.avatarItem, {
2728
[styles.avatarItemLarge]: size === 'large',
2829
[styles.avatarItemSmall]: size === 'small',
@@ -54,9 +55,7 @@ const AvatarList: React.SFC<AvatarListProps> & { Item: typeof Item } = ({
5455
}) => {
5556
const numOfChildren = React.Children.count(children);
5657
const numToShow = maxLength >= numOfChildren ? numOfChildren : maxLength;
57-
const childrenArray = React.Children.toArray(children) as Array<
58-
React.ReactElement<AvatarItemProps>
59-
>;
58+
const childrenArray = React.Children.toArray(children) as React.ReactElement<AvatarItemProps>[];
6059
const childrenWithProps = childrenArray.slice(0, numToShow).map(child =>
6160
React.cloneElement(child, {
6261
size,

Diff for: AccountCenter/src/components/Projects/index.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { Card, List } from 'antd';
12
import React, { Component } from 'react';
2-
import { List, Card } from 'antd';
3-
import moment from 'moment';
3+
44
import { connect } from 'dva';
5+
import moment from 'moment';
56
import AvatarList from '../AvatarList';
6-
import styles from './index.less';
7+
import { ListItemDataType } from '../../data.d';
78
import { ModalState } from '../../model';
8-
import { ListItemDataType } from '../../data';
9+
import styles from './index.less';
910

1011
@connect(({ BLOCK_NAME_CAMEL_CASE }: { BLOCK_NAME_CAMEL_CASE: ModalState }) => ({
1112
list: BLOCK_NAME_CAMEL_CASE.list,

Diff for: AccountCenter/src/data.d.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
export interface ITag {
1+
export interface TagType {
22
key: string;
33
label: string;
44
}
55

6-
export interface IProvince {
6+
export interface ProvinceType {
77
label: string;
88
key: string;
99
}
1010

11-
export interface ICity {
11+
export interface CityType {
1212
label: string;
1313
key: string;
1414
}
1515

16-
export interface IGeographic {
17-
province: IProvince;
18-
city: ICity;
16+
export interface GeographicType {
17+
province: ProvinceType;
18+
city: CityType;
1919
}
2020

21-
export interface INotice {
21+
export interface NoticeType {
2222
id: string;
2323
title: string;
2424
logo: string;
@@ -33,16 +33,16 @@ export interface CurrentUser {
3333
name: string;
3434
avatar: string;
3535
userid: string;
36-
notice: INotice[];
36+
notice: NoticeType[];
3737
email: string;
3838
signature: string;
3939
title: string;
4040
group: string;
41-
tags: ITag[];
41+
tags: TagType[];
4242
notifyCount: number;
4343
unreadCount: number;
4444
country: string;
45-
geographic: IGeographic;
45+
geographic: GeographicType;
4646
address: string;
4747
phone: string;
4848
}

0 commit comments

Comments
 (0)