]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: revert prettier
authorEvan You <yyx990803@gmail.com>
Tue, 22 Oct 2019 15:52:29 +0000 (11:52 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 22 Oct 2019 15:53:32 +0000 (11:53 -0400)
package.json
packages/reactivity/src/ref.ts
packages/runtime-core/src/apiOptions.ts
packages/runtime-core/src/apiWatch.ts
packages/runtime-core/src/componentProps.ts
packages/runtime-core/src/createRenderer.ts
packages/runtime-core/src/helpers/toString.ts
packages/runtime-dom/src/directives/vModel.ts
yarn.lock

index eb6779a1651a4f0ff7547e69623041b03141c0b3..edf9f47d9289da363411f0c052de09a9c9806a21 100644 (file)
@@ -37,7 +37,7 @@
     "lerna": "^3.16.4",
     "lint-staged": "^9.2.3",
     "minimist": "^1.2.0",
-    "prettier": "^1.18.2",
+    "prettier": "~1.14.0",
     "rollup": "^1.19.4",
     "rollup-plugin-alias": "^2.0.0",
     "rollup-plugin-json": "^4.0.0",
index 58c9c639e8ee56cc661aabcf19538d9b16d0ded3..efedc4f47a218ef0094335c14a720e34b98d5c3c 100644 (file)
@@ -72,11 +72,9 @@ export type UnwrapRef<T> = {
 }[T extends ComputedRef<any>
   ? 'cRef'
   : T extends Ref
-  ? 'ref'
-  : T extends Array<any>
-  ? 'array'
-  : T extends Function | CollectionTypes
-  ? 'ref' // bail out on types that shouldn't be unwrapped
-  : T extends object
-  ? 'object'
-  : 'ref']
+    ? 'ref'
+    : T extends Array<any>
+      ? 'array'
+      : T extends Function | CollectionTypes
+        ? 'ref' // bail out on types that shouldn't be unwrapped
+        : T extends object ? 'object' : 'ref']
index 4d50317dc516360fdf47b16e79799818cfbce255..26d1ceac59926fcc04049b0f6277db9ecd16a0fd 100644 (file)
@@ -288,12 +288,12 @@ export function applyOptions(
             set: isFunction(set)
               ? set.bind(ctx)
               : __DEV__
-              ? () => {
-                  warn(
-                    `Computed property "${key}" was assigned to but it has no setter.`
-                  )
-                }
-              : NOOP
+                ? () => {
+                    warn(
+                      `Computed property "${key}" was assigned to but it has no setter.`
+                    )
+                  }
+                : NOOP
           })
         } else if (__DEV__) {
           warn(`Computed property "${key}" has no getter.`)
index ff899d944406d3297eafdda751598f9c819c05c0..f374940e955037581d7aedc09b471ef20fd4b1cc 100644 (file)
@@ -61,7 +61,7 @@ export function watch<T>(
 ): StopHandle
 
 // overload #3: array of multiple sources + cb
-export function watch<T extends readonly WatcherSource<unknown>[]>(
+export function watch<T extends Readonly<WatcherSource<unknown>[]>>(
   sources: T,
   cb: WatchHandler<MapSources<T>>,
   options?: WatchOptions
@@ -94,10 +94,11 @@ function doWatch(
   let getter: () => any
   if (isArray(source)) {
     getter = () =>
-      source.map(s =>
-        isRef(s)
-          ? s.value
-          : callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
+      source.map(
+        s =>
+          isRef(s)
+            ? s.value
+            : callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
       )
   } else if (isRef(source)) {
     getter = () => source.value
index 9bd682a3552861c2b4241e5306b7f8a19ba5ac81..fc8120efaa89dbc0e3912ca72799a5ab32e6f982 100644 (file)
@@ -53,12 +53,10 @@ type OptionalKeys<T, MakeDefaultRequired> = Exclude<
 type InferPropType<T> = T extends null
   ? any // null & true would fail to infer
   : T extends { type: null | true }
-  ? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
-  : T extends ObjectConstructor | { type: ObjectConstructor }
-  ? { [key: string]: any }
-  : T extends Prop<infer V>
-  ? V
-  : T
+    ? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
+    : T extends ObjectConstructor | { type: ObjectConstructor }
+      ? { [key: string]: any }
+      : T extends Prop<infer V> ? V : T
 
 export type ExtractPropTypes<
   O,
index 253c42c94a5377711d4291c136a6a0f467eefd12..16ca8e8da3959d0ed734114703f152f5dbdc83ed 100644 (file)
@@ -1162,83 +1162,72 @@ export function createRenderer<
   ) {
     // create reactive effect for rendering
     let mounted = false
-    instance.update = effect(
-      function componentEffect() {
-        if (!mounted) {
-          const subTree = (instance.subTree = renderComponentRoot(instance))
-          // beforeMount hook
-          if (instance.bm !== null) {
-            invokeHooks(instance.bm)
-          }
-          patch(
-            null,
-            subTree,
-            container,
-            anchor,
-            instance,
-            parentSuspense,
-            isSVG
-          )
-          initialVNode.el = subTree.el
-          // mounted hook
-          if (instance.m !== null) {
-            queuePostRenderEffect(instance.m, parentSuspense)
-          }
-          mounted = true
-        } else {
-          // updateComponent
-          // This is triggered by mutation of component's own state (next: null)
-          // OR parent calling processComponent (next: HostVNode)
-          const { next } = instance
+    instance.update = effect(function componentEffect() {
+      if (!mounted) {
+        const subTree = (instance.subTree = renderComponentRoot(instance))
+        // beforeMount hook
+        if (instance.bm !== null) {
+          invokeHooks(instance.bm)
+        }
+        patch(null, subTree, container, anchor, instance, parentSuspense, isSVG)
+        initialVNode.el = subTree.el
+        // mounted hook
+        if (instance.m !== null) {
+          queuePostRenderEffect(instance.m, parentSuspense)
+        }
+        mounted = true
+      } else {
+        // updateComponent
+        // This is triggered by mutation of component's own state (next: null)
+        // OR parent calling processComponent (next: HostVNode)
+        const { next } = instance
 
-          if (__DEV__) {
-            pushWarningContext(next || instance.vnode)
-          }
+        if (__DEV__) {
+          pushWarningContext(next || instance.vnode)
+        }
 
-          if (next !== null) {
-            updateComponentPreRender(instance, next)
-          }
-          const prevTree = instance.subTree
-          const nextTree = (instance.subTree = renderComponentRoot(instance))
-          // beforeUpdate hook
-          if (instance.bu !== null) {
-            invokeHooks(instance.bu)
-          }
-          // reset refs
-          // only needed if previous patch had refs
-          if (instance.refs !== EMPTY_OBJ) {
-            instance.refs = {}
-          }
-          patch(
-            prevTree,
-            nextTree,
-            // parent may have changed if it's in a portal
-            hostParentNode(prevTree.el as HostNode) as HostElement,
-            // anchor may have changed if it's in a fragment
-            getNextHostNode(prevTree),
-            instance,
-            parentSuspense,
-            isSVG
-          )
-          instance.vnode.el = nextTree.el
-          if (next === null) {
-            // self-triggered update. In case of HOC, update parent component
-            // vnode el. HOC is indicated by parent instance's subTree pointing
-            // to child component's vnode
-            updateHOCHostEl(instance, nextTree.el)
-          }
-          // updated hook
-          if (instance.u !== null) {
-            queuePostRenderEffect(instance.u, parentSuspense)
-          }
+        if (next !== null) {
+          updateComponentPreRender(instance, next)
+        }
+        const prevTree = instance.subTree
+        const nextTree = (instance.subTree = renderComponentRoot(instance))
+        // beforeUpdate hook
+        if (instance.bu !== null) {
+          invokeHooks(instance.bu)
+        }
+        // reset refs
+        // only needed if previous patch had refs
+        if (instance.refs !== EMPTY_OBJ) {
+          instance.refs = {}
+        }
+        patch(
+          prevTree,
+          nextTree,
+          // parent may have changed if it's in a portal
+          hostParentNode(prevTree.el as HostNode) as HostElement,
+          // anchor may have changed if it's in a fragment
+          getNextHostNode(prevTree),
+          instance,
+          parentSuspense,
+          isSVG
+        )
+        instance.vnode.el = nextTree.el
+        if (next === null) {
+          // self-triggered update. In case of HOC, update parent component
+          // vnode el. HOC is indicated by parent instance's subTree pointing
+          // to child component's vnode
+          updateHOCHostEl(instance, nextTree.el)
+        }
+        // updated hook
+        if (instance.u !== null) {
+          queuePostRenderEffect(instance.u, parentSuspense)
+        }
 
-          if (__DEV__) {
-            popWarningContext()
-          }
+        if (__DEV__) {
+          popWarningContext()
         }
-      },
-      __DEV__ ? createDevEffectOptions(instance) : prodEffectOptions
-    )
+      }
+    }, __DEV__ ? createDevEffectOptions(instance) : prodEffectOptions)
   }
 
   function updateComponentPreRender(
index 8e8ee56b8618eae22b6eedb5680b85c1eba5e83a..968f51d6a725e456257abe3b9fae8c5411124684 100644 (file)
@@ -5,6 +5,6 @@ export function toString(val: unknown): string {
   return val == null
     ? ''
     : isArray(val) || (isPlainObject(val) && val.toString === objectToString)
-    ? JSON.stringify(val, null, 2)
-    : String(val)
+      ? JSON.stringify(val, null, 2)
+      : String(val)
 }
index 65802a6014664e930124d888108229a1f18484c8..20dfb9189e2ae386b376d9ac90e5d15421d16057 100644 (file)
@@ -35,7 +35,9 @@ function toNumber(val: string): number | string {
 
 // We are exporting the v-model runtime directly as vnode hooks so that it can
 // be tree-shaken in case v-model is never used.
-export const vModelText: ObjectDirective<HTMLInputElement | HTMLTextAreaElement> = {
+export const vModelText: ObjectDirective<
+  HTMLInputElement | HTMLTextAreaElement
+> = {
   beforeMount(el, { value, modifiers: { lazy, trim, number } }, vnode) {
     el.value = value
     const assign = getModelAssigner(vnode)
index 77e6d3f49ad575bdb516ce1911ca78be881ff194..26504e596a3214f05ce925e3d2f500516950a98e 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -5597,10 +5597,10 @@ prelude-ls@~1.1.2:
   resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
   integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
 
-prettier@^1.18.2:
-  version "1.18.2"
-  resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
-  integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
+prettier@~1.14.0:
+  version "1.14.3"
+  resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895"
+  integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==
 
 pretty-format@^24.9.0:
   version "24.9.0"