@dereekb/firebase 13.11.17 → 13.12.0

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.
Files changed (36) hide show
  1. package/eslint/index.cjs.js +7229 -1551
  2. package/eslint/index.esm.js +7203 -1552
  3. package/eslint/package.json +4 -2
  4. package/eslint/rollup.alias-internal.config.d.ts +1 -0
  5. package/eslint/src/lib/firebase-rules-text.d.ts +121 -0
  6. package/eslint/src/lib/firestore-rules-parser.d.ts +61 -0
  7. package/eslint/src/lib/index.d.ts +10 -0
  8. package/eslint/src/lib/plugin.d.ts +16 -0
  9. package/eslint/src/lib/predicate-evaluator.d.ts +47 -0
  10. package/eslint/src/lib/require-api-details-for-crud-function.rule.d.ts +83 -0
  11. package/eslint/src/lib/require-complete-crud-function-config-map.rule.d.ts +61 -0
  12. package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +47 -0
  13. package/eslint/src/lib/require-dbx-model-service-factory-tag.rule.d.ts +56 -0
  14. package/eslint/src/lib/require-firestore-constraint-type-parameter.rule.d.ts +45 -0
  15. package/eslint/src/lib/require-firestore-rule-for-service-model.rule.d.ts +115 -0
  16. package/eslint/src/lib/require-service-factory-for-dbx-model.rule.d.ts +80 -0
  17. package/eslint/src/lib/require-storagefile-policy-matches-rules.rule.d.ts +79 -0
  18. package/eslint/src/lib/storage-rules-parser.d.ts +38 -0
  19. package/index.cjs.js +53 -5
  20. package/index.esm.js +46 -6
  21. package/package.json +5 -5
  22. package/src/lib/common/auth/auth.d.ts +8 -0
  23. package/src/lib/common/auth/oidc/oidc.d.ts +7 -5
  24. package/src/lib/common/model/function.d.ts +12 -1
  25. package/src/lib/model/notification/notification.d.ts +6 -0
  26. package/src/lib/model/oidcmodel/oidcmodel.d.ts +1 -0
  27. package/src/lib/model/storagefile/storagefile.api.d.ts +113 -2
  28. package/src/lib/model/storagefile/storagefile.d.ts +2 -0
  29. package/src/lib/model/storagefile/storagefile.upload.d.ts +33 -1
  30. package/src/lib/model/system/system.d.ts +1 -0
  31. package/test/index.cjs.js +2 -4
  32. package/test/index.esm.js +2 -4
  33. package/test/package.json +6 -6
  34. package/eslint/src/lib/comments.d.ts +0 -112
  35. package/eslint/src/lib/dbx-tag-families.d.ts +0 -280
  36. package/eslint/src/lib/jsdoc-parser.d.ts +0 -116
package/test/index.esm.js CHANGED
@@ -1469,12 +1469,10 @@ function _is_native_reflect_construct$4() {
1469
1469
  }(AbstractFirestoreDocument);
