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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,9 +2,9 @@ import Row from './Row';
import Col from './Col'; import Col from './Col';
import useBreakpoint from '../_util/hooks/useBreakpoint'; 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 }; export { Row, Col };

View File

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

View File

@ -19,7 +19,7 @@ import type { Breakpoint } from '../_util/responsiveObserve';
import { responsiveArray } from '../_util/responsiveObserve'; import { responsiveArray } from '../_util/responsiveObserve';
export { ListItemProps } from './Item'; export { ListItemProps } from './Item';
export { ListItemMetaProps } from './ItemMeta'; export type { ListItemMetaProps } from './ItemMeta';
export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; 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 ItemGroup, { MenuItemGroupProps } from './src/ItemGroup';
import Divider from './src/Divider'; import Divider from './src/Divider';
import type { App, Plugin } from 'vue'; import type { App, Plugin } from 'vue';
import { MenuTheme } from './src/interface'; import type { MenuTheme } from './src/interface';
/* istanbul ignore next */ /* istanbul ignore next */
Menu.install = function (app: App) { Menu.install = function (app: App) {
app.component(Menu.name, Menu); app.component(Menu.name, Menu);
@ -19,7 +19,7 @@ Menu.Item = MenuItem;
Menu.Divider = Divider; Menu.Divider = Divider;
Menu.SubMenu = SubMenu; Menu.SubMenu = SubMenu;
Menu.ItemGroup = ItemGroup; Menu.ItemGroup = ItemGroup;
export type { MenuProps, SubMenuProps, MenuItemProps, MenuItemGroupProps, MenuTheme };
export { export {
SubMenu, SubMenu,
MenuItem as Item, MenuItem as Item,
@ -28,11 +28,6 @@ export {
ItemGroup as MenuItemGroup, ItemGroup as MenuItemGroup,
Divider, Divider,
Divider as MenuDivider, Divider as MenuDivider,
MenuProps,
SubMenuProps,
MenuItemProps,
MenuItemGroupProps,
MenuTheme,
}; };
export default Menu as typeof Menu & 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 CloseCircleOutlined from '@ant-design/icons-vue/CloseCircleOutlined';
import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined'; import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOutlined';
export { IActionButtonProps as ActionButtonProps } from './ActionButton'; export type { IActionButtonProps as ActionButtonProps } from './ActionButton';
export { ModalProps, ModalFuncProps } from './Modal'; export type { ModalProps, ModalFuncProps } from './Modal';
const info = function (props: ModalFuncProps) { const info = function (props: ModalFuncProps) {
const config = { const config = {

View File

@ -1,6 +1,7 @@
import Pagination from './Pagination'; import Pagination from './Pagination';
import { withInstall } from '../_util/type'; 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); export default withInstall(Pagination);

View File

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

View File

@ -5,7 +5,8 @@ import SkeletonInput from './Input';
import SkeletonImage from './Image'; import SkeletonImage from './Image';
import SkeletonAvatar from './Avatar'; import SkeletonAvatar from './Avatar';
export { SkeletonProps, skeletonProps } from './Skeleton'; export type { SkeletonProps } from './Skeleton';
export { skeletonProps } from './Skeleton';
Skeleton.Button = SkeletonButton; Skeleton.Button = SkeletonButton;
Skeleton.Avatar = SkeletonAvatar; 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 SpinSize = PropTypes.oneOf(tuple('small', 'default', 'large'));
export const getSpinProps = () => ({ export const spinProps = () => ({
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
spinning: PropTypes.looseBool, spinning: PropTypes.looseBool,
size: SpinSize, size: SpinSize,
@ -20,7 +20,7 @@ export const getSpinProps = () => ({
indicator: PropTypes.any, indicator: PropTypes.any,
}); });
export type SpinProps = Partial<ExtractPropTypes<ReturnType<typeof getSpinProps>>>; export type SpinProps = Partial<ExtractPropTypes<ReturnType<typeof spinProps>>>;
// Render indicator // Render indicator
let defaultIndicator: () => VNode = null; let defaultIndicator: () => VNode = null;
@ -38,7 +38,7 @@ export default defineComponent({
name: 'ASpin', name: 'ASpin',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
props: initDefaultProps(getSpinProps(), { props: initDefaultProps(spinProps(), {
size: 'default', size: 'default',
spinning: true, spinning: true,
wrapperClassName: '', wrapperClassName: '',

View File

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

View File

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

View File

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

View File

@ -1,7 +1,10 @@
import Picker, { PickerProps } from './Picker'; import Picker, { PickerProps } from './Picker';
import PickerPanel, { PickerPanelProps } from './PickerPanel'; import PickerPanel from './PickerPanel';
import RangePicker, { RangePickerProps } from './RangePicker'; 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; export default Picker;

View File

@ -3,6 +3,7 @@ import TreeNode from './TreeNode';
import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil'; import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil';
import { TreeSelectProps, treeSelectProps } from './props'; 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; export default TreeSelect;

View File

@ -41,7 +41,7 @@
"prettier": "prettier -c --write '**/*'", "prettier": "prettier -c --write '**/*'",
"pretty-quick": "pretty-quick", "pretty-quick": "pretty-quick",
"dist": "node --max_old_space_size=8192 antd-tools/cli/run.js dist", "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", "lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov" "codecov": "codecov"
}, },

View File

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