Remove all dot-folder imports everywhere
We aren't supposed to import from '.' or '../..' etc; point to the actual node being imported instead. I did allow e.g. '../../bigfolder' however. Going all the way to the individual file could be done too, but is a matter of taste perhaps. Also ran Organize Imports on all the touched files :) No changeset since there are no functional changes at all - only the imports changed Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -13,28 +13,27 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { useAsync } from 'react-use';
|
||||
import { useTheme } from '@material-ui/core';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { EntityName } from '@backstage/catalog-model';
|
||||
import { useApi } from '@backstage/core';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import { useShadowDom } from '..';
|
||||
import { useTheme } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useAsync } from 'react-use';
|
||||
import { techdocsStorageApiRef } from '../../api';
|
||||
import TechDocsProgressBar from './TechDocsProgressBar';
|
||||
|
||||
import { useShadowDom } from '../hooks';
|
||||
import transformer, {
|
||||
addBaseUrl,
|
||||
rewriteDocLinks,
|
||||
addLinkClickListener,
|
||||
removeMkdocsHeader,
|
||||
simplifyMkdocsFooter,
|
||||
onCssReady,
|
||||
sanitizeDOM,
|
||||
injectCss,
|
||||
onCssReady,
|
||||
removeMkdocsHeader,
|
||||
rewriteDocLinks,
|
||||
sanitizeDOM,
|
||||
simplifyMkdocsFooter,
|
||||
} from '../transformers';
|
||||
import { TechDocsNotFound } from './TechDocsNotFound';
|
||||
import TechDocsProgressBar from './TechDocsProgressBar';
|
||||
|
||||
type Props = {
|
||||
entityId: EntityName;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { createTestShadowDom } from '../../test-utils';
|
||||
import { addLinkClickListener } from '.';
|
||||
import { addLinkClickListener } from './addLinkClickListener';
|
||||
|
||||
describe('addLinkClickListener', () => {
|
||||
it('calls onClick when a link has been clicked', () => {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import transform, { Transformer } from '.';
|
||||
import transform, { Transformer } from './index';
|
||||
|
||||
describe('transform', () => {
|
||||
it('calls the transformers', () => {
|
||||
|
||||
@@ -23,6 +23,8 @@ export * from './onCssReady';
|
||||
export * from './sanitizeDOM';
|
||||
export * from './injectCss';
|
||||
|
||||
// TODO(freben): move all of this out of index
|
||||
|
||||
export type Transformer = (dom: Element) => Element;
|
||||
|
||||
function transform(
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
|
||||
import { createTestShadowDom, FIXTURES } from '../../../test-utils';
|
||||
import { Transformer, sanitizeDOM } from '..';
|
||||
import { Transformer } from '../index';
|
||||
import { sanitizeDOM } from '../sanitizeDOM';
|
||||
|
||||
const injectMaliciousLink = (): Transformer => dom => {
|
||||
const link = document.createElement('a');
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
// @ts-ignore
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
import type { Transformer } from '..';
|
||||
import type { Transformer } from '../index';
|
||||
import { TECHDOCS_ALLOWED_TAGS } from './tags';
|
||||
import { TECHDOCS_ALLOWED_ATTRIBUTES } from './attributes';
|
||||
|
||||
// TODO(freben): move all of this out of index
|
||||
|
||||
export const sanitizeDOM = (): Transformer => {
|
||||
return dom => {
|
||||
const sanitizedHtml = sanitizeHtml(dom.innerHTML, {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { createTestShadowDom, FIXTURES } from '../../test-utils';
|
||||
import { simplifyMkdocsFooter } from '.';
|
||||
import { simplifyMkdocsFooter } from './simplifyMkdocsFooter';
|
||||
|
||||
describe('simplifyMkdocsFooter', () => {
|
||||
it('does not remove mkdocs copyright', () => {
|
||||
|
||||
Reference in New Issue
Block a user