From b450af3142989ddc1a8972228249f85998a2ede6 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Mon, 8 Apr 2024 00:09:00 +0200 Subject: [PATCH] Add ESLint Rule to techdocs-react plugin Signed-off-by: Juan Pablo Garcia Ripa --- .changeset/chatty-rules-repair.md | 5 +++++ plugins/techdocs-react/.eslintrc.js | 6 +++++- plugins/techdocs-react/src/component.tsx | 3 ++- plugins/techdocs-react/src/context.test.tsx | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/chatty-rules-repair.md diff --git a/.changeset/chatty-rules-repair.md b/.changeset/chatty-rules-repair.md new file mode 100644 index 0000000000..0442826484 --- /dev/null +++ b/.changeset/chatty-rules-repair.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-react': patch +--- + +Added ESLint rule `no-top-level-material-ui-4-imports` in the Techdocs-react plugin to migrate the Material UI imports. diff --git a/plugins/techdocs-react/.eslintrc.js b/plugins/techdocs-react/.eslintrc.js index e2a53a6ad2..e487f765b2 100644 --- a/plugins/techdocs-react/.eslintrc.js +++ b/plugins/techdocs-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/techdocs-react/src/component.tsx b/plugins/techdocs-react/src/component.tsx index 48d3138321..0388aafed8 100644 --- a/plugins/techdocs-react/src/component.tsx +++ b/plugins/techdocs-react/src/component.tsx @@ -22,7 +22,8 @@ import React, { } from 'react'; import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/styles'; +import StylesProvider from '@material-ui/styles/StylesProvider'; +import jssPreset from '@material-ui/styles/jssPreset'; import { Progress } from '@backstage/core-components'; diff --git a/plugins/techdocs-react/src/context.test.tsx b/plugins/techdocs-react/src/context.test.tsx index bcab445729..a923b3c528 100644 --- a/plugins/techdocs-react/src/context.test.tsx +++ b/plugins/techdocs-react/src/context.test.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { renderHook, act, waitFor } from '@testing-library/react'; -import { ThemeProvider } from '@material-ui/core'; +import { ThemeProvider } from '@material-ui/core/styles'; import { lightTheme } from '@backstage/theme'; import {