Skip to content

Commit 33c7230

Browse files
committed
style: update prettier & format code
1 parent fdecafb commit 33c7230

File tree

113 files changed

+333
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+333
-424
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"parser": "babel-eslint"
1212
},
1313
"extends": ["plugin:vue/vue3-recommended", "prettier"],
14-
"plugins": ["markdown"],
14+
"plugins": ["markdown", "jest"],
1515
"overrides": [
1616
{
1717
"files": ["**/demo/*.md"],

.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"trailingComma": "all",
44
"printWidth": 100,
55
"proseWrap": "never",
6+
"arrowParens": "avoid",
67
"overrides": [
78
{
89
"files": ".prettierrc",

antd-tools/getBabelCommonConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { resolve } = require('./utils/projectHelper');
22

3-
module.exports = function(modules) {
3+
module.exports = function (modules) {
44
const plugins = [
55
[
66
resolve('@babel/plugin-transform-typescript'),

antd-tools/getTSCommonConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const fs = require('fs');
44
const assign = require('object-assign');
55
const { getProjectPath } = require('./utils/projectHelper');
66

7-
module.exports = function() {
7+
module.exports = function () {
88
let my = {};
99
if (fs.existsSync(getProjectPath('tsconfig.json'))) {
1010
my = require(getProjectPath('tsconfig.json'));

antd-tools/gulpfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function compileTs(stream) {
8080
return stream
8181
.pipe(ts(tsConfig))
8282
.js.pipe(
83-
through2.obj(function(file, encoding, next) {
83+
through2.obj(function (file, encoding, next) {
8484
// console.log(file.path, file.base);
8585
file.path = file.path.replace(/\.[jt]sx$/, '.js');
8686
this.push(file);
@@ -146,7 +146,7 @@ function compile(modules) {
146146
const less = gulp
147147
.src(['components/**/*.less'])
148148
.pipe(
149-
through2.obj(function(file, encoding, next) {
149+
through2.obj(function (file, encoding, next) {
150150
this.push(file.clone());
151151
if (
152152
file.path.match(/\/style\/index\.less$/) ||

antd-tools/utils/getChangelog.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
const fs = require('fs');
22

33
module.exports = function getChangelog(file, version) {
4-
const lines = fs
5-
.readFileSync(file)
6-
.toString()
7-
.split('\n');
4+
const lines = fs.readFileSync(file).toString().split('\n');
85
const changeLog = [];
96
const startPattern = new RegExp(`^## ${version}`);
107
const stopPattern = /^## /; // 前一个版本

antd-tools/utils/getRunCmdEnv.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ module.exports = function getRunCmdEnv() {
1111
const nodeModulesBinDir = path.join(__dirname, '../../node_modules/.bin');
1212

1313
Object.entries(env)
14-
.filter(
15-
v =>
16-
v
17-
.slice(0, 1)
18-
.pop()
19-
.toLowerCase() === 'path',
20-
)
14+
.filter(v => v.slice(0, 1).pop().toLowerCase() === 'path')
2115
.forEach(v => {
2216
const key = v.slice(0, 1).pop();
2317
env[key] = env[key] ? `${nodeModulesBinDir}:${env[key]}` : nodeModulesBinDir;

antd-tools/utils/projectHelper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function injectRequire() {
2020
const Module = require('module');
2121

2222
const oriRequire = Module.prototype.require;
23-
Module.prototype.require = function(...args) {
23+
Module.prototype.require = function (...args) {
2424
const moduleName = args[0];
2525
try {
2626
return oriRequire.apply(this, args);

components/_util/component-classes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,6 @@ export class ClassList {
163163
* @return {ClassList}
164164
* @api public
165165
*/
166-
export default function(el: Element): ClassList {
166+
export default function (el: Element): ClassList {
167167
return new ClassList(el);
168168
}

components/_util/copy-to-clipboard/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function copy(text: string, options?: Options): boolean {
5252
mark.style.MozUserSelect = 'text';
5353
mark.style.msUserSelect = 'text';
5454
mark.style.userSelect = 'text';
55-
mark.addEventListener('copy', function(e) {
55+
mark.addEventListener('copy', function (e) {
5656
e.stopPropagation();
5757
if (options.format) {
5858
e.preventDefault();

components/_util/copy-to-clipboard/toggle-selection.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const deselectCurrent = (): (() => void) => {
44
const selection = document.getSelection();
55
if (!selection.rangeCount) {
6-
return function() {};
6+
return function () {};
77
}
88
let active = document.activeElement as any;
99

@@ -26,11 +26,11 @@ const deselectCurrent = (): (() => void) => {
2626
}
2727

2828
selection.removeAllRanges();
29-
return function() {
29+
return function () {
3030
selection.type === 'Caret' && selection.removeAllRanges();
3131

3232
if (!selection.rangeCount) {
33-
ranges.forEach(function(range) {
33+
ranges.forEach(function (range) {
3434
selection.addRange(range);
3535
});
3636
}

components/_util/dom-closest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import matches from './dom-matches';
1111
* @param context {Element=}
1212
* @return {Element}
1313
*/
14-
export default function(element, selector, context) {
14+
export default function (element, selector, context) {
1515
context = context || document;
1616
// guard against orphans
1717
element = { parentNode: element };

components/_util/getRequestAnimationFrame.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const availablePrefixs = ['moz', 'ms', 'webkit'];
22

33
function requestAnimationFramePolyfill() {
44
let lastTime = 0;
5-
return function(callback) {
5+
return function (callback) {
66
const currTime = new Date().getTime();
77
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
8-
const id = window.setTimeout(function() {
8+
const id = window.setTimeout(function () {
99
callback(currTime + timeToCall);
1010
}, timeToCall);
1111
lastTime = currTime + timeToCall;

components/_util/hooks/useSize.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const useInjectSize = <T = SizeType>(props?: Record<any, any>): ComputedRef<T> =
1818
? computed(() => props.size)
1919
: inject(
2020
sizeProvider,
21-
computed(() => ('default' as unknown) as T),
21+
computed(() => 'default' as unknown as T),
2222
);
2323
return size;
2424
};

components/_util/json2mq.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
* https://github.com/akiran/json2mq.git
44
*/
55

6-
const camel2hyphen = function(str) {
6+
const camel2hyphen = function (str) {
77
return str
8-
.replace(/[A-Z]/g, function(match) {
8+
.replace(/[A-Z]/g, function (match) {
99
return '-' + match.toLowerCase();
1010
})
1111
.toLowerCase();
1212
};
1313

14-
const isDimension = function(feature) {
14+
const isDimension = function (feature) {
1515
const re = /[height|width]$/;
1616
return re.test(feature);
1717
};
1818

19-
const obj2mq = function(obj) {
19+
const obj2mq = function (obj) {
2020
let mq = '';
2121
const features = Object.keys(obj);
22-
features.forEach(function(feature, index) {
22+
features.forEach(function (feature, index) {
2323
let value = obj[feature];
2424
feature = camel2hyphen(feature);
2525
// Add px to dimension features
@@ -40,14 +40,14 @@ const obj2mq = function(obj) {
4040
return mq;
4141
};
4242

43-
export default function(query) {
43+
export default function (query) {
4444
let mq = '';
4545
if (typeof query === 'string') {
4646
return query;
4747
}
4848
// Handling array of media queries
4949
if (query instanceof Array) {
50-
query.forEach(function(q, index) {
50+
query.forEach(function (q, index) {
5151
mq += obj2mq(q);
5252
if (index < query.length - 1) {
5353
mq += ', ';

components/_util/props-util/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const parseStyleText = (cssText = '', camel) => {
2828
const res = {};
2929
const listDelimiter = /;(?![^(]*\))/g;
3030
const propertyDelimiter = /:(.+)/;
31-
cssText.split(listDelimiter).forEach(function(item) {
31+
cssText.split(listDelimiter).forEach(function (item) {
3232
if (item) {
3333
const tmp = item.split(propertyDelimiter);
3434
if (tmp.length > 1) {

components/_util/shallowequal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ function shallowEqual(objA, objB, compare, compareContext) {
4545
return true;
4646
}
4747

48-
export default function(value, other, customizer, thisArg) {
48+
export default function (value, other, customizer, thisArg) {
4949
return shallowEqual(toRaw(value), toRaw(other), customizer, thisArg);
5050
}

components/_util/throttleByAnimationFrame.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function throttleByAnimationFrame(fn: (...args: any[]) => void) {
1919

2020
export function throttleByAnimationFrameDecorator() {
2121
// eslint-disable-next-line func-names
22-
return function(target: any, key: string, descriptor: any) {
22+
return function (target: any, key: string, descriptor: any) {
2323
const fn = descriptor.value;
2424
let definingProperty = false;
2525
return {

components/_util/type.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type VueNode = VNodeChild | JSX.Element;
3434

3535
export const withInstall = <T>(comp: T) => {
3636
const c = comp as any;
37-
c.install = function(app: App) {
37+
c.install = function (app: App) {
3838
app.component(c.displayName || c.name, comp);
3939
};
4040

components/anchor/Anchor.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ export default defineComponent({
175175
`${prefixCls.value}-link-title-active`,
176176
)[0];
177177
if (linkNode) {
178-
(inkNodeRef.value as HTMLElement).style.top = `${linkNode.offsetTop +
179-
linkNode.clientHeight / 2 -
180-
4.5}px`;
178+
(inkNodeRef.value as HTMLElement).style.top = `${
179+
linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5
180+
}px`;
181181
}
182182
};
183183

components/anchor/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import AnchorLink, { AnchorLinkProps } from './AnchorLink';
55
Anchor.Link = AnchorLink;
66

77
/* istanbul ignore next */
8-
Anchor.install = function(app: App) {
8+
Anchor.install = function (app: App) {
99
app.component(Anchor.name, Anchor);
1010
app.component(Anchor.Link.name, Anchor.Link);
1111
return app;

components/auto-complete/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const AutoComplete = defineComponent({
146146
});
147147

148148
/* istanbul ignore next */
149-
AutoComplete.install = function(app: App) {
149+
AutoComplete.install = function (app: App) {
150150
app.component(AutoComplete.name, AutoComplete);
151151
app.component(AutoComplete.Option.displayName, AutoComplete.Option);
152152
app.component(AutoComplete.OptGroup.displayName, AutoComplete.OptGroup);

components/avatar/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export { AvatarGroupProps } from './Group';
88
Avatar.Group = Group;
99

1010
/* istanbul ignore next */
11-
Avatar.install = function(app: App) {
11+
Avatar.install = function (app: App) {
1212
app.component(Avatar.name, Avatar);
1313
app.component(Group.name, Group);
1414
return app;

components/badge/Badge.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export default defineComponent({
4444

4545
// ================================ Misc ================================
4646
const numberedDisplayCount = computed(() => {
47-
return ((props.count as number) > (props.overflowCount as number)
48-
? `${props.overflowCount}+`
49-
: props.count) as string | number | null;
47+
return (
48+
(props.count as number) > (props.overflowCount as number)
49+
? `${props.overflowCount}+`
50+
: props.count
51+
) as string | number | null;
5052
});
5153

5254
const hasStatus = computed(

components/badge/ScrollNumber.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default defineComponent({
3535
count,
3636
title,
3737
show,
38-
component: Tag = ('sup' as unknown) as DefineComponent,
38+
component: Tag = 'sup' as unknown as DefineComponent,
3939
class: className,
4040
style,
4141
...restProps

components/badge/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { App, Plugin } from 'vue';
22
import Badge from './Badge';
33
import Ribbon from './Ribbon';
4-
export type { BadgeProps } from './Badge'
4+
export type { BadgeProps } from './Badge';
55

6-
Badge.install = function(app: App) {
6+
Badge.install = function (app: App) {
77
app.component(Badge.name, Badge);
88
app.component(Ribbon.name, Ribbon);
99
return app;
1010
};
1111

12-
export {Ribbon as BadgeRibbon}
12+
export { Ribbon as BadgeRibbon };
1313

1414
export default Badge as typeof Badge &
1515
Plugin & {

components/breadcrumb/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import BreadcrumbItem from './BreadcrumbItem';
44
import BreadcrumbSeparator from './BreadcrumbSeparator';
55

66
export type { BreadcrumbProps } from './Breadcrumb';
7-
export type { BreadcrumbItemProps } from './BreadcrumbItem';
8-
export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator';
7+
export type { BreadcrumbItemProps } from './BreadcrumbItem';
8+
export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator';
99

1010
Breadcrumb.Item = BreadcrumbItem;
1111
Breadcrumb.Separator = BreadcrumbSeparator;
1212

1313
/* istanbul ignore next */
14-
Breadcrumb.install = function(app: App) {
14+
Breadcrumb.install = function (app: App) {
1515
app.component(Breadcrumb.name, Breadcrumb);
1616
app.component(BreadcrumbItem.name, BreadcrumbItem);
1717
app.component(BreadcrumbSeparator.name, BreadcrumbSeparator);

components/button/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { App, Plugin } from 'vue';
22
import Button from './button';
33
import ButtonGroup from './button-group';
4-
export type {ButtonProps} from './button'
4+
export type { ButtonProps } from './button';
55

66
Button.Group = ButtonGroup;
77

88
/* istanbul ignore next */
9-
Button.install = function(app: App) {
9+
Button.install = function (app: App) {
1010
app.component(Button.name, Button);
1111
app.component(ButtonGroup.name, ButtonGroup);
1212
return app;
1313
};
14-
export {ButtonGroup}
14+
export { ButtonGroup };
1515
export default Button as typeof Button &
1616
Plugin & {
1717
readonly Group: typeof ButtonGroup;

components/card/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ import Card from './Card';
33
import Meta from './Meta';
44
import Grid from './Grid';
55

6-
export type {CardProps} from './Card'
6+
export type { CardProps } from './Card';
77

88
Card.Meta = Meta;
99
Card.Grid = Grid;
1010

1111
/* istanbul ignore next */
12-
Card.install = function(app: App) {
12+
Card.install = function (app: App) {
1313
app.component(Card.name, Card);
1414
app.component(Meta.name, Meta);
1515
app.component(Grid.name, Grid);
1616
return app;
1717
};
1818

19-
export {Meta as CardMeta, Grid as CardGrid}
19+
export { Meta as CardMeta, Grid as CardGrid };
2020

2121
export default Card as typeof Card &
2222
Plugin & {

0 commit comments

Comments
 (0)