feat(core-eslint): add no-undeclared-analytics-event ESLint rule

Adds the conformance/no-undeclared-analytics-event rule at warn severity,
mirroring no-undeclared-audit and no-undeclared-event-publish. The rule
cross-checks analytics.track("X", ...) literal slugs in *.use-case.ts
files against manifest.useCases[name].analyticsEvents, providing
sub-second editor feedback before boot-time conformance fires.

- Extends _manifest-ast.js to parse analyticsEvents arrays in both
  extractUseCaseEntry helpers
- Registers rule in plugin.js and base.js at ["warn", { repoRoot }]
- RuleTester fixtures: declared pass, undeclared warn, non-literal no-op,
  non-use-case file no-op, missing manifest entry no-op

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 15:43:37 +00:00
parent 0f8e3b8caf
commit 395143466c
6 changed files with 345 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ import usecaseMustHaveTestFile from "./rules/usecase-must-have-test-file.js";
import requiredCoresInstalled from "./rules/required-cores-installed.js";
import noUndeclaredEventPublish from "./rules/no-undeclared-event-publish.js";
import noUndeclaredAudit from "./rules/no-undeclared-audit.js";
import noUndeclaredAnalyticsEvent from "./rules/no-undeclared-analytics-event.js";
import usecaseMustBeWired from "./rules/usecase-must-be-wired.js";
import componentMustHaveStory from "./rules/component-must-have-story.js";
import componentMustHaveTest from "./rules/component-must-have-test.js";
@@ -29,6 +30,7 @@ const plugin = {
"required-cores-installed": requiredCoresInstalled,
"no-undeclared-event-publish": noUndeclaredEventPublish,
"no-undeclared-audit": noUndeclaredAudit,
"no-undeclared-analytics-event": noUndeclaredAnalyticsEvent,
"usecase-must-be-wired": usecaseMustBeWired,
"component-must-have-story": componentMustHaveStory,
"component-must-have-test": componentMustHaveTest,