Skip to content

Commit

Permalink
[Docs] Fix multiline import statements in Demo JS tab output (#2966)
Browse files Browse the repository at this point in the history
* minor bug fixed in src-docs dynamic import

* Resolved lint error
  • Loading branch information
thompsongl authored Mar 4, 2020
1 parent 9f823ac commit 7a24b3f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class GuideSection extends Component {
"from '@elastic/eui';"
);
renderedCode = renderedCode.split('\n');
let linesWithImport = [];
const linesWithImport = [];
// eslint-disable-next-line guard-for-in
for (const idx in renderedCode) {
const line = renderedCode[idx];
Expand All @@ -179,13 +179,12 @@ export class GuideSection extends Component {
renderedCode[idx] = '';
}
}

if (linesWithImport.length > 1) {
linesWithImport[0] = linesWithImport[0].replace(
" } from '@elastic/eui';",
','
);
for (let i = 1; i < linesWithImport.length - 1; linesWithImport++) {
for (let i = 1; i < linesWithImport.length - 1; i++) {
linesWithImport[i] = linesWithImport[i]
.replace('import {', '')
.replace(" } from '@elastic/eui';", ',');
Expand Down

0 comments on commit 7a24b3f

Please sign in to comment.