From 9ec32e427ca16fb3db3336ed2ce2f9cccac0f8fe Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 19 Sep 2021 10:54:26 +0800 Subject: [PATCH] style: add import eslint --- .eslintrc.js | 12 ++++++++++-- components/_util/hooks/useMergedState.ts | 6 +----- components/_util/transition.tsx | 11 ++++++++--- components/avatar/__tests__/Avatar.test.js | 2 +- components/badge/__tests__/index.test.js | 2 +- components/button/__tests__/wave.test.js | 2 +- components/calendar/__tests__/index.test.js | 3 +-- components/carousel/__tests__/index.test.js | 2 +- components/cascader/__tests__/index.test.js | 2 +- components/checkbox/__tests__/group.test.js | 2 +- components/color-picker/__tests__/index.test.js | 2 +- components/comment/__tests__/index.test.js | 2 +- components/date-picker/__tests__/DatePicker.test.js | 2 +- .../date-picker/__tests__/RangePicker.test.js | 3 +-- components/date-picker/__tests__/WeekPicker.test.js | 2 +- components/date-picker/__tests__/other.test.js | 3 +-- .../generatePicker/generateRangePicker.tsx | 2 +- components/descriptions/__tests__/index.test.js | 2 +- components/drawer/__tests__/Drawer.test.js | 2 +- components/drawer/__tests__/DrawerEvent.test.js | 2 +- components/drawer/__tests__/MultiDrawer.test.js | 2 +- components/dropdown/dropdown.tsx | 3 +-- components/form/FormItem.tsx | 3 +-- components/form/useForm.ts | 3 +-- components/grid/context.ts | 3 +-- components/input/ResizableTextArea.tsx | 3 +-- components/input/__tests__/Search.test.js | 2 +- components/input/__tests__/index.test.js | 2 +- components/list/__tests__/index.test.js | 2 +- components/locale-provider/LocaleReceiver.tsx | 3 +-- components/mentions/index.tsx | 4 +--- components/menu/__tests__/index.test.js | 2 +- components/message/__tests__/index.test.js | 2 +- components/modal/__tests__/Modal.test.js | 2 +- components/notification/__tests__/index.test.js | 2 +- components/notification/__tests__/placement.test.js | 2 +- components/pagination/Pagination.tsx | 3 +-- components/popconfirm/__tests__/index.test.js | 2 +- components/popconfirm/index.tsx | 3 +-- components/popover/__tests__/index.test.js | 2 +- components/progress/Steps.tsx | 3 +-- components/progress/__tests__/index.test.js | 2 +- components/radio/__tests__/group.test.js | 2 +- components/radio/__tests__/radio.test.js | 2 +- components/rate/index.tsx | 3 +-- components/select/__tests__/index.test.js | 2 +- components/select/index.tsx | 3 +-- components/skeleton/__tests__/index.test.js | 2 +- components/slider/SliderTooltip.tsx | 4 +--- components/slider/__tests__/index.test.js | 2 +- components/slider/index.tsx | 6 ++---- components/spin/__tests__/delay.test.js | 2 +- components/spin/__tests__/index.test.js | 2 +- components/steps/index.tsx | 3 +-- components/switch/__tests__/index.test.js | 2 +- components/table/Table.tsx | 3 +-- components/table/__tests__/Table.filter.test.js | 3 +-- components/table/__tests__/Table.pagination.test.js | 3 +-- .../table/__tests__/Table.rowSelection.test.js | 3 +-- components/table/__tests__/Table.sorter.test.js | 2 +- components/table/context.ts | 3 +-- components/table/hooks/useLazyKVMap.ts | 3 +-- components/tabs/__tests__/index.test.js | 4 +--- components/tag/__tests__/index.test.js | 2 +- components/tooltip/Tooltip.tsx | 3 +-- components/tooltip/__tests__/tooltip.test.js | 2 +- components/transfer/__tests__/index.test.js | 3 +-- components/transfer/__tests__/search.test.js | 2 +- components/transfer/index.tsx | 3 +-- components/transfer/list.tsx | 3 +-- components/tree-select/index.tsx | 3 +-- components/tree/DirectoryTree.tsx | 9 +++------ components/tree/Tree.tsx | 4 +--- components/typography/Base.tsx | 2 +- components/typography/__tests__/index.test.js | 2 +- components/vc-align/Align.tsx | 12 ++++++++++-- components/vc-cascader/Cascader.jsx | 3 +-- components/vc-mentions/src/Mentions.tsx | 3 ++- components/vc-picker/hooks/usePickerInput.ts | 6 +----- components/vc-picker/hooks/useRangeViewDates.ts | 4 +--- components/vc-select/Select.tsx | 3 +-- components/vc-select/Selector/SingleSelector.tsx | 3 +-- components/vc-select/generate.tsx | 2 +- components/vc-select/interface/index.ts | 13 ++++++------- components/vc-slider/src/Handle.tsx | 4 +--- components/vc-tree-select/hooks/useKeyValueMap.ts | 3 +-- components/vc-tree-select/props.ts | 12 ++++++------ components/vc-tree/MotionTreeNode.tsx | 12 ++++++++++-- components/vc-tree/contextTypes.ts | 4 +--- components/vc-trigger/Popup/useVisibleStatus.ts | 4 +--- package.json | 1 + 91 files changed, 139 insertions(+), 168 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2c66f83b2..324daf12f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,8 +11,13 @@ module.exports = { parserOptions: { parser: 'babel-eslint', }, - extends: ['plugin:vue/vue3-recommended', 'prettier'], - plugins: ['markdown', 'jest', '@typescript-eslint'], + extends: [ + 'plugin:vue/vue3-recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'prettier', + ], + plugins: ['markdown', 'jest', '@typescript-eslint', 'import'], overrides: [ { files: ['*.md'], @@ -57,6 +62,9 @@ module.exports = { }, ], rules: { + 'import/no-named-as-default': 'off', + 'import/namespace': [2, { allowComputed: true }], + 'import/no-named-as-default-member': 'off', 'comma-dangle': [2, 'always-multiline'], 'no-var': 'error', 'no-console': [2, { allow: ['warn', 'error'] }], diff --git a/components/_util/hooks/useMergedState.ts b/components/_util/hooks/useMergedState.ts index e18a9028d..179e7dc61 100644 --- a/components/_util/hooks/useMergedState.ts +++ b/components/_util/hooks/useMergedState.ts @@ -1,9 +1,5 @@ import type { Ref, UnwrapRef } from 'vue'; -import { toRaw } from 'vue'; -import { watchEffect } from 'vue'; -import { unref } from 'vue'; -import { watch } from 'vue'; -import { ref } from 'vue'; +import { toRaw, watchEffect, unref, watch, ref } from 'vue'; export default function useMergedState>( defaultStateValue: T | (() => T), diff --git a/components/_util/transition.tsx b/components/_util/transition.tsx index d44295e83..a1efbd052 100644 --- a/components/_util/transition.tsx +++ b/components/_util/transition.tsx @@ -5,9 +5,14 @@ import type { TransitionGroupProps, TransitionProps, } from 'vue'; -import { onUpdated } from 'vue'; -import { getCurrentInstance } from 'vue'; -import { defineComponent, nextTick, Transition as T, TransitionGroup as TG } from 'vue'; +import { + onUpdated, + getCurrentInstance, + defineComponent, + nextTick, + Transition as T, + TransitionGroup as TG, +} from 'vue'; export const getTransitionProps = (transitionName: string, opt: TransitionProps = {}) => { if (process.env.NODE_ENV === 'test') { diff --git a/components/avatar/__tests__/Avatar.test.js b/components/avatar/__tests__/Avatar.test.js index 0d51a42f6..40cd1b907 100644 --- a/components/avatar/__tests__/Avatar.test.js +++ b/components/avatar/__tests__/Avatar.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Avatar from '..'; import useBreakpoint from '../../_util/hooks/useBreakpoint'; diff --git a/components/badge/__tests__/index.test.js b/components/badge/__tests__/index.test.js index 2b4000810..aec04a2c1 100644 --- a/components/badge/__tests__/index.test.js +++ b/components/badge/__tests__/index.test.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'; import Badge from '../index'; import mountTest from '../../../tests/shared/mountTest'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; describe('Badge', () => { it('badge dot not scaling count > 9', () => { const badge = mount({ diff --git a/components/button/__tests__/wave.test.js b/components/button/__tests__/wave.test.js index d10b2374c..0e9300484 100644 --- a/components/button/__tests__/wave.test.js +++ b/components/button/__tests__/wave.test.js @@ -1,6 +1,6 @@ import Button from '../index'; import { mount } from '@vue/test-utils'; -import { asyncExpect, sleep } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; describe('click wave effect', () => { async function clickButton(wrapper) { diff --git a/components/calendar/__tests__/index.test.js b/components/calendar/__tests__/index.test.js index e547a3062..66225e893 100644 --- a/components/calendar/__tests__/index.test.js +++ b/components/calendar/__tests__/index.test.js @@ -1,11 +1,10 @@ import dayjs from 'dayjs'; import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect , sleep } from '../../../tests/utils'; import MockDate from 'mockdate'; import Calendar from '..'; import Header from '../Header'; import mountTest from '../../../tests/shared/mountTest'; -import { sleep } from '../../../tests/utils'; import generateConfig from '../../vc-picker/generate/dayjs'; describe('Calendar', () => { diff --git a/components/carousel/__tests__/index.test.js b/components/carousel/__tests__/index.test.js index 19a663394..6f372c2c6 100644 --- a/components/carousel/__tests__/index.test.js +++ b/components/carousel/__tests__/index.test.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import { h, createVNode } from 'vue'; -import { asyncExpect, sleep } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import Carousel from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/cascader/__tests__/index.test.js b/components/cascader/__tests__/index.test.js index 86dd9d7dc..13056583b 100644 --- a/components/cascader/__tests__/index.test.js +++ b/components/cascader/__tests__/index.test.js @@ -1,4 +1,4 @@ -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import { mount } from '@vue/test-utils'; import KeyCode from '../../_util/KeyCode'; import Cascader from '..'; diff --git a/components/checkbox/__tests__/group.test.js b/components/checkbox/__tests__/group.test.js index 7d69df567..0cd6a940c 100644 --- a/components/checkbox/__tests__/group.test.js +++ b/components/checkbox/__tests__/group.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect, sleep } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import Checkbox from '../index'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/color-picker/__tests__/index.test.js b/components/color-picker/__tests__/index.test.js index bec2d2c07..1ad6a1d03 100644 --- a/components/color-picker/__tests__/index.test.js +++ b/components/color-picker/__tests__/index.test.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import ColorPicker from '..'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; describe('ColorPicker', () => { xit('should support default value', async () => { const wrapper = mount( diff --git a/components/comment/__tests__/index.test.js b/components/comment/__tests__/index.test.js index 10e9cf4e4..754937253 100644 --- a/components/comment/__tests__/index.test.js +++ b/components/comment/__tests__/index.test.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import dayjs from 'dayjs'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Comment from '..'; import List from '../../list'; import Form from '../../form'; diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js index ca01d942b..c186473e7 100644 --- a/components/date-picker/__tests__/DatePicker.test.js +++ b/components/date-picker/__tests__/DatePicker.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import dayjs from 'dayjs'; import MockDate from 'mockdate'; import DatePicker from '..'; diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index 167c91b35..85ee3b6be 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -1,8 +1,7 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect, setMockDate, resetMockDate, sleep } from '../../../tests/utils'; import dayjs from 'dayjs'; import DatePicker from '../'; -import { setMockDate, resetMockDate, sleep } from '../../../tests/utils'; import { openPicker, selectCell, closePicker } from './utils'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/date-picker/__tests__/WeekPicker.test.js b/components/date-picker/__tests__/WeekPicker.test.js index 47d6b7f85..53d77a158 100644 --- a/components/date-picker/__tests__/WeekPicker.test.js +++ b/components/date-picker/__tests__/WeekPicker.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import DatePicker from '..'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/date-picker/__tests__/other.test.js b/components/date-picker/__tests__/other.test.js index 178cc664f..f187764fe 100644 --- a/components/date-picker/__tests__/other.test.js +++ b/components/date-picker/__tests__/other.test.js @@ -1,10 +1,9 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import dayjs from 'dayjs'; import DatePicker from '../'; import LocaleProvider from '../../locale-provider'; import locale from '../../locale-provider/zh_CN'; -import { sleep } from '../../../tests/utils'; const { MonthPicker, WeekPicker } = DatePicker; diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index a4a3280db..89f560b40 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -22,12 +22,12 @@ export default function generateRangePicker( ) { const RangePicker = defineComponent({ name: 'ARangePicker', + inheritAttrs: false, props: { ...commonProps(), ...rangePickerProps(), ...extraProps, }, - inheritAttrs: false, slots: [ 'suffixIcon', // 'clearIcon', diff --git a/components/descriptions/__tests__/index.test.js b/components/descriptions/__tests__/index.test.js index 84ad00912..855d51438 100644 --- a/components/descriptions/__tests__/index.test.js +++ b/components/descriptions/__tests__/index.test.js @@ -3,7 +3,7 @@ import { h } from 'vue'; import MockDate from 'mockdate'; import Descriptions from '..'; import { resetWarned } from '../../_util/warning'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; describe('Descriptions', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); diff --git a/components/drawer/__tests__/Drawer.test.js b/components/drawer/__tests__/Drawer.test.js index 7da6d86ea..9081fd9bd 100644 --- a/components/drawer/__tests__/Drawer.test.js +++ b/components/drawer/__tests__/Drawer.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Drawer from '..'; const DrawerCom = { diff --git a/components/drawer/__tests__/DrawerEvent.test.js b/components/drawer/__tests__/DrawerEvent.test.js index 8470e3553..0922940b0 100644 --- a/components/drawer/__tests__/DrawerEvent.test.js +++ b/components/drawer/__tests__/DrawerEvent.test.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import Drawer from '..'; import Button from '../../button'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; const DrawerEventTester = { props: { diff --git a/components/drawer/__tests__/MultiDrawer.test.js b/components/drawer/__tests__/MultiDrawer.test.js index b434f8829..6380569d7 100644 --- a/components/drawer/__tests__/MultiDrawer.test.js +++ b/components/drawer/__tests__/MultiDrawer.test.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import Drawer from '..'; import Button from '../../button'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; export function $$(className) { return document.body.querySelectorAll(className); } diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 358509b66..68708cf5f 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -1,6 +1,5 @@ import type { ExtractPropTypes } from 'vue'; -import { computed } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, defineComponent } from 'vue'; import RcDropdown from '../vc-dropdown'; import DropdownButton from './dropdown-button'; import { cloneElement } from '../_util/vnode'; diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 08b3566bc..0f8f8fcc2 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -1,6 +1,5 @@ import type { PropType, ExtractPropTypes, ComputedRef } from 'vue'; -import { watch } from 'vue'; -import { defineComponent, computed, nextTick, ref, watchEffect, onBeforeUnmount } from 'vue'; +import { watch, defineComponent, computed, nextTick, ref, watchEffect, onBeforeUnmount } from 'vue'; import cloneDeep from 'lodash-es/cloneDeep'; import PropTypes from '../_util/vue-types'; import Row from '../grid/Row'; diff --git a/components/form/useForm.ts b/components/form/useForm.ts index a6ebaa99a..63a49f30f 100644 --- a/components/form/useForm.ts +++ b/components/form/useForm.ts @@ -1,6 +1,5 @@ import type { Ref } from 'vue'; -import { computed } from 'vue'; -import { reactive, watch, nextTick, unref } from 'vue'; +import { computed, reactive, watch, nextTick, unref } from 'vue'; import cloneDeep from 'lodash-es/cloneDeep'; import intersection from 'lodash-es/intersection'; import isEqual from 'lodash-es/isEqual'; diff --git a/components/grid/context.ts b/components/grid/context.ts index f1192a9ce..358cf4ef8 100644 --- a/components/grid/context.ts +++ b/components/grid/context.ts @@ -1,6 +1,5 @@ -import { computed } from 'vue'; +import { computed, inject, provide } from 'vue'; import type { Ref, InjectionKey, ComputedRef } from 'vue'; -import { inject, provide } from 'vue'; export interface RowContext { gutter: ComputedRef<[number, number]>; diff --git a/components/input/ResizableTextArea.tsx b/components/input/ResizableTextArea.tsx index 2ef07375b..e92ea26c3 100644 --- a/components/input/ResizableTextArea.tsx +++ b/components/input/ResizableTextArea.tsx @@ -1,5 +1,5 @@ import type { PropType, VNode } from 'vue'; -import { nextTick } from 'vue'; +import { nextTick, defineComponent, withDirectives } from 'vue'; import ResizeObserver from '../vc-resize-observer'; import omit from 'omit.js'; import classNames from '../_util/classNames'; @@ -10,7 +10,6 @@ import BaseMixin from '../_util/BaseMixin'; import inputProps from './inputProps'; import PropTypes from '../_util/vue-types'; import { getOptionProps } from '../_util/props-util'; -import { defineComponent, withDirectives } from 'vue'; import antInput from '../_util/antInputDirective'; const RESIZE_STATUS_NONE = 0; diff --git a/components/input/__tests__/Search.test.js b/components/input/__tests__/Search.test.js index 62d5ad60f..51462171c 100644 --- a/components/input/__tests__/Search.test.js +++ b/components/input/__tests__/Search.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Input from '../index'; import Button from '../../button'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js index 944e86d74..6a15b2f4f 100644 --- a/components/input/__tests__/index.test.js +++ b/components/input/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Input from '..'; // import Form from '../../form'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/list/__tests__/index.test.js b/components/list/__tests__/index.test.js index 5e39c2974..610b156e5 100644 --- a/components/list/__tests__/index.test.js +++ b/components/list/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import List from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/locale-provider/LocaleReceiver.tsx b/components/locale-provider/LocaleReceiver.tsx index 62ea42edc..1fb6dc036 100644 --- a/components/locale-provider/LocaleReceiver.tsx +++ b/components/locale-provider/LocaleReceiver.tsx @@ -1,6 +1,5 @@ import type { VNodeTypes, PropType, ComputedRef, Ref } from 'vue'; -import { unref } from 'vue'; -import { inject, defineComponent, computed } from 'vue'; +import { unref, inject, defineComponent, computed } from 'vue'; import PropTypes from '../_util/vue-types'; import defaultLocaleData from './default'; import type { Locale } from '.'; diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index 8eeca75b9..bbbdff9b6 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -1,7 +1,5 @@ import type { App, PropType, Plugin, ExtractPropTypes } from 'vue'; -import { watch } from 'vue'; -import { ref, onMounted } from 'vue'; -import { defineComponent, nextTick } from 'vue'; +import { watch, ref, onMounted, defineComponent, nextTick } from 'vue'; import classNames from '../_util/classNames'; import omit from 'omit.js'; import PropTypes from '../_util/vue-types'; diff --git a/components/menu/__tests__/index.test.js b/components/menu/__tests__/index.test.js index 2faf48776..a55e415c2 100644 --- a/components/menu/__tests__/index.test.js +++ b/components/menu/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Menu from '..'; import { InboxOutlined, PieChartOutlined } from '@ant-design/icons-vue'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/message/__tests__/index.test.js b/components/message/__tests__/index.test.js index e60232232..33e727348 100644 --- a/components/message/__tests__/index.test.js +++ b/components/message/__tests__/index.test.js @@ -1,4 +1,4 @@ -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import message from '..'; import SmileOutlined from '@ant-design/icons-vue/SmileOutlined'; diff --git a/components/modal/__tests__/Modal.test.js b/components/modal/__tests__/Modal.test.js index f9f7adca3..5415e8eaa 100644 --- a/components/modal/__tests__/Modal.test.js +++ b/components/modal/__tests__/Modal.test.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import Modal from '..'; import mountTest from '../../../tests/shared/mountTest'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; const ModalTester = { props: ['footer', 'visible'], diff --git a/components/notification/__tests__/index.test.js b/components/notification/__tests__/index.test.js index 9e4c26064..f8fa33fd2 100644 --- a/components/notification/__tests__/index.test.js +++ b/components/notification/__tests__/index.test.js @@ -1,4 +1,4 @@ -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import notification from '..'; import { StepBackwardOutlined } from '@ant-design/icons-vue'; diff --git a/components/notification/__tests__/placement.test.js b/components/notification/__tests__/placement.test.js index c9f6924dc..194a967ec 100644 --- a/components/notification/__tests__/placement.test.js +++ b/components/notification/__tests__/placement.test.js @@ -1,4 +1,4 @@ -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import notification from '..'; describe('Notification.placement', () => { diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 75b69a408..de04c3532 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -1,6 +1,5 @@ import type { ExtractPropTypes } from 'vue'; -import { computed, toRef } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, toRef, defineComponent } from 'vue'; import LeftOutlined from '@ant-design/icons-vue/LeftOutlined'; import RightOutlined from '@ant-design/icons-vue/RightOutlined'; import DoubleLeftOutlined from '@ant-design/icons-vue/DoubleLeftOutlined'; diff --git a/components/popconfirm/__tests__/index.test.js b/components/popconfirm/__tests__/index.test.js index 419f5aeb7..affe21ba9 100644 --- a/components/popconfirm/__tests__/index.test.js +++ b/components/popconfirm/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Popconfirm from '..'; function $$(className) { return document.body.querySelectorAll(className); diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index b96af1352..9968cbf95 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -1,7 +1,6 @@ import omit from 'omit.js'; import type { ExtractPropTypes, PropType } from 'vue'; -import { computed, onMounted, ref, toRef } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, onMounted, ref, toRef, defineComponent } from 'vue'; import Tooltip from '../tooltip'; import abstractTooltipProps from '../tooltip/abstractTooltipProps'; import PropTypes from '../_util/vue-types'; diff --git a/components/popover/__tests__/index.test.js b/components/popover/__tests__/index.test.js index 0656831f7..1b05750af 100644 --- a/components/popover/__tests__/index.test.js +++ b/components/popover/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Popover from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/progress/Steps.tsx b/components/progress/Steps.tsx index 6d7543aec..a6fb3e720 100644 --- a/components/progress/Steps.tsx +++ b/components/progress/Steps.tsx @@ -1,6 +1,5 @@ import type { ExtractPropTypes, PropType, VNodeChild } from 'vue'; -import { computed } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, defineComponent } from 'vue'; import PropTypes from '../_util/vue-types'; import type { ProgressSize } from './props'; import { progressProps } from './props'; diff --git a/components/progress/__tests__/index.test.js b/components/progress/__tests__/index.test.js index 2694a167f..c094c6c28 100644 --- a/components/progress/__tests__/index.test.js +++ b/components/progress/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import { handleGradient, sortGradient } from '../Line'; import Progress from '..'; import ProgressSteps from '../Steps'; diff --git a/components/radio/__tests__/group.test.js b/components/radio/__tests__/group.test.js index e05ea9af9..17bcccd0a 100644 --- a/components/radio/__tests__/group.test.js +++ b/components/radio/__tests__/group.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Radio from '../Radio'; import RadioGroup from '../Group'; diff --git a/components/radio/__tests__/radio.test.js b/components/radio/__tests__/radio.test.js index ac7806e89..4da8a8172 100644 --- a/components/radio/__tests__/radio.test.js +++ b/components/radio/__tests__/radio.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Radio, { Group, Button } from '..'; import focusTest from '../../../tests/shared/focusTest'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/rate/index.tsx b/components/rate/index.tsx index fb690bab8..100802408 100644 --- a/components/rate/index.tsx +++ b/components/rate/index.tsx @@ -1,6 +1,5 @@ import type { ExtractPropTypes, VNode } from 'vue'; -import { watch } from 'vue'; -import { defineComponent, ref, reactive, onMounted } from 'vue'; +import { watch, defineComponent, ref, reactive, onMounted } from 'vue'; import { initDefaultProps, getPropsSlot, findDOMNode } from '../_util/props-util'; import { withInstall } from '../_util/type'; import { getOffsetLeft } from './util'; diff --git a/components/select/__tests__/index.test.js b/components/select/__tests__/index.test.js index accc2050f..16a776c80 100644 --- a/components/select/__tests__/index.test.js +++ b/components/select/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Select from '..'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined'; import focusTest from '../../../tests/shared/focusTest'; diff --git a/components/select/index.tsx b/components/select/index.tsx index cbe760a34..740ff54e3 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -1,8 +1,7 @@ import type { App, PropType, Plugin, ExtractPropTypes } from 'vue'; import { computed, defineComponent, ref } from 'vue'; import classNames from '../_util/classNames'; -import { selectProps as vcSelectProps } from '../vc-select'; -import RcSelect, { Option, OptGroup } from '../vc-select'; +import RcSelect, { selectProps as vcSelectProps, Option, OptGroup } from '../vc-select'; import type { OptionProps as OptionPropsType } from '../vc-select/Option'; import getIcons from './utils/iconUtil'; import PropTypes from '../_util/vue-types'; diff --git a/components/skeleton/__tests__/index.test.js b/components/skeleton/__tests__/index.test.js index 4fc10c427..339e156a7 100644 --- a/components/skeleton/__tests__/index.test.js +++ b/components/skeleton/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Skeleton from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/slider/SliderTooltip.tsx b/components/slider/SliderTooltip.tsx index 9e2becb23..af431692d 100644 --- a/components/slider/SliderTooltip.tsx +++ b/components/slider/SliderTooltip.tsx @@ -1,6 +1,4 @@ -import { onBeforeUnmount, watch } from 'vue'; -import { onActivated } from 'vue'; -import { defineComponent, ref } from 'vue'; +import { onBeforeUnmount, watch, onActivated, defineComponent, ref } from 'vue'; import Tooltip, { tooltipProps } from '../tooltip'; import raf from '../_util/raf'; diff --git a/components/slider/__tests__/index.test.js b/components/slider/__tests__/index.test.js index f2a1af21c..e807fb4b6 100644 --- a/components/slider/__tests__/index.test.js +++ b/components/slider/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Slider from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 3df249280..8350c9d50 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -1,13 +1,11 @@ -import type { CSSProperties, VNodeTypes } from 'vue'; -import { computed, ref } from 'vue'; -import { defineComponent } from 'vue'; +import type { CSSProperties, VNodeTypes, PropType } from 'vue'; +import { computed, ref, defineComponent } from 'vue'; import BaseMixin from '../_util/BaseMixin'; import VcSlider from '../vc-slider/src/Slider'; import VcRange from '../vc-slider/src/Range'; import VcHandle from '../vc-slider/src/Handle'; import type { VueNode } from '../_util/type'; import { withInstall } from '../_util/type'; -import type { PropType } from 'vue'; import type { TooltipPlacement } from '../tooltip/Tooltip'; import useConfigInject from '../_util/hooks/useConfigInject'; import SliderTooltip from './SliderTooltip'; diff --git a/components/spin/__tests__/delay.test.js b/components/spin/__tests__/delay.test.js index db41b9fe0..1b704ca86 100644 --- a/components/spin/__tests__/delay.test.js +++ b/components/spin/__tests__/delay.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Spin from '..'; describe('delay spinning', () => { diff --git a/components/spin/__tests__/index.test.js b/components/spin/__tests__/index.test.js index 11e2da295..621220731 100644 --- a/components/spin/__tests__/index.test.js +++ b/components/spin/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Spin from '..'; describe('Spin', () => { diff --git a/components/steps/index.tsx b/components/steps/index.tsx index c17c20192..de7dba38e 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -1,6 +1,5 @@ import type { App, ExtractPropTypes, Plugin } from 'vue'; -import { computed } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, defineComponent } from 'vue'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined'; import CheckOutlined from '@ant-design/icons-vue/CheckOutlined'; import PropTypes, { withUndefined } from '../_util/vue-types'; diff --git a/components/switch/__tests__/index.test.js b/components/switch/__tests__/index.test.js index 5770a9934..69c74dc3f 100644 --- a/components/switch/__tests__/index.test.js +++ b/components/switch/__tests__/index.test.js @@ -4,7 +4,7 @@ import focusTest from '../../../tests/shared/focusTest'; import { resetWarned } from '../../_util/warning'; import mountTest from '../../../tests/shared/mountTest'; import { ref } from 'vue'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; describe('Switch', () => { focusTest(Switch); diff --git a/components/table/Table.tsx b/components/table/Table.tsx index e9ce5a048..6f2c6ea34 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -35,8 +35,7 @@ import defaultLocale from '../locale/en_US'; import type { SizeType } from '../config-provider'; import devWarning from '../vc-util/devWarning'; import type { PropType } from 'vue'; -import { reactive, ref } from 'vue'; -import { computed, defineComponent, toRef, watchEffect } from 'vue'; +import { reactive, ref, computed, defineComponent, toRef, watchEffect } from 'vue'; import type { DefaultRecordType } from '../vc-table/interface'; import useBreakpoint from '../_util/hooks/useBreakpoint'; import useConfigInject from '../_util/hooks/useConfigInject'; diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js index 16702e785..8247425cd 100644 --- a/components/table/__tests__/Table.filter.test.js +++ b/components/table/__tests__/Table.filter.test.js @@ -1,7 +1,6 @@ import * as Vue from 'vue'; import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; -import { sleep } from '../../../tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import Table from '..'; function $$(className) { diff --git a/components/table/__tests__/Table.pagination.test.js b/components/table/__tests__/Table.pagination.test.js index 83f10d7d5..ead27fb76 100644 --- a/components/table/__tests__/Table.pagination.test.js +++ b/components/table/__tests__/Table.pagination.test.js @@ -1,8 +1,7 @@ import { mount } from '@vue/test-utils'; import Table from '..'; import * as Vue from 'vue'; -import { asyncExpect } from '@/tests/utils'; -import { sleep } from '../../../tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; describe('Table.pagination', () => { const columns = [ diff --git a/components/table/__tests__/Table.rowSelection.test.js b/components/table/__tests__/Table.rowSelection.test.js index b8c8fb449..455c9bc7a 100644 --- a/components/table/__tests__/Table.rowSelection.test.js +++ b/components/table/__tests__/Table.rowSelection.test.js @@ -1,7 +1,6 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import Table from '..'; -import { sleep } from '../../../tests/utils'; describe('Table.rowSelection', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); diff --git a/components/table/__tests__/Table.sorter.test.js b/components/table/__tests__/Table.sorter.test.js index 4cb23bc7d..157cea84f 100644 --- a/components/table/__tests__/Table.sorter.test.js +++ b/components/table/__tests__/Table.sorter.test.js @@ -1,6 +1,6 @@ import * as Vue from 'vue'; import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Table from '..'; describe('Table.sorter', () => { diff --git a/components/table/context.ts b/components/table/context.ts index 21017a2c5..f169d8964 100644 --- a/components/table/context.ts +++ b/components/table/context.ts @@ -1,6 +1,5 @@ import type { ComputedRef, InjectionKey } from 'vue'; -import { computed } from 'vue'; -import { inject, provide } from 'vue'; +import { computed, inject, provide } from 'vue'; export type ContextSlots = { emptyText?: (...args: any[]) => any; diff --git a/components/table/hooks/useLazyKVMap.ts b/components/table/hooks/useLazyKVMap.ts index 4c13ecda3..039756097 100644 --- a/components/table/hooks/useLazyKVMap.ts +++ b/components/table/hooks/useLazyKVMap.ts @@ -1,6 +1,5 @@ import type { Ref } from 'vue'; -import { watch } from 'vue'; -import { ref } from 'vue'; +import { watch, ref } from 'vue'; import type { Key, GetRowKey } from '../interface'; interface MapCache { diff --git a/components/tabs/__tests__/index.test.js b/components/tabs/__tests__/index.test.js index a5701e1db..f5332d800 100644 --- a/components/tabs/__tests__/index.test.js +++ b/components/tabs/__tests__/index.test.js @@ -1,7 +1,5 @@ import { mount } from '@vue/test-utils'; -import Tabs from '..'; - -const { TabPane } = Tabs; +import Tabs, { TabPane } from '..'; describe('Tabs', () => { describe('editable-card', () => { diff --git a/components/tag/__tests__/index.test.js b/components/tag/__tests__/index.test.js index f752b6cc1..2e3328201 100644 --- a/components/tag/__tests__/index.test.js +++ b/components/tag/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Tag from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/tooltip/Tooltip.tsx b/components/tooltip/Tooltip.tsx index f1ab5d1ea..38abe7636 100644 --- a/components/tooltip/Tooltip.tsx +++ b/components/tooltip/Tooltip.tsx @@ -1,6 +1,5 @@ import type { ExtractPropTypes, CSSProperties } from 'vue'; -import { computed, watch } from 'vue'; -import { defineComponent, onMounted, ref } from 'vue'; +import { computed, watch, defineComponent, onMounted, ref } from 'vue'; import VcTooltip from '../vc-tooltip'; import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; diff --git a/components/tooltip/__tests__/tooltip.test.js b/components/tooltip/__tests__/tooltip.test.js index 90fd1ad27..3c413a1ff 100644 --- a/components/tooltip/__tests__/tooltip.test.js +++ b/components/tooltip/__tests__/tooltip.test.js @@ -1,4 +1,4 @@ -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import { mount } from '@vue/test-utils'; import Tooltip from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/transfer/__tests__/index.test.js b/components/transfer/__tests__/index.test.js index ab2a3f18a..ea280f3e2 100644 --- a/components/transfer/__tests__/index.test.js +++ b/components/transfer/__tests__/index.test.js @@ -1,8 +1,7 @@ import { mount } from '@vue/test-utils'; import Transfer from '..'; import * as Vue from 'vue'; -import { sleep } from '../../../tests/utils'; -import { asyncExpect } from '@/tests/utils'; +import { sleep, asyncExpect } from '../../../tests/utils'; import mountTest from '../../../tests/shared/mountTest'; const listCommonProps = { diff --git a/components/transfer/__tests__/search.test.js b/components/transfer/__tests__/search.test.js index 1f3ffb466..8c98826a9 100644 --- a/components/transfer/__tests__/search.test.js +++ b/components/transfer/__tests__/search.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect } from '@/tests/utils'; +import { asyncExpect } from '../../../tests/utils'; import Search from '../search'; import Transfer from '../index'; diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index 7199672e3..2ec864800 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -1,6 +1,5 @@ import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'; -import { watchEffect } from 'vue'; -import { defineComponent, ref, watch } from 'vue'; +import { watchEffect, defineComponent, ref, watch } from 'vue'; import PropTypes from '../_util/vue-types'; import { getPropsSlot } from '../_util/props-util'; import classNames from '../_util/classNames'; diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx index 2bb2e227b..a82661498 100644 --- a/components/transfer/list.tsx +++ b/components/transfer/list.tsx @@ -8,8 +8,7 @@ import Dropdown from '../dropdown'; import Search from './search'; import ListBody from './ListBody'; import type { VNode, VNodeTypes, ExtractPropTypes, PropType } from 'vue'; -import { watchEffect, computed } from 'vue'; -import { defineComponent, ref } from 'vue'; +import { watchEffect, computed, defineComponent, ref } from 'vue'; import type { RadioChangeEvent } from '../radio/interface'; import type { TransferItem } from './index'; diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index e094e6db0..97d613ec6 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -1,6 +1,5 @@ import type { App, ExtractPropTypes, Plugin, PropType } from 'vue'; -import { computed, ref, watchEffect } from 'vue'; -import { defineComponent } from 'vue'; +import { computed, ref, watchEffect, defineComponent } from 'vue'; import VcTreeSelect, { TreeNode, SHOW_ALL, diff --git a/components/tree/DirectoryTree.tsx b/components/tree/DirectoryTree.tsx index 6a3b319c8..28743f91f 100644 --- a/components/tree/DirectoryTree.tsx +++ b/components/tree/DirectoryTree.tsx @@ -1,15 +1,12 @@ import type { ExtractPropTypes, PropType } from 'vue'; -import { nextTick, onUpdated, ref, watch } from 'vue'; -import { defineComponent } from 'vue'; +import { nextTick, onUpdated, ref, watch, defineComponent } from 'vue'; import debounce from 'lodash-es/debounce'; import FolderOpenOutlined from '@ant-design/icons-vue/FolderOpenOutlined'; import FolderOutlined from '@ant-design/icons-vue/FolderOutlined'; import FileOutlined from '@ant-design/icons-vue/FileOutlined'; import classNames from '../_util/classNames'; -import type { AntdTreeNodeAttribute } from './Tree'; -import { treeProps } from './Tree'; -import type { TreeProps } from './Tree'; -import Tree from './Tree'; +import type { AntdTreeNodeAttribute, TreeProps } from './Tree'; +import Tree, { treeProps } from './Tree'; import initDefaultProps from '../_util/props-util/initDefaultProps'; import { convertDataToEntities, convertTreeToData } from '../vc-tree/utils/treeUtil'; import type { DataNode, EventDataNode, Key } from '../vc-tree/interface'; diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 5a70ab8d6..9673f85a0 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -1,7 +1,5 @@ import type { PropType, ExtractPropTypes } from 'vue'; -import { watchEffect } from 'vue'; -import { ref } from 'vue'; -import { defineComponent } from 'vue'; +import { watchEffect, ref, defineComponent } from 'vue'; import classNames from '../_util/classNames'; import VcTree, { TreeNode } from '../vc-tree'; import PropTypes from '../_util/vue-types'; diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index 5e67d9567..9e49aa70d 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -3,7 +3,7 @@ import LocaleReceiver from '../locale-provider/LocaleReceiver'; import warning from '../_util/warning'; import TransButton from '../_util/transButton'; import raf from '../_util/raf'; -import isStyleSupport from '../_util/styleChecker'; +import { isStyleSupport } from '../_util/styleChecker'; import Editable from './Editable'; import measure from './util'; import PropTypes from '../_util/vue-types'; diff --git a/components/typography/__tests__/index.test.js b/components/typography/__tests__/index.test.js index 941a042c9..92b6f810c 100644 --- a/components/typography/__tests__/index.test.js +++ b/components/typography/__tests__/index.test.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import { asyncExpect, sleep } from '@/tests/utils'; +import { asyncExpect, sleep } from '../../../tests/utils'; import KeyCode from '../../_util/KeyCode'; import copy from '../../_util/copy-to-clipboard'; import Typography from '..'; diff --git a/components/vc-align/Align.tsx b/components/vc-align/Align.tsx index de1f793ba..2ac328952 100644 --- a/components/vc-align/Align.tsx +++ b/components/vc-align/Align.tsx @@ -1,6 +1,14 @@ import type { PropType } from 'vue'; -import { nextTick } from 'vue'; -import { defineComponent, ref, computed, onMounted, onUpdated, watch, onUnmounted } from 'vue'; +import { + nextTick, + defineComponent, + ref, + computed, + onMounted, + onUpdated, + watch, + onUnmounted, +} from 'vue'; import { alignElement, alignPoint } from 'dom-align'; import addEventListener from '../vc-util/Dom/addEventListener'; import { cloneElement } from '../_util/vnode'; diff --git a/components/vc-cascader/Cascader.jsx b/components/vc-cascader/Cascader.jsx index ee532cb16..457871b24 100644 --- a/components/vc-cascader/Cascader.jsx +++ b/components/vc-cascader/Cascader.jsx @@ -1,11 +1,10 @@ -import { getComponent, getSlot } from '../_util/props-util'; +import { getComponent, getSlot , hasProp, getEvents } from '../_util/props-util'; import PropTypes from '../_util/vue-types'; import Trigger from '../vc-trigger'; import Menus from './Menus'; import KeyCode from '../_util/KeyCode'; import arrayTreeFilter from 'array-tree-filter'; import shallowEqualArrays from 'shallow-equal/arrays'; -import { hasProp, getEvents } from '../_util/props-util'; import BaseMixin from '../_util/BaseMixin'; import { cloneElement } from '../_util/vnode'; import { defineComponent } from 'vue'; diff --git a/components/vc-mentions/src/Mentions.tsx b/components/vc-mentions/src/Mentions.tsx index 923f39d22..15f1bde4b 100644 --- a/components/vc-mentions/src/Mentions.tsx +++ b/components/vc-mentions/src/Mentions.tsx @@ -1,6 +1,7 @@ import type { ExtractPropTypes } from 'vue'; -import { toRef, watchEffect } from 'vue'; import { + toRef, + watchEffect, defineComponent, provide, withDirectives, diff --git a/components/vc-picker/hooks/usePickerInput.ts b/components/vc-picker/hooks/usePickerInput.ts index 5518e11f8..316f32d2c 100644 --- a/components/vc-picker/hooks/usePickerInput.ts +++ b/components/vc-picker/hooks/usePickerInput.ts @@ -1,9 +1,5 @@ import type { ComputedRef, HTMLAttributes, Ref } from 'vue'; -import { onBeforeUnmount } from 'vue'; -import { watchEffect } from 'vue'; -import { watch } from 'vue'; -import { ref } from 'vue'; -import { computed } from 'vue'; +import { onBeforeUnmount, watchEffect, watch, ref, computed } from 'vue'; import type { FocusEventHandler } from '../../_util/EventInterface'; import KeyCode from '../../_util/KeyCode'; import { addGlobalMousedownEvent, getTargetFromEvent } from '../utils/uiUtil'; diff --git a/components/vc-picker/hooks/useRangeViewDates.ts b/components/vc-picker/hooks/useRangeViewDates.ts index 274c295c9..f73ba09f1 100644 --- a/components/vc-picker/hooks/useRangeViewDates.ts +++ b/components/vc-picker/hooks/useRangeViewDates.ts @@ -3,9 +3,7 @@ import type { GenerateConfig } from '../generate'; import { getValue, updateValues } from '../utils/miscUtil'; import { getClosingViewDate, isSameYear, isSameMonth, isSameDecade } from '../utils/dateUtil'; import type { Ref } from 'vue'; -import { watch } from 'vue'; -import { computed } from 'vue'; -import { ref } from 'vue'; +import { watch, computed, ref } from 'vue'; function getStartEndDistance( startDate: DateType, diff --git a/components/vc-select/Select.tsx b/components/vc-select/Select.tsx index 6664a152a..ac1051831 100644 --- a/components/vc-select/Select.tsx +++ b/components/vc-select/Select.tsx @@ -43,8 +43,7 @@ import { fillOptionsWithMissingValue, } from './utils/valueUtil'; import type { SelectProps } from './generate'; -import { selectBaseProps } from './generate'; -import generateSelector from './generate'; +import generateSelector, { selectBaseProps } from './generate'; import type { DefaultValueType } from './interface/generator'; import warningProps from './utils/warningPropsUtil'; import { defineComponent, ref } from 'vue'; diff --git a/components/vc-select/Selector/SingleSelector.tsx b/components/vc-select/Selector/SingleSelector.tsx index 1f4a64dd7..5698d52fe 100644 --- a/components/vc-select/Selector/SingleSelector.tsx +++ b/components/vc-select/Selector/SingleSelector.tsx @@ -2,8 +2,7 @@ import pickAttrs from '../../_util/pickAttrs'; import Input from './Input'; import type { InnerSelectorProps } from './interface'; import type { VNodeChild } from 'vue'; -import { Fragment } from 'vue'; -import { computed, defineComponent, ref, watch } from 'vue'; +import { Fragment, computed, defineComponent, ref, watch } from 'vue'; import PropTypes from '../../_util/vue-types'; import { useInjectTreeSelectContext } from '../../vc-tree-select/Context'; diff --git a/components/vc-select/generate.tsx b/components/vc-select/generate.tsx index 94f37bb04..a7c8f1b02 100644 --- a/components/vc-select/generate.tsx +++ b/components/vc-select/generate.tsx @@ -37,8 +37,8 @@ import useSelectTriggerControl from './hooks/useSelectTriggerControl'; import useCacheDisplayValue from './hooks/useCacheDisplayValue'; import useCacheOptions from './hooks/useCacheOptions'; import type { CSSProperties, PropType, VNode, VNodeChild } from 'vue'; -import { getCurrentInstance } from 'vue'; import { + getCurrentInstance, computed, defineComponent, onBeforeUnmount, diff --git a/components/vc-select/interface/index.ts b/components/vc-select/interface/index.ts index 28cca156c..8c70ef44b 100644 --- a/components/vc-select/interface/index.ts +++ b/components/vc-select/interface/index.ts @@ -1,10 +1,9 @@ -import type * as Vue from 'vue'; -import type { VNode } from 'vue'; +import type { VNode, VNodeChild, CSSProperties } from 'vue'; import type { Key, RawValueType } from './generator'; export type RenderDOMFunc = (props: any) => HTMLElement; -export type RenderNode = Vue.VNodeChild | ((props: any) => Vue.VNodeChild); +export type RenderNode = VNodeChild | ((props: any) => VNodeChild); export type Mode = 'multiple' | 'tags' | 'combobox'; @@ -21,8 +20,8 @@ export interface OptionCoreData { value?: Key; title?: string; class?: string; - style?: Vue.CSSProperties; - label?: Vue.VNodeChild; + style?: CSSProperties; + label?: VNodeChild; /** @deprecated Only works when use `children` as option data */ children?: VNode[] | JSX.Element[]; } @@ -34,10 +33,10 @@ export interface OptionData extends OptionCoreData { export interface OptionGroupData { key?: Key; - label?: Vue.VNodeChild; + label?: VNodeChild; options: OptionData[]; class?: string; - style?: Vue.CSSProperties; + style?: CSSProperties; /** Save for customize data */ [prop: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any diff --git a/components/vc-slider/src/Handle.tsx b/components/vc-slider/src/Handle.tsx index ccad32dd3..8174f568c 100644 --- a/components/vc-slider/src/Handle.tsx +++ b/components/vc-slider/src/Handle.tsx @@ -1,10 +1,8 @@ import type { CSSProperties } from 'vue'; -import { computed, defineComponent, ref } from 'vue'; +import { computed, defineComponent, ref, onMounted, onBeforeUnmount } from 'vue'; import classNames from '../../_util/classNames'; import PropTypes from '../../_util/vue-types'; import addEventListener from '../../vc-util/Dom/addEventListener'; -import { onMounted } from 'vue'; -import { onBeforeUnmount } from 'vue'; export default defineComponent({ name: 'Handle', diff --git a/components/vc-tree-select/hooks/useKeyValueMap.ts b/components/vc-tree-select/hooks/useKeyValueMap.ts index d8183601f..0a099f55a 100644 --- a/components/vc-tree-select/hooks/useKeyValueMap.ts +++ b/components/vc-tree-select/hooks/useKeyValueMap.ts @@ -1,6 +1,5 @@ import type { ComputedRef, Ref } from 'vue'; -import { ref } from 'vue'; -import { watchEffect } from 'vue'; +import { ref, watchEffect } from 'vue'; import type { FlattenDataNode, Key, RawValueType } from '../interface'; /** diff --git a/components/vc-tree-select/props.ts b/components/vc-tree-select/props.ts index cae99fe47..98b40c432 100644 --- a/components/vc-tree-select/props.ts +++ b/components/vc-tree-select/props.ts @@ -1,11 +1,6 @@ import type { ExtractPropTypes, PropType } from 'vue'; -import type { DataNode } from './interface'; -import { selectBaseProps } from '../vc-select'; -import type { FilterFunc } from '../vc-select/interface/generator'; -import omit from '../_util/omit'; -import type { Key } from '../_util/type'; -import PropTypes from '../_util/vue-types'; import type { + DataNode, ChangeEventExtra, DefaultValueType, FieldNames, @@ -15,6 +10,11 @@ import type { RawValueType, SimpleModeConfig, } from './interface'; +import { selectBaseProps } from '../vc-select'; +import type { FilterFunc } from '../vc-select/interface/generator'; +import omit from '../_util/omit'; +import type { Key } from '../_util/type'; +import PropTypes from '../_util/vue-types'; import type { CheckedStrategy } from './utils/strategyUtil'; export function optionListProps() { diff --git a/components/vc-tree/MotionTreeNode.tsx b/components/vc-tree/MotionTreeNode.tsx index 3437c658f..eaf175edb 100644 --- a/components/vc-tree/MotionTreeNode.tsx +++ b/components/vc-tree/MotionTreeNode.tsx @@ -4,8 +4,16 @@ import type { TreeNodeRequiredProps } from './utils/treeUtil'; import { getTreeNodeProps } from './utils/treeUtil'; import { useInjectTreeContext } from './contextTypes'; import type { PropType } from 'vue'; -import { computed, nextTick } from 'vue'; -import { defineComponent, onBeforeUnmount, onMounted, ref, Transition, watch } from 'vue'; +import { + computed, + nextTick, + defineComponent, + onBeforeUnmount, + onMounted, + ref, + Transition, + watch, +} from 'vue'; import { treeNodeProps } from './props'; import { collapseMotion } from '../_util/transition'; diff --git a/components/vc-tree/contextTypes.ts b/components/vc-tree/contextTypes.ts index 24c4d1a40..b8d0c978c 100644 --- a/components/vc-tree/contextTypes.ts +++ b/components/vc-tree/contextTypes.ts @@ -4,9 +4,7 @@ */ import type { ComputedRef, InjectionKey, PropType } from 'vue'; -import { inject } from 'vue'; -import { computed } from 'vue'; -import { defineComponent, provide } from 'vue'; +import { inject, computed, defineComponent, provide } from 'vue'; import type { VueNode } from '../_util/type'; import type { IconType, diff --git a/components/vc-trigger/Popup/useVisibleStatus.ts b/components/vc-trigger/Popup/useVisibleStatus.ts index abcbc0356..331e7f4a5 100644 --- a/components/vc-trigger/Popup/useVisibleStatus.ts +++ b/components/vc-trigger/Popup/useVisibleStatus.ts @@ -1,7 +1,5 @@ import type { Ref } from 'vue'; -import { nextTick } from 'vue'; -import { onBeforeUnmount } from 'vue'; -import { ref, watch } from 'vue'; +import { nextTick, onBeforeUnmount, ref, watch } from 'vue'; import raf from '../../_util/raf'; /** diff --git a/package.json b/package.json index 266d095a0..f8011ea9c 100644 --- a/package.json +++ b/package.json @@ -141,6 +141,7 @@ "eslint": "^7.25.0", "eslint-config-prettier": "^8.0.0", "eslint-plugin-html": "^6.0.0", + "eslint-plugin-import": "^2.24.2", "eslint-plugin-jest": "^24.3.6", "eslint-plugin-markdown": "^2.0.0", "eslint-plugin-no-explicit-type-exports": "^0.11.10",