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 ? // for component and vnode lifecycle event listeners, auto convert
// it to camelCase. See issue #2249 // it to camelCase. See issue #2249
toHandlerKey(camelize(rawName)) 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 // letters, as these may be custom elements' custom events
: `on:${rawName}` `on:${rawName}`
eventName = createSimpleExpression(eventString, true, arg.loc) eventName = createSimpleExpression(eventString, true, arg.loc)
} else { } else {
// #2388 // #2388

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ export function isMemoSame(cached: VNode, memo: any[]) {
if (prev.length != memo.length) { if (prev.length != memo.length) {
return false return false
} }
for (let i = 0; i < prev.length; i++) { for (let i = 0; i < prev.length; i++) {
if (hasChanged(prev[i], memo[i])) { if (hasChanged(prev[i], memo[i])) {
return false return false

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> => export const isSet = (val: unknown): val is Set<any> =>
toTypeString(val) === '[object Set]' 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 => export const isFunction = (val: unknown): val is Function =>
typeof val === 'function' typeof val === 'function'
export const isString = (val: unknown): val is string => typeof val === 'string' export const isString = (val: unknown): val is string => typeof val === 'string'