feat(core-eslint): add no-undeclared-rate-limit conformance rule
Adds the `no-undeclared-rate-limit` ESLint rule (warn severity) that
enforces rate-limit drift at lint time:
- Warns when rateLimit.consume("X", _) is called inside a use-case but
"X" is absent from manifest.useCases[name].rateLimit
- Warns when a declared rateLimit budget has no matching consume call
in the use-case body (unusedDeclaration)
- Is a no-op outside use-case files
Extends _manifest-ast.js to extract the rateLimit[] field from both
parseManifestUseCases and parseManifestFully. Updates _manifest-ast
tests to include the new field in expected shapes. Registers the rule
at warn severity in plugin.js and base.js. Adds RuleTester fixtures
for all four cases (declared+matching, undeclared, unused, non-use-case).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,7 @@ describe("parseManifestUseCases", () => {
|
||||
publishes: [],
|
||||
consumes: [],
|
||||
analyticsEvents: [],
|
||||
rateLimit: [],
|
||||
},
|
||||
signUp: {
|
||||
mutates: true,
|
||||
@@ -49,6 +50,7 @@ describe("parseManifestUseCases", () => {
|
||||
publishes: ["auth.signed-up"],
|
||||
consumes: [],
|
||||
analyticsEvents: [],
|
||||
rateLimit: [],
|
||||
},
|
||||
signOut: {
|
||||
mutates: true,
|
||||
@@ -56,6 +58,7 @@ describe("parseManifestUseCases", () => {
|
||||
publishes: [],
|
||||
consumes: [],
|
||||
analyticsEvents: [],
|
||||
rateLimit: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -94,6 +97,7 @@ describe("parseManifestFully", () => {
|
||||
publishes: [],
|
||||
consumes: [],
|
||||
analyticsEvents: [],
|
||||
rateLimit: [],
|
||||
},
|
||||
signUp: {
|
||||
mutates: true,
|
||||
@@ -101,6 +105,7 @@ describe("parseManifestFully", () => {
|
||||
publishes: [],
|
||||
consumes: [],
|
||||
analyticsEvents: [],
|
||||
rateLimit: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user