From cdb5ffa62eaf07c8e8507b043483f8b3d35b18bc Mon Sep 17 00:00:00 2001 From: Timothy Deakin Date: Sat, 13 Apr 2024 17:38:08 +0100 Subject: [PATCH] feat: add eslint rule for top level imports Signed-off-by: Timothy Deakin --- .changeset/smooth-spoons-repeat.md | 5 +++++ plugins/azure-sites/.eslintrc.js | 6 +++++- .../AzureSitesOverviewTable.tsx | 20 +++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .changeset/smooth-spoons-repeat.md diff --git a/.changeset/smooth-spoons-repeat.md b/.changeset/smooth-spoons-repeat.md new file mode 100644 index 0000000000..eec933d9c2 --- /dev/null +++ b/.changeset/smooth-spoons-repeat.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-azure-sites': patch +--- + +Added the `no-top-level-material-ui-4-imports` ESLint rule to aid with the migration to Material UI v5 diff --git a/plugins/azure-sites/.eslintrc.js b/plugins/azure-sites/.eslintrc.js index e2a53a6ad2..e487f765b2 100644 --- a/plugins/azure-sites/.eslintrc.js +++ b/plugins/azure-sites/.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/azure-sites/src/components/AzureSitesOverviewTableComponent/AzureSitesOverviewTable.tsx b/plugins/azure-sites/src/components/AzureSitesOverviewTableComponent/AzureSitesOverviewTable.tsx index c8afb1c6aa..6ba6fb0a3d 100644 --- a/plugins/azure-sites/src/components/AzureSitesOverviewTableComponent/AzureSitesOverviewTable.tsx +++ b/plugins/azure-sites/src/components/AzureSitesOverviewTableComponent/AzureSitesOverviewTable.tsx @@ -15,17 +15,15 @@ */ import React, { Dispatch, useEffect, useState } from 'react'; -import { - Box, - Card, - Chip, - IconButton, - LinearProgress, - Menu, - MenuItem, - Snackbar, - Tooltip, -} from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import Card from '@material-ui/core/Card'; +import Chip from '@material-ui/core/Chip'; +import IconButton from '@material-ui/core/IconButton'; +import LinearProgress from '@material-ui/core/LinearProgress'; +import Menu from '@material-ui/core/Menu'; +import MenuItem from '@material-ui/core/MenuItem'; +import Snackbar from '@material-ui/core/Snackbar'; +import Tooltip from '@material-ui/core/Tooltip'; import { default as MuiAlert } from '@material-ui/lab/Alert'; import { AzureSite,