Extends the conformance ESLint layer with the consent-check rule:
- `no-undeclared-consent-check` (warn): `consent.isGranted("X")` in a
use-case file must match a category declared in `manifest.requiresConsent`;
also warns when requiresConsent is declared but no isGranted call is found.
- `_manifest-ast.js`: adds `parseManifestFully` which extracts top-level
`name`, `requiredCores`, `requiresConsent`, and per-use-case maps from the
manifest AST; `requiresConsent` extraction tested in `_manifest-ast.test.js`.
- `_rule-context.js` / `_rule-schema.js`: shared helpers extracted from the
existing per-rule files so the new rule can resolve use-case name + feature
root without duplication.
- Existing rules (`no-undeclared-audit`, `no-undeclared-event-publish`,
`no-undeclared-analytics-event`) updated to use the shared helpers.
- `plugin.js` + `base.js` register the rule at warn severity.
- CLAUDE.md + conformance-quickref.md: rule count advanced from 11 → 12.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
2.2 KiB
JavaScript
46 lines
2.2 KiB
JavaScript
import featureMustHaveManifest from "./rules/feature-must-have-manifest.js";
|
|
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";
|
|
import atomicTierImportDirection from "./rules/atomic-tier-import-direction.js";
|
|
import piiDeclarationMustBeComplete from "./rules/pii-declaration-must-be-complete.js";
|
|
import noUndeclaredConsentCheck from "./rules/no-undeclared-consent-check.js";
|
|
|
|
/**
|
|
* The `@repo/core-eslint` conformance plugin. Aggregates custom rules that
|
|
* enforce feature-conformance contracts (manifest presence, sibling tests,
|
|
* required-cores ↔ workspace consistency).
|
|
*
|
|
* Registered as the `conformance` plugin in flat config:
|
|
*
|
|
* import conformancePlugin from "@repo/core-eslint/plugin";
|
|
* export default [
|
|
* { plugins: { conformance: conformancePlugin } },
|
|
* { rules: { "conformance/feature-must-have-manifest": ["warn", { repoRoot: import.meta.dirname }] } },
|
|
* ];
|
|
*/
|
|
const plugin = {
|
|
meta: { name: "conformance", version: "0.3.0" },
|
|
rules: {
|
|
"feature-must-have-manifest": featureMustHaveManifest,
|
|
"usecase-must-have-test-file": usecaseMustHaveTestFile,
|
|
"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,
|
|
"atomic-tier-import-direction": atomicTierImportDirection,
|
|
"pii-declaration-must-be-complete": piiDeclarationMustBeComplete,
|
|
"no-undeclared-consent-check": noUndeclaredConsentCheck,
|
|
},
|
|
};
|
|
|
|
export default plugin;
|