Merge pull request #15037 from luchillo17/feat/BCKSTG-93-linter-rules

Enable eslint-plugin-react with recommended settings & forbid button
This commit is contained in:
Fredrik Adelöw
2022-12-16 11:10:49 +01:00
committed by GitHub
10 changed files with 60 additions and 18 deletions
@@ -23,6 +23,8 @@ import {
SvgIcon,
Tooltip,
} from '@material-ui/core';
import Button from '@material-ui/core/Button';
import type { Transformer } from './transformer';
const CopyToClipboardTooltip = withStyles(theme => ({
tooltip: {
@@ -65,15 +67,13 @@ const CopyToClipboardButton = ({ text }: CopyToClipboardButtonProps) => {
onClose={handleClose}
leaveDelay={1000}
>
<button className="md-clipboard md-icon" onClick={handleClick}>
<Button className="md-clipboard md-icon" onClick={handleClick}>
<CopyToClipboardIcon />
</button>
</Button>
</CopyToClipboardTooltip>
);
};
import type { Transformer } from './transformer';
/**
* Recreates copy-to-clipboard functionality attached to <code> snippets that
* is native to mkdocs-material theme.
@@ -16,6 +16,7 @@
import { ApiProvider } from '@backstage/core-app-api';
import { searchApiRef } from '@backstage/plugin-search-react';
import { TestApiRegistry, wrapInTestApp } from '@backstage/test-utils';
import Button from '@material-ui/core/Button';
import {
act,
fireEvent,
@@ -136,9 +137,9 @@ describe('<TechDocsSearch />', () => {
const [entityName, setEntityName] = useState(entityId);
return wrapInTestApp(
<ApiProvider apis={apiRegistry}>
<button onClick={() => setEntityName(newEntityId)}>
<Button onClick={() => setEntityName(newEntityId)}>
Update Entity
</button>
</Button>
<TechDocsSearch entityId={entityName} debounceTime={0} />
</ApiProvider>,
);