Skip to content

Type the package.json webjs.* configuration block #259

Description

@vivek7405

Problem

webjs reads a webjs.* object from package.json (elide today, and the surface will grow with headers/redirects/basePath/trailingSlash). There is no type, JSON schema, or validation, so a typo'd key is silently dropped and the feature it was meant to toggle stays at default with no diagnostic. This is the config equivalent of an untyped API and fails open.

Design / approach

Ship a standard JSON Schema ($schema) for the webjs.* block (and/or a small exported type) so editors validate it natively; optionally a webjs check warning on unknown keys. Schema is a static file, no code.

Web-standards fit: A standard JSON Schema the editor consumes natively; adds a static file, not validation code.

Prior art: Next.js NextConfig type; Astro/Vite defineConfig rejecting unknown keys.

Acceptance criteria

  • A JSON $schema for the package.json webjs.* block (and/or an exported TS type) covering documented keys
  • An unknown or wrong-typed key produces a diagnostic (editor schema or a webjs check warning)
  • agent-docs and the scaffold reference the schema/type
  • Adding a new webjs.* key has one documented place to extend
  • Tests cover the new behaviour at the applicable layer(s)
  • Docs / AGENTS.md / CONVENTIONS.md updated if the public surface changed

Filed from the production-readiness audit (webjs vs Next.js / Remix / Rails / Turbo / Lit). Theme: types. Priority: P2. Kept to webjs identity: no-build, progressive enhancement, web-components-first, AI-first, batteries-included, close to web standards.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions