From e550b2b274e5ab44ed487e5faae94c8c96c34503 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Thu, 14 Mar 2024 14:01:26 +0530 Subject: [PATCH] Added Material UI 4 import rule to plugins/dynatrace Signed-off-by: Aditya Kumar --- .changeset/gorgeous-eels-cheat.md | 5 +++++ plugins/dynatrace/.eslintrc.js | 6 +++++- .../dynatrace/src/components/DynatraceTab/DynatraceTab.tsx | 2 +- .../Synthetics/SyntheticsLocation/SyntheticsLocation.tsx | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/gorgeous-eels-cheat.md diff --git a/.changeset/gorgeous-eels-cheat.md b/.changeset/gorgeous-eels-cheat.md new file mode 100644 index 0000000000..6c3b362e30 --- /dev/null +++ b/.changeset/gorgeous-eels-cheat.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-dynatrace': patch +--- + +Added an optional ESLint rule - no-top-level-material-ui-4-imports -in dynatrace plugin which has an auto fix function to migrate the imports and used it to migrate the Material UI imports for plugins/dynatrace. diff --git a/plugins/dynatrace/.eslintrc.js b/plugins/dynatrace/.eslintrc.js index e2a53a6ad2..9d5b45a010 100644 --- a/plugins/dynatrace/.eslintrc.js +++ b/plugins/dynatrace/.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/dynatrace/src/components/DynatraceTab/DynatraceTab.tsx b/plugins/dynatrace/src/components/DynatraceTab/DynatraceTab.tsx index 16d9d47545..d77a32b668 100644 --- a/plugins/dynatrace/src/components/DynatraceTab/DynatraceTab.tsx +++ b/plugins/dynatrace/src/components/DynatraceTab/DynatraceTab.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ import React from 'react'; -import { Grid } from '@material-ui/core'; +import Grid from '@material-ui/core/Grid'; import { Page, Content } from '@backstage/core-components'; import { useEntity, diff --git a/plugins/dynatrace/src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx b/plugins/dynatrace/src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx index 4d328210cb..336baec4e8 100644 --- a/plugins/dynatrace/src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx +++ b/plugins/dynatrace/src/components/Synthetics/SyntheticsLocation/SyntheticsLocation.tsx @@ -18,7 +18,7 @@ import React from 'react'; import useAsync from 'react-use/lib/useAsync'; import { Progress, ResponseErrorPanel } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; -import { Chip } from '@material-ui/core'; +import Chip from '@material-ui/core/Chip'; import { dynatraceApiRef } from '../../../api'; type SyntheticsLocationProps = {