Skip to content

Commit 4a16b20

Browse files
committed
chore: run format
1 parent 4902354 commit 4a16b20

File tree

7 files changed

+59
-47
lines changed

7 files changed

+59
-47
lines changed

packages/compiler-core/__tests__/parse.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ foo
19901990
})
19911991
expect(ast.children[2].type).toBe(NodeTypes.INTERPOLATION)
19921992
})
1993-
1993+
19941994
it('should NOT remove whitespaces w/o newline between elements', () => {
19951995
const ast = parse(`<div/> <div/> <div/>`)
19961996
expect(ast.children.length).toBe(5)

packages/compiler-core/src/parse.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ function parseChildren(
273273
(shouldCondense &&
274274
((prev.type === NodeTypes.COMMENT &&
275275
next.type === NodeTypes.COMMENT) ||
276-
(prev.type === NodeTypes.COMMENT &&
277-
next.type === NodeTypes.ELEMENT) ||
276+
(prev.type === NodeTypes.COMMENT &&
277+
next.type === NodeTypes.ELEMENT) ||
278278
(prev.type === NodeTypes.ELEMENT &&
279-
next.type === NodeTypes.COMMENT) ||
279+
next.type === NodeTypes.COMMENT) ||
280280
(prev.type === NodeTypes.ELEMENT &&
281281
next.type === NodeTypes.ELEMENT &&
282282
/[\r\n]/.test(node.content))))

packages/runtime-core/__tests__/apiWatch.spec.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -1158,23 +1158,18 @@ describe('api: watch', () => {
11581158
const Comp = {
11591159
setup() {
11601160
effectScope(true).run(() => {
1161-
watchEffect(
1162-
() => {
1163-
trigger.value
1164-
countWE++
1165-
},
1166-
)
1167-
watch(
1168-
trigger,
1169-
() => countW++
1170-
)
1161+
watchEffect(() => {
1162+
trigger.value
1163+
countWE++
1164+
})
1165+
watch(trigger, () => countW++)
11711166
})
11721167
return () => ''
11731168
}
11741169
}
11751170
const root = nodeOps.createElement('div')
11761171
render(h(Comp), root)
1177-
// only watchEffect as ran so far
1172+
// only watchEffect as ran so far
11781173
expect(countWE).toBe(1)
11791174
expect(countW).toBe(0)
11801175
trigger.value++
@@ -1186,7 +1181,7 @@ describe('api: watch', () => {
11861181
await nextTick()
11871182
trigger.value++
11881183
await nextTick()
1189-
// both watchers run again event though component has been unmounted
1184+
// both watchers run again event though component has been unmounted
11901185
expect(countWE).toBe(3)
11911186
expect(countW).toBe(2)
11921187
})

packages/runtime-core/__tests__/componentProps.spec.ts

+29-14
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,7 @@ describe('component props', () => {
322322
})
323323

324324
test('warn on type mismatch', () => {
325-
class MyClass {
326-
327-
}
325+
class MyClass {}
328326
const Comp = {
329327
props: {
330328
bool: { type: Boolean },
@@ -333,28 +331,45 @@ describe('component props', () => {
333331
arr: { type: Array },
334332
obj: { type: Object },
335333
cls: { type: MyClass },
336-
fn: { type: Function },
334+
fn: { type: Function }
337335
},
338336
setup() {
339337
return () => null
340338
}
341339
}
342-
render(h(Comp, {
340+
render(
341+
h(Comp, {
343342
bool: 'true',
344343
str: 100,
345344
num: '100',
346345
arr: {},
347346
obj: 'false',
348347
cls: {},
349-
fn: true,
350-
}), nodeOps.createElement('div'))
351-
expect(`Invalid prop: type check failed for prop "bool". Expected Boolean, got String`).toHaveBeenWarned()
352-
expect(`Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.`).toHaveBeenWarned()
353-
expect(`Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".`).toHaveBeenWarned()
354-
expect(`Invalid prop: type check failed for prop "arr". Expected Array, got Object`).toHaveBeenWarned()
355-
expect(`Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"`).toHaveBeenWarned()
356-
expect(`Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.`).toHaveBeenWarned()
357-
expect(`Invalid prop: type check failed for prop "cls". Expected MyClass, got Object`).toHaveBeenWarned()
348+
fn: true
349+
}),
350+
nodeOps.createElement('div')
351+
)
352+
expect(
353+
`Invalid prop: type check failed for prop "bool". Expected Boolean, got String`
354+
).toHaveBeenWarned()
355+
expect(
356+
`Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.`
357+
).toHaveBeenWarned()
358+
expect(
359+
`Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".`
360+
).toHaveBeenWarned()
361+
expect(
362+
`Invalid prop: type check failed for prop "arr". Expected Array, got Object`
363+
).toHaveBeenWarned()
364+
expect(
365+
`Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"`
366+
).toHaveBeenWarned()
367+
expect(
368+
`Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.`
369+
).toHaveBeenWarned()
370+
expect(
371+
`Invalid prop: type check failed for prop "cls". Expected MyClass, got Object`
372+
).toHaveBeenWarned()
358373
})
359374

360375
// #3495

packages/runtime-core/__tests__/components/BaseTransition.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@ describe('BaseTransition', () => {
770770
})
771771
})
772772

773-
774773
// #6835
775774
describe('mode: "out-in" toggle again after unmounted', () => {
776775
async function testOutIn(

packages/runtime-core/src/apiWatch.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
ReactiveFlags,
99
EffectScheduler,
1010
DebuggerOptions,
11-
getCurrentScope,
11+
getCurrentScope
1212
} from '@vue/reactivity'
1313
import { SchedulerJob, queueJob } from './scheduler'
1414
import {
@@ -198,7 +198,8 @@ function doWatch(
198198
)
199199
}
200200

201-
const instance = getCurrentScope() === currentInstance?.scope ? currentInstance : null
201+
const instance =
202+
getCurrentScope() === currentInstance?.scope ? currentInstance : null
202203
// const instance = currentInstance
203204
let getter: () => any
204205
let forceTrigger = false
@@ -331,11 +332,11 @@ function doWatch(
331332
callWithAsyncErrorHandling(cb, instance, ErrorCodes.WATCH_CALLBACK, [
332333
newValue,
333334
// pass undefined as the old value when it's changed for the first time
334-
oldValue === INITIAL_WATCHER_VALUE
335+
oldValue === INITIAL_WATCHER_VALUE
335336
? undefined
336-
: (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
337-
? []
338-
: oldValue,
337+
: isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE
338+
? []
339+
: oldValue,
339340
onCleanup
340341
])
341342
oldValue = newValue

packages/runtime-dom/types/jsx.d.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ export interface HTMLAttributes extends AriaAttributes, EventHandlers<Events> {
310310
}
311311

312312
type HTMLAttributeReferrerPolicy =
313-
| ''
314-
| 'no-referrer'
315-
| 'no-referrer-when-downgrade'
316-
| 'origin'
317-
| 'origin-when-cross-origin'
318-
| 'same-origin'
319-
| 'strict-origin'
320-
| 'strict-origin-when-cross-origin'
321-
| 'unsafe-url'
313+
| ''
314+
| 'no-referrer'
315+
| 'no-referrer-when-downgrade'
316+
| 'origin'
317+
| 'origin-when-cross-origin'
318+
| 'same-origin'
319+
| 'strict-origin'
320+
| 'strict-origin-when-cross-origin'
321+
| 'unsafe-url'
322322

323323
export interface AnchorHTMLAttributes extends HTMLAttributes {
324324
download?: any
@@ -1316,7 +1316,9 @@ export interface Events {
13161316
}
13171317

13181318
type EventHandlers<E> = {
1319-
[K in keyof E]?: E[K] extends (...args: any) => any ? E[K] : (payload: E[K]) => void
1319+
[K in keyof E]?: E[K] extends (...args: any) => any
1320+
? E[K]
1321+
: (payload: E[K]) => void
13201322
}
13211323

13221324
// use namespace import to avoid collision with generated types which use

0 commit comments

Comments
 (0)