mirror of https://github.com/vuejs/core.git
style: respect root prettier config
This commit is contained in:
parent
17af64c0c1
commit
63aacf6194
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
|
@ -291,11 +291,11 @@ export function generate(
|
|||
if (vaporHelpers.size)
|
||||
// TODO: extract import codegen
|
||||
preamble = `import { ${[...vaporHelpers]
|
||||
.map((h) => `${h} as _${h}`)
|
||||
.map(h => `${h} as _${h}`)
|
||||
.join(', ')} } from 'vue/vapor';`
|
||||
if (helpers.size)
|
||||
preamble = `import { ${[...helpers]
|
||||
.map((h) => `${h} as _${h}`)
|
||||
.map(h => `${h} as _${h}`)
|
||||
.join(', ')} } from 'vue';`
|
||||
|
||||
if (!isSetupInlined) {
|
||||
|
|
|
@ -21,7 +21,7 @@ export function genWithDirective(
|
|||
// directive
|
||||
pushMulti(
|
||||
['[', ']', ', '],
|
||||
...opers.map((oper) => () => {
|
||||
...opers.map(oper => () => {
|
||||
push('[')
|
||||
|
||||
const { dir, builtin } = oper
|
||||
|
@ -73,7 +73,7 @@ export function genWithDirective(
|
|||
function genDirectiveModifiers(modifiers: string[]) {
|
||||
return modifiers
|
||||
.map(
|
||||
(value) =>
|
||||
value =>
|
||||
`${isSimpleIdentifier(value) ? value : JSON.stringify(value)}: true`,
|
||||
)
|
||||
.join(', ')
|
||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
|||
export function genInsertNode(oper: InsertNodeIRNode, context: CodegenContext) {
|
||||
const { newline, pushFnCall, vaporHelper } = context
|
||||
const elements = ([] as number[]).concat(oper.element)
|
||||
let element = elements.map((el) => `n${el}`).join(', ')
|
||||
let element = elements.map(el => `n${el}`).join(', ')
|
||||
if (elements.length > 1) element = `[${element}]`
|
||||
newline()
|
||||
pushFnCall(
|
||||
|
@ -28,7 +28,7 @@ export function genPrependNode(
|
|||
pushFnCall(
|
||||
vaporHelper('prepend'),
|
||||
`n${oper.parent}`,
|
||||
oper.elements.map((el) => `n${el}`).join(', '),
|
||||
oper.elements.map(el => `n${el}`).join(', '),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,6 @@ export function genAppendNode(oper: AppendNodeIRNode, context: CodegenContext) {
|
|||
pushFnCall(
|
||||
vaporHelper('append'),
|
||||
`n${oper.parent}`,
|
||||
oper.elements.map((el) => `n${el}`).join(', '),
|
||||
oper.elements.map(el => `n${el}`).join(', '),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ export function genSetEvent(oper: SetEventIRNode, context: CodegenContext) {
|
|||
},
|
||||
// 4th arg, gen options
|
||||
!!options.length &&
|
||||
(() => push(`{ ${options.map((v) => `${v}: true`).join(', ')} }`)),
|
||||
(() => push(`{ ${options.map(v => `${v}: true`).join(', ')} }`)),
|
||||
)
|
||||
|
||||
function genEventHandler(context: CodegenContext) {
|
||||
|
@ -83,5 +83,5 @@ export function genSetEvent(oper: SetEventIRNode, context: CodegenContext) {
|
|||
}
|
||||
|
||||
function genArrayExpression(elements: string[]) {
|
||||
return `[${elements.map((it) => JSON.stringify(it)).join(', ')}]`
|
||||
return `[${elements.map(it => JSON.stringify(it)).join(', ')}]`
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ function createRootContext(
|
|||
) {
|
||||
return this.registerOperation(...operations)
|
||||
}
|
||||
const existing = this.block.effect.find((e) =>
|
||||
const existing = this.block.effect.find(e =>
|
||||
isSameExpression(e.expressions, expressions as IRExpression[]),
|
||||
)
|
||||
if (existing) {
|
||||
|
@ -174,7 +174,7 @@ function createRootContext(
|
|||
registerTemplate() {
|
||||
let templateNode: TemplateFactoryIRNode | FragmentFactoryIRNode
|
||||
|
||||
const existing = root.template.findIndex((t) =>
|
||||
const existing = root.template.findIndex(t =>
|
||||
this.template
|
||||
? t.type === IRNodeTypes.TEMPLATE_FACTORY &&
|
||||
t.template === this.template
|
||||
|
@ -356,7 +356,7 @@ function processDynamicChildren(ctx: TransformContext<RootNode | ElementNode>) {
|
|||
ctx.registerOperation({
|
||||
type: IRNodeTypes.INSERT_NODE,
|
||||
loc: node.loc,
|
||||
element: prevChildren.map((child) => child.id!),
|
||||
element: prevChildren.map(child => child.id!),
|
||||
parent: ctx.reference(),
|
||||
anchor,
|
||||
})
|
||||
|
@ -364,7 +364,7 @@ function processDynamicChildren(ctx: TransformContext<RootNode | ElementNode>) {
|
|||
ctx.registerOperation({
|
||||
type: IRNodeTypes.PREPEND_NODE,
|
||||
loc: node.loc,
|
||||
elements: prevChildren.map((child) => child.id!),
|
||||
elements: prevChildren.map(child => child.id!),
|
||||
parent: ctx.reference(),
|
||||
})
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ function processDynamicChildren(ctx: TransformContext<RootNode | ElementNode>) {
|
|||
ctx.registerOperation({
|
||||
type: IRNodeTypes.APPEND_NODE,
|
||||
loc: node.loc,
|
||||
elements: prevChildren.map((child) => child.id!),
|
||||
elements: prevChildren.map(child => child.id!),
|
||||
parent: ctx.reference(),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ export function createIfBranch(
|
|||
children: [
|
||||
extend({}, node, {
|
||||
props: node.props.filter(
|
||||
(p) => p.type !== NodeTypes.DIRECTIVE && p.name !== 'if',
|
||||
p => p.type !== NodeTypes.DIRECTIVE && p.name !== 'if',
|
||||
),
|
||||
} as TemplateChildNode),
|
||||
],
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
|
@ -16,7 +16,7 @@ describe('watchEffect and onEffectCleanup', () => {
|
|||
|
||||
scope.run(() => {
|
||||
source = ref(0)
|
||||
watchEffect((onCleanup) => {
|
||||
watchEffect(onCleanup => {
|
||||
source.value
|
||||
|
||||
onCleanup(() => (dummy += 2))
|
||||
|
|
|
@ -114,7 +114,7 @@ describe('renderWatch', () => {
|
|||
return { source, change, renderSource, changeRender }
|
||||
},
|
||||
// render
|
||||
(_ctx) => {
|
||||
_ctx => {
|
||||
// Render Watch API
|
||||
renderEffect(() => {
|
||||
const current = _ctx.renderSource
|
||||
|
@ -123,7 +123,7 @@ describe('renderWatch', () => {
|
|||
})
|
||||
renderWatch(
|
||||
() => _ctx.renderSource,
|
||||
(value) => {
|
||||
value => {
|
||||
calls.push(`renderWatch ${value}`)
|
||||
onEffectCleanup(() => calls.push(`renderWatch cleanup ${value}`))
|
||||
},
|
||||
|
@ -175,7 +175,7 @@ describe('renderWatch', () => {
|
|||
return { source, update }
|
||||
},
|
||||
// render
|
||||
(ctx) => {
|
||||
ctx => {
|
||||
renderEffect(() => {
|
||||
ctx.source
|
||||
})
|
||||
|
@ -206,7 +206,7 @@ describe('renderWatch', () => {
|
|||
return { source, update }
|
||||
},
|
||||
// render
|
||||
(ctx) => {
|
||||
ctx => {
|
||||
renderEffect(() => {
|
||||
ctx.source
|
||||
})
|
||||
|
|
|
@ -259,7 +259,7 @@ function getTypeIndex(
|
|||
expectedTypes: PropType<any> | void | null | true,
|
||||
): number {
|
||||
if (isArray(expectedTypes)) {
|
||||
return expectedTypes.findIndex((t) => isSameType(t, type))
|
||||
return expectedTypes.findIndex(t => isSameType(t, type))
|
||||
} else if (isFunction(expectedTypes)) {
|
||||
return isSameType(expectedTypes, type) ? 0 : -1
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function getModelAssigner(
|
|||
): AssignerFn {
|
||||
const metadata = instance.metadata.get(el)!
|
||||
const fn: any = metadata.props['onUpdate:modelValue']
|
||||
return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn
|
||||
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn
|
||||
}
|
||||
|
||||
function onCompositionStart(e: Event) {
|
||||
|
@ -38,7 +38,7 @@ export const vModelText: ObjectDirective<
|
|||
assignKeyMap.set(el, assigner)
|
||||
|
||||
const castToNumber = number // || (vnode.props && vnode.props.type === 'number')
|
||||
on(el, lazy ? 'change' : 'input', (e) => {
|
||||
on(el, lazy ? 'change' : 'input', e => {
|
||||
if ((e.target as any).composing) return
|
||||
let domValue: string | number = el.value
|
||||
if (trim) {
|
||||
|
|
|
@ -95,7 +95,7 @@ export function callWithAsyncErrorHandling(
|
|||
if (isFunction(fn)) {
|
||||
const res = callWithErrorHandling(fn, instance, type, args)
|
||||
if (res && isPromise(res)) {
|
||||
res.catch((err) => {
|
||||
res.catch(err => {
|
||||
handleError(err, instance, type)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export const createIf = (
|
|||
|
||||
renderWatch(
|
||||
() => !!condition(),
|
||||
(value) => {
|
||||
value => {
|
||||
parent ||= anchor.parentNode
|
||||
if ((branch = value ? b1 : b2)) {
|
||||
let scope = effectScope()
|
||||
|
|
|
@ -74,7 +74,7 @@ function doWatch(
|
|||
|
||||
const createMiddleware =
|
||||
(instance: ComponentInternalInstance | null): BaseWatchMiddleware =>
|
||||
(next) => {
|
||||
next => {
|
||||
let value: unknown
|
||||
// with lifecycle
|
||||
if (instance && instance.isMounted) {
|
||||
|
|
|
@ -189,7 +189,7 @@ export const createVaporSyncScheduler: SchedulerFactory =
|
|||
}
|
||||
|
||||
export const createVaporPreScheduler: SchedulerFactory =
|
||||
(instance) => (job, effect, isInit) => {
|
||||
instance => (job, effect, isInit) => {
|
||||
if (isInit) {
|
||||
effect.run()
|
||||
} else {
|
||||
|
@ -200,7 +200,7 @@ export const createVaporPreScheduler: SchedulerFactory =
|
|||
}
|
||||
|
||||
export const createVaporRenderingScheduler: SchedulerFactory =
|
||||
(instance) => (job, effect, isInit) => {
|
||||
instance => (job, effect, isInit) => {
|
||||
if (isInit) {
|
||||
effect.run()
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue