diff --git a/.eslintrc b/.eslintrc index e719c37e1..c094c3d6f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,7 @@ "parser": "babel-eslint" }, "extends": ["plugin:vue/vue3-recommended", "prettier"], - "plugins": ["markdown"], + "plugins": ["markdown", "jest"], "overrides": [ { "files": ["**/demo/*.md"], diff --git a/.prettierrc b/.prettierrc index 84d393d19..5989126d7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,7 @@ "trailingComma": "all", "printWidth": 100, "proseWrap": "never", + "arrowParens": "avoid", "overrides": [ { "files": ".prettierrc", diff --git a/antd-tools/getBabelCommonConfig.js b/antd-tools/getBabelCommonConfig.js index 20f5fa70d..a58b0becc 100644 --- a/antd-tools/getBabelCommonConfig.js +++ b/antd-tools/getBabelCommonConfig.js @@ -1,6 +1,6 @@ const { resolve } = require('./utils/projectHelper'); -module.exports = function(modules) { +module.exports = function (modules) { const plugins = [ [ resolve('@babel/plugin-transform-typescript'), diff --git a/antd-tools/getTSCommonConfig.js b/antd-tools/getTSCommonConfig.js index f47249d89..d935888c4 100644 --- a/antd-tools/getTSCommonConfig.js +++ b/antd-tools/getTSCommonConfig.js @@ -4,7 +4,7 @@ const fs = require('fs'); const assign = require('object-assign'); const { getProjectPath } = require('./utils/projectHelper'); -module.exports = function() { +module.exports = function () { let my = {}; if (fs.existsSync(getProjectPath('tsconfig.json'))) { my = require(getProjectPath('tsconfig.json')); diff --git a/antd-tools/gulpfile.js b/antd-tools/gulpfile.js index b44d485f7..2e99c1c51 100644 --- a/antd-tools/gulpfile.js +++ b/antd-tools/gulpfile.js @@ -80,7 +80,7 @@ function compileTs(stream) { return stream .pipe(ts(tsConfig)) .js.pipe( - through2.obj(function(file, encoding, next) { + through2.obj(function (file, encoding, next) { // console.log(file.path, file.base); file.path = file.path.replace(/\.[jt]sx$/, '.js'); this.push(file); @@ -146,7 +146,7 @@ function compile(modules) { const less = gulp .src(['components/**/*.less']) .pipe( - through2.obj(function(file, encoding, next) { + through2.obj(function (file, encoding, next) { this.push(file.clone()); if ( file.path.match(/\/style\/index\.less$/) || diff --git a/antd-tools/utils/getChangelog.js b/antd-tools/utils/getChangelog.js index 381183e94..b22396784 100644 --- a/antd-tools/utils/getChangelog.js +++ b/antd-tools/utils/getChangelog.js @@ -1,10 +1,7 @@ const fs = require('fs'); module.exports = function getChangelog(file, version) { - const lines = fs - .readFileSync(file) - .toString() - .split('\n'); + const lines = fs.readFileSync(file).toString().split('\n'); const changeLog = []; const startPattern = new RegExp(`^## ${version}`); const stopPattern = /^## /; // 前一个版本 diff --git a/antd-tools/utils/getRunCmdEnv.js b/antd-tools/utils/getRunCmdEnv.js index 24d8ca99e..c7b474bb3 100644 --- a/antd-tools/utils/getRunCmdEnv.js +++ b/antd-tools/utils/getRunCmdEnv.js @@ -11,13 +11,7 @@ module.exports = function getRunCmdEnv() { const nodeModulesBinDir = path.join(__dirname, '../../node_modules/.bin'); Object.entries(env) - .filter( - v => - v - .slice(0, 1) - .pop() - .toLowerCase() === 'path', - ) + .filter(v => v.slice(0, 1).pop().toLowerCase() === 'path') .forEach(v => { const key = v.slice(0, 1).pop(); env[key] = env[key] ? `${nodeModulesBinDir}:${env[key]}` : nodeModulesBinDir; diff --git a/antd-tools/utils/projectHelper.js b/antd-tools/utils/projectHelper.js index 3b9a19c9f..79cdb57cc 100644 --- a/antd-tools/utils/projectHelper.js +++ b/antd-tools/utils/projectHelper.js @@ -20,7 +20,7 @@ function injectRequire() { const Module = require('module'); const oriRequire = Module.prototype.require; - Module.prototype.require = function(...args) { + Module.prototype.require = function (...args) { const moduleName = args[0]; try { return oriRequire.apply(this, args); diff --git a/components/_util/component-classes.ts b/components/_util/component-classes.ts index 4682d9693..fc854ec05 100644 --- a/components/_util/component-classes.ts +++ b/components/_util/component-classes.ts @@ -163,6 +163,6 @@ export class ClassList { * @return {ClassList} * @api public */ -export default function(el: Element): ClassList { +export default function (el: Element): ClassList { return new ClassList(el); } diff --git a/components/_util/copy-to-clipboard/index.ts b/components/_util/copy-to-clipboard/index.ts index 998f04373..bc69aae33 100644 --- a/components/_util/copy-to-clipboard/index.ts +++ b/components/_util/copy-to-clipboard/index.ts @@ -52,7 +52,7 @@ function copy(text: string, options?: Options): boolean { mark.style.MozUserSelect = 'text'; mark.style.msUserSelect = 'text'; mark.style.userSelect = 'text'; - mark.addEventListener('copy', function(e) { + mark.addEventListener('copy', function (e) { e.stopPropagation(); if (options.format) { e.preventDefault(); diff --git a/components/_util/copy-to-clipboard/toggle-selection.ts b/components/_util/copy-to-clipboard/toggle-selection.ts index d6ece1612..e422d1efa 100644 --- a/components/_util/copy-to-clipboard/toggle-selection.ts +++ b/components/_util/copy-to-clipboard/toggle-selection.ts @@ -3,7 +3,7 @@ const deselectCurrent = (): (() => void) => { const selection = document.getSelection(); if (!selection.rangeCount) { - return function() {}; + return function () {}; } let active = document.activeElement as any; @@ -26,11 +26,11 @@ const deselectCurrent = (): (() => void) => { } selection.removeAllRanges(); - return function() { + return function () { selection.type === 'Caret' && selection.removeAllRanges(); if (!selection.rangeCount) { - ranges.forEach(function(range) { + ranges.forEach(function (range) { selection.addRange(range); }); } diff --git a/components/_util/dom-closest.js b/components/_util/dom-closest.js index 13f73f7d3..6d4262c7e 100644 --- a/components/_util/dom-closest.js +++ b/components/_util/dom-closest.js @@ -11,7 +11,7 @@ import matches from './dom-matches'; * @param context {Element=} * @return {Element} */ -export default function(element, selector, context) { +export default function (element, selector, context) { context = context || document; // guard against orphans element = { parentNode: element }; diff --git a/components/_util/getRequestAnimationFrame.js b/components/_util/getRequestAnimationFrame.js index 2a6413e5b..25bdc2ab2 100644 --- a/components/_util/getRequestAnimationFrame.js +++ b/components/_util/getRequestAnimationFrame.js @@ -2,10 +2,10 @@ const availablePrefixs = ['moz', 'ms', 'webkit']; function requestAnimationFramePolyfill() { let lastTime = 0; - return function(callback) { + return function (callback) { const currTime = new Date().getTime(); const timeToCall = Math.max(0, 16 - (currTime - lastTime)); - const id = window.setTimeout(function() { + const id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; diff --git a/components/_util/hooks/useSize.ts b/components/_util/hooks/useSize.ts index c3bbf0612..9ae706b63 100644 --- a/components/_util/hooks/useSize.ts +++ b/components/_util/hooks/useSize.ts @@ -18,7 +18,7 @@ const useInjectSize = (props?: Record): ComputedRef = ? computed(() => props.size) : inject( sizeProvider, - computed(() => ('default' as unknown) as T), + computed(() => 'default' as unknown as T), ); return size; }; diff --git a/components/_util/json2mq.js b/components/_util/json2mq.js index e3095c35c..2418d7c67 100644 --- a/components/_util/json2mq.js +++ b/components/_util/json2mq.js @@ -3,23 +3,23 @@ * https://github.com/akiran/json2mq.git */ -const camel2hyphen = function(str) { +const camel2hyphen = function (str) { return str - .replace(/[A-Z]/g, function(match) { + .replace(/[A-Z]/g, function (match) { return '-' + match.toLowerCase(); }) .toLowerCase(); }; -const isDimension = function(feature) { +const isDimension = function (feature) { const re = /[height|width]$/; return re.test(feature); }; -const obj2mq = function(obj) { +const obj2mq = function (obj) { let mq = ''; const features = Object.keys(obj); - features.forEach(function(feature, index) { + features.forEach(function (feature, index) { let value = obj[feature]; feature = camel2hyphen(feature); // Add px to dimension features @@ -40,14 +40,14 @@ const obj2mq = function(obj) { return mq; }; -export default function(query) { +export default function (query) { let mq = ''; if (typeof query === 'string') { return query; } // Handling array of media queries if (query instanceof Array) { - query.forEach(function(q, index) { + query.forEach(function (q, index) { mq += obj2mq(q); if (index < query.length - 1) { mq += ', '; diff --git a/components/_util/props-util/index.js b/components/_util/props-util/index.js index 2ecdecf1f..c35e796fc 100644 --- a/components/_util/props-util/index.js +++ b/components/_util/props-util/index.js @@ -28,7 +28,7 @@ const parseStyleText = (cssText = '', camel) => { const res = {}; const listDelimiter = /;(?![^(]*\))/g; const propertyDelimiter = /:(.+)/; - cssText.split(listDelimiter).forEach(function(item) { + cssText.split(listDelimiter).forEach(function (item) { if (item) { const tmp = item.split(propertyDelimiter); if (tmp.length > 1) { diff --git a/components/_util/shallowequal.js b/components/_util/shallowequal.js index 6e1dd790a..b06a5ea60 100644 --- a/components/_util/shallowequal.js +++ b/components/_util/shallowequal.js @@ -45,6 +45,6 @@ function shallowEqual(objA, objB, compare, compareContext) { return true; } -export default function(value, other, customizer, thisArg) { +export default function (value, other, customizer, thisArg) { return shallowEqual(toRaw(value), toRaw(other), customizer, thisArg); } diff --git a/components/_util/throttleByAnimationFrame.ts b/components/_util/throttleByAnimationFrame.ts index 9f13d0b72..ac36d70f4 100644 --- a/components/_util/throttleByAnimationFrame.ts +++ b/components/_util/throttleByAnimationFrame.ts @@ -19,7 +19,7 @@ export default function throttleByAnimationFrame(fn: (...args: any[]) => void) { export function throttleByAnimationFrameDecorator() { // eslint-disable-next-line func-names - return function(target: any, key: string, descriptor: any) { + return function (target: any, key: string, descriptor: any) { const fn = descriptor.value; let definingProperty = false; return { diff --git a/components/_util/type.ts b/components/_util/type.ts index 84c45e5ae..6276cc310 100644 --- a/components/_util/type.ts +++ b/components/_util/type.ts @@ -34,7 +34,7 @@ export type VueNode = VNodeChild | JSX.Element; export const withInstall = (comp: T) => { const c = comp as any; - c.install = function(app: App) { + c.install = function (app: App) { app.component(c.displayName || c.name, comp); }; diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 41772337b..2c42f3eac 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -175,9 +175,9 @@ export default defineComponent({ `${prefixCls.value}-link-title-active`, )[0]; if (linkNode) { - (inkNodeRef.value as HTMLElement).style.top = `${linkNode.offsetTop + - linkNode.clientHeight / 2 - - 4.5}px`; + (inkNodeRef.value as HTMLElement).style.top = `${ + linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5 + }px`; } }; diff --git a/components/anchor/index.tsx b/components/anchor/index.tsx index ecea1a192..ec300117c 100644 --- a/components/anchor/index.tsx +++ b/components/anchor/index.tsx @@ -5,7 +5,7 @@ import AnchorLink, { AnchorLinkProps } from './AnchorLink'; Anchor.Link = AnchorLink; /* istanbul ignore next */ -Anchor.install = function(app: App) { +Anchor.install = function (app: App) { app.component(Anchor.name, Anchor); app.component(Anchor.Link.name, Anchor.Link); return app; diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 41688e666..8844b6b53 100644 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -146,7 +146,7 @@ const AutoComplete = defineComponent({ }); /* istanbul ignore next */ -AutoComplete.install = function(app: App) { +AutoComplete.install = function (app: App) { app.component(AutoComplete.name, AutoComplete); app.component(AutoComplete.Option.displayName, AutoComplete.Option); app.component(AutoComplete.OptGroup.displayName, AutoComplete.OptGroup); diff --git a/components/avatar/index.ts b/components/avatar/index.ts index d082fada0..27126fb6e 100644 --- a/components/avatar/index.ts +++ b/components/avatar/index.ts @@ -8,7 +8,7 @@ export { AvatarGroupProps } from './Group'; Avatar.Group = Group; /* istanbul ignore next */ -Avatar.install = function(app: App) { +Avatar.install = function (app: App) { app.component(Avatar.name, Avatar); app.component(Group.name, Group); return app; diff --git a/components/badge/Badge.tsx b/components/badge/Badge.tsx index 6e16cf613..988814af4 100644 --- a/components/badge/Badge.tsx +++ b/components/badge/Badge.tsx @@ -44,9 +44,11 @@ export default defineComponent({ // ================================ Misc ================================ const numberedDisplayCount = computed(() => { - return ((props.count as number) > (props.overflowCount as number) - ? `${props.overflowCount}+` - : props.count) as string | number | null; + return ( + (props.count as number) > (props.overflowCount as number) + ? `${props.overflowCount}+` + : props.count + ) as string | number | null; }); const hasStatus = computed( diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index ffb7f7ee2..bfd95e21b 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -35,7 +35,7 @@ export default defineComponent({ count, title, show, - component: Tag = ('sup' as unknown) as DefineComponent, + component: Tag = 'sup' as unknown as DefineComponent, class: className, style, ...restProps diff --git a/components/badge/index.ts b/components/badge/index.ts index ba77cbebf..44d649fd0 100644 --- a/components/badge/index.ts +++ b/components/badge/index.ts @@ -1,15 +1,15 @@ import { App, Plugin } from 'vue'; import Badge from './Badge'; import Ribbon from './Ribbon'; -export type { BadgeProps } from './Badge' +export type { BadgeProps } from './Badge'; -Badge.install = function(app: App) { +Badge.install = function (app: App) { app.component(Badge.name, Badge); app.component(Ribbon.name, Ribbon); return app; }; -export {Ribbon as BadgeRibbon} +export { Ribbon as BadgeRibbon }; export default Badge as typeof Badge & Plugin & { diff --git a/components/breadcrumb/index.ts b/components/breadcrumb/index.ts index c1a9ac48a..ad4d461a1 100644 --- a/components/breadcrumb/index.ts +++ b/components/breadcrumb/index.ts @@ -4,14 +4,14 @@ import BreadcrumbItem from './BreadcrumbItem'; import BreadcrumbSeparator from './BreadcrumbSeparator'; export type { BreadcrumbProps } from './Breadcrumb'; -export type { BreadcrumbItemProps } from './BreadcrumbItem'; -export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator'; +export type { BreadcrumbItemProps } from './BreadcrumbItem'; +export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator'; Breadcrumb.Item = BreadcrumbItem; Breadcrumb.Separator = BreadcrumbSeparator; /* istanbul ignore next */ -Breadcrumb.install = function(app: App) { +Breadcrumb.install = function (app: App) { app.component(Breadcrumb.name, Breadcrumb); app.component(BreadcrumbItem.name, BreadcrumbItem); app.component(BreadcrumbSeparator.name, BreadcrumbSeparator); diff --git a/components/button/index.ts b/components/button/index.ts index 45995a6a8..026dd6f34 100644 --- a/components/button/index.ts +++ b/components/button/index.ts @@ -1,17 +1,17 @@ import { App, Plugin } from 'vue'; import Button from './button'; import ButtonGroup from './button-group'; -export type {ButtonProps} from './button' +export type { ButtonProps } from './button'; Button.Group = ButtonGroup; /* istanbul ignore next */ -Button.install = function(app: App) { +Button.install = function (app: App) { app.component(Button.name, Button); app.component(ButtonGroup.name, ButtonGroup); return app; }; -export {ButtonGroup} +export { ButtonGroup }; export default Button as typeof Button & Plugin & { readonly Group: typeof ButtonGroup; diff --git a/components/card/index.ts b/components/card/index.ts index e22e3cf00..69efb13ea 100644 --- a/components/card/index.ts +++ b/components/card/index.ts @@ -3,20 +3,20 @@ import Card from './Card'; import Meta from './Meta'; import Grid from './Grid'; -export type {CardProps} from './Card' +export type { CardProps } from './Card'; Card.Meta = Meta; Card.Grid = Grid; /* istanbul ignore next */ -Card.install = function(app: App) { +Card.install = function (app: App) { app.component(Card.name, Card); app.component(Meta.name, Meta); app.component(Grid.name, Grid); return app; }; -export {Meta as CardMeta, Grid as CardGrid} +export { Meta as CardMeta, Grid as CardGrid }; export default Card as typeof Card & Plugin & { diff --git a/components/cascader/__tests__/index.test.js b/components/cascader/__tests__/index.test.js index f1f68f9bc..86dd9d7dc 100644 --- a/components/cascader/__tests__/index.test.js +++ b/components/cascader/__tests__/index.test.js @@ -110,9 +110,7 @@ describe('Cascader', () => { }); await asyncExpect(() => { - $$('.ant-cascader-menu')[0] - .querySelectorAll('.ant-cascader-menu-item')[0] - .click(); + $$('.ant-cascader-menu')[0].querySelectorAll('.ant-cascader-menu-item')[0].click(); }); await asyncExpect(() => { @@ -120,9 +118,7 @@ describe('Cascader', () => { }); await asyncExpect(() => { - $$('.ant-cascader-menu')[1] - .querySelectorAll('.ant-cascader-menu-item')[0] - .click(); + $$('.ant-cascader-menu')[1].querySelectorAll('.ant-cascader-menu-item')[0].click(); }); await asyncExpect(() => { @@ -130,9 +126,7 @@ describe('Cascader', () => { }); await asyncExpect(() => { - $$('.ant-cascader-menu')[2] - .querySelectorAll('.ant-cascader-menu-item')[0] - .click(); + $$('.ant-cascader-menu')[2].querySelectorAll('.ant-cascader-menu-item')[0].click(); }); await asyncExpect(() => { diff --git a/components/checkbox/index.ts b/components/checkbox/index.ts index 7c3ca61ed..ca6e066b9 100644 --- a/components/checkbox/index.ts +++ b/components/checkbox/index.ts @@ -5,7 +5,7 @@ import CheckboxGroup from './Group'; Checkbox.Group = CheckboxGroup; /* istanbul ignore next */ -Checkbox.install = function(app: App) { +Checkbox.install = function (app: App) { app.component(Checkbox.name, Checkbox); app.component(CheckboxGroup.name, CheckboxGroup); return app; diff --git a/components/col/index.ts b/components/col/index.ts index 5c0d36735..5638e8181 100644 --- a/components/col/index.ts +++ b/components/col/index.ts @@ -1,4 +1,4 @@ import { Col } from '../grid'; import { withInstall } from '../_util/type'; -export type {ColProps} from '../grid' +export type { ColProps } from '../grid'; export default withInstall(Col); diff --git a/components/collapse/index.ts b/components/collapse/index.ts index ca5d6d774..8244d223d 100644 --- a/components/collapse/index.ts +++ b/components/collapse/index.ts @@ -1,20 +1,19 @@ import { App, Plugin } from 'vue'; import Collapse from './Collapse'; import CollapsePanel from './CollapsePanel'; -export type {CollapseProps} from './Collapse' -export type {CollapsePanelProps} from './CollapsePanel' - +export type { CollapseProps } from './Collapse'; +export type { CollapsePanelProps } from './CollapsePanel'; Collapse.Panel = CollapsePanel; /* istanbul ignore next */ -Collapse.install = function(app: App) { +Collapse.install = function (app: App) { app.component(Collapse.name, Collapse); app.component(CollapsePanel.name, CollapsePanel); return app; }; -export {CollapsePanel} +export { CollapsePanel }; export default Collapse as typeof Collapse & Plugin & { readonly Panel: typeof CollapsePanel; diff --git a/components/color-picker/ColorPicker.jsx b/components/color-picker/ColorPicker.jsx index e0e12f7d5..e6ee88691 100644 --- a/components/color-picker/ColorPicker.jsx +++ b/components/color-picker/ColorPicker.jsx @@ -97,7 +97,7 @@ export default { this.createPickr(); this.eventsBinding(); }, - setColor: debounce(function(val) { + setColor: debounce(function (val) { this.pickr.setColor(val); }, 1000), eventsBinding() { diff --git a/components/color-picker/index.js b/components/color-picker/index.js index abd2eec9a..3bf52f607 100644 --- a/components/color-picker/index.js +++ b/components/color-picker/index.js @@ -1,6 +1,6 @@ import ColorPicker from './ColorPicker'; /* istanbul ignore next */ -ColorPicker.install = function(app) { +ColorPicker.install = function (app) { app.component(ColorPicker.name, ColorPicker); return app; }; diff --git a/components/components.ts b/components/components.ts index 16f3e4638..e953ead65 100644 --- a/components/components.ts +++ b/components/components.ts @@ -1,4 +1,3 @@ - export type { AffixProps } from './affix'; export { default as Affix } from './affix'; @@ -6,7 +5,7 @@ export type { AnchorProps, AnchorLinkProps } from './anchor'; export { default as Anchor, AnchorLink } from './anchor'; export type { AutoCompleteProps } from './auto-complete'; -export {default as AutoComplete, AutoCompleteOptGroup, AutoCompleteOption } from './auto-complete' +export { default as AutoComplete, AutoCompleteOptGroup, AutoCompleteOption } from './auto-complete'; export type { AlertProps } from './alert'; export { default as Alert } from './alert'; @@ -86,7 +85,7 @@ export { default as Layout, LayoutHeader, LayouSider, LayouFooter, LayouContent export type { ListProps } from './list'; export { default as List, ListItem, ListItemMeta } from './list'; -export type { MessageArgsProps } from './message'; +export type { MessageArgsProps } from './message'; export { default as message } from './message'; export type { MenuProps, MenuTheme, SubMenuProps, MenuItemProps } from './menu'; @@ -131,7 +130,13 @@ export type { SelectProps } from './select'; export { default as Select, SelectOptGroup, SelectOption } from './select'; export type { SkeletonProps } from './skeleton'; -export { default as Skeleton, SkeletonButton, SkeletonAvatar, SkeletonInput, SkeletonImage } from './skeleton'; +export { + default as Skeleton, + SkeletonButton, + SkeletonAvatar, + SkeletonInput, + SkeletonImage, +} from './skeleton'; export { default as Slider } from './slider'; @@ -171,7 +176,13 @@ export type { TooltipProps } from './tooltip'; export { default as Tooltip } from './tooltip'; export type { TypographyProps } from './typography'; -export { default as Typography, TypographyLink, TypographyParagraph, TypographyText, TypographyTitle } from './typography'; +export { + default as Typography, + TypographyLink, + TypographyParagraph, + TypographyText, + TypographyTitle, +} from './typography'; export type { UploadProps } from './upload'; diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index c060e765c..58a51a888 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -195,11 +195,9 @@ describe('RangePicker', () => { $$('.ant-calendar-picker-input')[0].click(); }); await asyncExpect(() => { - expect( - $$('.ant-calendar-cell')[23] - .getAttribute('class') - .split(' '), - ).toContain('ant-calendar-in-range-cell'); + expect($$('.ant-calendar-cell')[23].getAttribute('class').split(' ')).toContain( + 'ant-calendar-in-range-cell', + ); }); }); diff --git a/components/date-picker/__tests__/showTime.test.js b/components/date-picker/__tests__/showTime.test.js index 8fa619815..d0e6de644 100644 --- a/components/date-picker/__tests__/showTime.test.js +++ b/components/date-picker/__tests__/showTime.test.js @@ -124,30 +124,22 @@ describe('RangePicker with showTime', () => { ); await asyncExpect(() => { - expect( - $$('.ant-calendar-time-picker-btn')[0] - .getAttribute('class') - .split(' '), - ).toContain('ant-calendar-time-picker-btn-disabled'); - expect( - $$('.ant-calendar-ok-btn')[0] - .getAttribute('class') - .split(' '), - ).toContain('ant-calendar-ok-btn-disabled'); + expect($$('.ant-calendar-time-picker-btn')[0].getAttribute('class').split(' ')).toContain( + 'ant-calendar-time-picker-btn-disabled', + ); + expect($$('.ant-calendar-ok-btn')[0].getAttribute('class').split(' ')).toContain( + 'ant-calendar-ok-btn-disabled', + ); }); $$('.ant-calendar-date')[10].click(); $$('.ant-calendar-date')[11].click(); await asyncExpect(() => { - expect( - $$('.ant-calendar-time-picker-btn')[0] - .getAttribute('class') - .split(' '), - ).not.toContain('ant-calendar-time-picker-btn-disabled'); - expect( - $$('.ant-calendar-ok-btn')[0] - .getAttribute('class') - .split(' '), - ).not.toContain('ant-calendar-ok-btn-disabled'); + expect($$('.ant-calendar-time-picker-btn')[0].getAttribute('class').split(' ')).not.toContain( + 'ant-calendar-time-picker-btn-disabled', + ); + expect($$('.ant-calendar-ok-btn')[0].getAttribute('class').split(' ')).not.toContain( + 'ant-calendar-ok-btn-disabled', + ); }); expect(onChangeFn).toHaveBeenCalled(); expect(onOpenChangeFn).not.toHaveBeenCalled(); diff --git a/components/date-picker/index.ts b/components/date-picker/index.ts index c4131233c..1f105e876 100755 --- a/components/date-picker/index.ts +++ b/components/date-picker/index.ts @@ -13,33 +13,33 @@ import { WeekPickerPropsTypes, } from './interface'; -const WrappedRangePicker = (wrapPicker( +const WrappedRangePicker = wrapPicker( RangePicker as any, RangePickerProps, 'date', -) as unknown) as DefineComponent; +) as unknown as DefineComponent; -const WrappedWeekPicker = (wrapPicker( +const WrappedWeekPicker = wrapPicker( WeekPicker as any, WeekPickerProps, 'week', -) as unknown) as DefineComponent; +) as unknown as DefineComponent; -const DatePicker = (wrapPicker( +const DatePicker = wrapPicker( createPicker(VcCalendar as any, DatePickerProps, 'ADatePicker'), DatePickerProps, 'date', -) as unknown) as DefineComponent & { +) as unknown as DefineComponent & { readonly RangePicker: typeof WrappedRangePicker; readonly MonthPicker: typeof MonthPicker; readonly WeekPicker: typeof WrappedWeekPicker; }; -const MonthPicker = (wrapPicker( +const MonthPicker = wrapPicker( createPicker(MonthCalendar as any, MonthPickerProps, 'AMonthPicker'), MonthPickerProps, 'month', -) as unknown) as DefineComponent; +) as unknown as DefineComponent; Object.assign(DatePicker, { RangePicker: WrappedRangePicker, @@ -48,7 +48,7 @@ Object.assign(DatePicker, { }); /* istanbul ignore next */ -DatePicker.install = function(app: App) { +DatePicker.install = function (app: App) { app.component(DatePicker.name, DatePicker); app.component(DatePicker.RangePicker.name, DatePicker.RangePicker); app.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker); diff --git a/components/date-picker/interface.tsx b/components/date-picker/interface.tsx index 2d5a24655..015eae0f2 100644 --- a/components/date-picker/interface.tsx +++ b/components/date-picker/interface.tsx @@ -56,9 +56,7 @@ export interface DatePickerPropsTypes extends PickerProps, SinglePickerProps { showTime?: Record | boolean; showToday?: boolean; open?: boolean; - disabledTime?: ( - current?: moment.Moment | null, - ) => { + disabledTime?: (current?: moment.Moment | null) => { disabledHours?: () => number[]; disabledMinutes?: () => number[]; disabledSeconds?: () => number[]; diff --git a/components/descriptions/index.tsx b/components/descriptions/index.tsx index aa04386cb..08e557155 100644 --- a/components/descriptions/index.tsx +++ b/components/descriptions/index.tsx @@ -154,9 +154,8 @@ export interface DescriptionsContextProp { contentStyle?: Ref; } -export const descriptionsContext: InjectionKey = Symbol( - 'descriptionsContext', -); +export const descriptionsContext: InjectionKey = + Symbol('descriptionsContext'); const Descriptions = defineComponent({ name: 'ADescriptions', @@ -244,7 +243,7 @@ const Descriptions = defineComponent({ }, }); -Descriptions.install = function(app: App) { +Descriptions.install = function (app: App) { app.component(Descriptions.name, Descriptions); app.component(Descriptions.Item.name, Descriptions.Item); return app; diff --git a/components/dropdown/index.ts b/components/dropdown/index.ts index d6eb1f0fc..e8be6c844 100644 --- a/components/dropdown/index.ts +++ b/components/dropdown/index.ts @@ -8,13 +8,13 @@ export type { DropdownButtonProps } from './dropdown-button'; Dropdown.Button = DropdownButton; /* istanbul ignore next */ -Dropdown.install = function(app: App) { +Dropdown.install = function (app: App) { app.component(Dropdown.name, Dropdown); app.component(DropdownButton.name, DropdownButton); return app; }; -export {DropdownButton} +export { DropdownButton }; export default Dropdown as typeof Dropdown & Plugin & { diff --git a/components/form/index.tsx b/components/form/index.tsx index f0e648d92..2eff7508d 100644 --- a/components/form/index.tsx +++ b/components/form/index.tsx @@ -1,12 +1,12 @@ import { App, Plugin } from 'vue'; -import Form, {formProps} from './Form'; -import FormItem, {formItemProps} from './FormItem'; +import Form, { formProps } from './Form'; +import FormItem, { formItemProps } from './FormItem'; export type { FormProps } from './Form'; export type { FormItemProps } from './FormItem'; /* istanbul ignore next */ -Form.install = function(app: App) { +Form.install = function (app: App) { app.component(Form.name, Form); app.component(Form.Item.name, Form.Item); return app; diff --git a/components/form/utils/validateUtil.ts b/components/form/utils/validateUtil.ts index bd8a1c91a..72cb95d47 100644 --- a/components/form/utils/validateUtil.ts +++ b/components/form/utils/validateUtil.ts @@ -211,9 +211,8 @@ export function validateRules( validateRule(name, value, rule, options, messageVariables), ); - summaryPromise = (validateFirst - ? finishOnFirstFailed(rulePromises) - : finishOnAllFailed(rulePromises) + summaryPromise = ( + validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises) ).then((errors: string[]): string[] | Promise => { if (!errors.length) { return []; diff --git a/components/image/index.tsx b/components/image/index.tsx index af9f10dc3..b123427c8 100644 --- a/components/image/index.tsx +++ b/components/image/index.tsx @@ -28,7 +28,7 @@ export { imageProps }; Image.PreviewGroup = PreviewGroup; -Image.install = function(app: App) { +Image.install = function (app: App) { app.component(Image.name, Image); app.component(Image.PreviewGroup.name, Image.PreviewGroup); return app; diff --git a/components/index.ts b/components/index.ts index ec7f25cf6..2bd014a06 100644 --- a/components/index.ts +++ b/components/index.ts @@ -4,7 +4,7 @@ import * as components from './components'; import { default as version } from './version'; export * from './components'; -export const install = function(app: App) { +export const install = function (app: App) { Object.keys(components).forEach(key => { const component = components[key]; if (component.install) { diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index 57c3f3d68..99a1d60ac 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -64,7 +64,12 @@ const InputNumber = defineComponent({ }, render() { - const { prefixCls: customizePrefixCls, size, class: className, ...others } = { + const { + prefixCls: customizePrefixCls, + size, + class: className, + ...others + } = { ...getOptionProps(this), ...this.$attrs, } as any; diff --git a/components/input/index.ts b/components/input/index.ts index 235e42207..8c2444140 100644 --- a/components/input/index.ts +++ b/components/input/index.ts @@ -11,7 +11,7 @@ Input.TextArea = TextArea; Input.Password = Password; /* istanbul ignore next */ -Input.install = function(app: App) { +Input.install = function (app: App) { app.component(Input.name, Input); app.component(Input.Group.name, Input.Group); app.component(Input.Search.name, Input.Search); diff --git a/components/layout/index.ts b/components/layout/index.ts index 036eccf54..383445c53 100644 --- a/components/layout/index.ts +++ b/components/layout/index.ts @@ -8,7 +8,7 @@ export { SiderProps } from './Sider'; Layout.Sider = Sider; /* istanbul ignore next */ -Layout.install = function(app: App) { +Layout.install = function (app: App) { app.component(Layout.name, Layout); app.component(Layout.Header.name, Layout.Header); app.component(Layout.Footer.name, Layout.Footer); diff --git a/components/list/index.tsx b/components/list/index.tsx index e939f2c5d..89b5b468c 100644 --- a/components/list/index.tsx +++ b/components/list/index.tsx @@ -322,7 +322,7 @@ const List = defineComponent({ }); /* istanbul ignore next */ -List.install = function(app: App) { +List.install = function (app: App) { app.component(List.name, List); app.component(List.Item.name, List.Item); app.component(List.Item.Meta.name, List.Item.Meta); diff --git a/components/locale-provider/__tests__/index.test.js b/components/locale-provider/__tests__/index.test.js index 372c934cd..bdc219daa 100644 --- a/components/locale-provider/__tests__/index.test.js +++ b/components/locale-provider/__tests__/index.test.js @@ -221,9 +221,10 @@ describe('Locale Provider', () => { { sync: false, attachTo: 'body' }, ); await sleep(); - const currentConfirmNode = document.querySelectorAll('.ant-modal-confirm')[ - document.querySelectorAll('.ant-modal-confirm').length - 1 - ]; + const currentConfirmNode = + document.querySelectorAll('.ant-modal-confirm')[ + document.querySelectorAll('.ant-modal-confirm').length - 1 + ]; let cancelButtonText = currentConfirmNode.querySelectorAll( '.ant-btn:not(.ant-btn-primary) span', )[0].innerHTML; diff --git a/components/locale-provider/index.tsx b/components/locale-provider/index.tsx index 38465a203..9d8c95890 100644 --- a/components/locale-provider/index.tsx +++ b/components/locale-provider/index.tsx @@ -89,7 +89,7 @@ const LocaleProvider = defineComponent({ }); /* istanbul ignore next */ -LocaleProvider.install = function(app: App) { +LocaleProvider.install = function (app: App) { app.component(LocaleProvider.name, LocaleProvider); return app; }; diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx index 46a0b7e68..714945288 100644 --- a/components/mentions/index.tsx +++ b/components/mentions/index.tsx @@ -211,7 +211,7 @@ const Mentions = defineComponent({ }); /* istanbul ignore next */ -Mentions.install = function(app: App) { +Mentions.install = function (app: App) { app.component(Mentions.name, Mentions); app.component(Mentions.Option.name, Mentions.Option); return app; diff --git a/components/menu/index.tsx b/components/menu/index.tsx index c714e0a7e..6d8275187 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -6,7 +6,7 @@ import Divider from './src/Divider'; import { App, Plugin } from 'vue'; import { MenuTheme } from './src/interface'; /* istanbul ignore next */ -Menu.install = function(app: App) { +Menu.install = function (app: App) { app.component(Menu.name, Menu); app.component(MenuItem.name, MenuItem); app.component(SubMenu.name, SubMenu); diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 6cf4412a2..13c5a8ce0 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -133,9 +133,7 @@ export interface ModalFuncProps { type getContainerFunc = () => HTMLElement; -export type ModalFunc = ( - props: ModalFuncProps, -) => { +export type ModalFunc = (props: ModalFuncProps) => { destroy: () => void; update: (newConfig: ModalFuncProps) => void; }; diff --git a/components/modal/index.tsx b/components/modal/index.tsx index 5362048c8..b4cb7c8ad 100644 --- a/components/modal/index.tsx +++ b/components/modal/index.tsx @@ -9,7 +9,7 @@ import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOu export { IActionButtonProps as ActionButtonProps } from './ActionButton'; export { ModalProps, ModalFuncProps } from './Modal'; -const info = function(props: ModalFuncProps) { +const info = function (props: ModalFuncProps) { const config = { type: 'info', icon: , @@ -19,7 +19,7 @@ const info = function(props: ModalFuncProps) { return modalConfirm(config); }; -const success = function(props: ModalFuncProps) { +const success = function (props: ModalFuncProps) { const config = { type: 'success', icon: , @@ -29,7 +29,7 @@ const success = function(props: ModalFuncProps) { return modalConfirm(config); }; -const error = function(props: ModalFuncProps) { +const error = function (props: ModalFuncProps) { const config = { type: 'error', icon: , @@ -39,7 +39,7 @@ const error = function(props: ModalFuncProps) { return modalConfirm(config); }; -const warning = function(props: ModalFuncProps) { +const warning = function (props: ModalFuncProps) { const config = { type: 'warning', icon: , @@ -75,7 +75,7 @@ Modal.destroyAll = function destroyAllFn() { }; /* istanbul ignore next */ -Modal.install = function(app: App) { +Modal.install = function (app: App) { app.component(Modal.name, Modal); return app; }; diff --git a/components/progress/line.tsx b/components/progress/line.tsx index 77d694fd0..06afa9685 100644 --- a/components/progress/line.tsx +++ b/components/progress/line.tsx @@ -51,15 +51,8 @@ export const handleGradient = strokeColor => { }; const Line = (_, { attrs, slots }) => { - const { - prefixCls, - percent, - successPercent, - strokeWidth, - size, - strokeColor, - strokeLinecap, - } = attrs; + const { prefixCls, percent, successPercent, strokeWidth, size, strokeColor, strokeLinecap } = + attrs; let backgroundProps; if (strokeColor && typeof strokeColor !== 'string') { backgroundProps = handleGradient(strokeColor); diff --git a/components/radio/index.ts b/components/radio/index.ts index 4b8ca8968..91e1b8487 100644 --- a/components/radio/index.ts +++ b/components/radio/index.ts @@ -9,7 +9,7 @@ Radio.Group = Group; Radio.Button = Button; /* istanbul ignore next */ -Radio.install = function(app: App) { +Radio.install = function (app: App) { app.component(Radio.name, Radio); app.component(Radio.Group.name, Radio.Group); app.component(Radio.Button.name, Radio.Button); diff --git a/components/result/index.tsx b/components/result/index.tsx index bf00929ac..56964e76e 100644 --- a/components/result/index.tsx +++ b/components/result/index.tsx @@ -93,7 +93,7 @@ Result.PRESENTED_IMAGE_404 = ExceptionMap[404]; Result.PRESENTED_IMAGE_500 = ExceptionMap[500]; /* istanbul ignore next */ -Result.install = function(app: App) { +Result.install = function (app: App) { app.component(Result.name, Result); return app; }; diff --git a/components/row/index.ts b/components/row/index.ts index 19df9e2a7..d2ff8b47d 100644 --- a/components/row/index.ts +++ b/components/row/index.ts @@ -1,6 +1,6 @@ import { Row } from '../grid'; import { withInstall } from '../_util/type'; -export type {RowProps} from '../grid' +export type { RowProps } from '../grid'; export default withInstall(Row); diff --git a/components/select/index.tsx b/components/select/index.tsx index 5d4497a1e..f8407b135 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -200,7 +200,7 @@ const Select = defineComponent({ }, }); /* istanbul ignore next */ -Select.install = function(app: App) { +Select.install = function (app: App) { app.component(Select.name, Select); app.component(Select.Option.displayName, Select.Option); app.component(Select.OptGroup.displayName, Select.OptGroup); diff --git a/components/skeleton/index.tsx b/components/skeleton/index.tsx index 33864b965..ff6006301 100644 --- a/components/skeleton/index.tsx +++ b/components/skeleton/index.tsx @@ -13,7 +13,7 @@ Skeleton.Input = SkeletonInput; Skeleton.Image = SkeletonImage; /* istanbul ignore next */ -Skeleton.install = function(app: App) { +Skeleton.install = function (app: App) { app.component(Skeleton.name, Skeleton); app.component(Skeleton.Button.name, SkeletonButton); app.component(Skeleton.Avatar.name, SkeletonAvatar); diff --git a/components/space/index.tsx b/components/space/index.tsx index 46d5e25ce..e896073bb 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -50,9 +50,12 @@ const Space = defineComponent({ watch( size, () => { - [horizontalSize.value, verticalSize.value] = ((Array.isArray(size.value) - ? size.value - : [size.value, size.value]) as [SpaceSize, SpaceSize]).map(item => getNumberSize(item)); + [horizontalSize.value, verticalSize.value] = ( + (Array.isArray(size.value) ? size.value : [size.value, size.value]) as [ + SpaceSize, + SpaceSize, + ] + ).map(item => getNumberSize(item)); }, { immediate: true }, ); diff --git a/components/spin/__tests__/delay.test.js b/components/spin/__tests__/delay.test.js index 70a38b600..db41b9fe0 100644 --- a/components/spin/__tests__/delay.test.js +++ b/components/spin/__tests__/delay.test.js @@ -13,12 +13,7 @@ describe('delay spinning', () => { }; const wrapper = mount(Spin, props); await asyncExpect(() => { - expect( - wrapper - .find('.ant-spin') - .classes() - .includes('ant-spin-spinning'), - ).toEqual(false); + expect(wrapper.find('.ant-spin').classes().includes('ant-spin-spinning')).toEqual(false); }); }); @@ -32,23 +27,13 @@ describe('delay spinning', () => { }; const wrapper = mount(Spin, props); - expect( - wrapper - .findAll('.ant-spin')[0] - .classes() - .includes('ant-spin-spinning'), - ).toEqual(false); + expect(wrapper.findAll('.ant-spin')[0].classes().includes('ant-spin-spinning')).toEqual(false); // use await not jest.runAllTimers() // because of https://github.com/facebook/jest/issues/3465 await new Promise(resolve => setTimeout(resolve, 500)); - expect( - wrapper - .findAll('.ant-spin')[0] - .classes() - .includes('ant-spin-spinning'), - ).toEqual(true); + expect(wrapper.findAll('.ant-spin')[0].classes().includes('ant-spin-spinning')).toEqual(true); }); it('should cancel debounce function when unmount', async () => { diff --git a/components/spin/index.ts b/components/spin/index.ts index ec92e81bc..f6032de6b 100644 --- a/components/spin/index.ts +++ b/components/spin/index.ts @@ -6,7 +6,7 @@ export { SpinProps, getSpinProps } from './Spin'; Spin.setDefaultIndicator = setDefaultIndicator; /* istanbul ignore next */ -Spin.install = function(app: App) { +Spin.install = function (app: App) { app.component(Spin.name, Spin); return app; }; diff --git a/components/statistic/__tests__/index.test.js b/components/statistic/__tests__/index.test.js index 64d9d8099..1c9587b88 100644 --- a/components/statistic/__tests__/index.test.js +++ b/components/statistic/__tests__/index.test.js @@ -65,12 +65,7 @@ describe('Statistic', () => { describe('Countdown', () => { it('render correctly', () => { - const now = moment() - .add(2, 'd') - .add(11, 'h') - .add(28, 'm') - .add(9, 's') - .add(3, 'ms'); + const now = moment().add(2, 'd').add(11, 'h').add(28, 'm').add(9, 's').add(3, 'ms'); [ ['H:m:s', '59:28:9'], diff --git a/components/statistic/index.ts b/components/statistic/index.ts index 599e70219..2473c1d51 100644 --- a/components/statistic/index.ts +++ b/components/statistic/index.ts @@ -2,17 +2,17 @@ import { App, Plugin } from 'vue'; import Statistic from './Statistic'; import Countdown from './Countdown'; -export type {StatisticProps} from './Statistic' +export type { StatisticProps } from './Statistic'; Statistic.Countdown = Countdown; /* istanbul ignore next */ -Statistic.install = function(app: App) { +Statistic.install = function (app: App) { app.component(Statistic.name, Statistic); app.component(Statistic.Countdown.name, Statistic.Countdown); return app; }; -export const StatisticCountdown = Statistic.Countdown +export const StatisticCountdown = Statistic.Countdown; export default Statistic as typeof Statistic & Plugin & { diff --git a/components/steps/index.tsx b/components/steps/index.tsx index eaea61945..c57249742 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -70,7 +70,7 @@ const Steps = defineComponent({ }); /* istanbul ignore next */ -Steps.install = function(app: App) { +Steps.install = function (app: App) { app.component(Steps.name, Steps); app.component(Steps.Step.name, Steps.Step); return app; diff --git a/components/table/Table.tsx b/components/table/Table.tsx index c2e238225..ddb7f75eb 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -1216,10 +1216,8 @@ export default defineComponent({ transformCellText: customizeTransformCellText, } = this; const data = this.getCurrentPageData(); - const { - getPopupContainer: getContextPopupContainer, - transformCellText: tct, - } = this.configProvider; + const { getPopupContainer: getContextPopupContainer, transformCellText: tct } = + this.configProvider; const getPopupContainer = this.getPopupContainer || getContextPopupContainer; const transformCellText = customizeTransformCellText || tct; let loading = this.loading; diff --git a/components/table/__tests__/Table.rowSelection.test.js b/components/table/__tests__/Table.rowSelection.test.js index b22db2666..ac7d39507 100644 --- a/components/table/__tests__/Table.rowSelection.test.js +++ b/components/table/__tests__/Table.rowSelection.test.js @@ -310,16 +310,10 @@ describe('Table.rowSelection', () => { ); expect(dropdownWrapper.findAll('.ant-dropdown-menu-item').length).toBe(4); - dropdownWrapper - .findAll('.ant-dropdown-menu-item > div') - .at(2) - .trigger('click'); + dropdownWrapper.findAll('.ant-dropdown-menu-item > div').at(2).trigger('click'); expect(handleSelectOdd).toBeCalledWith([0, 1, 2, 3]); - dropdownWrapper - .findAll('.ant-dropdown-menu-item > div') - .at(3) - .trigger('click'); + dropdownWrapper.findAll('.ant-dropdown-menu-item > div').at(3).trigger('click'); expect(handleSelectEven).toBeCalledWith([0, 1, 2, 3]); }); diff --git a/components/table/index.tsx b/components/table/index.tsx index 7de85c65b..c8336b947 100644 --- a/components/table/index.tsx +++ b/components/table/index.tsx @@ -93,7 +93,7 @@ const Table = defineComponent({ }, }); /* istanbul ignore next */ -Table.install = function(app: App) { +Table.install = function (app: App) { app.component(Table.name, Table); app.component(Table.Column.name, Table.Column); app.component(Table.ColumnGroup.name, Table.ColumnGroup); diff --git a/components/tabs/index.ts b/components/tabs/index.ts index e288d25a6..3ee715a1a 100644 --- a/components/tabs/index.ts +++ b/components/tabs/index.ts @@ -7,7 +7,7 @@ Tabs.TabPane = { ...TabPane, name: 'ATabPane', __ANT_TAB_PANE: true }; Tabs.TabContent = { ...TabContent, name: 'ATabContent' }; /* istanbul ignore next */ -Tabs.install = function(app: App) { +Tabs.install = function (app: App) { app.component(Tabs.name, Tabs); app.component(Tabs.TabPane.name, Tabs.TabPane); app.component(Tabs.TabContent.name, Tabs.TabContent); diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 716e0faaa..4af732b26 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -140,7 +140,7 @@ const Tag = defineComponent({ Tag.CheckableTag = CheckableTag; -Tag.install = function(app: App) { +Tag.install = function (app: App) { app.component(Tag.name, Tag); app.component(CheckableTag.name, CheckableTag); return app; diff --git a/components/timeline/index.tsx b/components/timeline/index.tsx index d174a985c..cefa85809 100644 --- a/components/timeline/index.tsx +++ b/components/timeline/index.tsx @@ -8,12 +8,12 @@ export type { TimelineItemProps } from './TimelineItem'; Timeline.Item = TimelineItem; /* istanbul ignore next */ -Timeline.install = function(app: App) { +Timeline.install = function (app: App) { app.component(Timeline.name, Timeline); app.component(TimelineItem.name, TimelineItem); return app; }; -export {TimelineItem} +export { TimelineItem }; export default Timeline as typeof Timeline & Plugin & { readonly Item: typeof TimelineItem; diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 233948d9b..def64a725 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -197,7 +197,7 @@ const TreeSelect = defineComponent({ }); /* istanbul ignore next */ -TreeSelect.install = function(app: App) { +TreeSelect.install = function (app: App) { app.component(TreeSelect.name, TreeSelect); app.component(TreeSelect.TreeNode.displayName, TreeSelect.TreeNode); return app; diff --git a/components/tree/index.tsx b/components/tree/index.tsx index 9feb7508c..c0d2493b6 100644 --- a/components/tree/index.tsx +++ b/components/tree/index.tsx @@ -5,7 +5,7 @@ import DirectoryTree from './DirectoryTree'; Tree.TreeNode.name = 'ATreeNode'; Tree.DirectoryTree = DirectoryTree; /* istanbul ignore next */ -Tree.install = function(app: App) { +Tree.install = function (app: App) { app.component(Tree.name, Tree); app.component(Tree.TreeNode.name, Tree.TreeNode); app.component(DirectoryTree.name, DirectoryTree); diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index 720c1e670..e9e3b11d4 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -123,18 +123,16 @@ const Base = defineComponent({ const contentRef = ref(); const editIcon = ref(); - const ellipsis = computed( - (): EllipsisConfig => { - const ellipsis = props.ellipsis; - if (!ellipsis) return {}; - - return { - rows: 1, - expandable: false, - ...(typeof ellipsis === 'object' ? ellipsis : null), - }; - }, - ); + const ellipsis = computed((): EllipsisConfig => { + const ellipsis = props.ellipsis; + if (!ellipsis) return {}; + + return { + rows: 1, + expandable: false, + ...(typeof ellipsis === 'object' ? ellipsis : null), + }; + }); onMounted(() => { state.clientRendered = true; }); @@ -294,7 +292,11 @@ const Base = defineComponent({ // Do not measure if css already support ellipsis if (canUseCSSEllipsis.value) return; - const { content, text, ellipsis: ell } = measure( + const { + content, + text, + ellipsis: ell, + } = measure( contentRef.value?.$el, { rows, suffix }, props.content, @@ -451,7 +453,14 @@ const Base = defineComponent({ { - const { type, disabled, content, class: className, style, ...restProps } = { + const { + type, + disabled, + content, + class: className, + style, + ...restProps + } = { ...props, ...attrs, }; diff --git a/components/typography/__tests__/index.test.js b/components/typography/__tests__/index.test.js index b8b39cbe1..5507d1657 100644 --- a/components/typography/__tests__/index.test.js +++ b/components/typography/__tests__/index.test.js @@ -20,8 +20,10 @@ describe('Typography', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); // Mock offsetHeight - const originOffsetHeight = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetHeight') - .get; + const originOffsetHeight = Object.getOwnPropertyDescriptor( + HTMLElement.prototype, + 'offsetHeight', + ).get; Object.defineProperty(HTMLElement.prototype, 'offsetHeight', { get() { let html = this.innerHTML; diff --git a/components/typography/index.tsx b/components/typography/index.tsx index 546fc1ade..2de640485 100644 --- a/components/typography/index.tsx +++ b/components/typography/index.tsx @@ -6,16 +6,15 @@ import Text from './Text'; import Title from './Title'; import Typography from './Typography'; -export type {TypographyProps} from './Typography' +export type { TypographyProps } from './Typography'; +Typography.Text = Text; +Typography.Title = Title; +Typography.Paragraph = Paragraph; +Typography.Link = Link; +Typography.Base = Base; -Typography.Text = Text -Typography.Title = Title -Typography.Paragraph = Paragraph -Typography.Link = Link -Typography.Base = Base - -Typography.install = function(app: App) { +Typography.install = function (app: App) { app.component(Typography.name, Typography); app.component(Typography.Text.displayName, Text); app.component(Typography.Title.displayName, Title); @@ -29,7 +28,7 @@ export { Title as TypographyTitle, Paragraph as TypographyParagraph, Link as TypographyLink, -} +}; export default Typography as typeof Typography & Plugin & { diff --git a/components/upload/__tests__/uploadlist.test.js b/components/upload/__tests__/uploadlist.test.js index 2f15af9b9..5bc2946e0 100644 --- a/components/upload/__tests__/uploadlist.test.js +++ b/components/upload/__tests__/uploadlist.test.js @@ -93,10 +93,7 @@ describe('Upload List', () => { const wrapper = mount(Upload, props); setTimeout(async () => { expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2); - wrapper - .findAll('.ant-upload-list-item')[0] - .find('.anticon-delete') - .trigger('click'); + wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click'); await delay(400); // wrapper.update(); expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1); diff --git a/components/upload/index.tsx b/components/upload/index.tsx index 3e910e001..e672fdb44 100644 --- a/components/upload/index.tsx +++ b/components/upload/index.tsx @@ -7,7 +7,7 @@ export { UploadProps, UploadListProps, UploadChangeParam } from './interface'; Upload.Dragger = Dragger; /* istanbul ignore next */ -Upload.install = function(app: App) { +Upload.install = function (app: App) { app.component(Upload.name, Upload); app.component(Dragger.name, Dragger); return app; diff --git a/components/upload/utils.jsx b/components/upload/utils.jsx index 3642ce9fb..2ee74403e 100644 --- a/components/upload/utils.jsx +++ b/components/upload/utils.jsx @@ -26,7 +26,7 @@ export function genPercentAdd() { let k = 0.1; const i = 0.01; const end = 0.98; - return function(s) { + return function (s) { let start = s; if (start >= end) { return start; diff --git a/components/vc-calendar/src/date/DateTBody.jsx b/components/vc-calendar/src/date/DateTBody.jsx index 4a8b08e06..08871b0d6 100644 --- a/components/vc-calendar/src/date/DateTBody.jsx +++ b/components/vc-calendar/src/date/DateTBody.jsx @@ -178,12 +178,7 @@ const DateTBody = { cls += ` ${nextMonthDayClass}`; } - if ( - current - .clone() - .endOf('month') - .date() === current.date() - ) { + if (current.clone().endOf('month').date() === current.date()) { cls += ` ${lastDayOfMonthClass}`; } diff --git a/components/vc-calendar/src/month/MonthPanel.jsx b/components/vc-calendar/src/month/MonthPanel.jsx index aeb5398d9..8aa19434b 100644 --- a/components/vc-calendar/src/month/MonthPanel.jsx +++ b/components/vc-calendar/src/month/MonthPanel.jsx @@ -59,15 +59,8 @@ const MonthPanel = { }, render() { - const { - sValue, - cellRender, - contentRender, - locale, - rootPrefixCls, - disabledDate, - renderFooter, - } = this; + const { sValue, cellRender, contentRender, locale, rootPrefixCls, disabledDate, renderFooter } = + this; const year = sValue.year(); const prefixCls = `${rootPrefixCls}-month-panel`; diff --git a/components/vc-checkbox/src/Checkbox.jsx b/components/vc-checkbox/src/Checkbox.jsx index 3e83ae0a4..92016e7da 100644 --- a/components/vc-checkbox/src/Checkbox.jsx +++ b/components/vc-checkbox/src/Checkbox.jsx @@ -100,18 +100,8 @@ export default defineComponent({ }, render() { - const { - prefixCls, - name, - id, - type, - disabled, - readonly, - tabindex, - autofocus, - value, - ...others - } = getOptionProps(this); + const { prefixCls, name, id, type, disabled, readonly, tabindex, autofocus, value, ...others } = + getOptionProps(this); const { class: className, onFocus, onBlur } = this.$attrs; const globalProps = Object.keys({ ...others, ...this.$attrs }).reduce((prev, key) => { if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') { diff --git a/components/vc-image/src/Image.tsx b/components/vc-image/src/Image.tsx index d4012a22b..dc1420eac 100644 --- a/components/vc-image/src/Image.tsx +++ b/components/vc-image/src/Image.tsx @@ -190,15 +190,8 @@ const ImageInternal = defineComponent({ return l; }; return () => { - const { - prefixCls, - wrapperClassName, - fallback, - src, - preview, - placeholder, - wrapperStyle, - } = props; + const { prefixCls, wrapperClassName, fallback, src, preview, placeholder, wrapperStyle } = + props; const { width, height, diff --git a/components/vc-overflow/context.ts b/components/vc-overflow/context.ts index 0ffe5c0e7..9543faab2 100644 --- a/components/vc-overflow/context.ts +++ b/components/vc-overflow/context.ts @@ -26,9 +26,9 @@ export interface OverflowContextProviderValueType { className?: string; } -const OverflowContextProviderKey: InjectionKey> = Symbol( - 'OverflowContextProviderKey', -); +const OverflowContextProviderKey: InjectionKey< + ComputedRef +> = Symbol('OverflowContextProviderKey'); export const OverflowContextProvider = defineComponent({ name: 'OverflowContextProvider', @@ -45,9 +45,10 @@ export const OverflowContextProvider = defineComponent({ }, }); -export const useInjectOverflowContext = (): ComputedRef => { - return inject( - OverflowContextProviderKey, - computed(() => null), - ); -}; +export const useInjectOverflowContext = + (): ComputedRef => { + return inject( + OverflowContextProviderKey, + computed(() => null), + ); + }; diff --git a/components/vc-select/Select.tsx b/components/vc-select/Select.tsx index 0e96eeada..4625dc9ae 100644 --- a/components/vc-select/Select.tsx +++ b/components/vc-select/Select.tsx @@ -63,9 +63,8 @@ const RefSelect = generateSelector({ fillOptionsWithMissingValue, }); -export type ExportedSelectProps< - ValueType extends DefaultValueType = DefaultValueType -> = SelectProps; +export type ExportedSelectProps = + SelectProps; const Select = defineComponent>({ setup(props, { attrs, expose, slots }) { diff --git a/components/vc-select/Selector/MultipleSelector.tsx b/components/vc-select/Selector/MultipleSelector.tsx index fe60ff760..fd406d7ff 100644 --- a/components/vc-select/Selector/MultipleSelector.tsx +++ b/components/vc-select/Selector/MultipleSelector.tsx @@ -56,8 +56,8 @@ const props = { maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), maxTagTextLength: PropTypes.number, - maxTagPlaceholder: PropTypes.any.def(() => (omittedValues: LabelValueType[]) => - `+ ${omittedValues.length} ...`, + maxTagPlaceholder: PropTypes.any.def( + () => (omittedValues: LabelValueType[]) => `+ ${omittedValues.length} ...`, ), tagRender: PropTypes.func, diff --git a/components/vc-select/generate.tsx b/components/vc-select/generate.tsx index ac1ad11a2..2fab4f7ae 100644 --- a/components/vc-select/generate.tsx +++ b/components/vc-select/generate.tsx @@ -326,7 +326,7 @@ export default function generateSelector< label?: VNodeChild; key?: Key; disabled?: boolean; - }[] + }[], >(config: GenerateConfig) { const { prefixCls: defaultPrefixCls, @@ -442,29 +442,27 @@ export default function generateSelector< return mergedSearchValue; }); - const mergedOptions = computed( - (): OptionsType => { - let newOptions = props.options; - if (newOptions === undefined) { - newOptions = convertChildrenToData(props.children); - } + const mergedOptions = computed((): OptionsType => { + let newOptions = props.options; + if (newOptions === undefined) { + newOptions = convertChildrenToData(props.children); + } - /** - * `tags` should fill un-list item. - * This is not cool here since TreeSelect do not need this - */ - if (props.mode === 'tags' && fillOptionsWithMissingValue) { - newOptions = fillOptionsWithMissingValue( - newOptions, - mergedValue.value, - mergedOptionLabelProp.value, - props.labelInValue, - ); - } + /** + * `tags` should fill un-list item. + * This is not cool here since TreeSelect do not need this + */ + if (props.mode === 'tags' && fillOptionsWithMissingValue) { + newOptions = fillOptionsWithMissingValue( + newOptions, + mergedValue.value, + mergedOptionLabelProp.value, + props.labelInValue, + ); + } - return newOptions || ([] as OptionsType); - }, - ); + return newOptions || ([] as OptionsType); + }); const mergedFlattenOptions = computed(() => flattenOptions(mergedOptions.value, props)); @@ -553,14 +551,16 @@ export default function generateSelector< const { internalProps = {} } = props; if (!internalProps.skipTriggerSelect) { // Skip trigger `onSelect` or `onDeselect` if configured - const selectValue = (mergedLabelInValue.value - ? getLabeledValue(newValue, { - options: newValueOption, - prevValueMap: mergedValueMap.value, - labelInValue: mergedLabelInValue.value, - optionLabelProp: mergedOptionLabelProp.value, - }) - : newValue) as SingleType; + const selectValue = ( + mergedLabelInValue.value + ? getLabeledValue(newValue, { + options: newValueOption, + prevValueMap: mergedValueMap.value, + labelInValue: mergedLabelInValue.value, + optionLabelProp: mergedOptionLabelProp.value, + }) + : newValue + ) as SingleType; if (isSelect && props.onSelect) { props.onSelect(selectValue, outOption); diff --git a/components/vc-select/hooks/useCacheOptions.ts b/components/vc-select/hooks/useCacheOptions.ts index 5abac1452..784a27af0 100644 --- a/components/vc-select/hooks/useCacheOptions.ts +++ b/components/vc-select/hooks/useCacheOptions.ts @@ -7,7 +7,7 @@ export default function useCacheOptions< label?: VNodeChild; key?: Key; disabled?: boolean; - }[] + }[], >(options: Ref) { const optionMap = computed(() => { const map: Map[number]> = new Map(); diff --git a/components/vc-select/utils/commonUtil.ts b/components/vc-select/utils/commonUtil.ts index 7825305c0..75457ab8a 100644 --- a/components/vc-select/utils/commonUtil.ts +++ b/components/vc-select/utils/commonUtil.ts @@ -80,7 +80,7 @@ export function toOuterValues( export function removeLastEnabledValue< T extends { disabled?: boolean }, - P extends RawValueType | object + P extends RawValueType | object, >(measureValues: T[], values: P[]): { values: P[]; removedValue: P } { const newValues = [...values]; diff --git a/components/vc-select/utils/valueUtil.ts b/components/vc-select/utils/valueUtil.ts index d14579a7d..c20d912df 100644 --- a/components/vc-select/utils/valueUtil.ts +++ b/components/vc-select/utils/valueUtil.ts @@ -178,9 +178,7 @@ function getFilterFunction(optionFilterProp: string) { // Group label search if ('options' in option) { - return toRawString(option.label) - .toLowerCase() - .includes(lowerSearchText); + return toRawString(option.label).toLowerCase().includes(lowerSearchText); } // Option value search const rawValue = option[optionFilterProp]; @@ -277,9 +275,7 @@ export function fillOptionsWithMissingValue( optionLabelProp: string, labelInValue: boolean, ): SelectOptionsType { - const values = toArray(value) - .slice() - .sort(); + const values = toArray(value).slice().sort(); const cloneOptions = [...options]; // Convert options value to set diff --git a/components/vc-select/utils/warningPropsUtil.ts b/components/vc-select/utils/warningPropsUtil.ts index 3462c89e7..eb52ccdab 100644 --- a/components/vc-select/utils/warningPropsUtil.ts +++ b/components/vc-select/utils/warningPropsUtil.ts @@ -137,9 +137,9 @@ function warningProps(props: SelectProps) { if (invalidateChildType) { warning( false, - `\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${invalidateChildType.displayName || - invalidateChildType.name || - invalidateChildType}\`.`, + `\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${ + invalidateChildType.displayName || invalidateChildType.name || invalidateChildType + }\`.`, ); } diff --git a/components/vc-slick/src/arrows.js b/components/vc-slick/src/arrows.js index 67a622203..374a4847c 100644 --- a/components/vc-slick/src/arrows.js +++ b/components/vc-slick/src/arrows.js @@ -14,7 +14,7 @@ function handler(options, handle, e) { const PrevArrow = (_, { attrs }) => { const { clickHandler, infinite, currentSlide, slideCount, slidesToShow } = attrs; const prevClasses = { 'slick-arrow': true, 'slick-prev': true }; - let prevHandler = function(e) { + let prevHandler = function (e) { handler({ message: 'previous' }, clickHandler, e); }; @@ -67,7 +67,7 @@ const NextArrow = (_, { attrs }) => { const { clickHandler, currentSlide, slideCount } = attrs; const nextClasses = { 'slick-arrow': true, 'slick-next': true }; - let nextHandler = function(e) { + let nextHandler = function (e) { handler({ message: 'next' }, clickHandler, e); }; if (!canGoNext(attrs)) { diff --git a/components/vc-slick/src/dots.js b/components/vc-slick/src/dots.js index 398ad8083..e8f02e378 100644 --- a/components/vc-slick/src/dots.js +++ b/components/vc-slick/src/dots.js @@ -1,7 +1,7 @@ import classnames from '../../_util/classNames'; import { cloneElement } from '../../_util/vnode'; -const getDotCount = function(spec) { +const getDotCount = function (spec) { let dots; if (spec.infinite) { diff --git a/components/vc-slick/src/slider.js b/components/vc-slick/src/slider.js index 07f77fa2c..e4f474218 100644 --- a/components/vc-slick/src/slider.js +++ b/components/vc-slick/src/slider.js @@ -56,7 +56,7 @@ export default defineComponent({ } }, beforeUnmount() { - this._responsiveMediaHandlers.forEach(function(obj) { + this._responsiveMediaHandlers.forEach(function (obj) { obj.mql.removeListener(obj.listener); }); }, diff --git a/components/vc-slick/src/track.js b/components/vc-slick/src/track.js index 6b2c8f622..4b3fe4de8 100644 --- a/components/vc-slick/src/track.js +++ b/components/vc-slick/src/track.js @@ -34,7 +34,7 @@ const getSlideClasses = spec => { }; }; -const getSlideStyle = function(spec) { +const getSlideStyle = function (spec) { const style = {}; if (spec.variableWidth === undefined || spec.variableWidth === false) { @@ -76,7 +76,7 @@ const getSlideStyle = function(spec) { const getKey = (child, fallbackKey) => child.key || (child.key === 0 && '0') || fallbackKey; -const renderSlides = function(spec, children) { +const renderSlides = function (spec, children) { let key; const slides = []; const preCloneSlides = []; diff --git a/components/vc-slider/src/Handle.jsx b/components/vc-slider/src/Handle.jsx index 63eeb089d..9164ebc2b 100644 --- a/components/vc-slider/src/Handle.jsx +++ b/components/vc-slider/src/Handle.jsx @@ -73,17 +73,8 @@ export default defineComponent({ }, }, render() { - const { - prefixCls, - vertical, - reverse, - offset, - disabled, - min, - max, - value, - tabindex, - } = getOptionProps(this); + const { prefixCls, vertical, reverse, offset, disabled, min, max, value, tabindex } = + getOptionProps(this); const className = classNames(this.$attrs.class, { [`${prefixCls}-handle-click-focused`]: this.clickFocused, }); diff --git a/components/vc-steps/Step.jsx b/components/vc-steps/Step.jsx index 8fa9a1cc6..77f632695 100644 --- a/components/vc-steps/Step.jsx +++ b/components/vc-steps/Step.jsx @@ -40,9 +40,8 @@ export default defineComponent({ this.__emit('stepClick', this.stepIndex); }, renderIconNode() { - const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } = getOptionProps( - this, - ); + const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } = + getOptionProps(this); const icon = getComponent(this, 'icon'); const title = getComponent(this, 'title'); const description = getComponent(this, 'description'); diff --git a/components/vc-table/src/Table.jsx b/components/vc-table/src/Table.jsx index 4ec9076b9..004f48b4a 100644 --- a/components/vc-table/src/Table.jsx +++ b/components/vc-table/src/Table.jsx @@ -366,12 +366,8 @@ export default defineComponent({ return; } const { scroll = {} } = this; - const { - ref_headTable, - ref_bodyTable, - ref_fixedColumnsBodyLeft, - ref_fixedColumnsBodyRight, - } = this; + const { ref_headTable, ref_bodyTable, ref_fixedColumnsBodyLeft, ref_fixedColumnsBodyRight } = + this; if (target.scrollTop !== this.lastScrollTop && scroll.y && target !== ref_headTable) { const scrollTop = target.scrollTop; if (ref_fixedColumnsBodyLeft && target !== ref_fixedColumnsBodyLeft) { diff --git a/components/vc-table/src/TableRow.jsx b/components/vc-table/src/TableRow.jsx index 796dc1541..9b6544d24 100644 --- a/components/vc-table/src/TableRow.jsx +++ b/components/vc-table/src/TableRow.jsx @@ -258,8 +258,12 @@ const TableRow = { ); } - const { class: customClass, className: customClassName, style: customStyle, ...rowProps } = - customRow(record, index) || {}; + const { + class: customClass, + className: customClassName, + style: customStyle, + ...rowProps + } = customRow(record, index) || {}; let style = { height: typeof height === 'number' ? `${height}px` : height }; diff --git a/components/vc-tabs/src/TabPane.jsx b/components/vc-tabs/src/TabPane.jsx index eeda2e3eb..3efab0fcd 100644 --- a/components/vc-tabs/src/TabPane.jsx +++ b/components/vc-tabs/src/TabPane.jsx @@ -34,12 +34,8 @@ export default defineComponent({ }; const isRender = destroyInactiveTabPane ? active : this.isActived; const shouldRender = isRender || forceRender; - const { - sentinelStart, - sentinelEnd, - setPanelSentinelStart, - setPanelSentinelEnd, - } = this.sentinelContext; + const { sentinelStart, sentinelEnd, setPanelSentinelStart, setPanelSentinelEnd } = + this.sentinelContext; let panelSentinelStart; let panelSentinelEnd; if (active && shouldRender) { diff --git a/components/vc-tabs/src/utils.js b/components/vc-tabs/src/utils.js index cd4e7e192..e8936acde 100644 --- a/components/vc-tabs/src/utils.js +++ b/components/vc-tabs/src/utils.js @@ -69,10 +69,7 @@ export function getMarginStyle(index, tabBarPosition) { } export function getStyle(el, property) { - return +window - .getComputedStyle(el) - .getPropertyValue(property) - .replace('px', ''); + return +window.getComputedStyle(el).getPropertyValue(property).replace('px', ''); } export function setPxStyle(el, value, vertical) { diff --git a/components/vc-time-picker/Header.jsx b/components/vc-time-picker/Header.jsx index 4501bcc06..1f2fa1801 100644 --- a/components/vc-time-picker/Header.jsx +++ b/components/vc-time-picker/Header.jsx @@ -90,10 +90,7 @@ const Header = { }); return; } - value - .hour(parsed.hour()) - .minute(parsed.minute()) - .second(parsed.second()); + value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); // if time value not allowed, response warning. if ( diff --git a/components/vc-tree-select/src/Base/BaseSelector.jsx b/components/vc-tree-select/src/Base/BaseSelector.jsx index 9c09ea98e..fa3a899e4 100644 --- a/components/vc-tree-select/src/Base/BaseSelector.jsx +++ b/components/vc-tree-select/src/Base/BaseSelector.jsx @@ -36,7 +36,7 @@ export const selectorPropTypes = () => ({ }); function noop() {} -export default function() { +export default function () { const BaseSelector = { name: 'BaseSelector', inheritAttrs: false, diff --git a/components/vc-tree-select/src/Select.jsx b/components/vc-tree-select/src/Select.jsx index df766976c..f606d66e7 100644 --- a/components/vc-tree-select/src/Select.jsx +++ b/components/vc-tree-select/src/Select.jsx @@ -59,7 +59,7 @@ import BasePopup from './Popup/MultiplePopup'; function getWatch(keys = []) { const watch = {}; keys.forEach(k => { - watch[k] = function() { + watch[k] = function () { this.needSyncKeys[k] = true; }; }); diff --git a/components/vc-tree-select/src/Selector/MultipleSelector/index.jsx b/components/vc-tree-select/src/Selector/MultipleSelector/index.jsx index 05aab776a..f3899fd31 100644 --- a/components/vc-tree-select/src/Selector/MultipleSelector/index.jsx +++ b/components/vc-tree-select/src/Selector/MultipleSelector/index.jsx @@ -50,13 +50,8 @@ const MultipleSelector = { }, _renderPlaceholder() { - const { - prefixCls, - placeholder, - searchPlaceholder, - searchValue, - selectorValueList, - } = this.$props; + const { prefixCls, placeholder, searchPlaceholder, searchValue, selectorValueList } = + this.$props; const currentPlaceholder = placeholder || searchPlaceholder; diff --git a/components/vc-trigger/Trigger.jsx b/components/vc-trigger/Trigger.jsx index 1fcfbedd2..cbc2f14e4 100644 --- a/components/vc-trigger/Trigger.jsx +++ b/components/vc-trigger/Trigger.jsx @@ -609,9 +609,8 @@ export default defineComponent({ } else { newChildProps.onClick = this.createTwoChains('onClick'); newChildProps.onMousedown = this.createTwoChains('onMousedown'); - newChildProps[ - supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' - ] = this.createTwoChains('onTouchstart'); + newChildProps[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart'] = + this.createTwoChains('onTouchstart'); } if (this.isMouseEnterToShow()) { newChildProps.onMouseenter = this.onMouseenter; diff --git a/examples/index.html b/examples/index.html index 31ba9fc6c..1b5f89adc 100644 --- a/examples/index.html +++ b/examples/index.html @@ -1,27 +1,30 @@ + + + + + + + + + Ant Design Vue + + + + - - - - - - - - - Ant Design Vue - - - - - - -
- - - \ No newline at end of file + +
+ + diff --git a/package.json b/package.json index 560ecfa57..3bd96dcfd 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "@typescript-eslint/eslint-plugin": "^4.1.0", "@typescript-eslint/parser": "^4.1.0", "@vue/babel-plugin-jsx": "^1.0.0", - "@vue/cli-plugin-eslint": "^4.0.0", + "@vue/cli-plugin-eslint": "^5.0.0-0", "@vue/compiler-sfc": "^3.1.0", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", @@ -119,6 +119,7 @@ "eslint": "^7.25.0", "eslint-config-prettier": "^8.0.0", "eslint-plugin-html": "^6.0.0", + "eslint-plugin-jest": "^24.3.6", "eslint-plugin-markdown": "^2.0.0-alpha.0", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-vue": "^7.1.0", @@ -132,7 +133,6 @@ "html-webpack-plugin": "^5.3.1", "husky": "^4.0.0", "ignore-emit-webpack-plugin": "^2.0.6", - "istanbul-instrumenter-loader": "^3.0.0", "jest": "^26.0.0", "jest-environment-jsdom-fifteen": "^1.0.2", "jest-serializer-vue": "^2.0.0", @@ -154,8 +154,8 @@ "nprogress": "^0.2.0", "postcss": "^8.2.12", "postcss-loader": "^5.0.0", - "prettier": "^1.18.2", - "pretty-quick": "^2.0.0", + "prettier": "^2.2.0", + "pretty-quick": "^3.0.0", "prismjs": "^1.20.0", "querystring": "^0.2.0", "raw-loader": "^4.0.2", diff --git a/scripts/gulpfile.js b/scripts/gulpfile.js index bcae3e28e..7221e5d3a 100644 --- a/scripts/gulpfile.js +++ b/scripts/gulpfile.js @@ -43,6 +43,7 @@ function dist(done) { hash: false, version: false, }); + // eslint-disable-next-line no-console console.log(buildInfo); done(0); }); @@ -64,6 +65,7 @@ function copyHtml() { rl.on('line', line => { if (line.indexOf('path:') > -1) { const name = line.split("'")[1].split("'")[0]; + // eslint-disable-next-line no-console console.log('create path:', name); const toPaths = [ `_site/components/${name}`, @@ -73,7 +75,7 @@ function copyHtml() { ]; toPaths.forEach(toPath => { rimraf.sync(path.join(cwd, toPath)); - mkdirp(path.join(cwd, toPath), function() { + mkdirp(path.join(cwd, toPath), function () { fs.writeFileSync( path.join(cwd, `${toPath}/index.html`), fs.readFileSync(path.join(cwd, '_site/index.html')), @@ -98,7 +100,7 @@ function copyHtml() { `_site/docs/vue/${name}-cn`, ]; toPaths.forEach(toPath => { - mkdirp(path.join(cwd, toPath), function() { + mkdirp(path.join(cwd, toPath), function () { fs.writeFileSync( path.join(cwd, `${toPath}/index.html`), fs.readFileSync(path.join(cwd, '_site/index.html')), diff --git a/tests/setup.js b/tests/setup.js index 3c28118dd..dcbc39b23 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -27,11 +27,11 @@ global.ResizeObserver = require('resize-observer-polyfill'); // The built-in requestAnimationFrame and cancelAnimationFrame not working with jest.runFakeTimes() // https://github.com/facebook/jest/issues/5147 -global.requestAnimationFrame = function(cb) { +global.requestAnimationFrame = function (cb) { return setTimeout(cb, 0); }; -global.cancelAnimationFrame = function(cb) { +global.cancelAnimationFrame = function (cb) { return clearTimeout(cb, 0); };