Skip to content

Commit 3793e2c

Browse files
[api-extractor] Fixed empty lines for removed lines (#5736)
* - Fixed empty lines for removed lines * - rel notes * Update common/changes/@microsoft/api-extractor/fix-empty-lines_2026-03-31-08-56.json Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com> * - Review points --------- Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
1 parent 958d907 commit 3793e2c

10 files changed

Lines changed: 478 additions & 0 deletions

File tree

apps/api-extractor/src/generators/DtsRollupGenerator.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ export class DtsRollupGenerator {
449449
}
450450
}
451451

452+
if (modification.suffix.trim().length === 0 && modification.prefix.trim().length === 0) {
453+
// In case of blank prefix and suffix, remove indentation to avoid blank lines in place of removed members
454+
modification.suffix = '';
455+
modification.prefix = '';
456+
}
457+
452458
trimmed = true;
453459
}
454460
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @public
3+
*/
4+
export declare class Combiner {
5+
/**
6+
* @alpha
7+
*/
8+
alphaMember(x: boolean, y: boolean): boolean;
9+
/**
10+
* @beta
11+
*/
12+
betaMember(x: string, y: string): string;
13+
/**
14+
* @public
15+
*/
16+
publicMember(x: number, y: number): number;
17+
}
18+
19+
export { }
Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
{
2+
"metadata": {
3+
"toolPackage": "@microsoft/api-extractor",
4+
"toolVersion": "[test mode]",
5+
"schemaVersion": 1011,
6+
"oldestForwardsCompatibleVersion": 1001,
7+
"tsdocConfig": {
8+
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
9+
"noStandardTags": true,
10+
"tagDefinitions": [
11+
{
12+
"tagName": "@alpha",
13+
"syntaxKind": "modifier"
14+
},
15+
{
16+
"tagName": "@beta",
17+
"syntaxKind": "modifier"
18+
},
19+
{
20+
"tagName": "@defaultValue",
21+
"syntaxKind": "block"
22+
},
23+
{
24+
"tagName": "@decorator",
25+
"syntaxKind": "block",
26+
"allowMultiple": true
27+
},
28+
{
29+
"tagName": "@deprecated",
30+
"syntaxKind": "block"
31+
},
32+
{
33+
"tagName": "@eventProperty",
34+
"syntaxKind": "modifier"
35+
},
36+
{
37+
"tagName": "@example",
38+
"syntaxKind": "block",
39+
"allowMultiple": true
40+
},
41+
{
42+
"tagName": "@experimental",
43+
"syntaxKind": "modifier"
44+
},
45+
{
46+
"tagName": "@inheritDoc",
47+
"syntaxKind": "inline"
48+
},
49+
{
50+
"tagName": "@internal",
51+
"syntaxKind": "modifier"
52+
},
53+
{
54+
"tagName": "@label",
55+
"syntaxKind": "inline"
56+
},
57+
{
58+
"tagName": "@link",
59+
"syntaxKind": "inline",
60+
"allowMultiple": true
61+
},
62+
{
63+
"tagName": "@override",
64+
"syntaxKind": "modifier"
65+
},
66+
{
67+
"tagName": "@packageDocumentation",
68+
"syntaxKind": "modifier"
69+
},
70+
{
71+
"tagName": "@param",
72+
"syntaxKind": "block",
73+
"allowMultiple": true
74+
},
75+
{
76+
"tagName": "@privateRemarks",
77+
"syntaxKind": "block"
78+
},
79+
{
80+
"tagName": "@public",
81+
"syntaxKind": "modifier"
82+
},
83+
{
84+
"tagName": "@readonly",
85+
"syntaxKind": "modifier"
86+
},
87+
{
88+
"tagName": "@remarks",
89+
"syntaxKind": "block"
90+
},
91+
{
92+
"tagName": "@returns",
93+
"syntaxKind": "block"
94+
},
95+
{
96+
"tagName": "@sealed",
97+
"syntaxKind": "modifier"
98+
},
99+
{
100+
"tagName": "@see",
101+
"syntaxKind": "block"
102+
},
103+
{
104+
"tagName": "@throws",
105+
"syntaxKind": "block",
106+
"allowMultiple": true
107+
},
108+
{
109+
"tagName": "@typeParam",
110+
"syntaxKind": "block",
111+
"allowMultiple": true
112+
},
113+
{
114+
"tagName": "@virtual",
115+
"syntaxKind": "modifier"
116+
},
117+
{
118+
"tagName": "@jsx",
119+
"syntaxKind": "block"
120+
},
121+
{
122+
"tagName": "@jsxRuntime",
123+
"syntaxKind": "block"
124+
},
125+
{
126+
"tagName": "@jsxFrag",
127+
"syntaxKind": "block"
128+
},
129+
{
130+
"tagName": "@jsxImportSource",
131+
"syntaxKind": "block"
132+
},
133+
{
134+
"tagName": "@betaDocumentation",
135+
"syntaxKind": "modifier"
136+
},
137+
{
138+
"tagName": "@internalRemarks",
139+
"syntaxKind": "block"
140+
},
141+
{
142+
"tagName": "@preapproved",
143+
"syntaxKind": "modifier"
144+
}
145+
],
146+
"supportForTags": {
147+
"@alpha": true,
148+
"@beta": true,
149+
"@defaultValue": true,
150+
"@decorator": true,
151+
"@deprecated": true,
152+
"@eventProperty": true,
153+
"@example": true,
154+
"@experimental": true,
155+
"@inheritDoc": true,
156+
"@internal": true,
157+
"@label": true,
158+
"@link": true,
159+
"@override": true,
160+
"@packageDocumentation": true,
161+
"@param": true,
162+
"@privateRemarks": true,
163+
"@public": true,
164+
"@readonly": true,
165+
"@remarks": true,
166+
"@returns": true,
167+
"@sealed": true,
168+
"@see": true,
169+
"@throws": true,
170+
"@typeParam": true,
171+
"@virtual": true,
172+
"@betaDocumentation": true,
173+
"@internalRemarks": true,
174+
"@preapproved": true
175+
},
176+
"reportUnsupportedHtmlElements": false
177+
}
178+
},
179+
"kind": "Package",
180+
"canonicalReference": "api-extractor-scenarios!",
181+
"docComment": "",
182+
"name": "api-extractor-scenarios",
183+
"preserveMemberOrder": false,
184+
"members": [
185+
{
186+
"kind": "EntryPoint",
187+
"canonicalReference": "api-extractor-scenarios!",
188+
"name": "",
189+
"preserveMemberOrder": false,
190+
"members": [
191+
{
192+
"kind": "Class",
193+
"canonicalReference": "api-extractor-scenarios!Combiner:class",
194+
"docComment": "/**\n * @public\n */\n",
195+
"excerptTokens": [
196+
{
197+
"kind": "Content",
198+
"text": "export declare class Combiner "
199+
}
200+
],
201+
"fileUrlPath": "src/omitNewlines/index.ts",
202+
"releaseTag": "Public",
203+
"isAbstract": false,
204+
"name": "Combiner",
205+
"preserveMemberOrder": false,
206+
"members": [
207+
{
208+
"kind": "Method",
209+
"canonicalReference": "api-extractor-scenarios!Combiner#betaMember:member(1)",
210+
"docComment": "/**\n * @beta\n */\n",
211+
"excerptTokens": [
212+
{
213+
"kind": "Content",
214+
"text": "betaMember(x: "
215+
},
216+
{
217+
"kind": "Content",
218+
"text": "string"
219+
},
220+
{
221+
"kind": "Content",
222+
"text": ", y: "
223+
},
224+
{
225+
"kind": "Content",
226+
"text": "string"
227+
},
228+
{
229+
"kind": "Content",
230+
"text": "): "
231+
},
232+
{
233+
"kind": "Content",
234+
"text": "string"
235+
},
236+
{
237+
"kind": "Content",
238+
"text": ";"
239+
}
240+
],
241+
"isStatic": false,
242+
"returnTypeTokenRange": {
243+
"startIndex": 5,
244+
"endIndex": 6
245+
},
246+
"releaseTag": "Beta",
247+
"isProtected": false,
248+
"overloadIndex": 1,
249+
"parameters": [
250+
{
251+
"parameterName": "x",
252+
"parameterTypeTokenRange": {
253+
"startIndex": 1,
254+
"endIndex": 2
255+
},
256+
"isOptional": false
257+
},
258+
{
259+
"parameterName": "y",
260+
"parameterTypeTokenRange": {
261+
"startIndex": 3,
262+
"endIndex": 4
263+
},
264+
"isOptional": false
265+
}
266+
],
267+
"isOptional": false,
268+
"isAbstract": false,
269+
"name": "betaMember"
270+
},
271+
{
272+
"kind": "Method",
273+
"canonicalReference": "api-extractor-scenarios!Combiner#publicMember:member(1)",
274+
"docComment": "/**\n * @public\n */\n",
275+
"excerptTokens": [
276+
{
277+
"kind": "Content",
278+
"text": "publicMember(x: "
279+
},
280+
{
281+
"kind": "Content",
282+
"text": "number"
283+
},
284+
{
285+
"kind": "Content",
286+
"text": ", y: "
287+
},
288+
{
289+
"kind": "Content",
290+
"text": "number"
291+
},
292+
{
293+
"kind": "Content",
294+
"text": "): "
295+
},
296+
{
297+
"kind": "Content",
298+
"text": "number"
299+
},
300+
{
301+
"kind": "Content",
302+
"text": ";"
303+
}
304+
],
305+
"isStatic": false,
306+
"returnTypeTokenRange": {
307+
"startIndex": 5,
308+
"endIndex": 6
309+
},
310+
"releaseTag": "Public",
311+
"isProtected": false,
312+
"overloadIndex": 1,
313+
"parameters": [
314+
{
315+
"parameterName": "x",
316+
"parameterTypeTokenRange": {
317+
"startIndex": 1,
318+
"endIndex": 2
319+
},
320+
"isOptional": false
321+
},
322+
{
323+
"parameterName": "y",
324+
"parameterTypeTokenRange": {
325+
"startIndex": 3,
326+
"endIndex": 4
327+
},
328+
"isOptional": false
329+
}
330+
],
331+
"isOptional": false,
332+
"isAbstract": false,
333+
"name": "publicMember"
334+
}
335+
],
336+
"implementsTokenRanges": []
337+
}
338+
]
339+
}
340+
]
341+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## API Report File for "api-extractor-scenarios"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
// @public (undocumented)
8+
export class Combiner {
9+
// @alpha (undocumented)
10+
alphaMember(x: boolean, y: boolean): boolean;
11+
// @beta (undocumented)
12+
betaMember(x: string, y: string): string;
13+
// (undocumented)
14+
publicMember(x: number, y: number): number;
15+
}
16+
17+
// (No @packageDocumentation comment for this package)
18+
19+
```

0 commit comments

Comments
 (0)