style: format ts type

pull/4606/head
tangjinzhou 2021-09-01 21:21:20 +08:00
parent a0392186c2
commit c4ea14358e
24 changed files with 52 additions and 47 deletions

View File

@ -12,7 +12,7 @@ module.exports = {
parser: 'babel-eslint',
},
extends: ['plugin:vue/vue3-recommended', 'prettier'],
plugins: ['markdown', 'jest', '@typescript-eslint', 'eslint-plugin-no-explicit-type-exports'],
plugins: ['markdown', 'jest', '@typescript-eslint'],
overrides: [
{
files: ['**/demo/*.md'],
@ -28,10 +28,9 @@ module.exports = {
project: './tsconfig.json',
},
rules: {
'no-explicit-type-exports/no-explicit-type-exports': 2,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/consistent-type-imports': 1,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-non-null-assertion': 0,

View File

@ -1,6 +1,8 @@
import type { App, Plugin } from 'vue';
import Anchor, { AnchorProps } from './Anchor';
import AnchorLink, { AnchorLinkProps } from './AnchorLink';
import type { AnchorProps } from './Anchor';
import type { AnchorLinkProps } from './AnchorLink';
import Anchor from './Anchor';
import AnchorLink from './AnchorLink';
Anchor.Link = AnchorLink;
@ -11,7 +13,8 @@ Anchor.install = function (app: App) {
return app;
};
export { AnchorLinkProps, AnchorProps, AnchorLink, AnchorLink as Link };
export type { AnchorLinkProps, AnchorProps };
export { AnchorLink, AnchorLink as Link };
export default Anchor as typeof Anchor &
Plugin & {

View File

@ -1,9 +1,9 @@
import type { App, Plugin } from 'vue';
import Avatar from './Avatar';
import Group from './Group';
export { AvatarProps, AvatarSize, avatarProps } from './Avatar';
export { AvatarGroupProps } from './Group';
export { avatarProps } from './Avatar';
export type { AvatarProps, AvatarSize } from './Avatar';
export type { AvatarGroupProps } from './Group';
Avatar.Group = Group;

View File

@ -4,5 +4,5 @@ import generateCalendar, { CalendarProps } from './generateCalendar';
const Calendar = generateCalendar<Date>(generateConfig);
export { CalendarProps };
export type { CalendarProps };
export default withInstall(Calendar);

View File

@ -5,5 +5,5 @@ import generateCalendar, { CalendarProps } from './generateCalendar';
const Calendar = generateCalendar<Dayjs>(generateConfig);
export { CalendarProps };
export type { CalendarProps };
export default withInstall(Calendar);

View File

@ -5,5 +5,5 @@ import generateCalendar, { CalendarProps } from './generateCalendar';
const Calendar = generateCalendar<Moment>(generateConfig);
export { CalendarProps };
export type { CalendarProps };
export default withInstall(Calendar);

View File

@ -82,7 +82,7 @@ export default defineComponent({
return (
<ButtonGroup {...restProps} class={classNames(prefixCls.value, className)}>
{slots.leftButton ? slots.leftButton({ button: leftButton }) : leftButton}
<Dropdown {...dropdownProps} v-slots={{ overlay: slots.overlay }}>
<Dropdown {...dropdownProps} v-slots={{ overlay: () => overlay }}>
{slots.rightButton ? slots.rightButton({ button: rightButton }) : rightButton}
</Dropdown>
</ButtonGroup>

View File

@ -2,9 +2,9 @@ import Row from './Row';
import Col from './Col';
import useBreakpoint from '../_util/hooks/useBreakpoint';
export { RowProps } from './Row';
export type { RowProps } from './Row';
export { ColProps, ColSize } from './Col';
export type { ColProps, ColSize } from './Col';
export { Row, Col };

View File

@ -2,8 +2,8 @@ import type { App, Plugin } from 'vue';
import Layout from './layout';
import Sider from './Sider';
export { BasicProps as LayoutProps } from './layout';
export { SiderProps } from './Sider';
export type { BasicProps as LayoutProps } from './layout';
export type { SiderProps } from './Sider';
Layout.Sider = Sider;

View File

@ -19,7 +19,7 @@ import type { Breakpoint } from '../_util/responsiveObserve';
import { responsiveArray } from '../_util/responsiveObserve';
export { ListItemProps } from './Item';
export { ListItemMetaProps } from './ItemMeta';
export type { ListItemMetaProps } from './ItemMeta';
export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';

View File

@ -4,7 +4,7 @@ import SubMenu, { SubMenuProps } from './src/SubMenu';
import ItemGroup, { MenuItemGroupProps } from './src/ItemGroup';
import Divider from './src/Divider';
import type { App, Plugin } from 'vue';
import { MenuTheme } from './src/interface';
import type { MenuTheme } from './src/interface';
/* istanbul ignore next */
Menu.install = function (app: App) {
app.component(Menu.name, Menu);
@ -19,7 +19,7 @@ Menu.Item = MenuItem;
Menu.Divider = Divider;
Menu.SubMenu = SubMenu;
Menu.ItemGroup = ItemGroup;
export type { MenuProps, SubMenuProps, MenuItemProps, MenuItemGroupProps, MenuTheme };
export {
SubMenu,
MenuItem as Item,
@ -28,11 +28,6 @@ export {
ItemGroup as MenuItemGroup,
Divider,
Divider as MenuDivider,
MenuProps,
SubMenuProps,
MenuItemProps,
MenuItemGroupProps,
MenuTheme,
};
export default Menu as typeof Menu &

View File

@ -7,8 +7,8 @@ import CheckCircleOutlined from '@ant-design/icons-vue/CheckCircleOutlined';
import CloseCircleOutlined from '@ant-design/icons-vue/CloseCircleOutlined';
import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined';
export { IActionButtonProps as ActionButtonProps } from './ActionButton';
export { ModalProps, ModalFuncProps } from './Modal';
export type { IActionButtonProps as ActionButtonProps } from './ActionButton';
export type { ModalProps, ModalFuncProps } from './Modal';
const info = function (props: ModalFuncProps) {
const config = {

View File

@ -1,6 +1,7 @@
import Pagination from './Pagination';
import { withInstall } from '../_util/type';
export { paginationProps, PaginationProps, PaginationConfig, paginationConfig } from './Pagination';
export { paginationProps, paginationConfig } from './Pagination';
export type { PaginationProps, PaginationConfig } from './Pagination';
export default withInstall(Pagination);

View File

@ -3,7 +3,7 @@ import Radio from './Radio';
import Group from './Group';
import Button from './RadioButton';
export { RadioChangeEventTarget, RadioChangeEvent } from './interface';
export type { RadioChangeEventTarget, RadioChangeEvent } from './interface';
Radio.Group = Group;
Radio.Button = Button;

View File

@ -5,7 +5,8 @@ import SkeletonInput from './Input';
import SkeletonImage from './Image';
import SkeletonAvatar from './Avatar';
export { SkeletonProps, skeletonProps } from './Skeleton';
export type { SkeletonProps } from './Skeleton';
export { skeletonProps } from './Skeleton';
Skeleton.Button = SkeletonButton;
Skeleton.Avatar = SkeletonAvatar;

View File

@ -10,7 +10,7 @@ import { defaultConfigProvider } from '../config-provider';
export const SpinSize = PropTypes.oneOf(tuple('small', 'default', 'large'));
export const getSpinProps = () => ({
export const spinProps = () => ({
prefixCls: PropTypes.string,
spinning: PropTypes.looseBool,
size: SpinSize,
@ -20,7 +20,7 @@ export const getSpinProps = () => ({
indicator: PropTypes.any,
});
export type SpinProps = Partial<ExtractPropTypes<ReturnType<typeof getSpinProps>>>;
export type SpinProps = Partial<ExtractPropTypes<ReturnType<typeof spinProps>>>;
// Render indicator
let defaultIndicator: () => VNode = null;
@ -38,7 +38,7 @@ export default defineComponent({
name: 'ASpin',
mixins: [BaseMixin],
inheritAttrs: false,
props: initDefaultProps(getSpinProps(), {
props: initDefaultProps(spinProps(), {
size: 'default',
spinning: true,
wrapperClassName: '',

View File

@ -1,7 +1,8 @@
import type { App, Plugin } from 'vue';
import Spin, { setDefaultIndicator } from './Spin';
export { SpinProps, getSpinProps } from './Spin';
export type { SpinProps } from './Spin';
export { spinProps } from './Spin';
Spin.setDefaultIndicator = setDefaultIndicator;

View File

@ -1,7 +1,7 @@
import type { ExtractPropTypes, PropType, UnwrapRef } from 'vue';
import PropTypes, { withUndefined } from '../_util/vue-types';
import { paginationProps as getPaginationProps, paginationConfig } from '../pagination';
import { getSpinProps } from '../spin';
import { spinProps } from '../spin';
import { tuple } from '../_util/type';
const PaginationProps = getPaginationProps();
@ -140,7 +140,7 @@ export const tableProps = {
expandIconAsCell: PropTypes.looseBool,
expandIconColumnIndex: PropTypes.number,
expandRowByClick: PropTypes.looseBool,
loading: PropTypes.oneOfType([PropTypes.shape(getSpinProps()).loose, PropTypes.looseBool]),
loading: PropTypes.oneOfType([PropTypes.shape(spinProps()).loose, PropTypes.looseBool]),
locale: TableLocale,
indentSize: PropTypes.number,
customRow: PropTypes.func,

View File

@ -11,10 +11,9 @@ import { cloneElement } from '../_util/vnode';
import type { triggerTypes, placementTypes } from './abstractTooltipProps';
import abstractTooltipProps from './abstractTooltipProps';
import useConfigInject from '../_util/hooks/useConfigInject';
import getPlacements, { AdjustOverflow, PlacementsConfig } from './placements';
import getPlacements from './placements';
import firstNotUndefined from '../_util/firstNotUndefined';
export { AdjustOverflow, PlacementsConfig };
export type { AdjustOverflow, PlacementsConfig } from './placements';
export type TooltipPlacement = typeof placementTypes[number];

View File

@ -1,5 +1,6 @@
import Overflow, { OverflowProps } from './Overflow';
import type { OverflowProps } from './Overflow';
import Overflow from './Overflow';
export { OverflowProps };
export type { OverflowProps };
export default Overflow;

View File

@ -1,7 +1,10 @@
import Picker, { PickerProps } from './Picker';
import PickerPanel, { PickerPanelProps } from './PickerPanel';
import RangePicker, { RangePickerProps } from './RangePicker';
import PickerPanel from './PickerPanel';
import RangePicker from './RangePicker';
import type { PickerPanelProps } from './PickerPanel';
import type { RangePickerProps } from './RangePicker';
export { PickerPanel, RangePicker, PickerProps, PickerPanelProps, RangePickerProps };
export { PickerPanel, RangePicker };
export type { PickerProps, PickerPanelProps, RangePickerProps };
export default Picker;

View File

@ -3,6 +3,7 @@ import TreeNode from './TreeNode';
import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil';
import { TreeSelectProps, treeSelectProps } from './props';
export { TreeNode, SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeSelectProps, treeSelectProps };
export { TreeNode, SHOW_ALL, SHOW_CHILD, SHOW_PARENT, treeSelectProps };
export type { TreeSelectProps };
export default TreeSelect;

View File

@ -41,7 +41,7 @@
"prettier": "prettier -c --write '**/*'",
"pretty-quick": "pretty-quick",
"dist": "node --max_old_space_size=8192 antd-tools/cli/run.js dist",
"lint": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.vue,.ts,.tsx ./components",
"lint": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.ts,.tsx ./components",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov"
},

View File

@ -11,7 +11,8 @@
"target": "es6",
"lib": ["dom", "es2017"],
"skipLibCheck": true,
"allowJs": true
"allowJs": true,
"importsNotUsedAsValues": "error"
},
"exclude": [
"node_modules",