Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/eslint-config-react/rules/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,33 @@ module.exports = {
'import/no-default-export': 'off',
},
},
/**
* Direct users to consume DataGrid wrapper component instead of @side/pantry or @mui/x-data-grid directly
* due to css import within @mui/x-data-grid starting with v8 (must be imported at app level instead of within a library)
*/
{
files: ['**/*.{tsx}', '!src/components/DataGrid.tsx', '!src/components/DataGrid/DataGrid.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@mui/x-data-grid',
importNames: ['DataGrid'],
message:
'Please import `DataGrid` from `src/components/DataGrid` instead.',
},
{
name: '@side/pantry',
importNames: ['DataGrid'],
message:
'Please import `DataGrid` from `src/components/DataGrid` instead.',
},
],
},
],
},
},
],
};
26 changes: 26 additions & 0 deletions packages/eslint-config-react/rules/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,30 @@ module.exports = {
'react/function-component-definition': 'off',
'react/require-default-props': 'off',
},
overrides: [
{
files: ['**/*.{tsx}', '!src/components/DataGrid.tsx', '!src/components/DataGrid/DataGrid.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@mui/x-data-grid',
importNames: ['DataGrid'],
message:
'Please import `DataGrid` from `src/components/DataGrid` instead.',
},
{
name: '@side/pantry',
importNames: ['DataGrid'],
message:
'Please import `DataGrid` from `src/components/DataGrid` instead.',
},
],
},
],
},
},
]
};
Loading