Skip to content

Commit d9a0587

Browse files
committed
Respond to PR feedback
1 parent 02ee8a0 commit d9a0587

File tree

9 files changed

+59
-36
lines changed

9 files changed

+59
-36
lines changed

apps/api-extractor/src/api/ExtractorMessageId.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const enum ExtractorMessageId {
2828
IncompatibleReleaseTags = 'ae-incompatible-release-tags',
2929

3030
/**
31-
* "___ is exported by the package, but it is missing a release tag (`@alpha`, `@beta`, `@public`, or `@internal`)."
31+
* "___ is part of the package's API, but it is missing a release tag (`@alpha`, `@beta`, `@public`, or `@internal`)."
3232
*/
3333
MissingReleaseTag = 'ae-missing-release-tag',
3434

apps/api-extractor/src/collector/Collector.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -815,28 +815,30 @@ export class Collector {
815815
if (options.effectiveReleaseTag === ReleaseTag.None) {
816816
if (!astDeclaration.astSymbol.isExternal) {
817817
// for now, don't report errors for external code
818-
// Don't report missing release tags for forgotten exports
818+
// Don't report missing release tags for forgotten exports (unless we're including forgotten exports
819+
// in either the API report or doc model).
819820
const astSymbol: AstSymbol = astDeclaration.astSymbol;
820821
const entity: CollectorEntity | undefined = this._entitiesByAstEntity.get(astSymbol.rootAstSymbol);
821-
if (entity && entity.consumable) {
822+
if (
823+
entity &&
824+
(entity.consumable ||
825+
this.extractorConfig.apiReportIncludeForgottenExports ||
826+
this.extractorConfig.docModelIncludeForgottenExports)
827+
) {
822828
// We also don't report errors for the default export of an entry point, since its doc comment
823829
// isn't easy to obtain from the .d.ts file
824830
if (astSymbol.rootAstSymbol.localName !== '_default') {
825831
this.messageRouter.addAnalyzerIssue(
826832
ExtractorMessageId.MissingReleaseTag,
827-
`"${entity.astEntity.localName}" is exported by the package, but it is missing ` +
833+
`"${entity.astEntity.localName}" is part of the package's API, but it is missing ` +
828834
`a release tag (@alpha, @beta, @public, or @internal)`,
829835
astSymbol
830836
);
831837
}
832-
833-
// All internal, exported APIs default to public if no release tag is specified.
834-
options.effectiveReleaseTag = ReleaseTag.Public;
835838
}
836-
} else {
837-
// All external APIs default to public if no release tag is specified.
838-
options.effectiveReleaseTag = ReleaseTag.Public;
839839
}
840+
841+
options.effectiveReleaseTag = ReleaseTag.Public;
840842
}
841843

842844
const apiItemMetadata: ApiItemMetadata = new ApiItemMetadata(options);

apps/api-extractor/src/schemas/api-extractor-template.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
*
8787
* DEFAULT VALUE: "by-name"
8888
*/
89-
// enumMemberOrder?: EnumMemberOrder,
89+
// "enumMemberOrder": "by-name",
9090

9191
/**
9292
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
@@ -185,7 +185,7 @@
185185
*
186186
* DEFAULT VALUE: "false"
187187
*/
188-
// includeForgottenExports?: boolean
188+
// "includeForgottenExports": false
189189
},
190190

191191
/**
@@ -215,7 +215,7 @@
215215
*
216216
* DEFAULT VALUE: "false"
217217
*/
218-
// includeForgottenExports?: boolean
218+
// "includeForgottenExports": false
219219
},
220220

221221
/**

build-tests/api-extractor-scenarios/etc/includeForgottenExports/api-extractor-scenarios.api.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@
175175
{
176176
"kind": "Class",
177177
"canonicalReference": "api-extractor-scenarios!~AnotherDuplicateName_2:class",
178-
"docComment": "",
178+
"docComment": "/**\n * @public\n */\n",
179179
"excerptTokens": [
180180
{
181181
"kind": "Content",
182182
"text": "declare class AnotherDuplicateName "
183183
}
184184
],
185-
"releaseTag": "None",
185+
"releaseTag": "Public",
186186
"name": "AnotherDuplicateName_2",
187187
"preserveMemberOrder": false,
188188
"members": [],
@@ -191,14 +191,14 @@
191191
{
192192
"kind": "Class",
193193
"canonicalReference": "api-extractor-scenarios!~AnotherDuplicateName:class",
194-
"docComment": "/**\n * This forgotten item has the same name as another forgotten item in another file. They should be given unique names.\n */\n",
194+
"docComment": "/**\n * This forgotten item has the same name as another forgotten item in another file. They should be given unique names.\n *\n * @public\n */\n",
195195
"excerptTokens": [
196196
{
197197
"kind": "Content",
198198
"text": "declare class AnotherDuplicateName "
199199
}
200200
],
201-
"releaseTag": "None",
201+
"releaseTag": "Public",
202202
"name": "AnotherDuplicateName",
203203
"preserveMemberOrder": false,
204204
"members": [],
@@ -207,7 +207,7 @@
207207
{
208208
"kind": "TypeAlias",
209209
"canonicalReference": "api-extractor-scenarios!~DuplicateName_2:type",
210-
"docComment": "/**\n * Will be renamed to avoid a name conflict with the exported `DuplicateName` from index.ts.\n */\n",
210+
"docComment": "/**\n * Will be renamed to avoid a name conflict with the exported `DuplicateName` from index.ts.\n *\n * @public\n */\n",
211211
"excerptTokens": [
212212
{
213213
"kind": "Content",
@@ -222,7 +222,7 @@
222222
"text": ";"
223223
}
224224
],
225-
"releaseTag": "None",
225+
"releaseTag": "Public",
226226
"name": "DuplicateName_2",
227227
"typeTokenRange": {
228228
"startIndex": 1,
@@ -257,14 +257,14 @@
257257
{
258258
"kind": "Class",
259259
"canonicalReference": "api-extractor-scenarios!~ForgottenExport1:class",
260-
"docComment": "/**\n * `ForgottenExport2` wants to inherit this doc comment, but unfortunately this isn't supported yet\n */\n",
260+
"docComment": "/**\n * `ForgottenExport2` wants to inherit this doc comment, but unfortunately this isn't supported yet\n *\n * @public\n */\n",
261261
"excerptTokens": [
262262
{
263263
"kind": "Content",
264264
"text": "declare class ForgottenExport1 "
265265
}
266266
],
267-
"releaseTag": "None",
267+
"releaseTag": "Public",
268268
"name": "ForgottenExport1",
269269
"preserveMemberOrder": false,
270270
"members": [
@@ -278,7 +278,7 @@
278278
"text": "constructor();"
279279
}
280280
],
281-
"releaseTag": "None",
281+
"releaseTag": "Public",
282282
"isProtected": false,
283283
"overloadIndex": 1,
284284
"parameters": []
@@ -304,7 +304,7 @@
304304
],
305305
"isReadonly": false,
306306
"isOptional": true,
307-
"releaseTag": "None",
307+
"releaseTag": "Public",
308308
"name": "prop",
309309
"propertyTypeTokenRange": {
310310
"startIndex": 1,
@@ -319,7 +319,7 @@
319319
{
320320
"kind": "TypeAlias",
321321
"canonicalReference": "api-extractor-scenarios!~ForgottenExport2:type",
322-
"docComment": "/**\n * {@inheritDoc ForgottenExport1}\n */\n",
322+
"docComment": "/**\n * {@inheritDoc ForgottenExport1}\n *\n * @public\n */\n",
323323
"excerptTokens": [
324324
{
325325
"kind": "Content",
@@ -334,7 +334,7 @@
334334
"text": ";"
335335
}
336336
],
337-
"releaseTag": "None",
337+
"releaseTag": "Public",
338338
"name": "ForgottenExport2",
339339
"typeTokenRange": {
340340
"startIndex": 1,
@@ -344,14 +344,14 @@
344344
{
345345
"kind": "Namespace",
346346
"canonicalReference": "api-extractor-scenarios!~ForgottenExport4:namespace",
347-
"docComment": "",
347+
"docComment": "/**\n * @public\n */\n",
348348
"excerptTokens": [
349349
{
350350
"kind": "Content",
351351
"text": "declare namespace ForgottenExport4 "
352352
}
353353
],
354-
"releaseTag": "None",
354+
"releaseTag": "Public",
355355
"name": "ForgottenExport4",
356356
"preserveMemberOrder": false,
357357
"members": [
@@ -365,7 +365,7 @@
365365
"text": "class ForgottenExport5 "
366366
}
367367
],
368-
"releaseTag": "None",
368+
"releaseTag": "Public",
369369
"name": "ForgottenExport5",
370370
"preserveMemberOrder": false,
371371
"members": [],
@@ -385,14 +385,14 @@
385385
{
386386
"kind": "Class",
387387
"canonicalReference": "api-extractor-scenarios!~internal2.ForgottenExport6:class",
388-
"docComment": "",
388+
"docComment": "/**\n * @public\n */\n",
389389
"excerptTokens": [
390390
{
391391
"kind": "Content",
392392
"text": "export declare class ForgottenExport6 "
393393
}
394394
],
395-
"releaseTag": "None",
395+
"releaseTag": "Public",
396396
"name": "ForgottenExport6",
397397
"preserveMemberOrder": false,
398398
"members": [],

build-tests/api-extractor-scenarios/etc/includeForgottenExports/api-extractor-scenarios.api.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
55
```ts
66

7+
// @public
78
class AnotherDuplicateName {
89
}
910

10-
// (undocumented)
11+
// @public (undocumented)
1112
class AnotherDuplicateName_2 {
1213
}
1314

1415
// @public
1516
export type DuplicateName = boolean;
1617

18+
// @public
1719
type DuplicateName_2 = number;
1820

21+
// @public
1922
class ForgottenExport1 {
2023
constructor();
2124
// Warning: (ae-forgotten-export) The symbol "ForgottenExport2" needs to be exported by the entry point index.d.ts
@@ -26,17 +29,17 @@ class ForgottenExport1 {
2629

2730
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "api-extractor-scenarios" does not have an export "ForgottenExport1"
2831
//
29-
// (undocumented)
32+
// @public (undocumented)
3033
type ForgottenExport2 = number;
3134

32-
// (undocumented)
35+
// @public (undocumented)
3336
namespace ForgottenExport4 {
3437
// (undocumented)
3538
class ForgottenExport5 {
3639
}
3740
}
3841

39-
// (undocumented)
42+
// @public (undocumented)
4043
class ForgottenExport6 {
4144
}
4245

build-tests/api-extractor-scenarios/etc/includeForgottenExports/rollup.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/**
22
* This forgotten item has the same name as another forgotten item in another
33
* file. They should be given unique names.
4+
* @public
45
*/
56
declare class AnotherDuplicateName {
67
}
78

9+
/** @public */
810
declare class AnotherDuplicateName_2 {
911
}
1012

@@ -19,26 +21,33 @@ export declare type DuplicateName = boolean;
1921
/**
2022
* Will be renamed to avoid a name conflict with the exported `DuplicateName` from
2123
* index.ts.
24+
* @public
2225
*/
2326
declare type DuplicateName_2 = number;
2427

2528
/**
2629
* `ForgottenExport2` wants to inherit this doc comment, but unfortunately this isn't
2730
* supported yet
31+
* @public
2832
*/
2933
declare class ForgottenExport1 {
3034
prop?: ForgottenExport2;
3135
constructor();
3236
}
3337

34-
/** {@inheritDoc ForgottenExport1} */
38+
/**
39+
* @public
40+
* {@inheritDoc ForgottenExport1}
41+
*/
3542
declare type ForgottenExport2 = number;
3643

44+
/** @public */
3745
declare namespace ForgottenExport4 {
3846
class ForgottenExport5 {
3947
}
4048
}
4149

50+
/** @public */
4251
declare class ForgottenExport6 {
4352
}
4453

build-tests/api-extractor-scenarios/src/includeForgottenExports/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import * as internal2 from './internal2';
33
/**
44
* `ForgottenExport2` wants to inherit this doc comment, but unfortunately this isn't
55
* supported yet
6+
* @public
67
*/
78
class ForgottenExport1 {
89
prop?: ForgottenExport2;
910
constructor() {}
1011
}
1112

12-
/** {@inheritDoc ForgottenExport1} */
13+
/**
14+
* @public
15+
* {@inheritDoc ForgottenExport1}
16+
*/
1317
type ForgottenExport2 = number;
1418

1519
/** @public */
@@ -36,6 +40,7 @@ export namespace SomeNamespace1 {
3640
}
3741
}
3842

43+
/** @public */
3944
namespace ForgottenExport4 {
4045
export class ForgottenExport5 {}
4146
}
@@ -53,6 +58,7 @@ export function someFunction5(): internal2.ForgottenExport6 {
5358
/**
5459
* This forgotten item has the same name as another forgotten item in another
5560
* file. They should be given unique names.
61+
* @public
5662
*/
5763
class AnotherDuplicateName {}
5864

build-tests/api-extractor-scenarios/src/includeForgottenExports/internal1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Will be renamed to avoid a name conflict with the exported `DuplicateName` from
33
* index.ts.
4+
* @public
45
*/
56
type DuplicateName = number;
67

@@ -9,6 +10,7 @@ export function someFunction2(): DuplicateName {
910
return 5;
1011
}
1112

13+
/** @public */
1214
class AnotherDuplicateName {}
1315

1416
/** @public */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/** @public */
12
export class ForgottenExport6 {}

0 commit comments

Comments
 (0)