Skip to content

Commit af57ad1

Browse files
committed
chore: revert prettier
1 parent b588618 commit af57ad1

File tree

9 files changed

+94
-106
lines changed

9 files changed

+94
-106
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"lerna": "^3.16.4",
3838
"lint-staged": "^9.2.3",
3939
"minimist": "^1.2.0",
40-
"prettier": "^1.18.2",
40+
"prettier": "~1.14.0",
4141
"rollup": "^1.19.4",
4242
"rollup-plugin-alias": "^2.0.0",
4343
"rollup-plugin-json": "^4.0.0",

packages/reactivity/src/ref.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ export type UnwrapRef<T> = {
7272
}[T extends ComputedRef<any>
7373
? 'cRef'
7474
: T extends Ref
75-
? 'ref'
76-
: T extends Array<any>
77-
? 'array'
78-
: T extends Function | CollectionTypes
79-
? 'ref' // bail out on types that shouldn't be unwrapped
80-
: T extends object
81-
? 'object'
82-
: 'ref']
75+
? 'ref'
76+
: T extends Array<any>
77+
? 'array'
78+
: T extends Function | CollectionTypes
79+
? 'ref' // bail out on types that shouldn't be unwrapped
80+
: T extends object ? 'object' : 'ref']

packages/runtime-core/src/apiOptions.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ export function applyOptions(
288288
set: isFunction(set)
289289
? set.bind(ctx)
290290
: __DEV__
291-
? () => {
292-
warn(
293-
`Computed property "${key}" was assigned to but it has no setter.`
294-
)
295-
}
296-
: NOOP
291+
? () => {
292+
warn(
293+
`Computed property "${key}" was assigned to but it has no setter.`
294+
)
295+
}
296+
: NOOP
297297
})
298298
} else if (__DEV__) {
299299
warn(`Computed property "${key}" has no getter.`)

packages/runtime-core/src/apiWatch.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function watch<T>(
6161
): StopHandle
6262

6363
// overload #3: array of multiple sources + cb
64-
export function watch<T extends readonly WatcherSource<unknown>[]>(
64+
export function watch<T extends Readonly<WatcherSource<unknown>[]>>(
6565
sources: T,
6666
cb: WatchHandler<MapSources<T>>,
6767
options?: WatchOptions
@@ -94,10 +94,11 @@ function doWatch(
9494
let getter: () => any
9595
if (isArray(source)) {
9696
getter = () =>
97-
source.map(s =>
98-
isRef(s)
99-
? s.value
100-
: callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
97+
source.map(
98+
s =>
99+
isRef(s)
100+
? s.value
101+
: callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
101102
)
102103
} else if (isRef(source)) {
103104
getter = () => source.value

packages/runtime-core/src/componentProps.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ type OptionalKeys<T, MakeDefaultRequired> = Exclude<
5353
type InferPropType<T> = T extends null
5454
? any // null & true would fail to infer
5555
: T extends { type: null | true }
56-
? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
57-
: T extends ObjectConstructor | { type: ObjectConstructor }
58-
? { [key: string]: any }
59-
: T extends Prop<infer V>
60-
? V
61-
: T
56+
? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
57+
: T extends ObjectConstructor | { type: ObjectConstructor }
58+
? { [key: string]: any }
59+
: T extends Prop<infer V> ? V : T
6260

6361
export type ExtractPropTypes<
6462
O,

packages/runtime-core/src/createRenderer.ts

Lines changed: 62 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,83 +1162,72 @@ export function createRenderer<
11621162
) {
11631163
// create reactive effect for rendering
11641164
let mounted = false
1165-
instance.update = effect(
1166-
function componentEffect() {
1167-
if (!mounted) {
1168-
const subTree = (instance.subTree = renderComponentRoot(instance))
1169-
// beforeMount hook
1170-
if (instance.bm !== null) {
1171-
invokeHooks(instance.bm)
1172-
}
1173-
patch(
1174-
null,
1175-
subTree,
1176-
container,
1177-
anchor,
1178-
instance,
1179-
parentSuspense,
1180-
isSVG
1181-
)
1182-
initialVNode.el = subTree.el
1183-
// mounted hook
1184-
if (instance.m !== null) {
1185-
queuePostRenderEffect(instance.m, parentSuspense)
1186-
}
1187-
mounted = true
1188-
} else {
1189-
// updateComponent
1190-
// This is triggered by mutation of component's own state (next: null)
1191-
// OR parent calling processComponent (next: HostVNode)
1192-
const { next } = instance
1165+
instance.update = effect(function componentEffect() {
1166+
if (!mounted) {
1167+
const subTree = (instance.subTree = renderComponentRoot(instance))
1168+
// beforeMount hook
1169+
if (instance.bm !== null) {
1170+
invokeHooks(instance.bm)
1171+
}
1172+
patch(null, subTree, container, anchor, instance, parentSuspense, isSVG)
1173+
initialVNode.el = subTree.el
1174+
// mounted hook
1175+
if (instance.m !== null) {
1176+
queuePostRenderEffect(instance.m, parentSuspense)
1177+
}
1178+
mounted = true
1179+
} else {
1180+
// updateComponent
1181+
// This is triggered by mutation of component's own state (next: null)
1182+
// OR parent calling processComponent (next: HostVNode)
1183+
const { next } = instance
11931184

1194-
if (__DEV__) {
1195-
pushWarningContext(next || instance.vnode)
1196-
}
1185+
if (__DEV__) {
1186+
pushWarningContext(next || instance.vnode)
1187+
}
11971188

1198-
if (next !== null) {
1199-
updateComponentPreRender(instance, next)
1200-
}
1201-
const prevTree = instance.subTree
1202-
const nextTree = (instance.subTree = renderComponentRoot(instance))
1203-
// beforeUpdate hook
1204-
if (instance.bu !== null) {
1205-
invokeHooks(instance.bu)
1206-
}
1207-
// reset refs
1208-
// only needed if previous patch had refs
1209-
if (instance.refs !== EMPTY_OBJ) {
1210-
instance.refs = {}
1211-
}
1212-
patch(
1213-
prevTree,
1214-
nextTree,
1215-
// parent may have changed if it's in a portal
1216-
hostParentNode(prevTree.el as HostNode) as HostElement,
1217-
// anchor may have changed if it's in a fragment
1218-
getNextHostNode(prevTree),
1219-
instance,
1220-
parentSuspense,
1221-
isSVG
1222-
)
1223-
instance.vnode.el = nextTree.el
1224-
if (next === null) {
1225-
// self-triggered update. In case of HOC, update parent component
1226-
// vnode el. HOC is indicated by parent instance's subTree pointing
1227-
// to child component's vnode
1228-
updateHOCHostEl(instance, nextTree.el)
1229-
}
1230-
// updated hook
1231-
if (instance.u !== null) {
1232-
queuePostRenderEffect(instance.u, parentSuspense)
1233-
}
1189+
if (next !== null) {
1190+
updateComponentPreRender(instance, next)
1191+
}
1192+
const prevTree = instance.subTree
1193+
const nextTree = (instance.subTree = renderComponentRoot(instance))
1194+
// beforeUpdate hook
1195+
if (instance.bu !== null) {
1196+
invokeHooks(instance.bu)
1197+
}
1198+
// reset refs
1199+
// only needed if previous patch had refs
1200+
if (instance.refs !== EMPTY_OBJ) {
1201+
instance.refs = {}
1202+
}
1203+
patch(
1204+
prevTree,
1205+
nextTree,
1206+
// parent may have changed if it's in a portal
1207+
hostParentNode(prevTree.el as HostNode) as HostElement,
1208+
// anchor may have changed if it's in a fragment
1209+
getNextHostNode(prevTree),
1210+
instance,
1211+
parentSuspense,
1212+
isSVG
1213+
)
1214+
instance.vnode.el = nextTree.el
1215+
if (next === null) {
1216+
// self-triggered update. In case of HOC, update parent component
1217+
// vnode el. HOC is indicated by parent instance's subTree pointing
1218+
// to child component's vnode
1219+
updateHOCHostEl(instance, nextTree.el)
1220+
}
1221+
// updated hook
1222+
if (instance.u !== null) {
1223+
queuePostRenderEffect(instance.u, parentSuspense)
1224+
}
12341225

1235-
if (__DEV__) {
1236-
popWarningContext()
1237-
}
1226+
if (__DEV__) {
1227+
popWarningContext()
12381228
}
1239-
},
1240-
__DEV__ ? createDevEffectOptions(instance) : prodEffectOptions
1241-
)
1229+
}
1230+
}, __DEV__ ? createDevEffectOptions(instance) : prodEffectOptions)
12421231
}
12431232

12441233
function updateComponentPreRender(

packages/runtime-core/src/helpers/toString.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export function toString(val: unknown): string {
55
return val == null
66
? ''
77
: isArray(val) || (isPlainObject(val) && val.toString === objectToString)
8-
? JSON.stringify(val, null, 2)
9-
: String(val)
8+
? JSON.stringify(val, null, 2)
9+
: String(val)
1010
}

packages/runtime-dom/src/directives/vModel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function toNumber(val: string): number | string {
3535

3636
// We are exporting the v-model runtime directly as vnode hooks so that it can
3737
// be tree-shaken in case v-model is never used.
38-
export const vModelText: ObjectDirective<HTMLInputElement | HTMLTextAreaElement> = {
38+
export const vModelText: ObjectDirective<
39+
HTMLInputElement | HTMLTextAreaElement
40+
> = {
3941
beforeMount(el, { value, modifiers: { lazy, trim, number } }, vnode) {
4042
el.value = value
4143
const assign = getModelAssigner(vnode)

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5597,10 +5597,10 @@ prelude-ls@~1.1.2:
55975597
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
55985598
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
55995599

5600-
prettier@^1.18.2:
5601-
version "1.18.2"
5602-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
5603-
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
5600+
prettier@~1.14.0:
5601+
version "1.14.3"
5602+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895"
5603+
integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==
56045604

56055605
pretty-format@^24.9.0:
56065606
version "24.9.0"

0 commit comments

Comments
 (0)