exclude the data-grid package from the imports rule

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-10-01 11:41:51 +02:00
parent 416d16795b
commit b1c2a2dbaf
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/eslint-plugin': patch
---
Exclude `@material-ui/data-grid`
@@ -132,6 +132,8 @@ module.exports = {
if (!node.source.value.startsWith('@material-ui/')) return;
// Return if import is from '@material-ui/core/styles', as it's valid already
if (node.source.value === '@material-ui/core/styles') return;
// Ignore the @material-ui/data-grid library which shares this namespace
if (node.source.value === '@material-ui/data-grid') return;
// Return if proper import eg. `import Box from '@material-ui/core/Box'`
// Or if third level or deeper imports
if (node.source.value?.split('/').length >= 3) return;
@@ -47,6 +47,9 @@ ruleTester.run('path-imports-rule', rule, {
{
code: `import { CreateCSSProperties, StyledComponentProps } from '@material-ui/core/styles/withStyles';`,
},
{
code: `import { DataGrid, GridColDef, GridValueGetterParams } from '@material-ui/data-grid';`,
},
],
invalid: [
{