From 2df7265f0eacf8b8f12acf7d9ed449e21e545d3d Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Tue, 19 Mar 2024 13:38:41 +0530 Subject: [PATCH] Add ESLint Rule to Sentry Plugin Signed-off-by: Aditya Kumar --- .changeset/selfish-swans-think.md | 5 +++++ plugins/sentry/.eslintrc.js | 6 +++++- plugins/sentry/dev/index.tsx | 2 +- plugins/sentry/src/components/ErrorCell/ErrorCell.tsx | 2 +- .../src/components/SentryIssuesTable/SentryIssuesTable.tsx | 4 +++- 5 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 .changeset/selfish-swans-think.md diff --git a/.changeset/selfish-swans-think.md b/.changeset/selfish-swans-think.md new file mode 100644 index 0000000000..ef9861988d --- /dev/null +++ b/.changeset/selfish-swans-think.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-sentry': patch +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the `sentry` plugin to migrate the Material UI imports. diff --git a/plugins/sentry/.eslintrc.js b/plugins/sentry/.eslintrc.js index e2a53a6ad2..a2d8179106 100644 --- a/plugins/sentry/.eslintrc.js +++ b/plugins/sentry/.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/sentry/dev/index.tsx b/plugins/sentry/dev/index.tsx index 667f965354..11207ea20c 100644 --- a/plugins/sentry/dev/index.tsx +++ b/plugins/sentry/dev/index.tsx @@ -17,7 +17,7 @@ import { Entity } from '@backstage/catalog-model'; import { createDevApp, EntityGridItem } from '@backstage/dev-utils'; import { EntityProvider } from '@backstage/plugin-catalog-react'; -import { Grid } from '@material-ui/core'; +import Grid from '@material-ui/core/Grid'; import React from 'react'; import { EntitySentryCard, diff --git a/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx b/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx index 2a0e0fbb69..26e1687a72 100644 --- a/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx +++ b/plugins/sentry/src/components/ErrorCell/ErrorCell.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { SentryIssue } from '../../api'; -import { Typography } from '@material-ui/core'; +import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/core/styles'; import { Link } from '@backstage/core-components'; diff --git a/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx b/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx index 8f336c629b..f9130a2ab4 100644 --- a/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx +++ b/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx @@ -22,7 +22,9 @@ import { ErrorGraph } from '../ErrorGraph/ErrorGraph'; import { Table, TableColumn } from '@backstage/core-components'; import Select from '@material-ui/core/Select'; import { Options } from '@material-table/core'; -import { FormControl, Grid, MenuItem } from '@material-ui/core'; +import FormControl from '@material-ui/core/FormControl'; +import Grid from '@material-ui/core/Grid'; +import MenuItem from '@material-ui/core/MenuItem'; const ONE_DAY_IN_MILLIS = 86400000; const SEVEN_DAYS_IN_MILLIS = ONE_DAY_IN_MILLIS * 7;