.ts, .tsx - Format according to prettier

This commit is contained in:
2019-12-15 16:38:38 +05:30
parent 1019de3d9f
commit 509775028c
3 changed files with 28 additions and 28 deletions
+4 -4
View File
@@ -3,8 +3,8 @@ import {
ElementType,
FunctionComponent,
PropsWithChildren,
ReactText
} from "react";
ReactText,
} from 'react';
export interface IReactElementSubset<TProps = {}> {
props: PropsWithChildren<TProps>;
@@ -22,7 +22,7 @@ export function isFunctionalComponent(
eleType: ElementType
): eleType is FunctionComponent {
return (
typeof eleType === "function" && // can be various things
typeof eleType === 'function' && // can be various things
!(
(eleType.prototype && eleType.prototype.isReactComponent) // native arrows don't have prototypes // special property
)
@@ -33,7 +33,7 @@ export function isClassComponent(
eleType: ElementType
): eleType is ComponentClass {
return !!(
typeof eleType === "function" &&
typeof eleType === 'function' &&
eleType.prototype &&
eleType.prototype.isReactComponent
);
+11 -11
View File
@@ -1,15 +1,15 @@
import { root, text } from "mdast-builder";
import { Children as ReactChildren } from "react";
import * as stringify from "remark-stringify";
import * as unified from "unified";
import { root, text } from 'mdast-builder';
import { Children as ReactChildren } from 'react';
import * as stringify from 'remark-stringify';
import * as unified from 'unified';
// tslint:disable-next-line: no-implicit-dependencies
import { Parent as MDASTParent } from "unist";
import { Parent as MDASTParent } from 'unist';
import {
isClassComponent,
isFunctionalComponent,
ReactElementSubsetWithPrimitive
} from "./helpers";
ReactElementSubsetWithPrimitive,
} from './helpers';
function render(
node: ReactElementSubsetWithPrimitive,
@@ -24,7 +24,7 @@ function render(
if (node === null || node === undefined) {
// Handle (skip) null and undefined nodes
} else if (typeof node === "string" || typeof node === "number") {
} else if (typeof node === 'string' || typeof node === 'number') {
// Handle (render) string and number nodes as string in markdown
const currASTNode = text(node.toString());
@@ -82,10 +82,10 @@ function render(
// For root call, return string
if (parentASTNode === undefined && parentASTNodeMod.children.length > 0) {
const processor = unified().use(stringify, {
bullet: "-",
fence: "`",
bullet: '-',
fence: '`',
fences: true,
incrementListMarker: false
incrementListMarker: false,
});
const output = processor.stringify(parentASTNodeMod);