Skip to content

Commit 551b942

Browse files
committed
(Disruptive commit) Fix up the @typescript-eslint/member-ordering and @typescript-eslint/no-use-before-define ESLint issues
1 parent a752505 commit 551b942

File tree

80 files changed

+1263
-1249
lines changed

Some content is hidden

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

80 files changed

+1263
-1249
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export class DocumenterConfig {
2525
*/
2626
public static readonly FILENAME: string = 'api-documenter.json';
2727

28+
private constructor(filePath: string, configFile: IConfigFile) {
29+
this.configFilePath = filePath;
30+
this.configFile = configFile;
31+
}
32+
2833
/**
2934
* Load and validate an api-documenter.json file.
3035
*/
@@ -33,9 +38,4 @@ export class DocumenterConfig {
3338

3439
return new DocumenterConfig(path.resolve(configFilePath), configFile);
3540
}
36-
37-
private constructor(filePath: string, configFile: IConfigFile) {
38-
this.configFilePath = filePath;
39-
this.configFile = configFile;
40-
}
4141
}

apps/api-documenter/src/plugin/MarkdownDocumenterFeature.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ import { MarkdownDocumenterAccessor } from './MarkdownDocumenterAccessor';
1212
* @public
1313
*/
1414
export class MarkdownDocumenterFeatureContext {
15-
/** @internal */
16-
public constructor(options: MarkdownDocumenterFeatureContext) {
17-
this.apiModel = options.apiModel;
18-
this.outputFolder = options.outputFolder;
19-
this.documenter = options.documenter;
20-
}
21-
2215
/**
2316
* Provides access to the `ApiModel` for the documentation being generated.
2417
*/
@@ -33,6 +26,13 @@ export class MarkdownDocumenterFeatureContext {
3326
* Exposes functionality of the documenter.
3427
*/
3528
public readonly documenter: MarkdownDocumenterAccessor;
29+
30+
/** @internal */
31+
public constructor(options: MarkdownDocumenterFeatureContext) {
32+
this.apiModel = options.apiModel;
33+
this.outputFolder = options.outputFolder;
34+
this.documenter = options.documenter;
35+
}
3636
}
3737

3838
/**

apps/api-documenter/src/plugin/PluginFeature.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
* @public
1111
*/
1212
export class PluginFeatureInitialization {
13+
/** @internal */
14+
public _context: PluginFeatureContext;
15+
1316
/** @internal */
1417
public constructor() {
1518
// reserved for future use
1619
}
17-
18-
/** @internal */
19-
public _context: PluginFeatureContext;
2020
}
2121

2222
/**

apps/api-extractor-model/src/items/ApiDeclaredItem.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ export class ApiDeclaredItem extends ApiDocumentedItem {
3636
private _excerptTokens: ExcerptToken[];
3737
private _excerpt: Excerpt;
3838

39-
/** @override */
40-
public static onDeserializeInto(options: Partial<IApiDeclaredItemOptions>, context: DeserializerContext,
41-
jsonObject: IApiDeclaredItemJson): void {
42-
43-
super.onDeserializeInto(options, context, jsonObject);
44-
45-
options.excerptTokens = jsonObject.excerptTokens;
46-
}
47-
4839
public constructor(options: IApiDeclaredItemOptions) {
4940
super(options);
5041

@@ -56,6 +47,15 @@ export class ApiDeclaredItem extends ApiDocumentedItem {
5647
this._excerpt = new Excerpt(this.excerptTokens, { startIndex: 0, endIndex: this.excerptTokens.length });
5748
}
5849

50+
/** @override */
51+
public static onDeserializeInto(options: Partial<IApiDeclaredItemOptions>, context: DeserializerContext,
52+
jsonObject: IApiDeclaredItemJson): void {
53+
54+
super.onDeserializeInto(options, context, jsonObject);
55+
56+
options.excerptTokens = jsonObject.excerptTokens;
57+
}
58+
5959
/**
6060
* The source code excerpt where the API item is declared.
6161
*/

apps/api-extractor-model/src/items/ApiDocumentedItem.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export interface IApiDocumentedItemJson extends IApiItemJson {
3131
export class ApiDocumentedItem extends ApiItem {
3232
private _tsdocComment: tsdoc.DocComment | undefined;
3333

34+
public constructor(options: IApiDocumentedItemOptions) {
35+
super(options);
36+
this._tsdocComment = options.docComment;
37+
}
38+
3439
/** @override */
3540
public static onDeserializeInto(options: Partial<IApiDocumentedItemOptions>, context: DeserializerContext,
3641
jsonObject: IApiItemJson): void {
@@ -52,11 +57,6 @@ export class ApiDocumentedItem extends ApiItem {
5257
}
5358
}
5459

55-
public constructor(options: IApiDocumentedItemOptions) {
56-
super(options);
57-
this._tsdocComment = options.docComment;
58-
}
59-
6060
public get tsdocComment(): tsdoc.DocComment | undefined {
6161
return this._tsdocComment;
6262
}

apps/api-extractor-model/src/items/ApiItem.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export class ApiItem {
6666
private _canonicalReference: DeclarationReference | undefined;
6767
private _parent: ApiItem | undefined;
6868

69+
public constructor(options: IApiItemOptions) {
70+
// ("options" is not used here, but part of the inheritance pattern)
71+
}
72+
6973
public static deserialize(jsonObject: IApiItemJson, context: DeserializerContext): ApiItem {
7074
// The Deserializer class is coupled with a ton of other classes, so we delay loading it
7175
// to avoid ES5 circular imports.
@@ -80,10 +84,6 @@ export class ApiItem {
8084
// (implemented by subclasses)
8185
}
8286

83-
public constructor(options: IApiItemOptions) {
84-
// ("options" is not used here, but part of the inheritance pattern)
85-
}
86-
8787
/** @virtual */
8888
public serializeInto(jsonObject: Partial<IApiItemJson>): void {
8989
jsonObject.kind = this.kind;

apps/api-extractor-model/src/items/ApiPropertyItem.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export class ApiPropertyItem extends ApiNameMixin(ApiReleaseTagMixin(ApiDeclared
3434
*/
3535
public readonly propertyTypeExcerpt: Excerpt;
3636

37+
public constructor(options: IApiPropertyItemOptions) {
38+
super(options);
39+
40+
this.propertyTypeExcerpt = this.buildExcerpt(options.propertyTypeTokenRange);
41+
}
42+
3743
/** @override */
3844
public static onDeserializeInto(options: Partial<IApiPropertyItemOptions>, context: DeserializerContext,
3945
jsonObject: IApiPropertyItemJson): void {
@@ -43,12 +49,6 @@ export class ApiPropertyItem extends ApiNameMixin(ApiReleaseTagMixin(ApiDeclared
4349
options.propertyTypeTokenRange = jsonObject.propertyTypeTokenRange;
4450
}
4551

46-
public constructor(options: IApiPropertyItemOptions) {
47-
super(options);
48-
49-
this.propertyTypeExcerpt = this.buildExcerpt(options.propertyTypeTokenRange);
50-
}
51-
5252
/**
5353
* Returns true if this property should be documented as an event.
5454
*

apps/api-extractor-model/src/mixins/ApiItemContainerMixin.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,6 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
116116
// that share a common ApiItemKind. Examples include overloaded constructors or index signatures.
117117
public [_membersByKind]: Map<string, ApiItem[]> | undefined; // key is ApiItemKind
118118

119-
/** @override */
120-
public static onDeserializeInto(options: Partial<IApiItemContainerMixinOptions>,
121-
context: DeserializerContext, jsonObject: IApiItemContainerJson): void {
122-
123-
baseClass.onDeserializeInto(options, context, jsonObject);
124-
125-
options.members = [];
126-
for (const memberObject of jsonObject.members) {
127-
options.members.push(ApiItem.deserialize(memberObject, context));
128-
}
129-
}
130-
131119
// eslint-disable-next-line @typescript-eslint/no-explicit-any
132120
public constructor(...args: any[]) {
133121
super(...args);
@@ -143,6 +131,18 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
143131
}
144132
}
145133

134+
/** @override */
135+
public static onDeserializeInto(options: Partial<IApiItemContainerMixinOptions>,
136+
context: DeserializerContext, jsonObject: IApiItemContainerJson): void {
137+
138+
baseClass.onDeserializeInto(options, context, jsonObject);
139+
140+
options.members = [];
141+
for (const memberObject of jsonObject.members) {
142+
options.members.push(ApiItem.deserialize(memberObject, context));
143+
}
144+
}
145+
146146
public get members(): ReadonlyArray<ApiItem> {
147147
if (!this[_membersSorted]) {
148148
this[_members].sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));

apps/api-extractor-model/src/mixins/ApiNameMixin.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ export function ApiNameMixin<TBaseClass extends IApiItemConstructor>(baseClass:
6262
abstract class MixedClass extends baseClass implements ApiNameMixin {
6363
public readonly [_name]: string;
6464

65+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
66+
public constructor(...args: any[]) {
67+
super(...args);
68+
69+
const options: IApiNameMixinOptions = args[0];
70+
this[_name] = options.name;
71+
}
72+
6573
/** @override */
6674
public static onDeserializeInto(options: Partial<IApiNameMixinOptions>, context: DeserializerContext,
6775
jsonObject: IApiNameMixinJson): void {
@@ -71,14 +79,6 @@ export function ApiNameMixin<TBaseClass extends IApiItemConstructor>(baseClass:
7179
options.name = jsonObject.name;
7280
}
7381

74-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
75-
public constructor(...args: any[]) {
76-
super(...args);
77-
78-
const options: IApiNameMixinOptions = args[0];
79-
this[_name] = options.name;
80-
}
81-
8282
public get name(): string {
8383
return this[_name];
8484
}

apps/api-extractor-model/src/mixins/ApiParameterListMixin.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,6 @@ export function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(ba
103103
public readonly [_overloadIndex]: number;
104104
public readonly [_parameters]: Parameter[];
105105

106-
/** @override */
107-
public static onDeserializeInto(options: Partial<IApiParameterListMixinOptions>, context: DeserializerContext,
108-
jsonObject: IApiParameterListJson): void {
109-
110-
baseClass.onDeserializeInto(options, context, jsonObject);
111-
112-
options.overloadIndex = jsonObject.overloadIndex;
113-
options.parameters = jsonObject.parameters || [];
114-
}
115-
116106
// eslint-disable-next-line @typescript-eslint/no-explicit-any
117107
public constructor(...args: any[]) {
118108
super(...args);
@@ -140,6 +130,16 @@ export function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(ba
140130
}
141131
}
142132

133+
/** @override */
134+
public static onDeserializeInto(options: Partial<IApiParameterListMixinOptions>, context: DeserializerContext,
135+
jsonObject: IApiParameterListJson): void {
136+
137+
baseClass.onDeserializeInto(options, context, jsonObject);
138+
139+
options.overloadIndex = jsonObject.overloadIndex;
140+
options.parameters = jsonObject.parameters || [];
141+
}
142+
143143
public get overloadIndex(): number {
144144
return this[_overloadIndex];
145145
}

0 commit comments

Comments
 (0)