From a5d6e434ab0991dcad2ad5bb19c9dcede5b223f5 Mon Sep 17 00:00:00 2001 From: matthewp Date: Mon, 14 Jun 2021 12:36:32 +0000 Subject: [PATCH] [ci] yarn format --- packages/astro/src/internal/__astro_component.ts | 6 +++--- packages/astro/test/preact-component.test.js | 2 +- packages/renderers/renderer-preact/server.js | 4 ++-- packages/renderers/renderer-react/server.js | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/astro/src/internal/__astro_component.ts b/packages/astro/src/internal/__astro_component.ts index 10844db93..4976fe84f 100644 --- a/packages/astro/src/internal/__astro_component.ts +++ b/packages/astro/src/internal/__astro_component.ts @@ -40,16 +40,16 @@ async function resolveRenderer(Component: any, props: any = {}, children?: strin try { const shouldUse: boolean = await __renderer.check(Component, props, children); - if(shouldUse) { + if (shouldUse) { rendererCache.set(Component, __renderer); return __renderer; } - } catch(err) { + } catch (err) { errors.push(err); } } - if(errors.length) { + if (errors.length) { // For now just throw the first error we encounter. throw errors[0]; } diff --git a/packages/astro/test/preact-component.test.js b/packages/astro/test/preact-component.test.js index 2ff4bbfdc..5971cc174 100644 --- a/packages/astro/test/preact-component.test.js +++ b/packages/astro/test/preact-component.test.js @@ -26,7 +26,7 @@ PreactComponent('Can load function component', async ({ runtime }) => { PreactComponent('Can use hooks', async ({ runtime }) => { const result = await runtime.load('/hooks'); if (result.error) throw new Error(result.error); - + const $ = doc(result.contents); assert.equal($('#world').length, 1); }); diff --git a/packages/renderers/renderer-preact/server.js b/packages/renderers/renderer-preact/server.js index 989e2d385..a46bb39b2 100644 --- a/packages/renderers/renderer-preact/server.js +++ b/packages/renderers/renderer-preact/server.js @@ -3,9 +3,9 @@ import { renderToString } from 'preact-render-to-string'; import StaticHtml from './static-html.js'; function check(Component, props, children) { - if(typeof Component !== 'function') return false; + if (typeof Component !== 'function') return false; - if(typeof Component.prototype.render === 'function') { + if (typeof Component.prototype.render === 'function') { return BaseComponent.isPrototypeOf(Component); } diff --git a/packages/renderers/renderer-react/server.js b/packages/renderers/renderer-react/server.js index 8ac177c7c..4bd9e321d 100644 --- a/packages/renderers/renderer-react/server.js +++ b/packages/renderers/renderer-react/server.js @@ -5,9 +5,9 @@ import StaticHtml from './static-html.js'; const reactTypeof = Symbol.for('react.element'); function check(Component, props, children) { - if(typeof Component !== 'function') return false; + if (typeof Component !== 'function') return false; - if(typeof Component.prototype.render === 'function') { + if (typeof Component.prototype.render === 'function') { return BaseComponent.isPrototypeOf(Component); } @@ -16,10 +16,10 @@ function check(Component, props, children) { function Tester(...args) { try { const vnode = Component(...args); - if(vnode && vnode['$$typeof'] === reactTypeof) { + if (vnode && vnode['$$typeof'] === reactTypeof) { isReactComponent = true; } - } catch(err) { + } catch (err) { error = err; } @@ -28,7 +28,7 @@ function check(Component, props, children) { renderToStaticMarkup(Tester, props, children); - if(error) { + if (error) { throw error; } return isReactComponent;