From 7a5e933552e7b294b90242644d16c20030c90619 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Thu, 14 Mar 2024 08:12:40 +0530 Subject: [PATCH] Added Material UI 4 import rule to plugins/cloudbuild Signed-off-by: Aditya Kumar --- .changeset/loud-llamas-call.md | 5 +++++ plugins/cloudbuild/.eslintrc.js | 6 ++++- .../cloudbuild/src/components/Cards/Cards.tsx | 3 ++- .../WorkflowRunDetails/WorkflowRunDetails.tsx | 22 +++++++++---------- .../WorkflowRunsTable/WorkflowRunsTable.tsx | 5 ++++- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 .changeset/loud-llamas-call.md diff --git a/.changeset/loud-llamas-call.md b/.changeset/loud-llamas-call.md new file mode 100644 index 0000000000..c4c05a8147 --- /dev/null +++ b/.changeset/loud-llamas-call.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-cloudbuild': patch +--- + +Added an optional ESLint rule - no-top-level-material-ui-4-imports -in cloudbuild plugin which has an auto fix function to migrate the imports and used it to migrate the Material UI imports for plugins/cloudbuild. diff --git a/plugins/cloudbuild/.eslintrc.js b/plugins/cloudbuild/.eslintrc.js index e2a53a6ad2..9d5b45a010 100644 --- a/plugins/cloudbuild/.eslintrc.js +++ b/plugins/cloudbuild/.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', + }, + }); \ No newline at end of file diff --git a/plugins/cloudbuild/src/components/Cards/Cards.tsx b/plugins/cloudbuild/src/components/Cards/Cards.tsx index 5d837cce68..572ccceb58 100644 --- a/plugins/cloudbuild/src/components/Cards/Cards.tsx +++ b/plugins/cloudbuild/src/components/Cards/Cards.tsx @@ -19,7 +19,8 @@ import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns'; import { WorkflowRunsTable } from '../WorkflowRunsTable'; import { useEntity } from '@backstage/plugin-catalog-react'; import { WorkflowRunStatus } from '../WorkflowRunStatus'; -import { makeStyles, LinearProgress } from '@material-ui/core'; +import LinearProgress from '@material-ui/core/LinearProgress'; +import { makeStyles } from '@material-ui/core/styles'; import ExternalLinkIcon from '@material-ui/icons/Launch'; import { CLOUDBUILD_ANNOTATION } from '../useProjectName'; import { getLocation } from '../useLocation'; diff --git a/plugins/cloudbuild/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx b/plugins/cloudbuild/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx index 1c9bdcbf5f..b7ff906c08 100644 --- a/plugins/cloudbuild/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx +++ b/plugins/cloudbuild/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx @@ -15,18 +15,16 @@ */ import { Entity } from '@backstage/catalog-model'; -import { - Box, - LinearProgress, - makeStyles, - Paper, - Table, - TableBody, - TableCell, - TableContainer, - TableRow, - Typography, -} from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import LinearProgress from '@material-ui/core/LinearProgress'; +import Paper from '@material-ui/core/Paper'; +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableContainer from '@material-ui/core/TableContainer'; +import TableRow from '@material-ui/core/TableRow'; +import Typography from '@material-ui/core/Typography'; +import { makeStyles } from '@material-ui/core/styles'; import ExternalLinkIcon from '@material-ui/icons/Launch'; import qs from 'qs'; import React from 'react'; diff --git a/plugins/cloudbuild/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx b/plugins/cloudbuild/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx index 65b5ca149f..cda5f16116 100644 --- a/plugins/cloudbuild/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx +++ b/plugins/cloudbuild/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx @@ -14,7 +14,10 @@ * limitations under the License. */ import React from 'react'; -import { Typography, Box, IconButton, Tooltip } from '@material-ui/core'; +import Typography from '@material-ui/core/Typography'; +import Box from '@material-ui/core/Box'; +import IconButton from '@material-ui/core/IconButton'; +import Tooltip from '@material-ui/core/Tooltip'; import RetryIcon from '@material-ui/icons/Replay'; import GoogleIcon from '@material-ui/icons/CloudCircle'; import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';