Skip to content

Commit 47f4883

Browse files
committed
chore: run updated prettier
1 parent 69344ff commit 47f4883

File tree

110 files changed

+695
-698
lines changed

Some content is hidden

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

110 files changed

+695
-698
lines changed

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

+10-38
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ describe('compiler: codegen', () => {
6161
})
6262
const { code } = generate(root, { mode: 'module' })
6363
expect(code).toMatch(
64-
`import { ${helperNameMap[CREATE_VNODE]} as _${
65-
helperNameMap[CREATE_VNODE]
66-
}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${
67-
helperNameMap[RESOLVE_DIRECTIVE]
68-
} } from "vue"`
64+
`import { ${helperNameMap[CREATE_VNODE]} as _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
6965
)
7066
expect(code).toMatchSnapshot()
7167
})
@@ -76,16 +72,10 @@ describe('compiler: codegen', () => {
7672
})
7773
const { code } = generate(root, { mode: 'module', optimizeImports: true })
7874
expect(code).toMatch(
79-
`import { ${helperNameMap[CREATE_VNODE]}, ${
80-
helperNameMap[RESOLVE_DIRECTIVE]
81-
} } from "vue"`
75+
`import { ${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
8276
)
8377
expect(code).toMatch(
84-
`const _${helperNameMap[CREATE_VNODE]} = ${
85-
helperNameMap[CREATE_VNODE]
86-
}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${
87-
helperNameMap[RESOLVE_DIRECTIVE]
88-
}`
78+
`const _${helperNameMap[CREATE_VNODE]} = ${helperNameMap[CREATE_VNODE]}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${helperNameMap[RESOLVE_DIRECTIVE]}`
8979
)
9080
expect(code).toMatchSnapshot()
9181
})
@@ -97,11 +87,7 @@ describe('compiler: codegen', () => {
9787
const { code } = generate(root, { mode: 'function' })
9888
expect(code).toMatch(`const _Vue = Vue`)
9989
expect(code).toMatch(
100-
`const { ${helperNameMap[CREATE_VNODE]}: _${
101-
helperNameMap[CREATE_VNODE]
102-
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
103-
helperNameMap[RESOLVE_DIRECTIVE]
104-
} } = _Vue`
90+
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = _Vue`
10591
)
10692
expect(code).toMatchSnapshot()
10793
})
@@ -116,11 +102,7 @@ describe('compiler: codegen', () => {
116102
})
117103
expect(code).not.toMatch(`const _Vue = Vue`)
118104
expect(code).toMatch(
119-
`const { ${helperNameMap[CREATE_VNODE]}: _${
120-
helperNameMap[CREATE_VNODE]
121-
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
122-
helperNameMap[RESOLVE_DIRECTIVE]
123-
} } = Vue`
105+
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = Vue`
124106
)
125107
expect(code).toMatchSnapshot()
126108
})
@@ -136,30 +118,20 @@ describe('compiler: codegen', () => {
136118
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
137119
)
138120
expect(code).toMatch(
139-
`const _component_bar_baz = _${
140-
helperNameMap[RESOLVE_COMPONENT]
141-
}("bar-baz")\n`
121+
`const _component_bar_baz = _${helperNameMap[RESOLVE_COMPONENT]}("bar-baz")\n`
142122
)
143123
expect(code).toMatch(
144-
`const _component_barbaz = _${
145-
helperNameMap[RESOLVE_COMPONENT]
146-
}("barbaz")\n`
124+
`const _component_barbaz = _${helperNameMap[RESOLVE_COMPONENT]}("barbaz")\n`
147125
)
148126
// implicit self reference from SFC filename
149127
expect(code).toMatch(
150-
`const _component_Qux = _${
151-
helperNameMap[RESOLVE_COMPONENT]
152-
}("Qux", true)\n`
128+
`const _component_Qux = _${helperNameMap[RESOLVE_COMPONENT]}("Qux", true)\n`
153129
)
154130
expect(code).toMatch(
155-
`const _directive_my_dir_0 = _${
156-
helperNameMap[RESOLVE_DIRECTIVE]
157-
}("my_dir_0")\n`
131+
`const _directive_my_dir_0 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_0")\n`
158132
)
159133
expect(code).toMatch(
160-
`const _directive_my_dir_1 = _${
161-
helperNameMap[RESOLVE_DIRECTIVE]
162-
}("my_dir_1")\n`
134+
`const _directive_my_dir_1 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_1")\n`
163135
)
164136
expect(code).toMatch(`let _temp0, _temp1, _temp2`)
165137
expect(code).toMatchSnapshot()

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2871,7 +2871,7 @@ foo
28712871
]
28722872
}
28732873

