From cfb2b788bc2efc08fea15854fc276fe9149bd12d Mon Sep 17 00:00:00 2001 From: Timothy Deakin Date: Sat, 13 Apr 2024 20:22:53 +0100 Subject: [PATCH] feat: add eslint rule for top level imports Signed-off-by: Timothy Deakin --- .changeset/sweet-planets-relate.md | 5 +++++ plugins/org-react/.eslintrc.js | 6 +++++- .../components/GroupListPicker/GroupListPickerButton.tsx | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/sweet-planets-relate.md diff --git a/.changeset/sweet-planets-relate.md b/.changeset/sweet-planets-relate.md new file mode 100644 index 0000000000..7697874957 --- /dev/null +++ b/.changeset/sweet-planets-relate.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org-react': 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/org-react/.eslintrc.js b/plugins/org-react/.eslintrc.js index e2a53a6ad2..e487f765b2 100644 --- a/plugins/org-react/.eslintrc.js +++ b/plugins/org-react/.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/org-react/src/components/GroupListPicker/GroupListPickerButton.tsx b/plugins/org-react/src/components/GroupListPicker/GroupListPickerButton.tsx index f4255a18be..b7a31f89f2 100644 --- a/plugins/org-react/src/components/GroupListPicker/GroupListPickerButton.tsx +++ b/plugins/org-react/src/components/GroupListPicker/GroupListPickerButton.tsx @@ -15,7 +15,9 @@ */ import React from 'react'; -import { makeStyles, Typography, Button } from '@material-ui/core'; +import Typography from '@material-ui/core/Typography'; +import Button from '@material-ui/core/Button'; +import { makeStyles } from '@material-ui/core/styles'; import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; import PeopleIcon from '@material-ui/icons/People';