feat(core-events): scaffold events optional core
Scaffolded via pnpm turbo gen core-package events (generator-first, ADR-022 pre-shipped zod trace landed in docs/library-decisions/). Generator wired transpilePackages + E1/J eslint rule block. Two story-00-precedent additions so the coverage gates pass: the @vitest/coverage-v8 devDep (L0 sweep) and the honest symbols.ts exclude (mirroring core-shared/vitest.config.ts) plus its missing ALLOWED_GLOBS mirror in scripts/coverage/diff.mjs (L1 gate). No consumers wired — compile-green floor for the walking-skeleton PRD (ADR-027). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
This commit is contained in:
@@ -188,6 +188,59 @@ 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`.
|
||||
|
||||
Reference in New Issue
Block a user