refactor: remove core-events from main (scaffoldable via gen core-package events)

- Delete packages/core-events/ (15 files)
- Strip @repo/core-events from all 5 feature package.json + apps/web-next/package.json
- Strip @repo/core-events from apps/web-next/next.config.mjs transpilePackages
- Strip E1 + J no-restricted-syntax blocks from core-eslint/base.js (anchor remains)
- Update bind-production.ts: drop bus construction + IEventBus import; rename
  resolveEventsAndJobsProduction → resolveJobsProduction (queue only),
  resolveEventsAndJobsDevSeed → resolveJobsDevSeed (queue only);
  ctx no longer has bus field; BindProductionContext generic arg narrowed
- Update bind-production.test.ts: assert ctx.bus is undefined, drop
  PayloadJobsEventBus/InMemoryEventBus instanceof checks
- Update sign-up-welcome-email.test.ts: assert mailer stays empty without bus
- Inline userSignedUpEvent in auth (drop defineEvent import from core-events)
- Drop InMemoryEventBus fallback from auth/di/module.ts

Feature binders' bus?.subscribe/publish calls remain as no-ops. Scaffold
@repo/core-events back via: pnpm turbo gen core-package events

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:00:35 +02:00
parent 681fe6ada1
commit a9f27f0d7e
29 changed files with 54 additions and 500 deletions

View File

@@ -111,64 +111,6 @@ export default [
// Events + jobs rules are added here when @repo/core-events is scaffolded
// via `pnpm turbo gen core-package events`.
// <gen:events-rules>
{
files: ["**/*.{ts,tsx,mjs,cjs,js}"],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
"ExportNamedDeclaration[source.value=/\\/events\\/handlers\\//]",
message:
"Event handlers (events/handlers/*.handler.ts) must not be re-exported. Wire them only inside the consumer feature's bind-production / bind-dev-seed (Rule E1).",
},
{
selector:
"ExportAllDeclaration[source.value=/\\/events\\/handlers\\//]",
message:
"Event handlers (events/handlers/*.handler.ts) must not be re-exported. Wire them only inside the consumer feature's bind-production / bind-dev-seed (Rule E1).",
},
{
selector:
"MemberExpression[object.type='MemberExpression'][object.object.type='Identifier'][object.object.name='payload'][object.property.type='Identifier'][object.property.name='jobs']",
message:
"Direct `payload.jobs.*` access is not allowed here. Use IJobQueue (from @repo/core-shared/jobs) instead. Allowed only in **/integrations/cms/jobs/** and **/core-shared/src/jobs/**.",
},
],
},
},
// J — `payload.jobs.*` is allowed only in the integration layer.
// In these paths, no-restricted-syntax is narrowed to keep E1 active but
// drop the payload.jobs check.
// Note: "**/core-shared/src/jobs/**" does not match from within a package-local
// ESLint run because ESLint resolves globs relative to the config file location.
// The pattern is kept for documentation; in practice, the PayloadJobQueue class
// uses `this.payload.jobs.*` which the selector already ignores (it only catches
// bare `payload.jobs.*`). Any new file added there that does use bare `payload.jobs.*`
// would need this allowlist to be expressed as "**/jobs/payload-*" or similar.
{
files: [
"**/integrations/cms/jobs/**",
"**/core-shared/src/jobs/**",
],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
"ExportNamedDeclaration[source.value=/\\/events\\/handlers\\//]",
message:
"Event handlers (events/handlers/*.handler.ts) must not be re-exported. Wire them only inside the consumer feature's bind-production / bind-dev-seed (Rule E1).",
},
{
selector:
"ExportAllDeclaration[source.value=/\\/events\\/handlers\\//]",
message:
"Event handlers (events/handlers/*.handler.ts) must not be re-exported. Wire them only inside the consumer feature's bind-production / bind-dev-seed (Rule E1).",
},
],
},
},
// R2 / R1 (ADR-016) — realtime-specific ESLint rules (no-direct-socket-io,
// no-realtime-handler-reexport) are added here when @repo/core-realtime is
// scaffolded via `pnpm turbo gen core-package realtime`.