52 Commits

Author SHA1 Message Date
Charles de Dreuille a4f2c56110 Bring back correct neutral tokens
Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
2026-05-29 15:59:39 +02:00
Charles de Dreuille 657aad6cf0 refactor(ui): rename surface tokens to neutral background tokens
Replace --bui-surface-1..5 with --bui-bg-neutral-1..5 for both light
and dark themes. --bui-bg-neutral-1 replaces the deprecated --bui-bg-app,
and --bui-bg-neutral-2..5 extend the scale. The old bare --bui-bg-neutral-1..4
entries are removed from the deprecated section since their names are now
reused; the hover/pressed/disabled variants remain deprecated.

Updates colors.stories.tsx, the ESLint rule and tests, and all migration
documentation and the PR description accordingly.

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
2026-05-27 13:11:38 +02:00
Charles de Dreuille 9c3b5ef2bd Update no-deprecated-bui-tokens.js
Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
2026-05-26 21:45:34 +02:00
Charles de Dreuille d38977c7b4 feat(ui): introduce semantic color token families and deprecate legacy tokens
Redesigns the BUI color token system in `@backstage/ui`:

- Adds a gray scale (`--bui-gray-1` through `--bui-gray-11`)
- Adds new foreground tokens with explicit hex values (primary, secondary, disabled, positive, negative, warning, announcement)
- Introduces five new semantic color families — Accent, Announcement, Warning, Negative, Positive — each with bg-base, bg-subdued, border, fg-on-base, and fg-on-subdued variants, for both light and dark themes
- Moves all legacy tokens (`--bui-bg-solid-*`, `--bui-bg-neutral-*`, `--bui-bg-danger/warning/success/info`, `--bui-fg-solid`, `--bui-fg-danger/success/info`, `--bui-border-*`, `--bui-shadow`) into a clearly marked `/* Deprecated tokens */` section in both light and dark themes
- Updates the Spotify theme overrides to use the new accent tokens and mark legacy overrides as deprecated
- Rewrites the `Colors` Storybook story to display all token families as a live, theme-aware reference grid
- Adds a new `@backstage/no-deprecated-bui-tokens` ESLint rule to `@backstage/eslint-plugin` that warns when any deprecated BUI token is referenced in JS/TS string literals; the rule is included in the `recommended` config so it applies to all plugin authors automatically

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
2026-05-26 15:08:53 +02:00
Marat Dyatko f1e26b8ed7 Address review feedback on no-self-package-imports rule
- `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
2026-04-23 16:28:20 +02:00
Marat Dyatko ab1cdbb9db Fix circular self-imports and add no-self-package-imports lint rule
- 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
2026-04-23 14:43:01 +02:00
Jon Koops df43b0e149 fix(eslint-plugin): fix TypeScript 6.0 type errors in no-mixed-plugin-imports
TypeScript 6.0 no longer applies bivariant checking to method-shorthand
functions that don't reference `this`. This causes the `fix` callbacks in
suggestion descriptors to fail type checking when they return `void`
instead of a valid `Fix | null` value.

- Return `null` from non-fixable suggestion `fix` handlers
- Add explicit `SuggestionReportDescriptor[]` type annotation to `suggest`
- Remove redundant `@param` JSDoc annotations now covered by the array type

Signed-off-by: Jon Koops <jonkoops@gmail.com>
2026-03-26 12:31:11 +01:00
Fredrik Adelöw 7455dae884 require the use of node prefix on native imports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-26 13:22:53 +01:00
Patrik Oldsberg 926389b38c eslint-plugin: add lint rule to ensure BUI CSS is not imported in plugins
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-10-17 19:42:30 +02:00
Hellgren Heikki cba3cd5203 chore(eslint): add same plugin id suggestion
Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-10-10 16:54:01 +03:00
Hellgren Heikki a1dae7180d feat(eslint): relax frontend imports for nfs
allow frontend plugins to import from other frontend plugins with same
plugin id to allow plugin overrides without unnecessary eslint warning.

relates to #31372

Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-10-09 15:40:46 +03:00
Hellgren Heikki 2974c08619 fix: review findings
removed default exclude targets so that tests are also in the scope.
added new includedFiles option that defaults to all in src/ directories

added more ignored packages to local config to make this pass, needs
fixes later on

Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-06-16 22:38:45 +03:00
Hellgren Heikki e84e7c55bf feat: add suggestions for fixes for mixed plugins rule
Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-06-16 22:11:21 +03:00
Hellgren Heikki 2788a08dad fix: tsc errors and rest of the tests
Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-06-16 22:11:21 +03:00
Hellgren Heikki 063b2d39ce feat: eslint rule to check forbidden plugin imports
basically verify-local-dependencies.js but done during linting also in
the 3rd party repositories.

Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2025-06-16 22:11:20 +03:00
Gabriel Dugny 098ef95bfe fix: slow eslint
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-06-10 17:14:00 +02:00
Fredrik Adelöw 14e253001e Merge pull request #26919 from backstage/freben/mui-grid
exclude the data-grid package from the imports rule
2024-10-07 11:16:53 +02:00
Fredrik Adelöw b1c2a2dbaf exclude the data-grid package from the imports rule
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-10-01 11:41:51 +02:00
Fredrik Adelöw 63963f6c2b fixup
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-09-27 15:08:51 +02:00
Patrik Oldsberg 434b9c19db Update packages/eslint-plugin/rules/no-undeclared-imports.js
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-09-09 20:10:56 +02:00
Patrik Oldsberg 08895e3f84 eslint-plugin: add support for inline packages
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-09-04 19:36:18 +03:00
Patrik Oldsberg e910e572e0 Revert "added the frontend-extensions package role"
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-08-13 14:47:00 +02:00
Fredrik Adelöw 705794def5 rename the role to frontend-extensions
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-08-12 11:10:54 +02:00
Fredrik Adelöw 0f7452c030 add example package
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-08-12 11:10:54 +02:00
Fredrik Adelöw 8669210f3b added the frontend-extension-bundle role
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: blam <ben@blam.sh>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2024-08-12 11:10:54 +02:00
Juan Pablo Garcia Ripa 65ec043e4e add some known issues and pickers fix
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-28 20:26:04 +02:00
Juan Pablo Garcia Ripa c56cfd8990 remove harcoded module
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-10 23:09:21 +02:00
Juan Pablo Garcia Ripa 2ab814f124 add more known styles
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-10 23:04:50 +02:00
Juan Pablo Garcia Ripa d55828d36d add fixer logic for aliases
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-10 09:39:47 +02:00
Juan Pablo Garcia Ripa 9ef572d05c fix lint rule fixer for more than one Component + Prop
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-09 15:48:21 +02:00
Juan Pablo Garcia Ripa 3a7eee71d2 fix eslint autofix for mui ThemeProvider
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
2024-04-08 17:07:14 +02:00
Andre Wanlin b07ff647d6 Clean-up based on feedback
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 15:05:12 -06:00
Andre Wanlin 7965c57e86 Removed third level or deeper reporting
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 14:47:02 -06:00
Andre Wanlin 834d2f530e Applied a map to avoid hard coded cases
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 14:47:02 -06:00
Andre Wanlin 74f5794387 Pair of adjustment based on feedback
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 14:47:02 -06:00
Andre Wanlin 37867e0c2c Renamed based on feedback
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 14:47:02 -06:00
Andre Wanlin 995d2809b8 Added new @backstage/no-top-level-mui4-imports rule
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2024-01-13 14:47:02 -06:00
Patrik Oldsberg 107dc46ab1 eslint-plugin: prefer existing version ranges when installing deps
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-11-18 15:57:07 +01:00
Patrik Oldsberg 68fcb7a675 Update packages/eslint-plugin/rules/no-undeclared-imports.js
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-04-03 12:14:49 +02:00
Patrik Oldsberg c85cddd899 eslint-plugin: fix auto install yarn add flag
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-04-03 12:04:03 +02:00
Patrik Oldsberg 911c25de59 eslint-plugin: add auto fix for missing imports
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-03-06 13:09:27 +01:00
blam b22d090dda chore: skip imports for the package itself, this works as expected in node
Signed-off-by: blam <ben@blam.sh>
2023-02-17 12:06:59 +01:00
blam a3576a386e chore: fixing the eslint rule
Signed-off-by: blam <ben@blam.sh>
2023-02-17 12:06:59 +01:00
Patrik Oldsberg e6d210947e eslint-plugin: add tests for no-undeclared-imports + fixes
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-04 11:33:55 +01:00
Patrik Oldsberg 6801eb5780 eslint-plugin: refactor to fix issues uncovered by more strict parsing
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-04 11:33:55 +01:00
Patrik Oldsberg 71bf2eb0ed eslint-plugin: add doc rule links and update README
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-03 17:21:46 +01:00
Patrik Oldsberg 4753d26b94 eslint-plugin: add no-relative-monorepo-imports rule
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-03 16:42:23 +01:00
Patrik Oldsberg 58e481a4f9 eslint-plugin: ignore type imports when checking deps
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-03 16:15:48 +01:00
Patrik Oldsberg d5eee2944c eslint-plugin: improved peer deps check and consider package role
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-03 16:15:17 +01:00
Patrik Oldsberg 765b7ee355 eslint-plugin: backwards compatiblity check for packages without exports
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-03 16:14:07 +01:00