chore: bump prettier v3 and format all code (#12111)

* chore: bump prettier v3 and format all code

* chore: mjs config

* chore: revert

* chore: revert

* chore: update lock
This commit is contained in:
neverland
2023-07-22 14:14:14 +08:00
committed by GitHub
parent b601ca1e0b
commit 3dcc92a5c0
209 changed files with 565 additions and 543 deletions

View File

@@ -12,7 +12,7 @@ export function useClickAway(
| Ref<Element | undefined>
| Array<Element | Ref<Element | undefined>>,
listener: EventListener,
options: UseClickAwayOptions = {}
options: UseClickAwayOptions = {},
) {
if (!inBrowser) {
return;

View File

@@ -21,17 +21,17 @@ export type UseEventListenerOptions = {
export function useEventListener<K extends keyof DocumentEventMap>(
type: K,
listener: (event: DocumentEventMap[K]) => void,
options?: UseEventListenerOptions
options?: UseEventListenerOptions,
): () => void;
export function useEventListener(
type: string,
listener: EventListener,
options?: UseEventListenerOptions
options?: UseEventListenerOptions,
): () => void;
export function useEventListener(
type: string,
listener: EventListener,
options: UseEventListenerOptions = {}
options: UseEventListenerOptions = {},
) {
if (!inBrowser) {
return;

View File

@@ -10,10 +10,10 @@ const makeDOMRect = (width: number, height: number) =>
bottom: height,
width,
height,
} as DOMRect);
}) as DOMRect;
export const useRect = (
elementOrRef: Element | Window | Ref<Element | Window | undefined>
elementOrRef: Element | Window | Ref<Element | Window | undefined>,
) => {
const element = unref(elementOrRef);

View File

@@ -45,7 +45,7 @@ const findVNodeIndex = (vnodes: VNode[], vnode: VNode) => {
vnode.key !== undefined &&
vnode.key !== null &&
item.type === vnode.type &&
item.key === vnode.key
item.key === vnode.key,
);
}
return index;
@@ -55,12 +55,12 @@ const findVNodeIndex = (vnodes: VNode[], vnode: VNode) => {
export function sortChildren(
parent: ComponentInternalInstance,
publicChildren: ComponentPublicInstance[],
internalChildren: ComponentInternalInstance[]
internalChildren: ComponentInternalInstance[],
) {
const vnodes = flattenVNodes(parent.subTree.children);
internalChildren.sort(
(a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode)
(a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode),
);
const orderedPublicChildren = internalChildren.map((item) => item.proxy!);
@@ -75,7 +75,7 @@ export function sortChildren(
export function useChildren<
// eslint-disable-next-line
Child extends ComponentPublicInstance = ComponentPublicInstance<{}, any>,
ProvideValue = never
ProvideValue = never,
>(key: InjectionKey<ProvideValue>) {
const publicChildren: Child[] = reactive([]);
const internalChildren: ComponentInternalInstance[] = reactive([]);
@@ -105,8 +105,8 @@ export function useChildren<
children: publicChildren,
internalChildren,
},
value
)
value,
),
);
};

View File

@@ -18,7 +18,7 @@ function isElement(node: Element) {
// https://github.com/vant-ui/vant/issues/3823
export function getScrollParent(
el: Element,
root: ScrollElement | undefined = defaultRoot
root: ScrollElement | undefined = defaultRoot,
) {
let node = el;
@@ -35,7 +35,7 @@ export function getScrollParent(
export function useScrollParent(
el: Ref<Element | undefined>,
root: ScrollElement | undefined = defaultRoot
root: ScrollElement | undefined = defaultRoot,
) {
const scrollParent = ref<Element | Window>();