You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: enable @antfu/eslint-config anti-slop and fix lint (#333)
* chore: enable @antfu/eslint-config anti-slop and fix lint
Upgrade @antfu/eslint-config to 9.5.1, install the eslint-plugin-slop and
eslint-plugin-sonarjs peers, and enable the anti-slop rule set with full-file
inspection. Parse CSS/HTML/Svelte and Vue style blocks as plain text so the
universal no-em-dash rule reads their raw content instead of erroring, then
resolve every reported violation across the codebase: replace em dashes with
the house-style spaced hyphen, drop chained type assertions, trim overlong
comments, and reduce cognitive complexity by extracting helpers.
Created with the help of an agent.
* docs: rework former em-dash phrasing into natural prose
Replace the mechanical em-dash-to-hyphen substitution with proper rewrites:
each former em dash becomes a colon, comma, semicolon, parentheses, a split
sentence, or a connective, chosen for natural reading. Covers docs, comments,
JSDoc, and human-facing strings across the codebase.
Created with the help of an agent.
* chore: update snapshot
* fix: restore revoke null-safety and refresh API snapshots
Restore the optional-chaining guard in revokeActiveConnectionsForToken: an
earlier assertion cleanup dropped it, so a context without an rpc host threw
"Cannot read properties of undefined (reading '_rpcGroup')" instead of
returning early (surfaced by host-docks.test.ts).
Update the tsnapi dts snapshots for devframe/internal and @devframes/json-render
node so the diagnostic `fix` literal types match the reworded messages.
Created with the help of an agent.
---------
Co-authored-by: Anthony Fu <github@antfu.me>
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ Ahead-of-time build artifacts that live under `src/` - the shadow-root styleshee
58
58
## Conventions
59
59
60
60
- RPC functions must use `defineRpcFunction`; always namespace IDs `devframes:plugin:<slug>:<fn-name>` for built-in devframes (the literal `plugin:` token mirrors the `@devframes/plugin-<slug>` package name on the wire - it is npm namespacing, not a concept).
61
-
- **No magic event names — use the centralized event maps.** Every event, broadcast, shared-state key, and channel name lives in one of two source-of-truth maps: `DEVFRAME_EVENTS` (`packages/devframe/src/events.ts`, re-exported from `devframe/constants`) for the core runtime, and `HUB_EVENTS` (`packages/hub/src/events.ts`, re-exported from `@devframes/hub/constants`) for the hub. Reference `DEVFRAME_EVENTS.*` / `HUB_EVENTS.*` at call sites (`.events.emit`/`.on`, `rpc.broadcast({ method })`, `sharedState.get(key)`, `defineHubRpcFunction({ name })`, `rpc.call`) instead of re-typing a string literal. The two maps and the [`docs/content/8.references/3.events.md`](docs/content/8.references/3.events.md) Events Reference are kept in lockstep: adding, renaming, or removing a name means editing the map **and** that page in the same change — every name in the maps appears in the tables, and vice versa. The only literals left are unavoidable type-position keys (the `EventEmitter<…>` maps in `types/*` and the `DevframeRpcClientFunctions`/`DevframeRpcServerFunctions` augmentations), which mirror the maps; a package that deliberately avoids a hub dependency (e.g. `@devframes/plugin-terminals`, which models the hub bridge structurally) keeps a local literal rather than importing `HUB_EVENTS`.
61
+
- **No magic event names: use the centralized event maps.** Every event, broadcast, shared-state key, and channel name lives in one of two source-of-truth maps: `DEVFRAME_EVENTS` (`packages/devframe/src/events.ts`, re-exported from `devframe/constants`) for the core runtime, and `HUB_EVENTS` (`packages/hub/src/events.ts`, re-exported from `@devframes/hub/constants`) for the hub. Reference `DEVFRAME_EVENTS.*` / `HUB_EVENTS.*` at call sites (`.events.emit`/`.on`, `rpc.broadcast({ method })`, `sharedState.get(key)`, `defineHubRpcFunction({ name })`, `rpc.call`) instead of re-typing a string literal. The two maps and the [`docs/content/8.references/3.events.md`](docs/content/8.references/3.events.md) Events Reference are kept in lockstep: adding, renaming, or removing a name means editing the map **and** that page in the same change; every name in the maps appears in the tables, and vice versa. The only literals left are unavoidable type-position keys (the `EventEmitter<…>` maps in `types/*` and the `DevframeRpcClientFunctions`/`DevframeRpcServerFunctions` augmentations), which mirror the maps; a package that deliberately avoids a hub dependency (e.g. `@devframes/plugin-terminals`, which models the hub bridge structurally) keeps a local literal rather than importing `HUB_EVENTS`.
62
62
-**Stay validator-neutral.**`devframe` and every `@devframes/*` package must not introduce a preferred schema validator dependency - no `valibot`, `zod`, `arktype`, etc. in their runtime `dependencies`. `args`/`returns`/flag schemas are typed against [Standard Schema](https://standardschema.dev/) (`@standard-schema/spec`, types-only); first-party code that needs to author a schema uses the built-in zero-dep `devframe/utils/simple-schema` builder (deliberately minimal - not a general validator). JSON-schema conversion uses each schema's own Standard JSON Schema converter (`~standard.jsonSchema`, implemented by e.g. zod 4) when present and degrades to a permissive object otherwise - no converter library and no vendor dependency is required. Docs, by contrast, should point *users* at a real validator for their own integrations - recommend **valibot** (lightest) or **zod** (worth reusing if they already pull it via the JSON-render or MCP integrations).
63
63
- Shared state via `devframe/utils/shared-state`; keep values serializable.
64
64
- Utility imports use the package-path form `devframe/utils/*`, never relative `../utils/*`.
0 commit comments