Merge pull request #34041 from dyatko/fix/self-package-imports

Fix circular self-imports and add no-self-package-imports lint rule
This commit is contained in:
Marat Dyatko
2026-04-23 20:28:26 +02:00
committed by GitHub
31 changed files with 863 additions and 26 deletions
@@ -0,0 +1,5 @@
---
'@backstage/eslint-plugin': minor
---
Added a new `no-self-package-imports` lint rule, enabled as `error` in the recommended config, that reports when a package imports itself by its own name instead of using a relative path. This pattern causes circular initialization errors in bundled ESM and with `jest.requireActual`.
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/frontend-plugin-api': patch
'@backstage/catalog-model': patch
'@backstage/core-plugin-api': patch
'@backstage/plugin-catalog-node': patch
'@backstage/plugin-kubernetes-common': patch
'@backstage/plugin-kubernetes-node': patch
---
Removed a handful of internal imports that referenced the package by its own name. Value imports were switched to relative paths, and type-only imports to `import type`. These self-referential imports could trigger circular initialization errors in bundled ESM and when the package was loaded via `jest.requireActual` — most visibly `Cannot access '_AppRootElementBlueprintesm' before initialization` from `@backstage/frontend-plugin-api`. There are no user-facing API changes.