import { type AstNode } from './util'; /** * Default file name searched relative to the lint root when `firestoreRulesPath` is omitted. */ export declare const DEFAULT_FIRESTORE_RULES_FILENAME: string; /** * Default call-expression callee name the rule looks for to locate the service.ts * model registry. Files without this call are treated as not-a-service.ts and skipped. */ export declare const DEFAULT_REGISTRY_FACTORY_CALL_NAME: string; /** * Default call-expression callee name used to discover `firestoreModelIdentity(...)` * declarations in the workspace. */ export declare const DEFAULT_IDENTITY_FACTORY_NAME: string; /** * Default glob patterns (relative to ESLint `cwd`) the rule scans to build the workspace * identity registry. Covers shared identities in `@dereekb/firebase` source, local model * identities inside `*-firebase` components, and any app-side model files. */ export declare const DEFAULT_MODEL_SEARCH_ROOTS: readonly string[]; /** * Inline identity stub used by the rule's spec to bypass workspace globbing. */ export interface VirtualModelIdentity { readonly modelName: string; readonly collectionName: string; readonly identityVariableName: string; readonly parentIdentityVariableName?: string; } /** * Options for the require-firestore-rule-for-service-model rule. */ export interface FirebaseRequireFirestoreRuleForServiceModelRuleOptions { /** * Path to the `firestore.rules` file. Resolved against the ESLint `cwd` when relative. * Defaults to `/firestore.rules`. */ readonly firestoreRulesPath?: string; /** * Inline `firestore.rules` source used in tests; bypasses filesystem reads when set. */ readonly virtualFirestoreRules?: string; /** * Inline `firestoreModelIdentity` registry used in tests; bypasses workspace globbing. */ readonly virtualModelIdentities?: readonly VirtualModelIdentity[]; /** * Call-expression callee name that marks a file as the app's service.ts. Defaults to * {@link DEFAULT_REGISTRY_FACTORY_CALL_NAME}. */ readonly registryFactoryCallName?: string; /** * Call-expression callee name treated as the model-identity factory. Defaults to * {@link DEFAULT_IDENTITY_FACTORY_NAME}. */ readonly identityFactoryName?: string; /** * Glob patterns (relative to ESLint `cwd`) used to discover identity declarations. * Defaults to {@link DEFAULT_MODEL_SEARCH_ROOTS}. */ readonly modelSearchRoots?: readonly string[]; /** * Model names that are intentionally registered in service.ts without a matching block * in firestore.rules. Suppresses the missing-match warning for each name. */ readonly allowedMissingCollectionNames?: readonly string[]; } /** * ESLint rule definition for require-firestore-rule-for-service-model. */ export interface FirebaseRequireFirestoreRuleForServiceModelRuleDefinition { readonly meta: { readonly type: 'problem'; readonly fixable: undefined; readonly docs: { readonly description: string; readonly recommended: boolean; }; readonly messages: Readonly>; readonly schema: readonly object[]; }; create(context: RuleContext): Record void>; } interface RuleContext { readonly options: FirebaseRequireFirestoreRuleForServiceModelRuleOptions[]; readonly cwd?: string; readonly report: (descriptor: { node: AstNode; messageId: string; data?: Record; }) => void; } /** * ESLint rule that cross-checks every model registered in an app's `service.ts` * (`firebaseModelsService<...>(REGISTRY)`) against the app's `firestore.rules`. Each * registered model must have a `match //...` block at the correct nesting * depth (subcollections nested under their parent collection's match, or matched via a * top-level `match /{path=**}//...` collection-group rule). * * Models whose model name appears in `allowedMissingCollectionNames` are exempt — used to * document intentional gaps in the rules file. * * @example * ```ts * // OK — firestore.rules has `match /gb/{guestbook} { match /gbe/{guestbookEntry} { ... } }` * export const DEMO_FIREBASE_MODEL_SERVICE_FACTORIES = { * guestbook: guestbookFirebaseModelServiceFactory, * guestbookEntry: guestbookEntryFirebaseModelServiceFactory * }; * export const demoFirebaseModelServices = firebaseModelsService(DEMO_FIREBASE_MODEL_SERVICE_FACTORIES); * ``` */ export declare const FIREBASE_REQUIRE_FIRESTORE_RULE_FOR_SERVICE_MODEL_RULE: FirebaseRequireFirestoreRuleForServiceModelRuleDefinition; export {};