From bb9e31efefde137fab2246508caa1f25367e3dfe Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Wed, 13 Mar 2024 14:33:41 +0530 Subject: [PATCH] Added Material UI 4 import rule to plugins/apollo-explorer Signed-off-by: Aditya Kumar --- .changeset/mighty-fishes-wait.md | 5 +++++ plugins/apollo-explorer/.eslintrc.js | 6 +++++- .../ApolloExplorerBrowser/ApolloExplorerBrowser.tsx | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/mighty-fishes-wait.md diff --git a/.changeset/mighty-fishes-wait.md b/.changeset/mighty-fishes-wait.md new file mode 100644 index 0000000000..d896a83665 --- /dev/null +++ b/.changeset/mighty-fishes-wait.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-apollo-explorer': patch +--- + +Added an optional ESLint rule - no-top-level-material-ui-4-imports -in apollo-explorer plugin which has an auto fix function to migrate the imports and used it to migrate the Material UI imports for plugins/apollo-explorer. diff --git a/plugins/apollo-explorer/.eslintrc.js b/plugins/apollo-explorer/.eslintrc.js index e2a53a6ad2..9d5b45a010 100644 --- a/plugins/apollo-explorer/.eslintrc.js +++ b/plugins/apollo-explorer/.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', + }, + }); \ No newline at end of file diff --git a/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx b/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx index 57f9eb7f8a..cf7ef16339 100644 --- a/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx +++ b/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx @@ -15,7 +15,10 @@ */ import React, { useState } from 'react'; -import { Divider, makeStyles, Tab, Tabs } from '@material-ui/core'; +import Divider from '@material-ui/core/Divider'; +import Tab from '@material-ui/core/Tab'; +import Tabs from '@material-ui/core/Tabs'; +import { makeStyles } from '@material-ui/core/styles'; import { JSONObject } from '@apollo/explorer/src/helpers/types'; import { ApolloExplorer } from '@apollo/explorer/react'; import { Content } from '@backstage/core-components';