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:
Dmitry Lobanov
2022-10-08 10:23:40 +00:00
committed by Fredrik Adelöw
parent f905853ad6
commit 7539b36748
2 changed files with 27 additions and 0 deletions
+16
View File
@@ -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: [] },
+ ],
});
```
+11
View File
@@ -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 ?? []),
],