From 7dad59c30301fb4005ea777f5c6f09dafd47879a Mon Sep 17 00:00:00 2001 From: AmbrishRamachandiran Date: Thu, 21 Mar 2024 11:15:21 +0530 Subject: [PATCH] Add ESLint Rule to Gcp-projects Plugin Signed-off-by: AmbrishRamachandiran --- .changeset/healthy-weeks-lay.md | 5 +++++ plugins/gcp-projects/.eslintrc.js | 6 ++++- .../NewProjectPage/NewProjectPage.tsx | 4 +++- .../ProjectDetailsPage/ProjectDetailsPage.tsx | 22 +++++++++---------- .../ProjectListPage/ProjectListPage.tsx | 5 ++++- 5 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 .changeset/healthy-weeks-lay.md diff --git a/.changeset/healthy-weeks-lay.md b/.changeset/healthy-weeks-lay.md new file mode 100644 index 0000000000..87176c51a9 --- /dev/null +++ b/.changeset/healthy-weeks-lay.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-gcp-projects': minor +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the `gcp-projects` plugin to migrate the Material UI imports. diff --git a/plugins/gcp-projects/.eslintrc.js b/plugins/gcp-projects/.eslintrc.js index e2a53a6ad2..c69a8f6aff 100644 --- a/plugins/gcp-projects/.eslintrc.js +++ b/plugins/gcp-projects/.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/gcp-projects/src/components/NewProjectPage/NewProjectPage.tsx b/plugins/gcp-projects/src/components/NewProjectPage/NewProjectPage.tsx index 5ecc7f15d4..a0e83c8d56 100644 --- a/plugins/gcp-projects/src/components/NewProjectPage/NewProjectPage.tsx +++ b/plugins/gcp-projects/src/components/NewProjectPage/NewProjectPage.tsx @@ -14,7 +14,9 @@ * limitations under the License. */ -import { Button, Grid, TextField } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import Grid from '@material-ui/core/Grid'; +import TextField from '@material-ui/core/TextField'; import React, { useState } from 'react'; import { Content, diff --git a/plugins/gcp-projects/src/components/ProjectDetailsPage/ProjectDetailsPage.tsx b/plugins/gcp-projects/src/components/ProjectDetailsPage/ProjectDetailsPage.tsx index 2982cbbd42..3c7272fa62 100644 --- a/plugins/gcp-projects/src/components/ProjectDetailsPage/ProjectDetailsPage.tsx +++ b/plugins/gcp-projects/src/components/ProjectDetailsPage/ProjectDetailsPage.tsx @@ -13,18 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { - Button, - ButtonGroup, - LinearProgress, - makeStyles, - Paper, - Table, - TableBody, - TableCell, - TableRow, - Typography, -} from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import ButtonGroup from '@material-ui/core/ButtonGroup'; +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 TableRow from '@material-ui/core/TableRow'; +import Typography from '@material-ui/core/Typography'; +import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; import { useAsync, useMountEffect } from '@react-hookz/web'; import { gcpApiRef } from '../../api'; diff --git a/plugins/gcp-projects/src/components/ProjectListPage/ProjectListPage.tsx b/plugins/gcp-projects/src/components/ProjectListPage/ProjectListPage.tsx index 209d2a27d0..002d7e2bc2 100644 --- a/plugins/gcp-projects/src/components/ProjectListPage/ProjectListPage.tsx +++ b/plugins/gcp-projects/src/components/ProjectListPage/ProjectListPage.tsx @@ -15,7 +15,10 @@ */ // NEEDS WORK -import { Button, LinearProgress, Tooltip, Typography } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import LinearProgress from '@material-ui/core/LinearProgress'; +import Tooltip from '@material-ui/core/Tooltip'; +import Typography from '@material-ui/core/Typography'; import React from 'react'; import { useAsync, useMountEffect } from '@react-hookz/web';