@dereekb/firebase 13.11.16 → 13.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/index.cjs.js +919 -43
- package/eslint/index.esm.js +916 -44
- package/eslint/package.json +2 -2
- package/eslint/src/lib/index.d.ts +2 -0
- package/eslint/src/lib/plugin.d.ts +4 -0
- package/eslint/src/lib/require-complete-crud-function-config-map.rule.d.ts +61 -0
- package/eslint/src/lib/require-firestore-constraint-type-parameter.rule.d.ts +45 -0
- package/package.json +5 -5
- package/test/package.json +6 -6
package/eslint/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/eslint",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.18",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@typescript-eslint/utils": "8.59.3"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@dereekb/util": "13.11.
|
|
8
|
+
"@dereekb/util": "13.11.18",
|
|
9
9
|
"@typescript-eslint/parser": "8.59.3",
|
|
10
10
|
"eslint": "10.4.0"
|
|
11
11
|
},
|
|
@@ -2,5 +2,7 @@ export { FIREBASE_REQUIRE_TAGGED_FIRESTORE_CONSTRAINTS_RULE, type FirebaseRequir
|
|
|
2
2
|
export { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE, type FirebaseRequireDbxModelFirebaseIndexQuerySuffixRuleOptions, type FirebaseRequireDbxModelFirebaseIndexQuerySuffixRuleDefinition } from './require-dbx-model-firebase-index-query-suffix.rule';
|
|
3
3
|
export { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE, type FirebaseRequireDbxModelFirebaseIndexCompanionTagsRuleOptions, type FirebaseRequireDbxModelFirebaseIndexCompanionTagsRuleDefinition } from './require-dbx-model-firebase-index-companion-tags.rule';
|
|
4
4
|
export { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE, type FirebaseRequireDbxModelFirebaseIndexValidDispatcherRuleOptions, type FirebaseRequireDbxModelFirebaseIndexValidDispatcherRuleDefinition } from './require-dbx-model-firebase-index-valid-dispatcher.rule';
|
|
5
|
+
export { FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE, type FirebaseRequireFirestoreConstraintTypeParameterRuleOptions, type FirebaseRequireFirestoreConstraintTypeParameterRuleDefinition } from './require-firestore-constraint-type-parameter.rule';
|
|
6
|
+
export { FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE, DEFAULT_CRUD_VERB_NAMES, MODEL_FIREBASE_CRUD_FUNCTION_CONFIG_MAP_TYPE_NAME, type FirebaseRequireCompleteCrudFunctionConfigMapRuleOptions, type FirebaseRequireCompleteCrudFunctionConfigMapRuleDefinition } from './require-complete-crud-function-config-map.rule';
|
|
5
7
|
export { FIREBASE_ESLINT_PLUGIN, firebaseESLintPlugin, type FirebaseEslintPlugin } from './plugin';
|
|
6
8
|
export { DBX_MODEL_FIREBASE_INDEX_MARKER, DEFAULT_CONSTRAINT_FACTORY_NAMES, DEFAULT_INDEX_AFFECTING_CONSTRAINT_NAMES, DEFAULT_PAGINATION_CONSTRAINT_NAMES, FIREBASE_MODULE, QUERY_SUFFIX } from './util';
|
|
@@ -2,6 +2,8 @@ import { FIREBASE_REQUIRE_TAGGED_FIRESTORE_CONSTRAINTS_RULE } from './require-ta
|
|
|
2
2
|
import { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE } from './require-dbx-model-firebase-index-query-suffix.rule';
|
|
3
3
|
import { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE } from './require-dbx-model-firebase-index-companion-tags.rule';
|
|
4
4
|
import { FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE } from './require-dbx-model-firebase-index-valid-dispatcher.rule';
|
|
5
|
+
import { FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE } from './require-firestore-constraint-type-parameter.rule';
|
|
6
|
+
import { FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE } from './require-complete-crud-function-config-map.rule';
|
|
5
7
|
/**
|
|
6
8
|
* ESLint plugin interface for `@dereekb/firebase` rules.
|
|
7
9
|
*/
|
|
@@ -11,6 +13,8 @@ export interface FirebaseEslintPlugin {
|
|
|
11
13
|
readonly 'require-dbx-model-firebase-index-query-suffix': typeof FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_QUERY_SUFFIX_RULE;
|
|
12
14
|
readonly 'require-dbx-model-firebase-index-companion-tags': typeof FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_COMPANION_TAGS_RULE;
|
|
13
15
|
readonly 'require-dbx-model-firebase-index-valid-dispatcher': typeof FIREBASE_REQUIRE_DBX_MODEL_FIREBASE_INDEX_VALID_DISPATCHER_RULE;
|
|
16
|
+
readonly 'require-firestore-constraint-type-parameter': typeof FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE;
|
|
17
|
+
readonly 'require-complete-crud-function-config-map': typeof FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE;
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type AstNode } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Type-reference name that triggers this rule. Variables whose declared type is
|
|
4
|
+
* `ModelFirebaseCrudFunctionConfigMap<ConfigType, Identity>` will have their
|
|
5
|
+
* initializer validated against the structure of `ConfigType`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MODEL_FIREBASE_CRUD_FUNCTION_CONFIG_MAP_TYPE_NAME = "ModelFirebaseCrudFunctionConfigMap";
|
|
8
|
+
/**
|
|
9
|
+
* CRUD verb names supported by `ModelFirebaseCrudFunctionConfigMap`. Mirrors the
|
|
10
|
+
* `create | read | update | delete | query` verbs in the type definition at
|
|
11
|
+
* `packages/firebase/src/lib/client/function/model.function.factory.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_CRUD_VERB_NAMES: readonly string[];
|
|
14
|
+
/**
|
|
15
|
+
* Options for the require-complete-crud-function-config-map rule.
|
|
16
|
+
*/
|
|
17
|
+
export interface FirebaseRequireCompleteCrudFunctionConfigMapRuleOptions {
|
|
18
|
+
readonly typeName?: string;
|
|
19
|
+
readonly verbNames?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ESLint rule definition for require-complete-crud-function-config-map.
|
|
23
|
+
*/
|
|
24
|
+
export interface FirebaseRequireCompleteCrudFunctionConfigMapRuleDefinition {
|
|
25
|
+
readonly meta: {
|
|
26
|
+
readonly type: 'problem';
|
|
27
|
+
readonly fixable: undefined;
|
|
28
|
+
readonly docs: {
|
|
29
|
+
readonly description: string;
|
|
30
|
+
readonly recommended: boolean;
|
|
31
|
+
};
|
|
32
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
33
|
+
readonly schema: readonly object[];
|
|
34
|
+
};
|
|
35
|
+
create(context: {
|
|
36
|
+
options: FirebaseRequireCompleteCrudFunctionConfigMapRuleOptions[];
|
|
37
|
+
report: (descriptor: {
|
|
38
|
+
node: AstNode;
|
|
39
|
+
messageId: string;
|
|
40
|
+
data?: Record<string, string>;
|
|
41
|
+
}) => void;
|
|
42
|
+
}): Record<string, (node: AstNode) => void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ESLint rule that verifies every `ModelFirebaseCrudFunctionConfigMap<ConfigType, ...>`
|
|
46
|
+
* variable initializer is structurally complete against its companion `ConfigType`
|
|
47
|
+
* defined in the same file.
|
|
48
|
+
*
|
|
49
|
+
* The rule walks the type alias for `ConfigType` (e.g., `NotificationBoxModelCrudFunctionsConfig`),
|
|
50
|
+
* builds the expected set of model keys, verbs, and specifiers, and then compares it
|
|
51
|
+
* against the object-literal initializer of the variable. Each mismatch — missing model
|
|
52
|
+
* key, missing verb, missing specifier, disabled-but-present key, etc. — is reported as
|
|
53
|
+
* an error so the const stays in sync with its companion type even when the TypeScript
|
|
54
|
+
* mapped-type enforcement decays in larger codebases.
|
|
55
|
+
*
|
|
56
|
+
* Same-file resolution only: the companion type must be declared in the same source
|
|
57
|
+
* file as the const (matching the convention in `notification.api.ts`, `oidcmodel.api.ts`,
|
|
58
|
+
* `storagefile.api.ts`). When the type cannot be located, the rule reports
|
|
59
|
+
* `configTypeNotFound`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const FIREBASE_REQUIRE_COMPLETE_CRUD_FUNCTION_CONFIG_MAP_RULE: FirebaseRequireCompleteCrudFunctionConfigMapRuleDefinition;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type AstNode } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the require-firestore-constraint-type-parameter rule.
|
|
4
|
+
*/
|
|
5
|
+
export interface FirebaseRequireFirestoreConstraintTypeParameterRuleOptions {
|
|
6
|
+
readonly constraintNames?: readonly string[];
|
|
7
|
+
readonly additionalConstraintNames?: readonly string[];
|
|
8
|
+
readonly allowedImportSources?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* ESLint rule definition for require-firestore-constraint-type-parameter.
|
|
12
|
+
*/
|
|
13
|
+
export interface FirebaseRequireFirestoreConstraintTypeParameterRuleDefinition {
|
|
14
|
+
readonly meta: {
|
|
15
|
+
readonly type: 'suggestion';
|
|
16
|
+
readonly fixable: undefined;
|
|
17
|
+
readonly docs: {
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly recommended: boolean;
|
|
20
|
+
};
|
|
21
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
22
|
+
readonly schema: readonly object[];
|
|
23
|
+
};
|
|
24
|
+
create(context: {
|
|
25
|
+
options: FirebaseRequireFirestoreConstraintTypeParameterRuleOptions[];
|
|
26
|
+
report: (descriptor: {
|
|
27
|
+
node: AstNode;
|
|
28
|
+
messageId: string;
|
|
29
|
+
data?: Record<string, string>;
|
|
30
|
+
}) => void;
|
|
31
|
+
}): Record<string, (node: AstNode) => void>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ESLint rule that warns when an `@dereekb/firebase` field-path-narrowing constraint factory
|
|
35
|
+
* (`where`, `orderBy`) is called without a generic type argument. Without `<Model>`, the
|
|
36
|
+
* overload falls back to a plain `FieldPathOrStringPath`, so field-name typos and renamed
|
|
37
|
+
* fields silently compile.
|
|
38
|
+
*
|
|
39
|
+
* The expected form is `where<Model>('field', '==', value)` / `orderBy<Model>('field')` so
|
|
40
|
+
* the field path is constrained to `StringKeyPropertyKeys<Model>`.
|
|
41
|
+
*
|
|
42
|
+
* Not auto-fixable: the rule cannot safely infer the correct model type from the surrounding
|
|
43
|
+
* function signature in an ESLint autofix.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FIREBASE_REQUIRE_FIRESTORE_CONSTRAINT_TYPE_PARAMETER_RULE: FirebaseRequireFirestoreConstraintTypeParameterRuleDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.18",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./test": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@dereekb/util": "13.11.
|
|
28
|
-
"@dereekb/date": "13.11.
|
|
29
|
-
"@dereekb/model": "13.11.
|
|
30
|
-
"@dereekb/rxjs": "13.11.
|
|
27
|
+
"@dereekb/util": "13.11.18",
|
|
28
|
+
"@dereekb/date": "13.11.18",
|
|
29
|
+
"@dereekb/model": "13.11.18",
|
|
30
|
+
"@dereekb/rxjs": "13.11.18",
|
|
31
31
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
32
32
|
"arktype": "^2.2.0",
|
|
33
33
|
"date-fns": "^4.1.0",
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.18",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.11.
|
|
6
|
-
"@dereekb/firebase": "13.11.
|
|
7
|
-
"@dereekb/model": "13.11.
|
|
8
|
-
"@dereekb/rxjs": "13.11.
|
|
9
|
-
"@dereekb/util": "13.11.
|
|
5
|
+
"@dereekb/date": "13.11.18",
|
|
6
|
+
"@dereekb/firebase": "13.11.18",
|
|
7
|
+
"@dereekb/model": "13.11.18",
|
|
8
|
+
"@dereekb/rxjs": "13.11.18",
|
|
9
|
+
"@dereekb/util": "13.11.18",
|
|
10
10
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
11
11
|
"date-fns": "^4.1.0",
|
|
12
12
|
"firebase": "^12.12.1",
|