]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: run format
authorAnthony Fu <anthonyfu117@hotmail.com>
Thu, 12 Jan 2023 11:58:11 +0000 (12:58 +0100)
committerAnthony Fu <anthonyfu117@hotmail.com>
Thu, 12 Jan 2023 11:58:11 +0000 (12:58 +0100)
packages/compiler-core/__tests__/parse.spec.ts
packages/compiler-core/src/parse.ts
packages/runtime-core/__tests__/apiWatch.spec.ts
packages/runtime-core/__tests__/componentProps.spec.ts
packages/runtime-core/__tests__/components/BaseTransition.spec.ts
packages/runtime-core/src/apiWatch.ts
packages/runtime-dom/types/jsx.d.ts

index 8979e8fb0e1dc10ea87452e1297bc615953f3449..c4e1a3f2fcedd181d78c3b8448c68c31ea8fef1a 100644 (file)
@@ -1990,7 +1990,7 @@ foo
       })
       expect(ast.children[2].type).toBe(NodeTypes.INTERPOLATION)
     })
-    
+
     it('should NOT remove whitespaces w/o newline between elements', () => {
       const ast = parse(`<div/> <div/> <div/>`)
       expect(ast.children.length).toBe(5)
index 642f3edafd776dcb7503fbd86384b9ccf8603f97..93ecf7be39936b7215b24092221722e8ed93de0c 100644 (file)
@@ -273,10 +273,10 @@ function parseChildren(
               (shouldCondense &&
                 ((prev.type === NodeTypes.COMMENT &&
                   next.type === NodeTypes.COMMENT) ||
-                  (prev.type === NodeTypes.COMMENT && 
-                  next.type === NodeTypes.ELEMENT) ||
+                  (prev.type === NodeTypes.COMMENT &&
+                    next.type === NodeTypes.ELEMENT) ||
                   (prev.type === NodeTypes.ELEMENT &&
-                  next.type === NodeTypes.COMMENT) ||
+                    next.type === NodeTypes.COMMENT) ||
                   (prev.type === NodeTypes.ELEMENT &&
                     next.type === NodeTypes.ELEMENT &&
                     /[\r\n]/.test(node.content))))
index 6de8f95dec6e66da2610d16683759c805c6e6ff7..7ae72cce7fb87ac5e10279183db6e01005caf875 100644 (file)
@@ -1158,23 +1158,18 @@ describe('api: watch', () => {
     const Comp = {
       setup() {
         effectScope(true).run(() => {
-          watchEffect(
-            () => {
-              trigger.value
-              countWE++
-            },
-          )
-          watch(
-            trigger,
-            () => countW++
-          )
+          watchEffect(() => {
+            trigger.value
+            countWE++
+          })
+          watch(trigger, () => countW++)
         })
         return () => ''
       }
     }
     const root = nodeOps.createElement('div')
     render(h(Comp), root)
-     // only watchEffect as ran so far
+    // only watchEffect as ran so far
     expect(countWE).toBe(1)
     expect(countW).toBe(0)
     trigger.value++
@@ -1186,7 +1181,7 @@ describe('api: watch', () => {
     await nextTick()
     trigger.value++
     await nextTick()
-     // both watchers run again event though component has been unmounted
+    // both watchers run again event though component has been unmounted
     expect(countWE).toBe(3)
     expect(countW).toBe(2)
   })
index 195f352154c9145b345bb23a959de3dfaaf42d9d..9763b22d3fb431dbf2c43a74c80e0ca4099e6e26 100644 (file)
@@ -322,9 +322,7 @@ describe('component props', () => {
   })
 
   test('warn on type mismatch', () => {
-    class MyClass {
-
-    }
+    class MyClass {}
     const Comp = {
       props: {
         bool: { type: Boolean },
@@ -333,28 +331,45 @@ describe('component props', () => {
         arr: { type: Array },
         obj: { type: Object },
         cls: { type: MyClass },
-        fn: { type: Function },
+        fn: { type: Function }
       },
       setup() {
         return () => null
       }
     }
-    render(h(Comp, {
+    render(
+      h(Comp, {
         bool: 'true',
         str: 100,
         num: '100',
         arr: {},
         obj: 'false',
         cls: {},
-        fn: true,
-    }), nodeOps.createElement('div'))
-    expect(`Invalid prop: type check failed for prop "bool". Expected Boolean, got String`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "arr". Expected Array, got Object`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.`).toHaveBeenWarned()
-    expect(`Invalid prop: type check failed for prop "cls". Expected MyClass, got Object`).toHaveBeenWarned()
+        fn: true
+      }),
+      nodeOps.createElement('div')
+    )
+    expect(
+      `Invalid prop: type check failed for prop "bool". Expected Boolean, got String`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "arr". Expected Array, got Object`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.`
+    ).toHaveBeenWarned()
+    expect(
+      `Invalid prop: type check failed for prop "cls". Expected MyClass, got Object`
+    ).toHaveBeenWarned()
   })
 
   // #3495
index 7b2fb38954050a383424880e146965e122312905..f0e49f2671e2f96e84c0429facaeb00b2b25f4e0 100644 (file)
@@ -770,7 +770,6 @@ describe('BaseTransition', () => {
     })
   })
 
-
   // #6835
   describe('mode: "out-in" toggle again after unmounted', () => {
     async function testOutIn(
index a85e0e93be6795819fef99f6c1db7db939807840..ac5778cd435125aea32123166deff3ff098857b9 100644 (file)
@@ -8,7 +8,7 @@ import {
   ReactiveFlags,
   EffectScheduler,
   DebuggerOptions,
-  getCurrentScope,
+  getCurrentScope
 } from '@vue/reactivity'
 import { SchedulerJob, queueJob } from './scheduler'
 import {
@@ -198,7 +198,8 @@ function doWatch(
     )
   }
 
-  const instance = getCurrentScope() === currentInstance?.scope ?  currentInstance : null
+  const instance =
+    getCurrentScope() === currentInstance?.scope ? currentInstance : null
   // const instance = currentInstance
   let getter: () => any
   let forceTrigger = false
@@ -331,11 +332,11 @@ function doWatch(
         callWithAsyncErrorHandling(cb, instance, ErrorCodes.WATCH_CALLBACK, [
           newValue,
           // pass undefined as the old value when it's changed for the first time
-          oldValue === INITIAL_WATCHER_VALUE 
+          oldValue === INITIAL_WATCHER_VALUE
             ? undefined
-            : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
-              ? []
-              : oldValue,
+            : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE
+            ? []
+            : oldValue,
           onCleanup
         ])
         oldValue = newValue
index 9471140310ce4a66cdada9b3c52db6892885c316..b5e1487151e91572375f615a7798f74f513ee631 100644 (file)
@@ -310,15 +310,15 @@ export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
 }
 
 type HTMLAttributeReferrerPolicy =
-        | ''
-        | 'no-referrer'
-        | 'no-referrer-when-downgrade'
-        | 'origin'
-        | 'origin-when-cross-origin'
-        | 'same-origin'
-        | 'strict-origin'
-        | 'strict-origin-when-cross-origin'
-        | 'unsafe-url'
+  | ''
+  | 'no-referrer'
+  | 'no-referrer-when-downgrade'
+  | 'origin'
+  | 'origin-when-cross-origin'
+  | 'same-origin'
+  | 'strict-origin'
+  | 'strict-origin-when-cross-origin'
+  | 'unsafe-url'
 
 export interface AnchorHTMLAttributes extends HTMLAttributes {
   download?: any
@@ -1316,7 +1316,9 @@ export interface Events {
 }
 
 type EventHandlers<E> = {
-  [K in keyof E]?: E[K] extends (...args: any) => any ? E[K] : (payload: E[K]) => void
+  [K in keyof E]?: E[K] extends (...args: any) => any
+    ? E[K]
+    : (payload: E[K]) => void
 }
 
 // use namespace import to avoid collision with generated types which use