Skip to main content

Function: reportViolation()

reportViolation(context: Readonly<Rule.RuleContext>, violation: Readonly<ViolationReport>): void

Defined in: _internal/jsonc-helpers.ts:340

Report a rule violation through the shared policy-compliant helper.

Parametersโ€‹

contextโ€‹

Readonly<Rule.RuleContext>

The ESLint rule context provided by createJsoncRule.

violationโ€‹

Readonly<ViolationReport>

Violation descriptor (location, messageId, optional fix).

Returnsโ€‹

void

Remarksโ€‹

This wrapper exists so that the rule-reporting policy contract test can confirm every rule uses a shared channel instead of calling context.report() directly. The cast to unknown is required because the JSONC SourceLocation type carries an additional offset field that ESLint's internal SourceLocation does not declare, even though both shapes are structurally equivalent at runtime.