From b8234ce637d90249e3e96087ced5dad715dfc4a8 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Mon, 18 Mar 2024 14:17:04 +0530 Subject: [PATCH] Add ESLint Rule to Stackstorm Plugin Signed-off-by: Aditya Kumar --- .changeset/plenty-singers-call.md | 5 ++++ plugins/stackstorm/.eslintrc.js | 6 ++++- .../components/ActionsList/ActionsList.tsx | 14 +++++------ .../ExecutionsTable/ExecutionPanel.tsx | 23 ++++++++----------- .../StackstormHome/StackstormHome.tsx | 2 +- 5 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 .changeset/plenty-singers-call.md diff --git a/.changeset/plenty-singers-call.md b/.changeset/plenty-singers-call.md new file mode 100644 index 0000000000..cd51c18aa1 --- /dev/null +++ b/.changeset/plenty-singers-call.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-stackstorm': patch +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the `stackstorm` plugin to migrate the Material UI imports. diff --git a/plugins/stackstorm/.eslintrc.js b/plugins/stackstorm/.eslintrc.js index e2a53a6ad2..a2d8179106 100644 --- a/plugins/stackstorm/.eslintrc.js +++ b/plugins/stackstorm/.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/stackstorm/src/components/ActionsList/ActionsList.tsx b/plugins/stackstorm/src/components/ActionsList/ActionsList.tsx index 1080f67373..bd5fc56c2f 100644 --- a/plugins/stackstorm/src/components/ActionsList/ActionsList.tsx +++ b/plugins/stackstorm/src/components/ActionsList/ActionsList.tsx @@ -17,14 +17,12 @@ import React, { useState } from 'react'; import useAsync from 'react-use/lib/useAsync'; import { Link, Progress, ResponseErrorPanel } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; -import { - List, - ListItemText, - Collapse, - ListItem, - ListItemSecondaryAction, - ListItemIcon, -} from '@material-ui/core'; +import List from '@material-ui/core/List'; +import ListItemText from '@material-ui/core/ListItemText'; +import Collapse from '@material-ui/core/Collapse'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; import { makeStyles } from '@material-ui/core/styles'; import ExpandMore from '@material-ui/icons/ExpandMore'; import ExpandLess from '@material-ui/icons/ExpandLess'; diff --git a/plugins/stackstorm/src/components/ExecutionsTable/ExecutionPanel.tsx b/plugins/stackstorm/src/components/ExecutionsTable/ExecutionPanel.tsx index 8a55c31246..cd22120898 100644 --- a/plugins/stackstorm/src/components/ExecutionsTable/ExecutionPanel.tsx +++ b/plugins/stackstorm/src/components/ExecutionsTable/ExecutionPanel.tsx @@ -22,19 +22,16 @@ import { import { useApi } from '@backstage/core-plugin-api'; import { Execution, stackstormApiRef } from '../../api'; import useAsync from 'react-use/lib/useAsync'; -import { - Button, - Card, - CardActions, - CardContent, - makeStyles, - Table, - TableBody, - TableCell, - TableRow, - Typography, - withStyles, -} from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import Card from '@material-ui/core/Card'; +import CardActions from '@material-ui/core/CardActions'; +import CardContent from '@material-ui/core/CardContent'; +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, withStyles } from '@material-ui/core/styles'; import { Status } from './Status'; const useStyles = makeStyles(theme => ({ diff --git a/plugins/stackstorm/src/components/StackstormHome/StackstormHome.tsx b/plugins/stackstorm/src/components/StackstormHome/StackstormHome.tsx index 1bb9031815..13b1e181b5 100644 --- a/plugins/stackstorm/src/components/StackstormHome/StackstormHome.tsx +++ b/plugins/stackstorm/src/components/StackstormHome/StackstormHome.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ import React, { Fragment } from 'react'; -import { IconButton } from '@material-ui/core'; +import IconButton from '@material-ui/core/IconButton'; import { Header, Page,