[ci] yarn format

This commit is contained in:
matthewp 2021-06-14 12:36:32 +00:00 committed by GitHub Actions
parent 271cfe6ce3
commit a5d6e434ab
4 changed files with 11 additions and 11 deletions

View file

@ -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];
}

View file

@ -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);
});

View file

@ -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);
}

View file

@ -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;