1470
1470
  /**
1471
1471
  * Firestore collection path name.
1472
- */ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
1473
- var MOCK_ITEM_USER_COLLECTION_NAME = 'mockItemUser';
1472
+ */ var MOCK_ITEM_USER_COLLECTION_NAME = 'mockItemUser';
1474
1473
  /**
1475
1474
  * Default document identifier used for MockItemUser in tests.
1476
- */ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
1477
- var MOCK_ITEM_USER_IDENTIFIER = '0';
1475
+ */ var MOCK_ITEM_USER_IDENTIFIER = '0';
1478
1476
  /**
1479
1477
  * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
1480
1478
  */ var mockItemUserConverter = snapshotConverterFunctions({
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "13.11.17",
3
+ "version": "13.12.0",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.11.17",
6
- "@dereekb/firebase": "13.11.17",
7
- "@dereekb/model": "13.11.17",
8
- "@dereekb/rxjs": "13.11.17",
9
- "@dereekb/util": "13.11.17",
5
+ "@dereekb/date": "13.12.0",
6
+ "@dereekb/firebase": "13.12.0",
7
+ "@dereekb/model": "13.12.0",
8
+ "@dereekb/rxjs": "13.12.0",
9
+ "@dereekb/util": "13.12.0",
10
10
  "@firebase/rules-unit-testing": "5.0.0",
11
11
  "date-fns": "^4.1.0",
12
12
  "firebase": "^12.12.1",
@@ -1,112 +0,0 @@
1
- import type { Maybe } from '@dereekb/util';
2
- /**
3
- * The bundler hint string that marks a function call as side-effect-free.
4
- */
5
- export declare const NO_SIDE_EFFECTS_TAG = "@__NO_SIDE_EFFECTS__";
6
- type AstNode = any;
7
- export interface JsdocCommentInfo {
8
- readonly node: AstNode;
9
- readonly text: string;
10
- readonly hasNoSideEffects: boolean;
11
- }
12
- export interface FunctionLeadingContext {
13
- readonly jsdoc: Maybe<JsdocCommentInfo>;
14
- /**
15
- * Adjacent `@__NO_SIDE_EFFECTS__` line/block comments that should be migrated into the JSDoc
16
- * and removed. Excludes the implementation-leading annotation on overloaded functions, which
17
- * is tracked separately by {@link implLineComment} because it must be preserved.
18
- */
19
- readonly orphanLineComments: readonly AstNode[];
20
- /**
21
- * True when this implementation is preceded by sibling overload signatures (`TSDeclareFunction`
22
- * statements with the same name).
23
- */
24
- readonly hasOverloads: boolean;
25
- /**
26
- * The `@__NO_SIDE_EFFECTS__` line/block comment immediately above the implementation
27
- * declaration when the function has overloads. TypeScript erases overload signatures during
28
- * emit, so JSDoc placed only on the first overload is dropped from the bundled JS — the
29
- * line comment directly above the implementation is what survives and reaches the bundler.
30
- *
31
- * `null` when the function is single-signature (the line comment is then a removable orphan)
32
- * or when no such comment is present.
33
- */
34
- readonly implLineComment: Maybe<AstNode>;
35
- /**
36
- * True when the implementation will carry the `@__NO_SIDE_EFFECTS__` annotation in the emitted
37
- * JavaScript:
38
- *
39
- * - Single-signature: true when the (only) JSDoc carries the tag.
40
- * - Overloaded: true when a line/block comment with the tag sits immediately above the
41
- * implementation, OR the implementation has its own JSDoc carrying the tag.
42
- *
43
- * This is the signal upstream packages need so esbuild/rollup can tree-shake unused calls.
44
- */
45
- readonly implHasSurvivingAnnotation: boolean;
46
- /**
47
- * The first statement in the overload chain (i.e. the first overload's export wrapper, or the
48
- * implementation itself when there are no overloads). Use this as the insertion anchor when
49
- * creating a brand-new JSDoc for the function, since docs conventionally live on the first
50
- * overload rather than the implementation.
51
- */
52
- readonly chainStartStatement: AstNode;
53
- }
54
- /**
55
- * Returns true if the given comment text contains the @__NO_SIDE_EFFECTS__ marker.
56
- *
57
- * @param text - The comment body text (without the `/*` and `*\/` delimiters).
58
- * @returns True when the marker substring is present.
59
- */
60
- export declare function commentContainsNoSideEffects(text: string): boolean;
61
- /**
62
- * Returns the leading whitespace (column indent) of the line containing the given offset.
63
- *
64
- * @param sourceText - The full source text being inspected.
65
- * @param offset - A character offset into `sourceText` indicating the line of interest.
66
- * @returns The whitespace prefix (spaces/tabs) of that line.
67
- */
68
- export declare function getLineIndent(sourceText: string, offset: number): string;
69
- /**
70
- * Returns the outermost statement node for a FunctionDeclaration — its `ExportNamedDeclaration`
71
- * or `ExportDefaultDeclaration` parent if exported, otherwise the declaration itself. This is the
72
- * node ESLint attaches leading comments to.
73
- *
74
- * @param node - The FunctionDeclaration AST node.
75
- * @returns The statement node ESLint attaches leading comments to.
76
- */
77
- export declare function getStatementAnchor(node: AstNode): AstNode;
78
- /**
79
- * Returns the JSDoc Block comment immediately preceding `anchor`, or `null` when
80
- * the anchor has no JSDoc leader. Used by the `@dbx<Family>` companion-tag rules
81
- * to locate the tagged declaration's documentation.
82
- *
83
- * @param sourceCode - The ESLint `SourceCode` object.
84
- * @param anchor - The statement-level node ESLint attaches leading comments to.
85
- * @returns The JSDoc block comment, or null when none is present.
86
- */
87
- export declare function leadingJsdocFor(sourceCode: AstNode, anchor: AstNode): Maybe<AstNode>;
88
- /**
89
- * Walks backward from the implementation FunctionDeclaration through any overload signatures
90
- * with the same name, collecting:.
91
- *
92
- * - The leading JSDoc block (preferring the one attached to the **first** overload, since that's
93
- * where the function's documentation conventionally lives).
94
- * - All orphan `@__NO_SIDE_EFFECTS__` line/block comments encountered between overloads or
95
- * between the last overload and the implementation.
96
- *
97
- * This handles the common pattern:
98
- *
99
- * ```ts
100
- * \/\*\* doc \*\/
101
- * export function foo(a: number): number;
102
- * export function foo(a: string): string;
103
- * \/\/ \@__NO_SIDE_EFFECTS__
104
- * export function foo(a: any) { ... }
105
- * ```
106
- *
107
- * @param sourceCode - The ESLint `SourceCode` object used to read leading comments.
108
- * @param implNode - The implementation FunctionDeclaration node.
109
- * @returns The leading JSDoc (if any) and any orphan side-effect annotation comments.
110
- */
111
- export declare function findFunctionLeadingContext(sourceCode: AstNode, implNode: AstNode): FunctionLeadingContext;
112
- export {};
@@ -1,280 +0,0 @@
1
- /**
2
- * Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
3
- * scanner schemas in `packages/dbx-components-mcp/src/scan/*-extract.ts` so
4
- * violations surface at lint time instead of at manifest-regeneration time.
5
- *
6
- * Each per-family rule supplies a {@link DbxTagFamilySpec} describing which
7
- * companions are required/optional, what value format each accepts, and which
8
- * messageId to emit when a check fails. The rule body itself only wires the
9
- * visitors and message map; all value-format validation lives here.
10
- */
11
- import type { Maybe } from '@dereekb/util';
12
- import { type ParsedJsdoc, type ParsedJsdocTag } from './jsdoc-parser';
13
- interface AstNode {
14
- readonly type: string;
15
- [key: string]: any;
16
- }
17
- /**
18
- * Kebab-case slug pattern: lowercase letters/digits, words separated by single hyphens,
19
- * starts with a letter. Used to validate slug/related/skill-ref values.
20
- */
21
- export declare const KEBAB_SLUG_PATTERN: RegExp;
22
- /**
23
- * Pascal-case TypeScript identifier pattern (starts uppercase). Used for model
24
- * identifiers and other `<ModelName>` style tag values.
25
- */
26
- export declare const PASCAL_IDENTIFIER_PATTERN: RegExp;
27
- /**
28
- * Discriminated description of how a companion tag's value should be parsed
29
- * and validated. The shared checker dispatches on `kind`.
30
- */
31
- export type DbxTagFormat = {
32
- readonly kind: 'marker';
33
- } | {
34
- readonly kind: 'kebab-slug';
35
- } | {
36
- readonly kind: 'enum';
37
- readonly values: readonly string[];
38
- } | {
39
- readonly kind: 'pascal-identifier';
40
- } | {
41
- readonly kind: 'comma-list-kebab-slug';
42
- } | {
43
- readonly kind: 'comma-list-lowercase';
44
- } | {
45
- readonly kind: 'comma-list-free-text';
46
- } | {
47
- readonly kind: 'free-text';
48
- } | {
49
- readonly kind: 'boolean';
50
- };
51
- /**
52
- * One companion-tag spec entry. `suffix` is appended to the family marker name
53
- * to form the full tag (e.g. `dbxPipe` + `Slug` → `@dbxPipeSlug`).
54
- */
55
- export interface DbxCompanionTagSpec {
56
- readonly suffix: string;
57
- readonly required?: boolean;
58
- readonly multiple?: boolean;
59
- readonly format: DbxTagFormat;
60
- }
61
- /**
62
- * The full set of companions plus the marker that triggers a family rule.
63
- */
64
- export interface DbxTagFamilySpec {
65
- readonly marker: string;
66
- readonly companions: readonly DbxCompanionTagSpec[];
67
- }
68
- /**
69
- * One violation emitted by {@link checkDbxTagFamily}. Each rule's `meta.messages`
70
- * map provides the message text for each `kind`.
71
- */
72
- export type DbxTagViolation = {
73
- readonly kind: 'missing';
74
- readonly suffix: string;
75
- readonly lineIndex: number;
76
- } | {
77
- readonly kind: 'empty';
78
- readonly suffix: string;
79
- readonly lineIndex: number;
80
- } | {
81
- readonly kind: 'invalid-kebab';
82
- readonly suffix: string;
83
- readonly value: string;
84
- readonly lineIndex: number;
85
- } | {
86
- readonly kind: 'invalid-enum';
87
- readonly suffix: string;
88
- readonly value: string;
89
- readonly allowed: readonly string[];
90
- readonly lineIndex: number;
91
- } | {
92
- readonly kind: 'invalid-pascal';
93
- readonly suffix: string;
94
- readonly value: string;
95
- readonly lineIndex: number;
96
- } | {
97
- readonly kind: 'invalid-boolean';
98
- readonly suffix: string;
99
- readonly value: string;
100
- readonly lineIndex: number;
101
- } | {
102
- readonly kind: 'comma-item-not-kebab';
103
- readonly suffix: string;
104
- readonly value: string;
105
- readonly lineIndex: number;
106
- } | {
107
- readonly kind: 'tags-not-lowercase';
108
- readonly suffix: string;
109
- readonly value: string;
110
- readonly lineIndex: number;
111
- readonly raw: ParsedJsdocTag;
112
- } | {
113
- readonly kind: 'unknown';
114
- readonly suffix: string;
115
- readonly lineIndex: number;
116
- } | {
117
- readonly kind: 'duplicate';
118
- readonly suffix: string;
119
- readonly lineIndex: number;
120
- };
121
- /**
122
- * Splits a comma-separated tag-value string into trimmed items, preserving order.
123
- *
124
- * @param value - Raw text following the tag name on a single line.
125
- * @returns Non-empty trimmed segments in declaration order.
126
- */
127
- export declare function splitCommaSeparated(value: string): string[];
128
- /**
129
- * Parses a boolean tag value using the workspace vocabulary
130
- * (`''`/`true`/`yes` → true; `false`/`no` → false). Other inputs return `undefined`.
131
- *
132
- * @param text - The trimmed tag value text.
133
- * @returns The parsed boolean, or `undefined` when the text is not in the vocabulary.
134
- */
135
- export declare function parseBooleanTagValue(text: string): Maybe<boolean>;
136
- /**
137
- * Returns the source-text offset of an offset-within-comment-value, given a Block comment node.
138
- *
139
- * @param commentNode - The ESLint Block comment AST node.
140
- * @param valueOffset - The character offset within `comment.value`.
141
- * @returns The character offset in the source file.
142
- */
143
- export declare function commentValueToSourceOffset(commentNode: AstNode, valueOffset: number): number;
144
- /**
145
- * Returns the family marker + companion tag list for the given parsed JSDoc.
146
- * Family membership is determined by tag-name prefix.
147
- *
148
- * @param parsed - The parsed JSDoc.
149
- * @param marker - The bare family marker (e.g. `'dbxPipe'`).
150
- * @returns The marker tag (if present), and all companion tags in source order.
151
- */
152
- export declare function findFamilyTags(parsed: ParsedJsdoc, marker: string): {
153
- readonly markerTag: Maybe<ParsedJsdocTag>;
154
- readonly familyTags: readonly ParsedJsdocTag[];
155
- };
156
- /**
157
- * Groups companion tags (those after the marker) by suffix. Marker entries are excluded.
158
- *
159
- * @param familyTags - The family tag list from {@link findFamilyTags}.
160
- * @param marker - The bare family marker.
161
- * @returns Lookup keyed by companion-suffix listing matching tags in declaration order.
162
- */
163
- export declare function groupCompanionsBySuffix(familyTags: readonly ParsedJsdocTag[], marker: string): Map<string, ParsedJsdocTag[]>;
164
- /**
165
- * Runs the canonical companion-tag validation pass for a `@dbx<Family>`-tagged
166
- * JSDoc against the supplied {@link DbxTagFamilySpec}. Emits one
167
- * {@link DbxTagViolation} per finding via `emit`; the calling rule maps each
168
- * violation to its own messageId.
169
- *
170
- * Validation pass order:
171
- *
172
- * 1. Unknown companions (typo detection — companions not in the spec).
173
- * 2. Required companions present (one violation per missing required tag).
174
- * 3. Duplicates (companion appears more than once, when `multiple` is not set).
175
- * 4. Per-companion value-format validation.
176
- *
177
- * Marker presence is the caller's responsibility — pass `markerPresent=true`
178
- * (i.e. `requireBareMarker` already satisfied) before invoking this.
179
- */
180
- export interface CheckDbxTagFamilyInput {
181
- readonly parsed: ParsedJsdoc;
182
- readonly spec: DbxTagFamilySpec;
183
- readonly markerTag: ParsedJsdocTag;
184
- readonly familyTags: readonly ParsedJsdocTag[];
185
- readonly emit: (violation: DbxTagViolation) => void;
186
- }
187
- /**
188
- * Validates a `@dbx<Family>` marker plus its companion tags against the supplied spec.
189
- * Reports unknown companions, missing required companions, duplicates, and per-companion
190
- * value violations through `input.emit`.
191
- *
192
- * @param input - Parsed JSDoc, family spec, resolved marker/companion tags, and emit sink.
193
- *
194
- * @example
195
- * ```ts
196
- * checkDbxTagFamily({ parsed, spec, markerTag, familyTags, emit });
197
- * ```
198
- */
199
- export declare function checkDbxTagFamily(input: CheckDbxTagFamilyInput): void;
200
- /**
201
- * Wraps `context.report` with the family rule's common "report on a tag line"
202
- * helper. The shared rule body uses this to translate {@link DbxTagViolation}
203
- * locations into ESLint source ranges.
204
- */
205
- export interface ReportOnLineInput {
206
- readonly commentNode: AstNode;
207
- readonly parsed: ParsedJsdoc;
208
- readonly sourceCode: AstNode;
209
- readonly lineIndex: number;
210
- readonly messageId: string;
211
- readonly data?: Record<string, string>;
212
- readonly report: (descriptor: {
213
- loc: AstNode;
214
- messageId: string;
215
- data?: Record<string, string>;
216
- fix?: (fixer: AstNode) => Maybe<AstNode | AstNode[]>;
217
- }) => void;
218
- readonly fix?: (fixer: AstNode) => Maybe<AstNode | AstNode[]>;
219
- }
220
- /**
221
- * Translates a JSDoc-line violation into an ESLint `context.report()` call by computing the
222
- * source range of the offending line and attaching the supplied message + optional fixer.
223
- *
224
- * @param input - Reporting context (comment node, parsed JSDoc, source code, line index, message id, optional data + fixer, report sink).
225
- *
226
- * @example
227
- * ```ts
228
- * reportOnJsdocLine({ commentNode, parsed, sourceCode, lineIndex: tag.startLineIndex, messageId: 'unknown', report: context.report });
229
- * ```
230
- */
231
- export declare function reportOnJsdocLine(input: ReportOnLineInput): void;
232
- /**
233
- * The visitor scopes used by `@dbx<Family>` companion-tag rules. Each rule
234
- * supplies a subset and the shared visitor wires them with the canonical
235
- * `getStatementAnchor` / `leadingJsdocFor` logic.
236
- */
237
- export type DbxFamilyVisitorKind = 'FunctionDeclaration' | 'VariableDeclaration' | 'ClassDeclaration' | 'TSInterfaceDeclaration' | 'TSTypeAliasDeclaration' | 'TSEnumDeclaration' | 'TSPropertySignature' | 'PropertyDefinition' | 'TSEnumMember';
238
- /**
239
- * Callback that maps a {@link DbxTagViolation} to its rule-specific
240
- * messageId + data, or `null` when the violation should be silently dropped
241
- * (e.g. when the rule does not require the missing companion).
242
- */
243
- export type DbxFamilyViolationMapper = (violation: DbxTagViolation) => Maybe<{
244
- readonly messageId: string;
245
- readonly data?: Record<string, string>;
246
- readonly fixable?: boolean;
247
- }>;
248
- /**
249
- * Produces an auto-fix for a `@dbx<Family>Tags ...` line that lowercases every
250
- * token after the tag name. Returns the replacement source range + text, or
251
- * `undefined` when the line is already canonical.
252
- *
253
- * @param input - The fix context (comment node, parsed JSDoc, source code, tag).
254
- * @returns The replacement range/text, or `undefined` when no fix is needed.
255
- */
256
- export interface BuildLowercaseTagsFixInput {
257
- readonly commentNode: AstNode;
258
- readonly parsed: ParsedJsdoc;
259
- readonly sourceCode: AstNode;
260
- readonly tag: ParsedJsdocTag;
261
- }
262
- export interface LowercaseTagsFixResult {
263
- readonly startOffset: number;
264
- readonly endOffset: number;
265
- readonly replacement: string;
266
- }
267
- /**
268
- * Computes an auto-fix descriptor that lowercases every token after a `@dbx<Family>Tags` tag
269
- * name. Returns `undefined` when the line is already canonical so the caller can short-circuit.
270
- *
271
- * @param input - Fix context (comment node, parsed JSDoc, source code, target tag).
272
- * @returns Replacement range + text when a rewrite is needed; otherwise `undefined`.
273
- *
274
- * @example
275
- * ```ts
276
- * const fix = buildLowercaseTagsFix({ commentNode, parsed, sourceCode, tag });
277
- * ```
278
- */
279
- export declare function buildLowercaseTagsFix(input: BuildLowercaseTagsFixInput): Maybe<LowercaseTagsFixResult>;
280
- export {};
@@ -1,116 +0,0 @@
1
- import type { Maybe } from '@dereekb/util';
2
- /**
3
- * Minimal JSDoc parser used by the workspace's custom ESLint rules.
4
- *
5
- * Operates on the raw `value` of an ESLint Block comment (the text between `/*` and `*\/`,
6
- * which includes the leading `*` of a JSDoc opener). Returns a structured view of the comment:
7
- * description, paragraphs, tags (with their continuation lines), and per-line metadata.
8
- */
9
- /**
10
- * Per-line view of a comment body.
11
- */
12
- export interface ParsedJsdocLine {
13
- /**
14
- * Raw line content with leading whitespace + `*` prefix preserved.
15
- */
16
- readonly raw: string;
17
- /**
18
- * Text content after the leading whitespace + `*` + optional space prefix has been stripped.
19
- */
20
- readonly text: string;
21
- /**
22
- * True when the line is blank after stripping (only `* ` with nothing else).
23
- */
24
- readonly blank: boolean;
25
- /**
26
- * Index in the original `splitLines` array.
27
- */
28
- readonly index: number;
29
- /**
30
- * Character offset of `raw[0]` relative to the start of `commentValue` (not the source file).
31
- */
32
- readonly valueOffsetStart: number;
33
- /**
34
- * Character offset of `text[0]` relative to the start of `commentValue`. Equals `valueOffsetStart` plus the length of the stripped prefix.
35
- */
36
- readonly textOffsetStart: number;
37
- }
38
- /**
39
- * Parsed view of a single `@tag` block, including any continuation lines that follow it
40
- * up to the next tag (or end of comment).
41
- */
42
- export interface ParsedJsdocTag {
43
- /**
44
- * Tag name without the leading `@`, e.g. `param`, `returns`, `throws`, `dbxUtil`, `__NO_SIDE_EFFECTS__`.
45
- */
46
- readonly tag: string;
47
- /**
48
- * For `@param`: the parameter name. For other tags: `undefined`.
49
- */
50
- readonly name: Maybe<string>;
51
- /**
52
- * For `@throws` / `@param` style: the `{Type}` annotation if present.
53
- */
54
- readonly type: Maybe<string>;
55
- /**
56
- * Remaining text on the tag line + continuation lines, joined with `\n`. Trimmed of trailing whitespace.
57
- */
58
- readonly description: string;
59
- /**
60
- * All lines belonging to this tag (the tag line itself and any continuation lines).
61
- */
62
- readonly lines: readonly ParsedJsdocLine[];
63
- /**
64
- * Index in the comment-lines array where the tag starts.
65
- */
66
- readonly startLineIndex: number;
67
- /**
68
- * Index (inclusive) where the tag ends.
69
- */
70
- readonly endLineIndex: number;
71
- }
72
- /**
73
- * Parsed view of a whole JSDoc comment.
74
- */
75
- export interface ParsedJsdoc {
76
- /**
77
- * All lines in the comment body.
78
- */
79
- readonly lines: readonly ParsedJsdocLine[];
80
- /**
81
- * Lines belonging to the description (before any tag).
82
- */
83
- readonly descriptionLines: readonly ParsedJsdocLine[];
84
- /**
85
- * Description text joined with `\n`, with leading and trailing blank lines stripped.
86
- */
87
- readonly description: string;
88
- /**
89
- * Description split into paragraphs by blank lines, with each paragraph joined by `\n`.
90
- */
91
- readonly descriptionParagraphs: readonly string[];
92
- /**
93
- * All tags in source order.
94
- */
95
- readonly tags: readonly ParsedJsdocTag[];
96
- /**
97
- * True when the original comment is a single-line `/** ... *\/` block (no newlines).
98
- */
99
- readonly singleLine: boolean;
100
- }
101
- /**
102
- * Parses the value of an ESLint Block comment that represents a JSDoc into a structured form.
103
- *
104
- * @param commentValue - The `value` of an ESLint Block comment (text between `/*` and `*\/`, including the leading `*`).
105
- * @returns A structured view of the JSDoc with description, paragraphs, and tags.
106
- *
107
- * @example
108
- * ```ts
109
- * const parsed = parseJsdocComment('*\n * Hello.\n *\n * @param x - The value.\n ');
110
- * // parsed.description === 'Hello.'
111
- * // parsed.tags[0].tag === 'param'
112
- * // parsed.tags[0].name === 'x'
113
- * // parsed.tags[0].description === 'The value.'
114
- * ```
115
- */
116
- export declare function parseJsdocComment(commentValue: string): ParsedJsdoc;