30 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 ae87db249a test(eslint-plugin): add RuleTester tests for no-deprecated-bui-tokens
Covers plain string literals, template literals, multiple tokens in one
string, non-deprecated --bui-* tokens (valid cases), and JSX inline
style attribute usage.

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
2026-05-26 15:46:15 +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
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 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 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
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
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
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
Patrik Oldsberg e93bc4fc13 eslint-plugin: fix tests not restoring cwd
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2024-01-26 10:12:50 +01: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 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 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 e24851b4fa chore: added mock node_modules for resolution
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 000fd3f4a8 eslint-plugin: fix no-undeclared-imports test on windows
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-06 17:24:10 +01:00
Patrik Oldsberg 2638dd4e7c eslint-plugin: add tests for no-forbidden-package-imports
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-04 11:33:55 +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 aefe3a5624 eslint-plugin: added tests for no-relative-monorepo-imports
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-04 11:33:55 +01:00