Skip to content

Widget validation warnings don't appear in Dev (running "skybridge dev") #534

@neil-ac

Description

@neil-ac

Context

When running skybridge dev, if a widget file is missing its export default or if the name passed to registerWidget() doesn't match the widget filename (e.g. registerWidget("search-product") vs web/src/widgets/search.tsx), the app fails silently.

The validateWidget function in the Vite plugin does check for missing export default and mountWidget() calls, but it uses this.warn() in the transform hook, which only surfaces during production builds (npm run build).

The name mismatch between registerWidget and the actual widget filename isn't validated at all.

Expected behaviour

Developers should get clear feedback in dev when:

  • A widget file is missing export default or mountWidget()
  • The name in registerWidget("some-name") doesn't match any file in web/src/widgets/
  • Other rules specific to Skybridge framework being broken

Suggested fix

I can see two options here:

  1. Dev server validation: run the existing validation checks at skybridge dev startup and on file change + check registerWidget names against widget files.

  2. ESLint plugin (eslint-plugin-skybridge): lint rules that catch these issues directly in the editor. This would create a shorter feedback loop, particularly helpful for AI coding agents that can run eslint and parse the output. Heavier to set up though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions