chore: (eslint) restrict imports of @material-ui Link
BREAKING CHANGE: Added a new ESLint rule that restricts imports of Link from @material-ui Signed-off-by: Dmitry Lobanov <lobanov.dmitry.s@gmail.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
f905853ad6
commit
7539b36748
@@ -0,0 +1,16 @@
|
||||
---
|
||||
'@backstage/cli': minor
|
||||
---
|
||||
|
||||
Added a new ESLint rule that restricts imports of Link from @material-ui
|
||||
|
||||
The rule can be can be overridden in the following way:
|
||||
|
||||
```diff
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
+ restrictedImports: [
|
||||
+ { name: '@material-ui/core', importNames: [] },
|
||||
+ { name: '@material-ui/core/Link', importNames: [] },
|
||||
+ ],
|
||||
});
|
||||
```
|
||||
@@ -239,6 +239,17 @@ function createConfigForRole(dir, role, extraConfig = {}) {
|
||||
name: '@material-ui/icons/', // because this is possible too ._.
|
||||
message: "Please import '@material-ui/icons/<Icon>' instead.",
|
||||
},
|
||||
{
|
||||
name: '@material-ui/core',
|
||||
importNames: ['Link'],
|
||||
message:
|
||||
'Prefer using `Link` from `@backstage/core-components` rather than material-UI',
|
||||
},
|
||||
{
|
||||
name: '@material-ui/core/Link',
|
||||
message:
|
||||
'Prefer using `Link` from `@backstage/core-components` rather than material-UI',
|
||||
},
|
||||
...require('module').builtinModules,
|
||||
...(extraConfig.restrictedImports ?? []),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user