Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Feb 24, 2021
1 parent d15e0ef commit c746ce0
Show file tree
Hide file tree
Showing 128 changed files with 616 additions and 605 deletions.
4 changes: 2 additions & 2 deletions AccountCenter/src/_mock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import { ListItemDataType } from './data.d';
import type { Request, Response } from 'express';
import type { ListItemDataType } from './data.d';

const titles = [
'Alipay',
Expand Down
2 changes: 1 addition & 1 deletion AccountCenter/src/components/Applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';

import { connect } from 'umi';
import numeral from 'numeral';
import { ModalState } from '../../model';
import type { ModalState } from '../../model';
import stylesApplications from './index.less';

export function formatWan(val: number) {
Expand Down
4 changes: 2 additions & 2 deletions AccountCenter/src/components/ArticleListContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import React from 'react';
import moment from 'moment';
import styles from './index.less';

export interface ApplicationsProps {
export type ApplicationsProps = {
data: {
content?: string;
updatedAt?: any;
avatar?: string;
owner?: string;
href?: string;
};
}
};
const ArticleListContent: React.FC<ApplicationsProps> = ({
data: { content, updatedAt, avatar, owner, href },
}) => (
Expand Down
4 changes: 2 additions & 2 deletions AccountCenter/src/components/Articles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react';

import { connect } from 'umi';
import ArticleListContent from '../ArticleListContent';
import { ListItemDataType } from '../../data.d';
import { ModalState } from '../../model';
import type { ListItemDataType } from '../../data.d';
import type { ModalState } from '../../model';
import styles from './index.less';

const Articles: React.FC<Partial<ModalState>> = (props) => {
Expand Down
8 changes: 4 additions & 4 deletions AccountCenter/src/components/AvatarList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import styles from './index.less';

export declare type SizeType = number | 'small' | 'default' | 'large';

export interface AvatarItemProps {
export type AvatarItemProps = {
tips: React.ReactNode;
src: string;
size?: SizeType;
style?: React.CSSProperties;
onClick?: () => void;
}
};

export interface AvatarListProps {
export type AvatarListProps = {
Item?: React.ReactElement<AvatarItemProps>;
size?: SizeType;
maxLength?: number;
excessItemsStyle?: React.CSSProperties;
style?: React.CSSProperties;
children: React.ReactElement<AvatarItemProps> | React.ReactElement<AvatarItemProps>[];
}
};

const avatarSizeToClassName = (size?: SizeType | 'mini') =>
classNames(styles.avatarItem, {
Expand Down
4 changes: 2 additions & 2 deletions AccountCenter/src/components/Projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react';
import { connect } from 'umi';
import moment from 'moment';
import AvatarList from '../AvatarList';
import { ListItemDataType } from '../../data.d';
import { ModalState } from '../../model';
import type { ListItemDataType } from '../../data.d';
import type { ModalState } from '../../model';
import styles from './index.less';

const Projects: React.FC<Partial<ModalState>> = (props) => {
Expand Down
24 changes: 12 additions & 12 deletions AccountCenter/src/data.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export interface TagType {
export type TagType = {
key: string;
label: string;
}
};

export interface GeographicType {
export type GeographicType = {
province: {
label: string;
key: string;
Expand All @@ -12,9 +12,9 @@ export interface GeographicType {
label: string;
key: string;
};
}
};

export interface NoticeType {
export type NoticeType = {
id: string;
title: string;
logo: string;
Expand All @@ -23,9 +23,9 @@ export interface NoticeType {
member: string;
href: string;
memberLink: string;
}
};

export interface CurrentUser {
export type CurrentUser = {
name: string;
avatar: string;
userid: string;
Expand All @@ -41,15 +41,15 @@ export interface CurrentUser {
geographic: GeographicType;
address: string;
phone: string;
}
};

export interface Member {
export type Member = {
avatar: string;
name: string;
id: string;
}
};

export interface ListItemDataType {
export type ListItemDataType = {
id: string;
owner: string;
title: string;
Expand All @@ -71,4 +71,4 @@ export interface ListItemDataType {
message: number;
content: string;
members: Member[];
}
};
21 changes: 11 additions & 10 deletions AccountCenter/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { PlusOutlined, HomeOutlined, ContactsOutlined, ClusterOutlined } from '@
import { Avatar, Card, Col, Divider, Input, Row, Tag } from 'antd';
import React, { Component, useState, useRef } from 'react';
import { GridContent } from '@ant-design/pro-layout';
import { Link, connect, Dispatch } from 'umi';
import { RouteChildrenProps } from 'react-router';
import { ModalState } from './model';
import type { Dispatch } from 'umi';
import { Link, connect } from 'umi';
import type { RouteChildrenProps } from 'react-router';
import type { ModalState } from './model';
import Projects from './components/Projects';
import Articles from './components/Articles';
import Applications from './components/Applications';
import { CurrentUser, TagType } from './data.d';
import type { CurrentUser, TagType } from './data.d';
import styles from './Center.less';

const operationTabList = [
Expand Down Expand Up @@ -38,14 +39,14 @@ const operationTabList = [
},
];

interface PAGE_NAME_UPPER_CAMEL_CASEProps extends RouteChildrenProps {
dispatch: Dispatch<any>;
type PAGE_NAME_UPPER_CAMEL_CASEProps = {
dispatch: Dispatch;
currentUser: Partial<CurrentUser>;
currentUserLoading: boolean;
}
interface PAGE_NAME_UPPER_CAMEL_CASEState {
} & RouteChildrenProps;
type PAGE_NAME_UPPER_CAMEL_CASEState = {
tabKey?: 'articles' | 'applications' | 'projects';
}
};

const TagList: React.FC<{ tags: CurrentUser['tags'] }> = ({ tags }) => {
const ref = useRef<Input | null>(null);
Expand Down Expand Up @@ -260,7 +261,7 @@ export default connect(
loading,
BLOCK_NAME_CAMEL_CASE,
}: {
loading: { effects: { [key: string]: boolean } };
loading: { effects: Record<string, boolean> };
BLOCK_NAME_CAMEL_CASE: ModalState;
}) => ({
currentUser: BLOCK_NAME_CAMEL_CASE.currentUser,
Expand Down
12 changes: 6 additions & 6 deletions AccountCenter/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Reducer, Effect } from 'umi';
import { CurrentUser, ListItemDataType } from './data.d';
import type { Reducer, Effect } from 'umi';
import type { CurrentUser, ListItemDataType } from './data.d';
import { queryCurrent, queryFakeList } from './service';

export interface ModalState {
export type ModalState = {
currentUser: Partial<CurrentUser>;
list: ListItemDataType[];
}
};

export interface ModelType {
export type ModelType = {
namespace: string;
state: ModalState;
effects: {
Expand All @@ -18,7 +18,7 @@ export interface ModelType {
saveCurrentUser: Reducer<ModalState>;
queryList: Reducer<ModalState>;
};
}
};

const Model: ModelType = {
namespace: 'BLOCK_NAME_CAMEL_CASE',
Expand Down
2 changes: 1 addition & 1 deletion AccountSettings/src/_mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import type { Request, Response } from 'express';
import city from './geographic/city.json';
import province from './geographic/province.json';

Expand Down
13 changes: 7 additions & 6 deletions AccountSettings/src/components/GeographicView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { Component } from 'react';
import { Select, Spin } from 'antd';
import { LabeledValue } from 'antd/es/select';
import { connect, Dispatch } from 'umi';
import { GeographicItemType } from '../data.d';
import type { LabeledValue } from 'antd/es/select';
import type { Dispatch } from 'umi';
import { connect } from 'umi';
import type { GeographicItemType } from '../data.d';
import styles from './GeographicView.less';

const { Option } = Select;
Expand All @@ -13,8 +14,8 @@ const nullSelectItem: LabeledValue = {
key: '',
};

interface GeographicViewProps {
dispatch?: Dispatch<any>;
type GeographicViewProps = {
dispatch?: Dispatch;
province?: GeographicItemType[];
city?: GeographicItemType[];
value?: {
Expand All @@ -23,7 +24,7 @@ interface GeographicViewProps {
};
loading?: boolean;
onChange?: (value: { province: LabeledValue; city: LabeledValue }) => void;
}
};

class GeographicView extends Component<GeographicViewProps> {
componentDidMount = () => {
Expand Down
4 changes: 2 additions & 2 deletions AccountSettings/src/components/PhoneView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React from 'react';
import { Input } from 'antd';
import styles from './PhoneView.less';

interface PhoneViewProps {
type PhoneViewProps = {
value?: string;
onChange?: (value: string) => void;
}
};

const PhoneView: React.FC<PhoneViewProps> = (props) => {
const { value, onChange } = props;
Expand Down
10 changes: 5 additions & 5 deletions AccountSettings/src/components/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button, Input, Select, Upload, Form, message } from 'antd';
import { connect, FormattedMessage, formatMessage } from 'umi';
import React, { Component } from 'react';

import { CurrentUser } from '../data.d';
import type { CurrentUser } from '../data.d';
import GeographicView from './GeographicView';
import PhoneView from './PhoneView';
import styles from './BaseView.less';
Expand All @@ -29,10 +29,10 @@ const AvatarView = ({ avatar }: { avatar: string }) => (
</Upload>
</>
);
interface SelectItem {
type SelectItem = {
label: string;
key: string;
}
};

const validatorGeographic = (
_: any,
Expand Down Expand Up @@ -63,9 +63,9 @@ const validatorPhone = (rule: any, value: string, callback: (message?: string) =
callback();
};

interface BaseViewProps {
type BaseViewProps = {
currentUser?: CurrentUser;
}
};

class BaseView extends Component<BaseViewProps> {
view: HTMLDivElement | undefined = undefined;
Expand Down
20 changes: 10 additions & 10 deletions AccountSettings/src/data.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export interface TagType {
export type TagType = {
key: string;
label: string;
}
};

export interface GeographicItemType {
export type GeographicItemType = {
name: string;
id: string;
}
};

export interface GeographicType {
export type GeographicType = {
province: GeographicItemType;
city: GeographicItemType;
}
};

export interface NoticeType {
export type NoticeType = {
id: string;
title: string;
logo: string;
Expand All @@ -22,9 +22,9 @@ export interface NoticeType {
member: string;
href: string;
memberLink: string;
}
};

export interface CurrentUser {
export type CurrentUser = {
name: string;
avatar: string;
userid: string;
Expand All @@ -40,4 +40,4 @@ export interface CurrentUser {
geographic: GeographicType;
address: string;
phone: string;
}
};
17 changes: 8 additions & 9 deletions AccountSettings/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import React, { Component } from 'react';

import { FormattedMessage, Dispatch, connect } from 'umi';
import type { Dispatch } from 'umi';
import { FormattedMessage, connect } from 'umi';
import { GridContent } from '@ant-design/pro-layout';
import { Menu } from 'antd';
import BaseView from './components/base';
import BindingView from './components/binding';
import { CurrentUser } from './data.d';
import type { CurrentUser } from './data.d';
import NotificationView from './components/notification';
import SecurityView from './components/security';
import styles from './style.less';

const { Item } = Menu;

interface PAGE_NAME_UPPER_CAMEL_CASEProps {
type PAGE_NAME_UPPER_CAMEL_CASEProps = {
dispatch: Dispatch;
currentUser: CurrentUser;
}
};

type PAGE_NAME_UPPER_CAMEL_CASEStateKeys = 'base' | 'security' | 'binding' | 'notification';
interface PAGE_NAME_UPPER_CAMEL_CASEState {
type PAGE_NAME_UPPER_CAMEL_CASEState = {
mode: 'inline' | 'horizontal';
menuMap: {
[key: string]: React.ReactNode;
};
menuMap: Record<string, React.ReactNode>;
selectKey: PAGE_NAME_UPPER_CAMEL_CASEStateKeys;
}
};

class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
PAGE_NAME_UPPER_CAMEL_CASEProps,
Expand Down
Loading

0 comments on commit c746ce0

Please sign in to comment.