Skip to content

Commit 1ae7d89

Browse files
committed
fix(eslint-plugin): refine MUI import reporting range to reduce noise [AR-56999] (drivenets#364)
1 parent f1e53a9 commit 1ae7d89

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

.changeset/lemon-wings-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@drivenets/eslint-plugin-design-system': patch
3+
---
4+
5+
Refine the MUI imports reporting range to reduce noise

packages/eslint-plugin/src/__tests__/no-mui.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,25 @@ ruleTester.run('no-mui', plugin.rules['no-mui'], {
1010
{
1111
code: 'import { Button } from "@mui/material";',
1212
errors: [
13-
{ message: 'Using MUI components is not allowed. Use DriveNets Design System components instead.' },
13+
{
14+
message: 'Using MUI components is not allowed. Use DriveNets Design System components instead.',
15+
line: 1,
16+
endLine: 1,
17+
column: 24,
18+
endColumn: 39,
19+
},
1420
],
1521
},
1622
{
1723
code: 'import { TextField } from "@mui/core";',
1824
errors: [
19-
{ message: 'Using MUI components is not allowed. Use DriveNets Design System components instead.' },
25+
{
26+
message: 'Using MUI components is not allowed. Use DriveNets Design System components instead.',
27+
line: 1,
28+
endLine: 1,
29+
column: 27,
30+
endColumn: 38,
31+
},
2032
],
2133
},
2234
],

packages/eslint-plugin/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const eslintPlugin = createPlugin(
129129

130130
{
131131
name: 'no-mui',
132-
selector: 'ImportDeclaration[source.value=/^@mui\\u002F/]',
132+
selector: 'ImportDeclaration[source.value=/^@mui\\u002F/] > .source',
133133
message: 'Using MUI components is not allowed. Use DriveNets Design System components instead.',
134134
},
135135
);

0 commit comments

Comments
 (0)