From 1a2225408801cac38de468ac03e40f90bae049d1 Mon Sep 17 00:00:00 2001 From: AmbrishRamachandiran Date: Thu, 21 Mar 2024 18:30:33 +0530 Subject: [PATCH] Add ESLint Rule to gitops-profile Plugin Signed-off-by: AmbrishRamachandiran --- .changeset/mean-pumpkins-whisper.md | 5 +++++ plugins/gitops-profiles/.eslintrc.js | 6 +++++- .../components/ClusterList/ClusterList.tsx | 4 ++-- .../ClusterTemplateCardList.tsx | 2 +- .../components/ProfileCard/ProfileCard.tsx | 19 ++++++++----------- .../ProfileCardList/ProfileCardList.tsx | 2 +- .../ProfileCatalog/ProfileCatalog.tsx | 4 +++- 7 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 .changeset/mean-pumpkins-whisper.md diff --git a/.changeset/mean-pumpkins-whisper.md b/.changeset/mean-pumpkins-whisper.md new file mode 100644 index 0000000000..f9bdb19288 --- /dev/null +++ b/.changeset/mean-pumpkins-whisper.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-gitops-profiles': patch +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the `gitops-profiles` plugin to migrate the Material UI imports. diff --git a/plugins/gitops-profiles/.eslintrc.js b/plugins/gitops-profiles/.eslintrc.js index e2a53a6ad2..c69a8f6aff 100644 --- a/plugins/gitops-profiles/.eslintrc.js +++ b/plugins/gitops-profiles/.eslintrc.js @@ -1 +1,5 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); +module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, { + rules: { + '@backstage/no-top-level-material-ui-4-imports': 'error', + }, + }); diff --git a/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx b/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx index 1080adc663..92ed26d2b7 100644 --- a/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx +++ b/plugins/gitops-profiles/src/components/ClusterList/ClusterList.tsx @@ -17,10 +17,10 @@ import React, { useState } from 'react'; import ClusterTable from '../ClusterTable/ClusterTable'; -import { Button } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; import useAsync from 'react-use/esm/useAsync'; import { gitOpsApiRef } from '../../api'; -import { Alert } from '@material-ui/lab'; +import Alert from '@material-ui/lab/Alert'; import { Content, diff --git a/plugins/gitops-profiles/src/components/ClusterTemplateCardList/ClusterTemplateCardList.tsx b/plugins/gitops-profiles/src/components/ClusterTemplateCardList/ClusterTemplateCardList.tsx index 99eddc5a48..d4c32ff204 100644 --- a/plugins/gitops-profiles/src/components/ClusterTemplateCardList/ClusterTemplateCardList.tsx +++ b/plugins/gitops-profiles/src/components/ClusterTemplateCardList/ClusterTemplateCardList.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; -import { Grid } from '@material-ui/core'; +import Grid from '@material-ui/core/Grid'; import ClusterTemplateCard from '../ClusterTemplateCard'; interface Props { diff --git a/plugins/gitops-profiles/src/components/ProfileCard/ProfileCard.tsx b/plugins/gitops-profiles/src/components/ProfileCard/ProfileCard.tsx index b9f0c42f32..3fed3bbb63 100644 --- a/plugins/gitops-profiles/src/components/ProfileCard/ProfileCard.tsx +++ b/plugins/gitops-profiles/src/components/ProfileCard/ProfileCard.tsx @@ -15,17 +15,14 @@ */ import React, { useState } from 'react'; -import { - Avatar, - Card, - CardActions, - CardContent, - CardHeader, - createStyles, - IconButton, - Theme, - Typography, -} from '@material-ui/core'; +import Avatar from '@material-ui/core/Avatar'; +import Card from '@material-ui/core/Card'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +import CardHeader from '@material-ui/core/CardHeader'; +import IconButton from '@material-ui/core/IconButton'; +import Typography from '@material-ui/core/Typography'; +import { createStyles, Theme } from '@material-ui/core/styles'; import { green } from '@material-ui/core/colors'; import { makeStyles } from '@material-ui/core/styles'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; diff --git a/plugins/gitops-profiles/src/components/ProfileCardList/ProfileCardList.tsx b/plugins/gitops-profiles/src/components/ProfileCardList/ProfileCardList.tsx index 7c8345a54e..09e30e0a15 100644 --- a/plugins/gitops-profiles/src/components/ProfileCardList/ProfileCardList.tsx +++ b/plugins/gitops-profiles/src/components/ProfileCardList/ProfileCardList.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ import React, { useState } from 'react'; -import { Grid } from '@material-ui/core'; +import Grid from '@material-ui/core/Grid'; import ProfileCard from '../ProfileCard'; interface Props { diff --git a/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.tsx b/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.tsx index 60b0c110b5..7b0ff3ba99 100644 --- a/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.tsx +++ b/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.tsx @@ -15,7 +15,9 @@ */ import React, { useEffect, useState } from 'react'; -import { TextField, List, ListItem } from '@material-ui/core'; +import TextField from '@material-ui/core/TextField'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; import ClusterTemplateCardList from '../ClusterTemplateCardList'; import ProfileCardList from '../ProfileCardList';