feat: add eslint rule for top level imports

Signed-off-by: Timothy Deakin <cftad@protonmail.com>
This commit is contained in:
Timothy Deakin
2024-04-13 17:45:09 +01:00
parent 22248747b8
commit c43315ae30
11 changed files with 35 additions and 18 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-config-schema': patch
---
Added the `no-top-level-material-ui-4-imports` ESLint rule to aid with the migration to Material UI v5
+5 -1
View File
@@ -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',
},
});
@@ -17,7 +17,7 @@ import React, { useMemo } from 'react';
import useObservable from 'react-use/esm/useObservable';
import { configSchemaApiRef } from '../../api';
import { SchemaViewer } from '../SchemaViewer';
import { Typography } from '@material-ui/core';
import Typography from '@material-ui/core/Typography';
import { Header, Page, Content, Progress } from '@backstage/core-components';
import { useApi } from '@backstage/core-plugin-api';
@@ -14,10 +14,12 @@
* limitations under the License.
*/
import { createStyles, alpha, withStyles } from '@material-ui/core';
import alpha from '@material-ui/core/alpha';
import { createStyles, withStyles } from '@material-ui/core/styles';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { TreeItem, TreeItemProps, TreeView } from '@material-ui/lab';
import TreeItem, { TreeItemProps } from '@material-ui/core/TreeItem';
import TreeView from '@material-ui/lab/TreeView';
import { Schema } from 'jsonschema';
import React, { ReactNode, useMemo, useRef } from 'react';
import { useScrollTargets } from '../ScrollTargetsContext';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Box, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Typography from '@material-ui/core/Typography';
import { Schema } from 'jsonschema';
import React from 'react';
import { ChildView } from './ChildView';
@@ -15,7 +15,11 @@
*/
import { JsonValue } from '@backstage/types';
import { Box, Chip, Divider, makeStyles, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Chip from '@material-ui/core/Chip';
import Divider from '@material-ui/core/Divider';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import { Schema } from 'jsonschema';
import React, { useEffect, useRef } from 'react';
import { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Typography } from '@material-ui/core';
import Typography from '@material-ui/core/Typography';
import { Schema } from 'jsonschema';
import React from 'react';
import { ChildView } from './ChildView';
@@ -15,14 +15,12 @@
*/
import { JsonValue } from '@backstage/types';
import {
Paper,
Table,
TableBody,
TableCell,
TableRow,
Typography,
} from '@material-ui/core';
import Paper from '@material-ui/core/Paper';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableRow from '@material-ui/core/TableRow';
import Typography from '@material-ui/core/Typography';
import { Schema } from 'jsonschema';
import React from 'react';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Box, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { ChildView } from './ChildView';
import { MetadataView } from './MetadataView';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Box, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { MetadataView } from './MetadataView';
import { SchemaViewProps } from './types';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { Box, Paper } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Paper from '@material-ui/core/Paper';
import { Schema } from 'jsonschema';
import React from 'react';
import { SchemaView } from '../SchemaView';