Skip to content

Commit e7e9429

Browse files
committed
prettier . --write
1 parent f7ad5d1 commit e7e9429

File tree

814 files changed

+12359
-11784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

814 files changed

+12359
-11784
lines changed

apps/api-documenter/.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This is a workaround for https://github.com/eslint/eslint/issues/3458
2-
require("@rushstack/eslint-config/patch-eslint6");
2+
require('@rushstack/eslint-config/patch-eslint6');
33

44
module.exports = {
5-
extends: [ "@rushstack/eslint-config" ],
5+
extends: ['@rushstack/eslint-config'],
66
parserOptions: { tsconfigRootDir: __dirname },
77
};

apps/api-documenter/config/api-extractor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
"dtsRollup": {
1717
"enabled": true,
18-
"untrimmedFilePath": "<projectFolder>/dist/rollup.d.ts",
18+
"untrimmedFilePath": "<projectFolder>/dist/rollup.d.ts"
1919
}
2020
}

apps/api-documenter/config/jest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"isEnabled": true
3-
}
3+
}

apps/api-documenter/src/cli/ApiDocumenterCommandLine.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ export class ApiDocumenterCommandLine extends CommandLineParser {
1010
public constructor() {
1111
super({
1212
toolFilename: 'api-documenter',
13-
toolDescription: 'Reads *.api.json files produced by api-extractor, '
14-
+ ' and generates API documentation in various output formats.'
13+
toolDescription:
14+
'Reads *.api.json files produced by api-extractor, ' +
15+
' and generates API documentation in various output formats.',
1516
});
1617
this._populateActions();
1718
}
1819

19-
protected onDefineParameters(): void { // override
20+
protected onDefineParameters(): void {
21+
// override
2022
// No parameters
2123
}
2224

apps/api-documenter/src/cli/BaseAction.ts

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ import * as path from 'path';
55
import * as tsdoc from '@microsoft/tsdoc';
66
import * as colors from 'colors';
77

8-
import {
9-
CommandLineAction,
10-
CommandLineStringParameter
11-
} from '@rushstack/ts-command-line';
8+
import { CommandLineAction, CommandLineStringParameter } from '@rushstack/ts-command-line';
129
import { FileSystem } from '@rushstack/node-core-library';
1310
import {
1411
ApiModel,
1512
ApiItem,
1613
ApiItemContainerMixin,
1714
ApiDocumentedItem,
18-
IResolveDeclarationReferenceResult
15+
IResolveDeclarationReferenceResult,
1916
} from '@microsoft/api-extractor-model';
2017

2118
export abstract class BaseAction extends CommandLineAction {
@@ -25,22 +22,25 @@ export abstract class BaseAction extends CommandLineAction {
2522
private _inputFolderParameter: CommandLineStringParameter;
2623
private _outputFolderParameter: CommandLineStringParameter;
2724

28-
protected onDefineParameters(): void { // override
25+
protected onDefineParameters(): void {
26+
// override
2927
this._inputFolderParameter = this.defineStringParameter({
3028
parameterLongName: '--input-folder',
3129
parameterShortName: '-i',
3230
argumentName: 'FOLDER1',
33-
description: `Specifies the input folder containing the *.api.json files to be processed.`
34-
+ ` If omitted, the default is "./input"`
31+
description:
32+
`Specifies the input folder containing the *.api.json files to be processed.` +
33+
` If omitted, the default is "./input"`,
3534
});
3635

3736
this._outputFolderParameter = this.defineStringParameter({
3837
parameterLongName: '--output-folder',
3938
parameterShortName: '-o',
4039
argumentName: 'FOLDER2',
41-
description: `Specifies the output folder where the documentation will be written.`
42-
+ ` ANY EXISTING CONTENTS WILL BE DELETED!`
43-
+ ` If omitted, the default is "./${this.actionName}"`
40+
description:
41+
`Specifies the output folder where the documentation will be written.` +
42+
` ANY EXISTING CONTENTS WILL BE DELETED!` +
43+
` If omitted, the default is "./${this.actionName}"`,
4444
});
4545
}
4646

@@ -72,28 +72,33 @@ export abstract class BaseAction extends CommandLineAction {
7272
// to apply all @inheritDoc tags before the .api.json file is written.
7373
// See DocCommentEnhancer._applyInheritDoc() for more info.
7474
private _applyInheritDoc(apiItem: ApiItem, apiModel: ApiModel): void {
75-
7675
if (apiItem instanceof ApiDocumentedItem) {
7776
if (apiItem.tsdocComment) {
7877
const inheritDocTag: tsdoc.DocInheritDocTag | undefined = apiItem.tsdocComment.inheritDocTag;
7978

8079
if (inheritDocTag && inheritDocTag.declarationReference) {
8180
// Attempt to resolve the declaration reference
82-
const result: IResolveDeclarationReferenceResult
83-
= apiModel.resolveDeclarationReference(inheritDocTag.declarationReference, apiItem);
81+
const result: IResolveDeclarationReferenceResult = apiModel.resolveDeclarationReference(
82+
inheritDocTag.declarationReference,
83+
apiItem
84+
);
8485

8586
if (result.errorMessage) {
86-
console.log(colors.yellow(`Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: `
87-
+ result.errorMessage));
87+
console.log(
88+
colors.yellow(
89+
`Warning: Unresolved @inheritDoc tag for ${apiItem.displayName}: ` + result.errorMessage
90+
)
91+
);
8892
} else {
89-
if (result.resolvedApiItem instanceof ApiDocumentedItem
90-
&& result.resolvedApiItem.tsdocComment
91-
&& result.resolvedApiItem !== apiItem) {
93+
if (
94+
result.resolvedApiItem instanceof ApiDocumentedItem &&
95+
result.resolvedApiItem.tsdocComment &&
96+
result.resolvedApiItem !== apiItem
97+
) {
9298
this._copyInheritedDocs(apiItem.tsdocComment, result.resolvedApiItem.tsdocComment);
9399
}
94100
}
95101
}
96-
97102
}
98103
}
99104

@@ -124,5 +129,4 @@ export abstract class BaseAction extends CommandLineAction {
124129

125130
targetDocComment.inheritDocTag = undefined;
126131
}
127-
128132
}

apps/api-documenter/src/cli/GenerateAction.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ export class GenerateAction extends BaseAction {
1717
super({
1818
actionName: 'generate',
1919
summary: 'EXPERIMENTAL',
20-
documentation: 'EXPERIMENTAL - This action is a prototype of a new config file driven mode of operation for'
21-
+ ' API Documenter. It is not ready for general usage yet. Its design may change in the future.'
20+
documentation:
21+
'EXPERIMENTAL - This action is a prototype of a new config file driven mode of operation for' +
22+
' API Documenter. It is not ready for general usage yet. Its design may change in the future.',
2223
});
2324
}
2425

25-
protected onExecute(): Promise<void> { // override
26+
protected onExecute(): Promise<void> {
27+
// override
2628
// Look for the config file under the current folder
2729

2830
let configFilePath: string = path.join(process.cwd(), DocumenterConfig.FILENAME);
@@ -32,7 +34,9 @@ export class GenerateAction extends BaseAction {
3234
// Otherwise try the standard "config" subfolder
3335
configFilePath = path.join(process.cwd(), 'config', DocumenterConfig.FILENAME);
3436
if (!FileSystem.exists(configFilePath)) {
35-
throw new Error(`Unable to find ${DocumenterConfig.FILENAME} in the current folder or in a "config" subfolder`);
37+
throw new Error(
38+
`Unable to find ${DocumenterConfig.FILENAME} in the current folder or in a "config" subfolder`
39+
);
3640
}
3741
}
3842

@@ -44,7 +48,10 @@ export class GenerateAction extends BaseAction {
4448
const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter(apiModel, documenterConfig);
4549
markdownDocumenter.generateFiles(this.outputFolder);
4650
} else {
47-
const yamlDocumenter: ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter(apiModel, documenterConfig);
51+
const yamlDocumenter: ExperimentalYamlDocumenter = new ExperimentalYamlDocumenter(
52+
apiModel,
53+
documenterConfig
54+
);
4855
yamlDocumenter.generateFiles(this.outputFolder);
4956
}
5057

apps/api-documenter/src/cli/MarkdownAction.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ export class MarkdownAction extends BaseAction {
1111
super({
1212
actionName: 'markdown',
1313
summary: 'Generate documentation as Markdown files (*.md)',
14-
documentation: 'Generates API documentation as a collection of files in'
15-
+ ' Markdown format, suitable for example for publishing on a GitHub site.'
14+
documentation:
15+
'Generates API documentation as a collection of files in' +
16+
' Markdown format, suitable for example for publishing on a GitHub site.',
1617
});
1718
}
1819

19-
protected onExecute(): Promise<void> { // override
20+
protected onExecute(): Promise<void> {
21+
// override
2022
const apiModel: ApiModel = this.buildApiModel();
2123

2224
const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter(apiModel, undefined);

apps/api-documenter/src/cli/YamlAction.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import {
5-
CommandLineFlagParameter
6-
} from '@rushstack/ts-command-line';
4+
import { CommandLineFlagParameter } from '@rushstack/ts-command-line';
75

86
import { ApiDocumenterCommandLine } from './ApiDocumenterCommandLine';
97
import { BaseAction } from './BaseAction';
@@ -20,34 +18,38 @@ export class YamlAction extends BaseAction {
2018
super({
2119
actionName: 'yaml',
2220
summary: 'Generate documentation as universal reference YAML files (*.yml)',
23-
documentation: 'Generates API documentation as a collection of files conforming'
24-
+ ' to the universal reference YAML format, which is used by the docs.microsoft.com'
25-
+ ' pipeline.'
21+
documentation:
22+
'Generates API documentation as a collection of files conforming' +
23+
' to the universal reference YAML format, which is used by the docs.microsoft.com' +
24+
' pipeline.',
2625
});
2726
}
2827

29-
protected onDefineParameters(): void { // override
28+
protected onDefineParameters(): void {
29+
// override
3030
super.onDefineParameters();
3131

3232
this._officeParameter = this.defineFlagParameter({
3333
parameterLongName: '--office',
34-
description: `Enables some additional features specific to Office Add-ins`
34+
description: `Enables some additional features specific to Office Add-ins`,
3535
});
3636
this._newDocfxNamespacesParameter = this.defineFlagParameter({
3737
parameterLongName: '--new-docfx-namespaces',
38-
description: `This enables an experimental feature that will be officially released with the next major version`
39-
+ ` of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and`
40-
+ ` adds them to the table of contents. This will also affect file layout as namespaced items will be nested`
41-
+ ` under a directory for the namespace instead of just within the package.`
38+
description:
39+
`This enables an experimental feature that will be officially released with the next major version` +
40+
` of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and` +
41+
` adds them to the table of contents. This will also affect file layout as namespaced items will be nested` +
42+
` under a directory for the namespace instead of just within the package.`,
4243
});
4344
}
4445

45-
protected onExecute(): Promise<void> { // override
46+
protected onExecute(): Promise<void> {
47+
// override
4648
const apiModel: ApiModel = this.buildApiModel();
4749

4850
const yamlDocumenter: YamlDocumenter = this._officeParameter.value
49-
? new OfficeYamlDocumenter(apiModel, this.inputFolder, this._newDocfxNamespacesParameter.value)
50-
: new YamlDocumenter(apiModel, this._newDocfxNamespacesParameter.value);
51+
? new OfficeYamlDocumenter(apiModel, this.inputFolder, this._newDocfxNamespacesParameter.value)
52+
: new YamlDocumenter(apiModel, this._newDocfxNamespacesParameter.value);
5153

5254
yamlDocumenter.generateFiles(this.outputFolder);
5355
return Promise.resolve();

apps/api-documenter/src/documenters/DocumenterConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export class DocumenterConfig {
2424
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
2525
*/
2626
public static readonly jsonSchema: JsonSchema = JsonSchema.fromFile(
27-
path.join(__dirname, '..', 'schemas', 'api-documenter.schema.json'));
27+
path.join(__dirname, '..', 'schemas', 'api-documenter.schema.json')
28+
);
2829

2930
/**
3031
* The config file name "api-extractor.json".

apps/api-documenter/src/documenters/ExperimentalYamlDocumenter.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ExperimentalYamlDocumenter extends YamlDocumenter {
3939
let tocItem: IYamlTocItem;
4040
if (apiItem.kind === ApiItemKind.Namespace && !this.newDocfxNamespaces) {
4141
tocItem = {
42-
name: this._getTocItemName(apiItem)
42+
name: this._getTocItemName(apiItem),
4343
};
4444
} else {
4545
if (this._shouldEmbed(apiItem.kind)) {
@@ -49,7 +49,7 @@ export class ExperimentalYamlDocumenter extends YamlDocumenter {
4949

5050
tocItem = {
5151
name: this._getTocItemName(apiItem),
52-
uid: this._getUid(apiItem)
52+
uid: this._getUid(apiItem),
5353
};
5454

5555
if (apiItem.kind !== ApiItemKind.Package) {
@@ -98,10 +98,9 @@ export class ExperimentalYamlDocumenter extends YamlDocumenter {
9898

9999
// First we attempt to filter by inline tag if provided.
100100
if (apiItem instanceof ApiDocumentedItem) {
101-
const docInlineTag: DocInlineTag | undefined =
102-
categoryInlineTag
103-
? this._findInlineTagByName(categoryInlineTag, apiItem.tsdocComment)
104-
: undefined;
101+
const docInlineTag: DocInlineTag | undefined = categoryInlineTag
102+
? this._findInlineTagByName(categoryInlineTag, apiItem.tsdocComment)
103+
: undefined;
105104

106105
const tagContent: string | undefined =
107106
docInlineTag && docInlineTag.tagContent && docInlineTag.tagContent.trim();
@@ -134,7 +133,10 @@ export class ExperimentalYamlDocumenter extends YamlDocumenter {
134133

135134
// This is a direct copy of a @docCategory inline tag finder in office-ui-fabric-react,
136135
// but is generic enough to be used for any inline tag
137-
private _findInlineTagByName(tagName: string, docComment: DocComment | undefined): DocInlineTag | undefined {
136+
private _findInlineTagByName(
137+
tagName: string,
138+
docComment: DocComment | undefined
139+
): DocInlineTag | undefined {
138140
const tagNameToCheck: string = `@${tagName}`;
139141

140142
if (docComment instanceof DocInlineTag) {

0 commit comments

Comments
 (0)