Skip to content

Commit b5b1ac3

Browse files
defccyyx990803
authored andcommitted
improve mutli-line && coding style to keep consistence (#5625)
1 parent 1c40e32 commit b5b1ac3

File tree

18 files changed

+59
-38
lines changed

18 files changed

+59
-38
lines changed

src/compiler/codegen/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export function genHandlers (
4444
const handler = events[name]
4545
// #5330: warn click.right, since right clicks do not actually fire click events.
4646
if (process.env.NODE_ENV !== 'production' &&
47-
name === 'click' &&
48-
handler && handler.modifiers && handler.modifiers.right
49-
) {
47+
name === 'click' &&
48+
handler && handler.modifiers && handler.modifiers.right
49+
) {
5050
warn(
5151
`Use "contextmenu" instead of "click.right" since right clicks ` +
5252
`do not actually fire "click" events.`

src/compiler/codegen/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ function genChildren (el: ASTElement, checkSkip?: boolean): string | void {
311311
const el: any = children[0]
312312
// optimize single v-for
313313
if (children.length === 1 &&
314-
el.for &&
315-
el.tag !== 'template' &&
316-
el.tag !== 'slot') {
314+
el.for &&
315+
el.tag !== 'template' &&
316+
el.tag !== 'slot'
317+
) {
317318
return genElement(el)
318319
}
319320
const normalizationType = checkSkip ? getNormalizationType(children) : 0

src/compiler/parser/html-parser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@ export function parseHTML (html, options) {
279279
// Close all the open elements, up the stack
280280
for (let i = stack.length - 1; i >= pos; i--) {
281281
if (process.env.NODE_ENV !== 'production' &&
282-
(i > pos || !tagName) &&
283-
options.warn) {
282+
(i > pos || !tagName) &&
283+
options.warn
284+
) {
284285
options.warn(
285286
`tag <${stack[i].tag}> has no matching end tag.`
286287
)

src/compiler/parser/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ export function parse (
246246
// IE textarea placeholder bug
247247
/* istanbul ignore if */
248248
if (isIE &&
249-
currentParent.tag === 'textarea' &&
250-
currentParent.attrsMap.placeholder === text) {
249+
currentParent.tag === 'textarea' &&
250+
currentParent.attrsMap.placeholder === text
251+
) {
251252
return
252253
}
253254
const children = currentParent.children

src/core/instance/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { warn } from '../util/index'
77

88
function Vue (options) {
99
if (process.env.NODE_ENV !== 'production' &&
10-
!(this instanceof Vue)) {
10+
!(this instanceof Vue)
11+
) {
1112
warn('Vue is a constructor and should be called with the `new` keyword')
1213
}
1314
this._init(options)

src/core/instance/render-helpers/resolve-slots.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export function resolveSlots (
1717
// named slots should only be respected if the vnode was rendered in the
1818
// same context.
1919
if ((child.context === context || child.functionalContext === context) &&
20-
child.data && child.data.slot != null) {
20+
child.data && child.data.slot != null
21+
) {
2122
const name = child.data.slot
2223
const slot = (slots[name] || (slots[name] = []))
2324
if (child.tag === 'template') {

src/core/util/props.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ function getPropDefaultValue (vm: ?Component, prop: PropOptions, key: string): a
6666
// return previous default value to avoid unnecessary watcher trigger
6767
if (vm && vm.$options.propsData &&
6868
vm.$options.propsData[key] === undefined &&
69-
vm._props[key] !== undefined) {
69+
vm._props[key] !== undefined
70+
) {
7071
return vm._props[key]
7172
}
7273
// call factory function for non-Function types

src/core/vdom/create-element.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export function _createElement (
6363
}
6464
// support single function children as default scoped slot
6565
if (Array.isArray(children) &&
66-
typeof children[0] === 'function') {
66+
typeof children[0] === 'function'
67+
) {
6768
data = data || {}
6869
data.scopedSlots = { default: children[0] }
6970
children.length = 0

src/core/vdom/patch.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,9 @@ export function createPatchFunction (backend) {
285285
}
286286
// for slot content they should also get the scopeId from the host instance.
287287
if (isDef(i = activeInstance) &&
288-
i !== vnode.context &&
289-
isDef(i = i.$options._scopeId)) {
288+
i !== vnode.context &&
289+
isDef(i = i.$options._scopeId)
290+
) {
290291
nodeOps.setAttribute(vnode.elm, i, '')
291292
}
292293
}
@@ -438,9 +439,10 @@ export function createPatchFunction (backend) {
438439
// if the new node is not cloned it means the render functions have been
439440
// reset by the hot-reload-api and we need to do a proper re-render.
440441
if (isTrue(vnode.isStatic) &&
441-
isTrue(oldVnode.isStatic) &&
442-
vnode.key === oldVnode.key &&
443-
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
442+
isTrue(oldVnode.isStatic) &&
443+
vnode.key === oldVnode.key &&
444+
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
445+
) {
444446
vnode.elm = oldVnode.elm
445447
vnode.componentInstance = oldVnode.componentInstance
446448
return
@@ -529,8 +531,9 @@ export function createPatchFunction (backend) {
529531
// longer than the virtual children list.
530532
if (!childrenMatch || childNode) {
531533
if (process.env.NODE_ENV !== 'production' &&
532-
typeof console !== 'undefined' &&
533-
!bailed) {
534+
typeof console !== 'undefined' &&
535+
!bailed
536+
) {
534537
bailed = true
535538
console.warn('Parent: ', elm)
536539
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children)

src/platforms/web/runtime/components/transition.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export default {
103103

104104
// warn invalid mode
105105
if (process.env.NODE_ENV !== 'production' &&
106-
mode && mode !== 'in-out' && mode !== 'out-in') {
106+
mode && mode !== 'in-out' && mode !== 'out-in'
107+
) {
107108
warn(
108109
'invalid <transition> mode: ' + mode,
109110
this.$parent

src/platforms/web/runtime/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ setTimeout(() => {
5656
}
5757
}
5858
if (process.env.NODE_ENV !== 'production' &&
59-
config.productionTip !== false &&
60-
inBrowser && typeof console !== 'undefined') {
59+
config.productionTip !== false &&
60+
inBrowser && typeof console !== 'undefined'
61+
) {
6162
console[console.info ? 'info' : 'log'](
6263
`You are running Vue in development mode.\n` +
6364
`Make sure to turn on production mode when deploying for production.\n` +

src/platforms/web/runtime/modules/style.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ function updateStyle (oldVnode: VNodeWithData, vnode: VNodeWithData) {
4949
const oldData = oldVnode.data
5050

5151
if (isUndef(data.staticStyle) && isUndef(data.style) &&
52-
isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
52+
isUndef(oldData.staticStyle) && isUndef(oldData.style)
53+
) {
5354
return
5455
}
5556

src/platforms/web/runtime/modules/transition.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ export function enter (vnode: VNodeWithData, toggleDisplay: ?() => void) {
134134
const parent = el.parentNode
135135
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
136136
if (pendingNode &&
137-
pendingNode.tag === vnode.tag &&
138-
pendingNode.elm._leaveCb) {
137+
pendingNode.tag === vnode.tag &&
138+
pendingNode.elm._leaveCb
139+
) {
139140
pendingNode.elm._leaveCb()
140141
}
141142
enterHook && enterHook(el, cb)

src/platforms/web/runtime/transition-util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ export let animationEndEvent = 'animationend'
4444
if (hasTransition) {
4545
/* istanbul ignore if */
4646
if (window.ontransitionend === undefined &&
47-
window.onwebkittransitionend !== undefined) {
47+
window.onwebkittransitionend !== undefined
48+
) {
4849
transitionProp = 'WebkitTransition'
4950
transitionEndEvent = 'webkitTransitionEnd'
5051
}
5152
if (window.onanimationend === undefined &&
52-
window.onwebkitanimationend !== undefined) {
53+
window.onwebkitanimationend !== undefined
54+
) {
5355
animationProp = 'WebkitAnimation'
5456
animationEndEvent = 'webkitAnimationEnd'
5557
}

src/platforms/web/server/modules/dom-props.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export default function renderDOMProps (node: VNodeWithData): string {
3030
} else {
3131
const attr = propsToAttrMap[key] || key.toLowerCase()
3232
if (isRenderableAttr(attr) &&
33-
// avoid rendering double-bound props/attrs twice
34-
!(isDef(attrs) && isDef(attrs[attr]))) {
33+
// avoid rendering double-bound props/attrs twice
34+
!(isDef(attrs) && isDef(attrs[attr]))
35+
) {
3536
res += renderAttr(attr, props[key])
3637
}
3738
}

src/platforms/weex/runtime/modules/class.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ function updateClass (oldVnode: VNodeWithData, vnode: VNodeWithData) {
88

99
const data: VNodeData = vnode.data
1010
const oldData: VNodeData = oldVnode.data
11-
if (!data.staticClass && !data.class &&
12-
(!oldData || (!oldData.staticClass && !oldData.class))) {
11+
if (!data.staticClass &&
12+
!data.class &&
13+
(!oldData || (!oldData.staticClass && !oldData.class))
14+
) {
1315
return
1416
}
1517

src/platforms/weex/runtime/modules/transition.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ function enter (_, vnode) {
9494
const parent = el.parentNode
9595
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
9696
if (pendingNode &&
97-
pendingNode.context === vnode.context &&
98-
pendingNode.tag === vnode.tag &&
99-
pendingNode.elm._leaveCb) {
97+
pendingNode.context === vnode.context &&
98+
pendingNode.tag === vnode.tag &&
99+
pendingNode.elm._leaveCb
100+
) {
100101
pendingNode.elm._leaveCb()
101102
}
102103
enterHook && enterHook(el, cb)

src/server/render.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ function renderStartingTag (node: VNode, context) {
255255
let scopeId
256256
const activeInstance = context.activeInstance
257257
if (isDef(activeInstance) &&
258-
activeInstance !== node.context &&
259-
isDef(scopeId = activeInstance.$options._scopeId)) {
258+
activeInstance !== node.context &&
259+
isDef(scopeId = activeInstance.$options._scopeId)
260+
) {
260261
markup += ` ${(scopeId: any)}`
261262
}
262263
while (isDef(node)) {

0 commit comments

Comments
 (0)