From 75277abc5f63c364ab3e1ec012ee1878f47f6148 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Fri, 15 Mar 2024 13:14:30 +0530 Subject: [PATCH] Add ESLint Rule to Jenkins Plugin Signed-off-by: Aditya Kumar --- .changeset/wise-schools-invite.md | 5 +++++ plugins/jenkins/.eslintrc.js | 6 +++++- .../BuildWithStepsPage/BuildWithStepsPage.tsx | 18 ++++++++---------- .../lib/ActionOutput/ActionOutput.tsx | 10 ++++------ .../BuildsPage/lib/CITable/CITable.tsx | 3 ++- .../BuildsPage/lib/CITable/columns.tsx | 5 ++++- plugins/jenkins/src/components/Cards/Cards.tsx | 3 ++- .../components/JobRunsTable/JobRunsTable.tsx | 5 ++++- 8 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 .changeset/wise-schools-invite.md diff --git a/.changeset/wise-schools-invite.md b/.changeset/wise-schools-invite.md new file mode 100644 index 0000000000..50cd0c8171 --- /dev/null +++ b/.changeset/wise-schools-invite.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-jenkins': patch +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the Jenkins plugin to migrate the Material UI imports. diff --git a/plugins/jenkins/.eslintrc.js b/plugins/jenkins/.eslintrc.js index e2a53a6ad2..a2d8179106 100644 --- a/plugins/jenkins/.eslintrc.js +++ b/plugins/jenkins/.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/jenkins/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx b/plugins/jenkins/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx index 3b52c65930..88c7d12ff6 100644 --- a/plugins/jenkins/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx +++ b/plugins/jenkins/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { - Box, - Paper, - Table, - TableBody, - TableCell, - TableContainer, - TableRow, - Typography, -} from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +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 React from 'react'; diff --git a/plugins/jenkins/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx b/plugins/jenkins/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx index 2cfc4eb073..750c79ff9f 100644 --- a/plugins/jenkins/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx +++ b/plugins/jenkins/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx @@ -14,12 +14,10 @@ * limitations under the License. */ -import { - Accordion, - AccordionDetails, - AccordionSummary, - Typography, -} from '@material-ui/core'; +import Accordion from '@material-ui/core/Accordion'; +import AccordionDetails from '@material-ui/core/AccordionDetails'; +import AccordionSummary from '@material-ui/core/AccordionSummary'; +import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/core/styles'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import React, { useEffect } from 'react'; diff --git a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx index 1f5d272c61..5318c4feb1 100644 --- a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx +++ b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx @@ -14,7 +14,8 @@ * limitations under the License. */ import { Table, TableColumn } from '@backstage/core-components'; -import { Box, Typography } from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import Typography from '@material-ui/core/Typography'; import RetryIcon from '@material-ui/icons/Replay'; import { default as React } from 'react'; import { Project } from '../../../../api/JenkinsApi'; diff --git a/plugins/jenkins/src/components/BuildsPage/lib/CITable/columns.tsx b/plugins/jenkins/src/components/BuildsPage/lib/CITable/columns.tsx index f18d3e5b21..cdf2b2febe 100644 --- a/plugins/jenkins/src/components/BuildsPage/lib/CITable/columns.tsx +++ b/plugins/jenkins/src/components/BuildsPage/lib/CITable/columns.tsx @@ -16,7 +16,10 @@ import { Link, Progress, TableColumn } from '@backstage/core-components'; import { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; import { useEntityPermission } from '@backstage/plugin-catalog-react/alpha'; -import { Box, IconButton, Tooltip, Typography } from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import IconButton from '@material-ui/core/IconButton'; +import Tooltip from '@material-ui/core/Tooltip'; +import Typography from '@material-ui/core/Typography'; import RetryIcon from '@material-ui/icons/Replay'; import VisibilityIcon from '@material-ui/icons/Visibility'; import HistoryIcon from '@material-ui/icons/History'; diff --git a/plugins/jenkins/src/components/Cards/Cards.tsx b/plugins/jenkins/src/components/Cards/Cards.tsx index 1cbc3e5d9f..0ae46a346f 100644 --- a/plugins/jenkins/src/components/Cards/Cards.tsx +++ b/plugins/jenkins/src/components/Cards/Cards.tsx @@ -14,7 +14,8 @@ * limitations under the License. */ -import { LinearProgress, makeStyles } 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 { DateTime, Duration } from 'luxon'; import React from 'react'; diff --git a/plugins/jenkins/src/components/JobRunsTable/JobRunsTable.tsx b/plugins/jenkins/src/components/JobRunsTable/JobRunsTable.tsx index 78b66b98eb..9fa2f71448 100644 --- a/plugins/jenkins/src/components/JobRunsTable/JobRunsTable.tsx +++ b/plugins/jenkins/src/components/JobRunsTable/JobRunsTable.tsx @@ -14,7 +14,10 @@ * limitations under the License. */ import { Link, Table, TableColumn } from '@backstage/core-components'; -import { Box, IconButton, Tooltip, Typography } from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import IconButton from '@material-ui/core/IconButton'; +import Tooltip from '@material-ui/core/Tooltip'; +import Typography from '@material-ui/core/Typography'; import { default as React } from 'react'; import JenkinsLogo from './../../assets/JenkinsLogo.svg'; import { useJobRuns } from './../useJobRuns';