2874-
for (const key of Object.keys(patterns) as (keyof (typeof patterns))[]) {
2874+
for (const key of Object.keys(patterns) as (keyof typeof patterns)[]) {
28752875
describe(key, () => {
28762876
for (const { code, errors, options } of patterns[key]) {
28772877
test(

packages/compiler-core/__tests__/transforms/hoistStatic.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ describe('compiler: hoistStatic transform', () => {
355355
},
356356
hoistedChildrenArrayMatcher(2)
357357
])
358-
const forBlockCodegen = ((root.children[0] as ElementNode)
359-
.children[0] as ForNode).codegenNode
358+
const forBlockCodegen = (
359+
(root.children[0] as ElementNode).children[0] as ForNode
360+
).codegenNode
360361
expect(forBlockCodegen).toMatchObject({
361362
type: NodeTypes.VNODE_CALL,
362363
tag: FRAGMENT,

packages/compiler-core/__tests__/transforms/vFor.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ describe('compiler: v-for', () => {
654654
patchFlag: !disableTracking
655655
? genFlagText(PatchFlags.STABLE_FRAGMENT)
656656
: keyed
657-
? genFlagText(PatchFlags.KEYED_FRAGMENT)
658-
: genFlagText(PatchFlags.UNKEYED_FRAGMENT),
657+
? genFlagText(PatchFlags.KEYED_FRAGMENT)
658+
: genFlagText(PatchFlags.UNKEYED_FRAGMENT),
659659
children: {
660660
type: NodeTypes.JS_CALL_EXPRESSION,
661661
callee: RENDER_LIST,

packages/compiler-core/__tests__/transforms/vModel.spec.ts

+14-15
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ describe('compiler: transform v-model', () => {
290290
test('with dynamic argument', () => {
291291
const root = parseWithVModel('<input v-model:[value]="model" />')
292292
const node = root.children[0] as ElementNode
293-
const props = ((node.codegenNode as VNodeCall)
294-
.props as unknown) as CallExpression
293+
const props = (node.codegenNode as VNodeCall)
294+
.props as unknown as CallExpression
295295

296296
expect(props).toMatchObject({
297297
type: NodeTypes.JS_CALL_EXPRESSION,
@@ -344,8 +344,8 @@ describe('compiler: transform v-model', () => {
344344
prefixIdentifiers: true
345345
})
346346
const node = root.children[0] as ElementNode
347-
const props = ((node.codegenNode as VNodeCall)
348-
.props as unknown) as CallExpression
347+
const props = (node.codegenNode as VNodeCall)
348+
.props as unknown as CallExpression
349349

350350
expect(props).toMatchObject({
351351
type: NodeTypes.JS_CALL_EXPRESSION,
@@ -417,22 +417,20 @@ describe('compiler: transform v-model', () => {
417417
}
418418
)
419419
expect(root.cached).toBe(0)
420-
const codegen = ((root.children[0] as ForNode)
421-
.children[0] as PlainElementNode).codegenNode as VNodeCall
420+
const codegen = (
421+
(root.children[0] as ForNode).children[0] as PlainElementNode
422+
).codegenNode as VNodeCall
422423
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
423424
expect(
424425
(codegen.props as ObjectExpression).properties[1].value.type
425426
).not.toBe(NodeTypes.JS_CACHE_EXPRESSION)
426427
})
427428

428429
test('should not cache update handler if it inside v-once', () => {
429-
const root = parseWithVModel(
430-
'<div v-once><input v-model="foo" /></div>',
431-
{
432-
prefixIdentifiers: true,
433-
cacheHandlers: true
434-
}
435-
)
430+
const root = parseWithVModel('<div v-once><input v-model="foo" /></div>', {
431+
prefixIdentifiers: true,
432+
cacheHandlers: true
433+
})
436434
expect(root.cached).not.toBe(2)
437435
expect(root.cached).toBe(1)
438436
})
@@ -444,8 +442,9 @@ describe('compiler: transform v-model', () => {
444442
prefixIdentifiers: true
445443
}
446444
)
447-
const codegen = ((root.children[0] as ComponentNode)
448-
.children[0] as PlainElementNode).codegenNode as VNodeCall
445+
const codegen = (
446+
(root.children[0] as ComponentNode).children[0] as PlainElementNode
447+
).codegenNode as VNodeCall
449448
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
450449
})
451450

packages/compiler-core/__tests__/transforms/vOn.spec.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,13 @@ describe('compiler: transform v-on', () => {
531531
})
532532

533533
test('should not be cached inside v-once', () => {
534-
const { root } = parseWithVOn(`<div v-once><div v-on:click="foo"/></div>`, {
535-
prefixIdentifiers: true,
536-
cacheHandlers: true
537-
})
534+
const { root } = parseWithVOn(
535+
`<div v-once><div v-on:click="foo"/></div>`,
536+
{
537+
prefixIdentifiers: true,
538+
cacheHandlers: true
539+
}
540+
)
538541
expect(root.cached).not.toBe(2)
539542
expect(root.cached).toBe(1)
540543
})

packages/compiler-core/src/ast.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ export interface CompoundExpressionNode extends Node {
237237
| InterpolationNode
238238
| TextNode
239239
| string
240-
| symbol)[]
240+
| symbol
241+
)[]
241242

242243
/**
243244
* an expression parsed as the params of a function will track
@@ -328,7 +329,8 @@ export interface CallExpression extends Node {
328329
| JSChildNode
329330
| SSRCodegenNode
330331
| TemplateChildNode
331-
| TemplateChildNode[])[]
332+
| TemplateChildNode[]
333+
)[]
332334
}
333335

334336
export interface ObjectExpression extends Node {
@@ -439,8 +441,8 @@ export interface DirectiveArguments extends ArrayExpression {
439441
}
440442

441443
export interface DirectiveArgumentNode extends ArrayExpression {
442-
elements: // dir, exp, arg, modifiers
443-
| [string]
444+
elements: // dir, exp, arg, modifiers
445+
| [string]
444446
| [string, ExpressionNode]
445447
| [string, ExpressionNode, ExpressionNode]
446448
| [string, ExpressionNode, ExpressionNode, ObjectExpression]
@@ -449,8 +451,8 @@ export interface DirectiveArgumentNode extends ArrayExpression {
449451
// renderSlot(...)
450452
export interface RenderSlotCall extends CallExpression {
451453
callee: typeof RENDER_SLOT
452-
arguments: // $slots, name, props, fallback
453-
| [string, string | ExpressionNode]
454+
arguments: // $slots, name, props, fallback
455+
| [string, string | ExpressionNode]
454456
| [string, string | ExpressionNode, PropsExpression]
455457
| [
456458
string,

packages/compiler-core/src/codegen.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ function genAssets(
444444
__COMPAT__ && type === 'filter'
445445
? RESOLVE_FILTER
446446
: type === 'component'
447-
? RESOLVE_COMPONENT
448-
: RESOLVE_DIRECTIVE
447+
? RESOLVE_COMPONENT
448+
: RESOLVE_DIRECTIVE
449449
)
450450
for (let i = 0; i < assets.length; i++) {
451451
let id = assets[i]

packages/compiler-core/src/compile.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export function getBaseTransformPreset(
4141
transformExpression
4242
]
4343
: __BROWSER__ && __DEV__
44-
? [transformExpression]
45-
: []),
44+
? [transformExpression]
45+
: []),
4646
transformSlotOutlet,
4747
transformElement,
4848
trackSlotScopes,
@@ -83,9 +83,8 @@ export function baseCompile(
8383
}
8484

8585
const ast = isString(template) ? baseParse(template, options) : template
86-
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(
87-
prefixIdentifiers
88-
)
86+
const [nodeTransforms, directiveTransforms] =
87+
getBaseTransformPreset(prefixIdentifiers)
8988
transform(
9089
ast,
9190
extend({}, options, {

packages/compiler-core/src/parse.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -774,18 +774,19 @@ function parseAttribute(
774774
const loc = getSelection(context, start)
775775

776776
if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
777-
const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
778-
name
779-
)!
777+
const match =
778+
/(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
779+
name
780+
)!
780781

781782
let isPropShorthand = startsWith(name, '.')
782783
let dirName =
783784
match[1] ||
784785
(isPropShorthand || startsWith(name, ':')
785786
? 'bind'
786787
: startsWith(name, '@')
787-
? 'on'
788-
: 'slot')
788+
? 'on'
789+
: 'slot')
789790
let arg: ExpressionNode | undefined
790791

791792
if (match[2]) {

packages/compiler-core/src/transform.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ export function createTransformContext(
235235
const removalIndex = node
236236
? list.indexOf(node)
237237
: context.currentNode
238-
? context.childIndex
239-
: -1
238+
? context.childIndex
239+
: -1
240240
/* istanbul ignore if */
241241
if (__DEV__ && removalIndex < 0) {
242242
throw new Error(`node being removed is not a child of current parent`)

packages/compiler-core/src/transforms/vFor.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ export const transformFor = createStructuralDirectiveTransform(
8686
const fragmentFlag = isStableFragment
8787
? PatchFlags.STABLE_FRAGMENT
8888
: keyProp
89-
? PatchFlags.KEYED_FRAGMENT
90-
: PatchFlags.UNKEYED_FRAGMENT
89+
? PatchFlags.KEYED_FRAGMENT
90+
: PatchFlags.UNKEYED_FRAGMENT
9191

9292
forNode.codegenNode = createVNodeCall(
9393
context,
@@ -135,8 +135,8 @@ export const transformFor = createStructuralDirectiveTransform(
135135
: isTemplate &&
136136
node.children.length === 1 &&
137137
isSlotOutlet(node.children[0])
138-
? (node.children[0] as SlotOutletNode) // api-extractor somehow fails to infer this
139-
: null
138+
? (node.children[0] as SlotOutletNode) // api-extractor somehow fails to infer this
139+
: null
140140

141141
if (slotOutlet) {
142142
// <slot v-for="..."> or <template v-for="..."><slot/></template>
@@ -221,11 +221,13 @@ export const transformFor = createStructuralDirectiveTransform(
221221
createSimpleExpression(String(context.cached++))
222222
)
223223
} else {
224-
renderExp.arguments.push(createFunctionExpression(
225-
createForLoopParams(forNode.parseResult),
226-
childBlock,
227-
true /* force newline */
228-
) as ForIteratorExpression)
224+
renderExp.arguments.push(
225+
createFunctionExpression(
226+
createForLoopParams(forNode.parseResult),
227+
childBlock,
228+
true /* force newline */
229+
) as ForIteratorExpression
230+
)
229231
}
230232
}
231233
})
@@ -343,9 +345,7 @@ export function parseForExpression(
343345
validateBrowserExpression(result.source as SimpleExpressionNode, context)
344346
}
345347

346-
let valueContent = LHS.trim()
347-
.replace(stripParensRE, '')
348-
.trim()
348+
let valueContent = LHS.trim().replace(stripParensRE, '').trim()
349349
const trimmedOffset = LHS.indexOf(valueContent)
350350

351351
const iteratorMatch = valueContent.match(forIteratorRE)

packages/compiler-core/src/transforms/vIf.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ function isSameKey(
319319
}
320320
if (
321321
exp.type !== NodeTypes.SIMPLE_EXPRESSION ||
322-
(exp.isStatic !== (branchExp as SimpleExpressionNode).isStatic ||
323-
exp.content !== (branchExp as SimpleExpressionNode).content)
322+
exp.isStatic !== (branchExp as SimpleExpressionNode).isStatic ||
323+
exp.content !== (branchExp as SimpleExpressionNode).content
324324
) {
325325
return false
326326
}

packages/compiler-core/src/transforms/vSlot.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ export function buildSlots(
337337
const slotFlag = hasDynamicSlots
338338
? SlotFlags.DYNAMIC
339339
: hasForwardedSlots(node.children)
340-
? SlotFlags.FORWARDED
341-
: SlotFlags.STABLE
340+
? SlotFlags.FORWARDED
341+
: SlotFlags.STABLE
342342

343343
let slots = createObjectExpression(
344344
slotsProperties.concat(

0 commit comments

Comments
 (0)