chore: format

This commit is contained in:
Anthony Fu 2022-10-03 15:30:43 +08:00
parent 24f4c479d6
commit 534593cfa8
7 changed files with 14 additions and 11 deletions

View File

@ -54,9 +54,9 @@ export const transformOn: DirectiveTransform = (
? // for component and vnode lifecycle event listeners, auto convert
// it to camelCase. See issue #2249
toHandlerKey(camelize(rawName))
// preserve case for plain element listeners that have uppercase
: // preserve case for plain element listeners that have uppercase
// letters, as these may be custom elements' custom events
: `on:${rawName}`
`on:${rawName}`
eventName = createSimpleExpression(eventString, true, arg.loc)
} else {
// #2388

View File

@ -206,7 +206,10 @@ describe('compiler sfc: rewriteDefault', () => {
test('@Component\nexport default class w/ comments', async () => {
expect(
rewriteDefault(`// export default\n@Component\nexport default class Foo {}`, 'script')
rewriteDefault(
`// export default\n@Component\nexport default class Foo {}`,
'script'
)
).toMatchInlineSnapshot(`
"// export default
@Component
@ -231,7 +234,8 @@ describe('compiler sfc: rewriteDefault', () => {
test('@Component\nexport default class w/ comments 3', async () => {
expect(
rewriteDefault(
`/*\n@Component\nexport default class Foo {}*/\n` + `export default class Bar {}`,
`/*\n@Component\nexport default class Foo {}*/\n` +
`export default class Bar {}`,
'script'
)
).toMatchInlineSnapshot(`

View File

@ -49,8 +49,7 @@ export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) {
createCompoundExpression([`const _cssVars = { style: `, varsExp, `}`])
)
Array.from(cssContext.helpers.keys()).forEach(helper => {
if (!ast.helpers.includes(helper))
ast.helpers.push(helper)
if (!ast.helpers.includes(helper)) ast.helpers.push(helper)
})
}

View File

@ -33,8 +33,8 @@ export function ssrTransformTransitionGroup(
node,
context,
otherProps,
true, /* isComponent */
false, /* isDynamicComponent */
true /* isComponent */,
false /* isDynamicComponent */,
true /* ssr (skip event listeners) */
)
let propsExp = null

View File

@ -1048,7 +1048,6 @@ describe('api: options', () => {
expect(root.innerHTML).toBe(`<h1>Foo</h1>`)
})
test('options defined in component have higher priority', async () => {
const Mixin = {
msg1: 'base'

View File

@ -52,7 +52,8 @@ export const isMap = (val: unknown): val is Map<any, any> =>
export const isSet = (val: unknown): val is Set<any> =>
toTypeString(val) === '[object Set]'
export const isDate = (val: unknown): val is Date => toTypeString(val) === '[object Date]'
export const isDate = (val: unknown): val is Date =>
toTypeString(val) === '[object Date]'
export const isFunction = (val: unknown): val is Function =>
typeof val === 'function'
export const isString = (val: unknown): val is string => typeof val === 'string'