Skip to content

Commit d7a0dd1

Browse files
fix(bulk-import): align eslint-rules as per other plugins (#845)
* fix(bulk-import): align eslint-rules as per other plugins Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> * adding changeset Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> --------- Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
1 parent e5f4a3a commit d7a0dd1

19 files changed

Lines changed: 88 additions & 55 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-bulk-import': patch
3+
---
4+
5+
Aligned eslint-rules as per other plugins.

workspaces/bulk-import/plugins/bulk-import/.eslintrc.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
const eslintConfigFactory = require('@backstage/cli/config/eslint-factory');
17-
18-
module.exports = eslintConfigFactory(__dirname); // Load the default Backstage config
19-
module.exports.rules = {
20-
// TODO: Remove this later
21-
'react/forbid-elements': 'off',
22-
};
16+
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/AddRepositoriesDrawer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const AddRepositoriesDrawer = ({
147147
bottom: '20px',
148148
}}
149149
>
150-
<span>
150+
<Typography component="span">
151151
<Button
152152
variant="contained"
153153
color="primary"
@@ -159,16 +159,16 @@ export const AddRepositoriesDrawer = ({
159159
>
160160
Select
161161
</Button>
162-
</span>
163-
<span>
162+
</Typography>
163+
<Typography component="span">
164164
<Button
165165
data-testid="close-drawer"
166166
variant="outlined"
167167
onClick={onClose}
168168
>
169169
Cancel
170170
</Button>
171-
</span>
171+
</Typography>
172172
</Box>
173173
</Container>
174174
</Drawer>

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/AddRepositoriesFormFooter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Box from '@mui/material/Box';
2020
import Button from '@mui/material/Button';
2121
import CircularProgress from '@mui/material/CircularProgress';
2222
import Tooltip from '@mui/material/Tooltip';
23+
import Typography from '@mui/material/Typography';
2324
import { useFormikContext } from 'formik';
2425

2526
import {
@@ -105,7 +106,7 @@ export const AddRepositoriesFormFooter = () => {
105106
maxWidth: 'none',
106107
}}
107108
>
108-
<span>{submitButton}</span>
109+
<Typography component="span">{submitButton}</Typography>
109110
</Tooltip>
110111
) : (
111112
submitButton

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/ApprovalTool.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react';
17+
import type { ChangeEvent, FC } from 'react';
1818

1919
import HelpIcon from '@mui/icons-material/HelpOutline';
2020
import Box from '@mui/material/Box';
@@ -30,13 +30,13 @@ interface ApprovalToolProps {
3030
setFieldValue: (field: string, value: any) => void; // Type for setFieldValue from Formik
3131
}
3232

33-
const ApprovalTool: React.FC<ApprovalToolProps> = ({
33+
const ApprovalTool: FC<ApprovalToolProps> = ({
3434
approvalTool,
3535
setFieldValue,
3636
}) => {
3737
const theme = useTheme();
3838
const handleApprovalToolChange = (
39-
_event: React.ChangeEvent<{}>,
39+
_event: ChangeEvent<{}>,
4040
newValue: string,
4141
) => {
4242
setFieldValue('approvalTool', newValue);

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/CatalogInfoStatus.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useEffect } from 'react';
1818

1919
import { StatusRunning } from '@backstage/core-components';
2020

21+
import Typography from '@mui/material/Typography';
2122
import { useFormikContext } from 'formik';
2223

2324
import {
@@ -80,24 +81,27 @@ export const CatalogInfoStatus = ({
8081
if (!isDrawer && isLoading) {
8182
return (
8283
<StatusRunning>
83-
<span
84+
<Typography
85+
component="span"
8486
style={{ fontWeight: '400', fontSize: '0.875rem', color: '#181818' }}
8587
>
8688
Generating
87-
</span>
89+
</Typography>
8890
</StatusRunning>
8991
);
9092
}
9193

9294
if (importStatus) {
9395
return (
94-
<span style={{ color: '#6A6E73' }}>{getImportStatus(importStatus)}</span>
96+
<Typography component="span" style={{ color: '#6A6E73' }}>
97+
{getImportStatus(importStatus)}
98+
</Typography>
9599
);
96100
}
97101

98102
if (isDrawer || data?.totalReposInOrg === 0) {
99103
return null;
100104
}
101105

102-
return <span>Not Generated</span>;
106+
return <Typography component="span">Not Generated</Typography>;
103107
};

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/Illustrations.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import Typography from '@mui/material/Typography';
18+
1719
import { getImageForIconClass } from '../../utils/icons';
1820

1921
export const Illustrations = ({
@@ -25,7 +27,8 @@ export const Illustrations = ({
2527
}) => {
2628
return (
2729
<div>
28-
<span
30+
<Typography
31+
component="span"
2932
style={{
3033
justifyContent: 'center',
3134
display: 'flex',
@@ -36,15 +39,15 @@ export const Illustrations = ({
3639
alt={iconText}
3740
height="100px"
3841
/>
39-
</span>
40-
<p
42+
</Typography>
43+
<Typography
4144
style={{
4245
maxWidth: '150px',
4346
textAlign: 'center',
4447
}}
4548
>
4649
{iconText}
47-
</p>
50+
</Typography>
4851
</div>
4952
);
5053
};

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/SelectRepositories.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
import { Link } from '@backstage/core-components';
1818

19+
import Typography from '@mui/material/Typography';
20+
1921
import { AddRepositoryData } from '../../types';
2022

2123
export const SelectRepositories = ({
@@ -29,20 +31,28 @@ export const SelectRepositories = ({
2931
}) => {
3032
if (orgData?.totalReposInOrg === 0) {
3133
return (
32-
<span style={{ color: '#6A6E73' }} data-testid="no-repositories">
34+
<Typography
35+
component="span"
36+
style={{ color: '#6A6E73' }}
37+
data-testid="no-repositories"
38+
>
3339
No repositories found
34-
</span>
40+
</Typography>
3541
);
3642
}
3743

3844
if (orgData?.totalReposInOrg === addedRepositoriesCount) {
3945
return (
40-
<span style={{ color: '#6A6E73' }} data-testid="no-repositories">
46+
<Typography
47+
component="span"
48+
style={{ color: '#6A6E73' }}
49+
data-testid="no-repositories"
50+
>
4151
All repositories are added{' '}
4252
<Link to="" onClick={() => onOrgRowSelected(orgData)}>
4353
View
4454
</Link>
45-
</span>
55+
</Typography>
4656
);
4757
}
4858

@@ -51,21 +61,21 @@ export const SelectRepositories = ({
5161
Object.keys(orgData?.selectedRepositories || [])?.length === 0
5262
) {
5363
return (
54-
<span data-testid="select-repositories">
64+
<Typography component="span" data-testid="select-repositories">
5565
None{' '}
5666
<Link to="" onClick={() => onOrgRowSelected(orgData)}>
5767
Select
5868
</Link>
59-
</span>
69+
</Typography>
6070
);
6171
}
6272
return (
63-
<span data-testid="edit-repositories">
73+
<Typography component="span" data-testid="edit-repositories">
6474
{Object.keys(orgData.selectedRepositories || [])?.length}/
6575
{(orgData?.totalReposInOrg || 0) - addedRepositoriesCount}{' '}
6676
<Link onClick={() => onOrgRowSelected(orgData)} to="">
6777
Edit
6878
</Link>
69-
</span>
79+
</Typography>
7080
);
7181
};

workspaces/bulk-import/plugins/bulk-import/src/components/GitLabIcon.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import * as React from 'react';
16+
import type { FC, HTMLProps, ReactElement } from 'react';
1717

18-
const GitLabIcon: React.FC<React.HTMLProps<SVGElement>> = ({
19-
style,
20-
}): React.ReactElement => {
18+
const GitLabIcon: FC<HTMLProps<SVGElement>> = ({ style }): ReactElement => {
2119
return (
2220
<svg
2321
xmlns="http://www.w3.org/2000/svg"

workspaces/bulk-import/plugins/bulk-import/src/components/PreviewFile/PreviewFile.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import ReadyIcon from '@mui/icons-material/CheckOutlined';
2121
import FailIcon from '@mui/icons-material/ErrorOutline';
2222
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
2323
import Tooltip from '@mui/material/Tooltip';
24+
import Typography from '@mui/material/Typography';
2425
import { useFormikContext } from 'formik';
2526

2627
import {
@@ -72,7 +73,10 @@ export const PreviewFile = ({ data }: { data: AddRepositoryData }) => {
7273
style={{ verticalAlign: 'sub', paddingTop: '7px' }}
7374
/>
7475
</Tooltip>
75-
<span data-testid="failed"> Failed to create PR </span>
76+
<Typography component="span" data-testid="failed">
77+
{' '}
78+
Failed to create PR{' '}
79+
</Typography>
7680
<Link
7781
to={errorMessage.showRepositoryLink ? data.repoUrl || '' : ''}
7882
onClick={() =>

0 commit comments

Comments
 (0)