exclude the data-grid package from the imports rule
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -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: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user