fix: apply stricter tslint rules

This commit is contained in:
Michel Jonathan Schmitz
2019-06-07 11:36:24 +02:00
parent 38a5bfed52
commit 967f946527
2 changed files with 5 additions and 5 deletions

View File

@@ -105,7 +105,7 @@ export async function createDiagramFromString(
response = await request(url); response = await request(url);
const httpOK = 200; const httpOK = 200;
if (response.statusCode !== httpOK) { if (response.statusCode !== httpOK) {
Logger.error(`Plantuml Server responded with an error.\n${response.statusMessage}`); await Logger.error(`Plantuml Server responded with an error.\n${response.statusMessage}`);
throw new Error('Response not okay'); throw new Error('Response not okay');
} }
} catch (e) { } catch (e) {

View File

@@ -93,7 +93,7 @@ export function readAsEnumDefinition(
); );
// get enum values according to type // get enum values according to type
if (declaration.kindString === 'Enumeration' && declaration.children) { if (declaration.kindString === 'Enumeration' && typeof declaration.children !== 'undefined') {
// standard enumeration // standard enumeration
for (const child of declaration.children) { for (const child of declaration.children) {
if (child.kindString === 'Enumeration member') { if (child.kindString === 'Enumeration member') {
@@ -154,7 +154,7 @@ function getTypeInformation(type: LightweightType): string[] {
export function readAsClassDefinition( export function readAsClassDefinition(
declaration: DeclarationReflection, declaration: DeclarationReflection,
): LightweightClassDefinition { ): LightweightClassDefinition {
let type = declaration.kindString ? declaration.kindString.toLowerCase() : ''; let type = typeof declaration.kindString !== 'undefined' ? declaration.kindString.toLowerCase() : '';
type = (declaration.flags.isAbstract ? 'abstract ' : '') + type; type = (declaration.flags.isAbstract ? 'abstract ' : '') + type;
const classDefinition: LightweightClassDefinition = new LightweightClassDefinition( const classDefinition: LightweightClassDefinition = new LightweightClassDefinition(
@@ -314,7 +314,7 @@ function readAsReferenceType(type: ReferenceType): LightweightType {
const tempTypeReflection = type.reflection as DeclarationReflection; const tempTypeReflection = type.reflection as DeclarationReflection;
// interfaces and classes in a type are a sink, since their declaration are defined elsewhere // interfaces and classes in a type are a sink, since their declaration are defined elsewhere
if ( if (
tempTypeReflection.kindString && typeof tempTypeReflection.kindString !== 'undefined' &&
['Interface', 'Class', 'Enumeration', 'Type alias'].indexOf( ['Interface', 'Class', 'Enumeration', 'Type alias'].indexOf(
tempTypeReflection.kindString, tempTypeReflection.kindString,
) > -1 ) > -1
@@ -383,7 +383,7 @@ function readAsUnionType(type: UnionType): LightweightType {
*/ */
function readAsReflectionType(type: ReflectionType): LightweightType { function readAsReflectionType(type: ReflectionType): LightweightType {
const returnType: LightweightType = new LightweightType(); const returnType: LightweightType = new LightweightType();
if (type.declaration.sources) { if (typeof type.declaration.sources !== 'undefined') {
const src = type.declaration.sources[0]; const src = type.declaration.sources[0];
Logger.warn( Logger.warn(
`${src.line} : ${src.fileName}: Reflection Type not recognized. Refactoring to explicit class is advised.`, `${src.line} : ${src.fileName}: Reflection Type not recognized. Refactoring to explicit class is advised.`,