From 43d65a56bbe91de967fa2ff86b25ec216bfd5ce1 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 22:16:02 +0300 Subject: style: fix linting errors :rotating_light: --- src/lib/Markdown/Content.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Markdown/Content.tsx b/src/lib/Markdown/Content.tsx index caac91c..aaea100 100644 --- a/src/lib/Markdown/Content.tsx +++ b/src/lib/Markdown/Content.tsx @@ -24,7 +24,7 @@ const denotesClosingHtml= (line: string, tag: string): boolean => { return line.match(regex) !== null; } -const denotesSelfClosingHtml = (line: string): any => { +const denotesSelfClosingHtml = (line: string): string[] | null => { const regex = /(<[^/\s]*[^<]*\/>)/g; return line.match(regex); } @@ -44,14 +44,14 @@ const Content: React.FC = ({ rawLines }) => { const dottedListLines = rawLines.splice(0, closeIndex).slice(0, closeIndex); dottedListLines.unshift(line); buffer = ; - } else if (denotesOpenHtml(line)) { - const tag = denotesOpenHtml(line); + } else if ((buffer = denotesOpenHtml(line))) { + const tag = buffer; const closeIndex = rawLines.findIndex(line => denotesClosingHtml(line, tag)); const htmlLines = rawLines.splice(0, closeIndex + 1).slice(0, closeIndex); htmlLines.unshift(line); buffer =
; - } else if (denotesSelfClosingHtml(line) !== null) { - const match = denotesSelfClosingHtml(line)[0]; + } else if ((buffer = denotesSelfClosingHtml(line)) !== null) { + const match = buffer[0]; const [before, after] = line.split(match); console.log({ line, match, before, after}); buffer = ( -- cgit v1.2.3