useResolvedPath returns the resolved path without the router basename,
eliminating the need for manual basename detection and stripping.
Signed-off-by: Johan Persson <johanopersson@gmail.com>
Closes#32861
Triggering or cancelling a scheduled task from the DevTools Scheduled
Tasks page previously left the table showing the pre-action state, so
users had to refresh the browser (which also reset the plugin selector)
to see the new status.
Switch `useScheduledTasks` to `useAsyncRetry` so it exposes a `refresh`
function, and call it after each trigger/cancel action in
`ScheduledTasksContent`. The refresh happens in a `finally` block so the
table also updates when the action itself fails, reflecting whatever the
backend ended up recording.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
The license changed in 4.9.0, so we need to cap the allowed version
range across all packages that depend on it.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
- `visitImports` now also reads `exportKind` so `export type { … } from`
statements are classified as type-only, fixing a false positive in the
self-import rule (and correctly skipping them in `no-undeclared-imports`
too).
- The reachability-graph regex in `no-self-package-imports` skips
`import type` / `export type` edges so files reachable only via
type-only re-exports aren't pulled into a runtime bundle and no longer
get false-positive same-entry errors.
- `SOURCE_EXTENSIONS` now includes `.mts` and `.cts` so entries and
barrels using those extensions are followed correctly.
- The ESLint plugin changeset wording matches the `error` severity of
the recommended config.
- Adds regression fixtures and RuleTester cases for `export type …` at
both entries and for a file only reachable via a type-only edge.
Signed-off-by: Marat Dyatko <maratd@spotify.com>
Made-with: Cursor
* Add test infrastructure to @backstage/ui
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add resolveResponsiveValue tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition prop resolution and classes tests
Fixed a bug in useDefinition where passing null for classNameTarget or
utilityTarget was incorrectly defaulted to 'root' due to the nullish
coalescing operator treating null as falsy.
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition data attributes tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add resolveDefinitionProps tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add processUtilityProps tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition bg system tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition utility style and analytics tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition href resolution tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Add useDefinition options tests
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Wrap all useDefinition tests with BUIProvider
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Fix type errors in useDefinition tests
Use `as const satisfies ComponentConfig<any, any>` instead of
`as ComponentConfig<any, any>` to preserve literal types needed
by the conditional type machinery (DataAttributes, ResolveBgProps,
analytics intersection).
Signed-off-by: Johan Persson <johanopersson@gmail.com>
* Address review feedback in useDefinition tests
- Rename shadowed Wrapper to RouterWrapper in createRouterWrapper
- Fix inaccurate comment about splat vs non-splat routes
- Clarify misleading test name for provider data-bg behavior
Signed-off-by: Johan Persson <johanopersson@gmail.com>
---------
Signed-off-by: Johan Persson <johanopersson@gmail.com>
Deduplicate the plugin/module feature flag registration loops and
distinguish the error source (Plugin vs Module). Treat
FEATURE_FLAG_INVALID as a warning in frontend-defaults.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
- Fixes the `Cannot access '_AppRootElementBlueprintesm' before
initialization` crash in `@backstage/frontend-plugin-api` caused by a
self-referential import in the packaged ESM.
- Cleans up similar self-imports in `@backstage/catalog-model`,
`@backstage/core-plugin-api`, `@backstage/plugin-catalog-node`,
`@backstage/plugin-kubernetes-common`, and
`@backstage/plugin-kubernetes-node`. Value imports switch to relative
paths; type-only imports use `import type` so they're erased at
runtime.
- Adds a new `@backstage/no-self-package-imports` ESLint rule. It reads
each package's `exports` map, traverses the relative import graph from
every entry's source file, and only reports imports where the current
file is in the same bundle as the target entry (same-entry). Files
that aren't reachable from any entry (tests, scripts, orphans) are
skipped. `import type`, `package.json` imports, and cross-entry
self-imports are allowed by default; cross-entry can be opted into
with `allowCrossEntry: false`.
Signed-off-by: Marat Dyatko <maratd@spotify.com>
Made-with: Cursor
The uuid package dropped its CommonJS entry point in v14, making it
incompatible with Backstage's CJS build output and Jest test runner.
Rather than working around the ESM-only issue, replace all usage with
the built-in crypto.randomUUID() which has been available in Node.js
since v16.7 and in all major browsers since March 2022.
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
Wrap each feature flag registration in a try/catch so that a single
invalid flag name (e.g. containing a slash) is reported through the
error collector instead of crashing the entire app at bootstrap.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
The following patches were included in the v1.50.2 patch release and
no longer need to be tracked:
- pr-33908 (TechDocs sidebar positioning)
- pr-33952 (zod v4 bump)
- pr-33975 (React Aria dependency clamping)
- pr-33984 (tab indicator opacity fix)
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor