From 1d81cdd434e98ef916ac1bd12983db16e7fb3e46 Mon Sep 17 00:00:00 2001 From: Gaurav Pandey Date: Thu, 21 Mar 2024 11:42:55 +0530 Subject: [PATCH] chore: added eslint rule Signed-off-by: Gaurav Pandey --- .changeset/hot-foxes-rush.md | 5 +++++ plugins/newrelic-dashboard/.eslintrc.js | 6 +++++- plugins/newrelic-dashboard/src/Router.tsx | 2 +- .../components/NewRelicDashboard/DashboardEntityList.tsx | 4 +++- .../DashboardSnapshotList/DashboardSnapshot.tsx | 5 ++++- .../DashboardSnapshotList/DashboardSnapshotList.tsx | 5 ++++- .../src/components/NewRelicDashboard/NewRelicDashboard.tsx | 2 +- 7 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 .changeset/hot-foxes-rush.md diff --git a/.changeset/hot-foxes-rush.md b/.changeset/hot-foxes-rush.md new file mode 100644 index 0000000000..65e7c25e3c --- /dev/null +++ b/.changeset/hot-foxes-rush.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-newrelic-dashboard': patch +--- + +Added an optional ESLint rule - no-top-level-material-ui-4-imports -in new relic plugin which has an auto fix function to migrate the imports and used it to migrate the Material UI imports for plugins/newrelic-dashboard diff --git a/plugins/newrelic-dashboard/.eslintrc.js b/plugins/newrelic-dashboard/.eslintrc.js index e2a53a6ad2..9d5b45a010 100644 --- a/plugins/newrelic-dashboard/.eslintrc.js +++ b/plugins/newrelic-dashboard/.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/newrelic-dashboard/src/Router.tsx b/plugins/newrelic-dashboard/src/Router.tsx index 82f20a4a29..6ef34b15af 100644 --- a/plugins/newrelic-dashboard/src/Router.tsx +++ b/plugins/newrelic-dashboard/src/Router.tsx @@ -15,7 +15,7 @@ */ import { Entity } from '@backstage/catalog-model'; import React from 'react'; -import { Button } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; import { NewRelicDashboard } from './components/NewRelicDashboard'; import { useEntity, diff --git a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardEntityList.tsx b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardEntityList.tsx index 04442620aa..2c20334251 100644 --- a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardEntityList.tsx +++ b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardEntityList.tsx @@ -14,7 +14,9 @@ * limitations under the License. */ import React from 'react'; -import { Box, makeStyles, Typography } from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import makeStyles from '@material-ui/core/styles/makeStyles'; +import Typography from '@material-ui/core/Typography'; import { newRelicDashboardApiRef } from '../../api'; import { useApi } from '@backstage/core-plugin-api'; import useAsync from 'react-use/esm/useAsync'; diff --git a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx index 73f8b871b6..ab766dfa02 100644 --- a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx +++ b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx @@ -15,7 +15,10 @@ */ import React from 'react'; -import { Box, makeStyles, MenuItem, Select } from '@material-ui/core'; +import Box from '@material-ui/core/Box'; +import makeStyles from '@material-ui/core/styles/makeStyles'; +import MenuItem from '@material-ui/core/MenuItem'; +import Select from '@material-ui/core/Select'; import { useApi, storageApiRef } from '@backstage/core-plugin-api'; import useAsync from 'react-use/esm/useAsync'; import { diff --git a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx index 6c0527ecf0..db7dc92c33 100644 --- a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx +++ b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx @@ -14,7 +14,10 @@ * limitations under the License. */ import React, { useState } from 'react'; -import { Tab, Tabs, makeStyles, Box } from '@material-ui/core'; +import Tab from '@material-ui/core/Tab'; +import Tabs from '@material-ui/core/Tabs'; +import makeStyles from '@material-ui/core/styles/makeStyles'; +import Box from '@material-ui/core/Box'; import { newRelicDashboardApiRef } from '../../../api'; import { useApi } from '@backstage/core-plugin-api'; import useAsync from 'react-use/esm/useAsync'; diff --git a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx index c9cc9bf611..ffe1ea06f1 100644 --- a/plugins/newrelic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx +++ b/plugins/newrelic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.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 { DashboardEntityList } from './DashboardEntityList'; import { DashboardSnapshotList } from './DashboardSnapshotList';