Skip to content

Commit 9b80d86

Browse files
Fix for linter issues while publishing to DefinitelyTyped
1 parent 7744be6 commit 9b80d86

File tree

1 file changed

+90
-24
lines changed

1 file changed

+90
-24
lines changed
Lines changed: 90 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<# // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. #>
22
<#@ template debug="true" hostspecific="true" language="C#" #>
3+
<#@ include file="utils.tt" #>
34
<#@ output extension="\\" #>
45
<#
56
CustomT4Host host = (CustomT4Host) Host;
@@ -9,45 +10,110 @@
910
var entityTypes = model.GetEntityTypes();
1011
var enumTypes = model.GetEnumTypes();
1112
var complexTypes = model.GetComplexTypes();
13+
14+
var maxLineLength = 180;
1215
#>
13-
// Type definitions for the Microsoft Graph <VERSION_STRING>
14-
// Project: https://github.com/microsoftgraph/msgraph-typescript-typings
16+
// Type definitions for non-npm package microsoft-graph <VERSION_STRING>
1517
// Definitions by: Microsoft Graph Team <https://github.com/microsoftgraph>
1618
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
1719
// TypeScript Version: 2.1
1820

1921
export as namespace microsoftgraph;
2022

21-
<# foreach(var enumType in enumTypes) { #>
23+
<#
24+
foreach(var enumType in enumTypes) {
25+
#>
2226
export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValues() #>;
23-
<# } #>
2427
<#
25-
foreach(var entityType in entityTypes)
26-
{
27-
var methods = entityType.Methods;
28+
}
29+
30+
foreach(var entityType in entityTypes) {
31+
var propCount = entityType.Properties.ToList().Count;
32+
if(propCount == 0) {
33+
#>
34+
// tslint:disable-next-line: no-empty-interface
35+
<#
36+
}
37+
#>
38+
export interface <#= entityType.Name.UpperCaseFirstChar() #><#
39+
if (entityType.Base != null) {
40+
#>
41+
extends <#= entityType.Base.Name.UpperCaseFirstChar() #><#
42+
}
43+
#> {<#
44+
if(propCount == 0){
45+
#>}<#
46+
} else {
2847
#>
2948

30-
export interface <#= entityType.Name.UpperCaseFirstChar() #><# if (entityType.Base != null) { #> extends <#= entityType.Base.Name.UpperCaseFirstChar() #><# }#> {
31-
<# foreach(var prop in entityType.Properties.ToList()) { #>
32-
<# if (prop.LongDescription != null || prop.Description != null) { #>
33-
/** <#=prop.GetSanitizedLongDescription()#> */
34-
<# } #>
35-
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
36-
<# } #>
49+
<#
50+
foreach(var prop in entityType.Properties.ToList()) {
51+
if (prop.LongDescription != null || prop.Description != null) {
52+
List<string> multiLineDescriptions = Utils.splitString(prop.GetSanitizedLongDescription(), maxLineLength);
53+
#>
54+
/**
55+
<#
56+
foreach(var descriptionLine in multiLineDescriptions) {
57+
#>
58+
* <#= descriptionLine #>
59+
<#
60+
}
61+
#>
62+
*/
63+
<#
64+
}
65+
#>
66+
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
67+
<#
68+
}
69+
#>
3770
}
3871
<#
72+
}
3973
}
74+
75+
foreach(var complexType in complexTypes) {
76+
var propCount = complexType.Properties.Count;
77+
if(propCount == 0) {
78+
#>
79+
// tslint:disable-next-line: no-empty-interface
80+
<#
81+
}
82+
#>
83+
export interface <#= complexType.Name.UpperCaseFirstChar() #><#
84+
if (complexType.Base != null) {
85+
#>
86+
extends <#= complexType.Base.Name.UpperCaseFirstChar() #><#
87+
}
88+
#> {<#
89+
if(propCount == 0){
90+
#>}<#
91+
} else {
92+
#>
93+
94+
<#
95+
foreach(var prop in complexType.Properties) {
96+
if (prop.LongDescription != null || prop.Description != null) {
97+
List<string> multiLineDescriptions = Utils.splitString(prop.GetSanitizedLongDescription(), maxLineLength);
4098
#>
99+
/**
41100
<#
42-
foreach(var complexType in complexTypes)
43-
{
101+
foreach(var descriptionLine in multiLineDescriptions) {
102+
#>
103+
* <#= descriptionLine #>
104+
<#
105+
}
106+
#>
107+
*/
108+
<#
109+
}
110+
#>
111+
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
112+
<#
113+
}
44114
#>
45-
export interface <#= complexType.Name.UpperCaseFirstChar()#><# if (complexType.Base != null) { #> extends <#= complexType.Base.Name.UpperCaseFirstChar() #><# }#> {
46-
<# foreach(var prop in complexType.Properties) { #>
47-
<# if (prop.LongDescription != null || prop.Description != null) { #>
48-
/** <#=prop.GetSanitizedLongDescription()#> */
49-
<# } #>
50-
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
51-
<# } #>
52115
}
53-
<# } #>
116+
<#
117+
}
118+
}
119+
#>

0 commit comments

Comments
 (0)