From b5269bee4d36af0546727148ebf35659bf94f49f Mon Sep 17 00:00:00 2001 From: matthewp Date: Wed, 9 Nov 2022 19:28:54 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/runtime/server/hydration.ts | 2 +- packages/astro/src/runtime/server/jsx.ts | 9 ++++----- packages/astro/test/units/render/jsx.test.js | 9 +++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/astro/src/runtime/server/hydration.ts b/packages/astro/src/runtime/server/hydration.ts index 36e7ca287..07a42445b 100644 --- a/packages/astro/src/runtime/server/hydration.ts +++ b/packages/astro/src/runtime/server/hydration.ts @@ -105,7 +105,7 @@ export function extractDirectives( extracted.props[key] = value; } } - for(const sym of Object.getOwnPropertySymbols(inputProps)) { + for (const sym of Object.getOwnPropertySymbols(inputProps)) { extracted.props[sym] = inputProps[sym]; } diff --git a/packages/astro/src/runtime/server/jsx.ts b/packages/astro/src/runtime/server/jsx.ts index 96a15299c..35775a3c3 100644 --- a/packages/astro/src/runtime/server/jsx.ts +++ b/packages/astro/src/runtime/server/jsx.ts @@ -28,7 +28,7 @@ class Skip { haveNoTried() { return this.count === 0; } - + isCompleted() { return this.count > 2; } @@ -59,7 +59,7 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise { // Extract the skip from the props, if we've already attempted a previous render let skip: Skip; - if(vnode.props[Skip.symbol]) { + if (vnode.props[Skip.symbol]) { skip = vnode.props[Skip.symbol]; } else { skip = new Skip(vnode); @@ -107,7 +107,7 @@ Did you forget to import the component or is it possible there is a typo?`); return await renderJSX(result, output); } if (typeof vnode.type === 'function') { - if(skip.haveNoTried() || skip.isCompleted()) { + if (skip.haveNoTried() || skip.isCompleted()) { useConsoleFilter(); try { const output = await vnode.type(vnode.props ?? {}); @@ -119,9 +119,8 @@ Did you forget to import the component or is it possible there is a typo?`); renderResult = await renderJSXVNode(result, output, skip); return renderResult; } - } catch (e: unknown) { - if(skip.isCompleted()) { + if (skip.isCompleted()) { throw e; } skip.increment(); diff --git a/packages/astro/test/units/render/jsx.test.js b/packages/astro/test/units/render/jsx.test.js index dd907725d..a34b6b53b 100644 --- a/packages/astro/test/units/render/jsx.test.js +++ b/packages/astro/test/units/render/jsx.test.js @@ -1,6 +1,11 @@ import { expect } from 'chai'; -import { createComponent, render, renderComponent, renderSlot } from '../../../dist/runtime/server/index.js'; +import { + createComponent, + render, + renderComponent, + renderSlot, +} from '../../../dist/runtime/server/index.js'; import { jsx } from '../../../dist/jsx-runtime/index.js'; import { createBasicEnvironment, @@ -106,7 +111,7 @@ describe('core/render', () => { try { await response.text(); expect(false).to.equal(true, 'should not have been successful'); - } catch(err) { + } catch (err) { expect(err.message).to.equal('uh oh'); } });