From 91a5a7af58b06bcf32be8458926c076c34d0dbb6 Mon Sep 17 00:00:00 2001
From: Roman Hotsiy
Date: Thu, 25 Jun 2020 18:46:50 +0300
Subject: [PATCH] chore: enable import esModuleInterop
---
demo/webpack.config.ts | 6 +++---
src/common-elements/PrismDiv.tsx | 13 +++----------
src/components/Endpoint/Endpoint.tsx | 2 +-
src/components/Endpoint/styled.elements.ts | 4 +++-
src/components/ErrorBoundary.tsx | 4 ++--
src/components/SideMenu/styled.elements.ts | 2 +-
.../StickySidebar/StickyResponsiveSidebar.tsx | 2 +-
src/components/StoreBuilder.ts | 2 +-
src/components/__tests__/JsonViewer.tsx | 6 +++---
src/services/MarkdownRenderer.ts | 2 +-
src/services/MarkerService.ts | 2 +-
src/services/ScrollService.ts | 2 +-
src/setupTests.ts | 4 ++--
src/utils/JsonPointer.ts | 2 +-
src/utils/loadAndBundleSpec.ts | 2 +-
src/utils/openapi.ts | 2 +-
tsconfig.json | 2 ++
17 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/demo/webpack.config.ts b/demo/webpack.config.ts
index d48443aea1..a95f674845 100644
--- a/demo/webpack.config.ts
+++ b/demo/webpack.config.ts
@@ -1,6 +1,6 @@
-import * as CopyWebpackPlugin from 'copy-webpack-plugin';
-import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
-import * as HtmlWebpackPlugin from 'html-webpack-plugin';
+import CopyWebpackPlugin from 'copy-webpack-plugin';
+import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
import { compact } from 'lodash';
import { resolve } from 'path';
import * as webpack from 'webpack';
diff --git a/src/common-elements/PrismDiv.tsx b/src/common-elements/PrismDiv.tsx
index c1cb692893..20d3ff5cea 100644
--- a/src/common-elements/PrismDiv.tsx
+++ b/src/common-elements/PrismDiv.tsx
@@ -1,14 +1,11 @@
import styled, { extensionsHook } from '../styled-components';
+/**
+ * Based on prism-dark.css
+ */
export const PrismDiv = styled.div`
- /**
- * Based on prism-dark.css
- */
-
code[class*='language-'],
pre[class*='language-'] {
- /* color: white;
- background: none; */
text-shadow: 0 -0.1em 0.2em black;
text-align: left;
white-space: pre;
@@ -82,10 +79,6 @@ export const PrismDiv = styled.div`
}
}
- /* .property.token.string {
- color: white;
- } */
-
.token.operator,
.token.entity,
.token.url,
diff --git a/src/components/Endpoint/Endpoint.tsx b/src/components/Endpoint/Endpoint.tsx
index e59ceff5e9..9e9a5f922d 100644
--- a/src/components/Endpoint/Endpoint.tsx
+++ b/src/components/Endpoint/Endpoint.tsx
@@ -62,7 +62,7 @@ export class Endpoint extends React.Component {
style={{ marginRight: '-25px' }}
/>
-
+
{operation.servers.map(server => {
const normalizedUrl = options.expandDefaultServerVariables
? expandDefaultServerVariables(server.url, server.variables)
diff --git a/src/components/Endpoint/styled.elements.ts b/src/components/Endpoint/styled.elements.ts
index 9524e9a4d4..5bf7b9955e 100644
--- a/src/components/Endpoint/styled.elements.ts
+++ b/src/components/Endpoint/styled.elements.ts
@@ -67,7 +67,9 @@ export const ServersOverlay = styled.div<{ expanded: boolean }>`
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
transition: all 0.25s ease;
- ${props => (props.expanded ? '' : 'transform: translateY(-50%) scaleY(0);')}
+ visibility: hidden;
+
+ ${props => (props.expanded ? 'visibility: visible;' : 'transform: translateY(-50%) scaleY(0);')}
`;
export const ServerItem = styled.div`
diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx
index d73c6f5717..06da96cca9 100644
--- a/src/components/ErrorBoundary.tsx
+++ b/src/components/ErrorBoundary.tsx
@@ -29,8 +29,8 @@ export class ErrorBoundary extends React.Component<{}, { error?: Error }> {
{this.state.error.stack}
- ReDoc Version: {__REDOC_VERSION__}
- Commit: {__REDOC_REVISION__}
+ {/* ReDoc Version: {__REDOC_VERSION__}
+ Commit: {__REDOC_REVISION__} */}
);
}
diff --git a/src/components/SideMenu/styled.elements.ts b/src/components/SideMenu/styled.elements.ts
index f400b170dc..26857f11f9 100644
--- a/src/components/SideMenu/styled.elements.ts
+++ b/src/components/SideMenu/styled.elements.ts
@@ -1,4 +1,4 @@
-import * as classnames from 'classnames';
+import classnames from 'classnames';
import { darken } from 'polished';
import { deprecatedCss, ShelfIcon } from '../../common-elements';
diff --git a/src/components/StickySidebar/StickyResponsiveSidebar.tsx b/src/components/StickySidebar/StickyResponsiveSidebar.tsx
index 45b70e2b68..157bb15a31 100644
--- a/src/components/StickySidebar/StickyResponsiveSidebar.tsx
+++ b/src/components/StickySidebar/StickyResponsiveSidebar.tsx
@@ -33,7 +33,7 @@ const StyledStickySidebar = styled.div<{ open?: boolean }>`
flex-direction: column;
backface-visibility: hidden;
- /* contain: strict; TODO: breaks layout since Chrome 80*/
+ /* contain: strict; TODO: breaks layout since Chrome 80 */
height: 100vh;
position: sticky;
diff --git a/src/components/StoreBuilder.ts b/src/components/StoreBuilder.ts
index d675ca5e57..4ac2300dbf 100644
--- a/src/components/StoreBuilder.ts
+++ b/src/components/StoreBuilder.ts
@@ -1,4 +1,4 @@
-import * as memoize from 'memoize-one/dist/memoize-one.cjs'; // fixme: https://github.com/alexreardon/memoize-one/issues/37
+import memoize from 'memoize-one/dist/memoize-one.cjs'; // fixme: https://github.com/alexreardon/memoize-one/issues/37
import { Component, createContext } from 'react';
import { AppStore } from '../services/';
diff --git a/src/components/__tests__/JsonViewer.tsx b/src/components/__tests__/JsonViewer.tsx
index 8f8f745ee7..8649c14d3f 100644
--- a/src/components/__tests__/JsonViewer.tsx
+++ b/src/components/__tests__/JsonViewer.tsx
@@ -25,11 +25,11 @@ describe('Components', () => {
test('should collapse/uncollapse', () => {
expect(component.html()).not.toContain('class="hoverable"'); // all are collapsed by default
- const expandAll = component.find('div > span[children=" Expand all "]');
+ const expandAll = component.find('div > button[children=" Expand all "]');
expandAll.simulate('click');
expect(component.html()).toContain('class="hoverable"'); // all are collapsed
- const collapseAll = component.find('div > span[children=" Collapse all "]');
+ const collapseAll = component.find('div > button[children=" Collapse all "]');
collapseAll.simulate('click');
expect(component.html()).not.toContain('class="hoverable"'); // all are collapsed
});
@@ -37,7 +37,7 @@ describe('Components', () => {
test('should collapse/uncollapse', () => {
ClipboardService.copySelected = jest.fn();
- const copy = component.find('span[onClick]').first();
+ const copy = component.find('button[onClick]').first();
copy.simulate('click');
expect(ClipboardService.copySelected as jest.Mock).toHaveBeenCalled();
diff --git a/src/services/MarkdownRenderer.ts b/src/services/MarkdownRenderer.ts
index 9276a09659..30c29f359d 100644
--- a/src/services/MarkdownRenderer.ts
+++ b/src/services/MarkdownRenderer.ts
@@ -1,4 +1,4 @@
-import * as marked from 'marked';
+import marked from 'marked';
import { highlight, safeSlugify, unescapeHTMLChars } from '../utils';
import { AppStore } from './AppStore';
diff --git a/src/services/MarkerService.ts b/src/services/MarkerService.ts
index 1bde6b3b69..12e2be2619 100644
--- a/src/services/MarkerService.ts
+++ b/src/services/MarkerService.ts
@@ -1,4 +1,4 @@
-import * as Mark from 'mark.js';
+import Mark from 'mark.js';
export class MarkerService {
map: Map = new Map();
diff --git a/src/services/ScrollService.ts b/src/services/ScrollService.ts
index 1843ea3756..357911ef81 100644
--- a/src/services/ScrollService.ts
+++ b/src/services/ScrollService.ts
@@ -1,5 +1,5 @@
import { bind } from 'decko';
-import * as EventEmitter from 'eventemitter3';
+import EventEmitter from 'eventemitter3';
import { IS_BROWSER, querySelector, Throttle } from '../utils';
import { RedocNormalizedOptions } from './RedocNormalizedOptions';
diff --git a/src/setupTests.ts b/src/setupTests.ts
index 5a599cc21a..a6b0465d32 100644
--- a/src/setupTests.ts
+++ b/src/setupTests.ts
@@ -1,5 +1,5 @@
-import * as Enzyme from 'enzyme';
-import * as Adapter from 'enzyme-adapter-react-16';
+import Enzyme from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
import 'raf/polyfill';
Enzyme.configure({ adapter: new Adapter() });
diff --git a/src/utils/JsonPointer.ts b/src/utils/JsonPointer.ts
index 96337069fa..8b98e46bb1 100644
--- a/src/utils/JsonPointer.ts
+++ b/src/utils/JsonPointer.ts
@@ -1,5 +1,5 @@
'use strict';
-import * as JsonPointerLib from 'json-pointer';
+import JsonPointerLib from 'json-pointer';
const origParse = JsonPointerLib.parse;
/**
diff --git a/src/utils/loadAndBundleSpec.ts b/src/utils/loadAndBundleSpec.ts
index d2431b8d5e..95040594af 100644
--- a/src/utils/loadAndBundleSpec.ts
+++ b/src/utils/loadAndBundleSpec.ts
@@ -1,4 +1,4 @@
-import * as JsonSchemaRefParser from 'json-schema-ref-parser';
+import JsonSchemaRefParser from 'json-schema-ref-parser';
/* tslint:disable-next-line:no-implicit-dependencies */
import { convertObj } from 'swagger2openapi';
import { OpenAPISpec } from '../types';
diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts
index 3dba3d2287..624770be19 100644
--- a/src/utils/openapi.ts
+++ b/src/utils/openapi.ts
@@ -1,5 +1,5 @@
import { dirname } from 'path';
-import * as URLtemplate from 'url-template';
+import URLtemplate from 'url-template';
import { FieldModel } from '../services/models';
import { OpenAPIParser } from '../services/OpenAPIParser';
diff --git a/tsconfig.json b/tsconfig.json
index eff5172a1d..85b6bffb65 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -5,6 +5,8 @@
"target": "es5",
"noImplicitAny": false,
"noUnusedParameters": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"sourceMap": true,