diff --git a/.changeset/weak-snails-sparkle.md b/.changeset/weak-snails-sparkle.md index 55450e0869..947c20117b 100644 --- a/.changeset/weak-snails-sparkle.md +++ b/.changeset/weak-snails-sparkle.md @@ -20,5 +20,5 @@ To allow the future support of plugins & components using MUI v5 you want to upg ``` **'@backstage/test-utils':** Test App Wrapper is using `UnifiedThemeProvider` for tests now. -**'@backstage/plugin-techdocs-addons-test-utils':** Fix avoiding test to run on unmount. +**'@backstage/plugin-techdocs-addons-test-utils':** Fix tests by avoiding re-running theme on cleanup. **'@backstage/cli':** Enforcing MUI v5 specific linting to minimize bundle size. diff --git a/docs/local-dev/cli-build-system.md b/docs/local-dev/cli-build-system.md index a5df84f8dc..61e94e9ef4 100644 --- a/docs/local-dev/cli-build-system.md +++ b/docs/local-dev/cli-build-system.md @@ -165,16 +165,17 @@ module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, { The configuration factory also provides utilities for extending the configuration in ways that are otherwise very cumbersome to do with plain ESLint, particularly for rules like `no-restricted-syntax`. These are the extra keys that are available: -| Key | Description | -| ----------------------- | ------------------------------------------------------------------ | -| `tsRules` | Additional rules to apply to TypeScript files | -| `testRules` | Additional rules to apply to tests files | -| `restrictedImports` | Additional paths to add to `no-restricted-imports` | -| `restrictedSrcImports` | Additional paths to add to `no-restricted-imports` in src files | -| `restrictedTestImports` | Additional paths to add to `no-restricted-imports` in test files | -| `restrictedSyntax` | Additional patterns to add to `no-restricted-syntax` | -| `restrictedSrcSyntax` | Additional patterns to add to `no-restricted-syntax` in src files | -| `restrictedTestSyntax` | Additional patterns to add to `no-restricted-syntax` in test files | +| Key | Description | +| -------------------------- | ------------------------------------------------------------------ | +| `tsRules` | Additional rules to apply to TypeScript files | +| `testRules` | Additional rules to apply to tests files | +| `restrictedImports` | Additional paths to add to `no-restricted-imports` | +| `restrictedImportPatterns` | Additional patterns to add to `no-restricted-imports` | +| `restrictedSrcImports` | Additional paths to add to `no-restricted-imports` in src files | +| `restrictedTestImports` | Additional paths to add to `no-restricted-imports` in test files | +| `restrictedSyntax` | Additional patterns to add to `no-restricted-syntax` | +| `restrictedSrcSyntax` | Additional patterns to add to `no-restricted-syntax` in src files | +| `restrictedTestSyntax` | Additional patterns to add to `no-restricted-syntax` in test files | ## Type Checking diff --git a/packages/cli/config/eslint-factory.js b/packages/cli/config/eslint-factory.js index 6888e0ff67..36b51324fc 100644 --- a/packages/cli/config/eslint-factory.js +++ b/packages/cli/config/eslint-factory.js @@ -45,7 +45,7 @@ function createConfig(dir, extraConfig = {}) { testRules, restrictedImports, - restrictedImportsPatterns, + restrictedImportPatterns, restrictedSrcImports, restrictedTestImports, restrictedSyntax, @@ -116,7 +116,7 @@ function createConfig(dir, extraConfig = {}) { '*.test*', '**/__testUtils__/**', '**/__mocks__/**', - ...(restrictedImportsPatterns ?? []), + ...(restrictedImportPatterns ?? []), ], }, ], @@ -220,7 +220,10 @@ function createConfigForRole(dir, role, extraConfig = {}) { ...(extraConfig.restrictedImports ?? []), ], // https://mui.com/material-ui/guides/minimizing-bundle-size/ - restrictedImportsPatterns: ['@mui/*/*/*'], + restrictedImportPatterns: [ + '@mui/*/*/*', + ...(extraConfig.restrictedImportPatterns ?? []), + ], tsRules: { 'react/prop-types': 0, ...extraConfig.tsRules,