Commit cdb9ee0c authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Fixed linting issues with libview

parent 180abd85583f
......@@ -262,7 +262,7 @@ export interface RenderingOptions {
/**
* The rendering options per target
*/
[target: string]: TargetRenderingOptions;
[target: string]: TargetRenderingOptions | undefined;
}
/**
......
......@@ -204,11 +204,11 @@ export class RdfEntityStore {
/**
* The map of known aliases
*/
private aliases: { [uri: string]: string[] };
private aliases: { [uri: string]: string[] | undefined };
/**
* The inverse relations
*/
private inverses: { [uri: string]: string };
private inverses: { [uri: string]: string | undefined };
/**
* Initializes this store
......@@ -286,7 +286,7 @@ export class RdfEntityStore {
let self = this;
relation.uris.forEach((uri: string) => {
let inverse = self.inverses[uri];
if (inverse) {
if (inverse !== undefined) {
let inverseEntity = self.entityForUri(inverse);
if (result.indexOf(inverseEntity) < 0) {
result.push(inverseEntity);
......@@ -360,7 +360,7 @@ export class RdfEntityStore {
.forEach(onNamedNode);
// look for registered aliases for this uri
let registeredAliases = this.aliases[uris[i]];
if (registeredAliases) {
if (registeredAliases !== undefined) {
registeredAliases.forEach(onUri);
}
// look for equivalent URIs
......
......@@ -183,7 +183,7 @@ export class MetaPropertyData implements MetaProperty {
return { literal: literal, rank: l } as RankedLiteral;
}
}
if (!literal.lang || literal.lang === "") {
if (literal.lang === "") {
// lang-tag is not defined, has more priority than other tagged literals that do not match (considered as a default)
return {
literal: literal,
......
......@@ -94,7 +94,7 @@ export interface ViewDescriptor {
* A repository of view descriptors
*/
export interface ViewDescriptors {
[id: string]: ViewDescriptor;
[id: string]: ViewDescriptor | undefined;
}
/**
......
......@@ -231,9 +231,7 @@ class ViewRendererImpl implements CachingViewRenderer {
if (options && options.language) {
result.push(options.language);
}
if (context.browserLanguage) {
result.push(context.browserLanguage);
}
result.push(context.browserLanguage);
return result;
}
......@@ -250,7 +248,7 @@ class ViewRendererImpl implements CachingViewRenderer {
target
);
let options = context.options[target.uri];
if (options && options.view) {
if (options && options.view !== undefined) {
// try to use the forced view
view = this.implementations[options.view];
}
......@@ -296,13 +294,15 @@ class ViewRendererImpl implements CachingViewRenderer {
let toAdd: ViewDescriptor[] = [];
Object.keys(registry.descriptors).forEach((id: string) => {
let candidate = self.descriptors[id];
if (candidate) {
toAdd.push(registry.descriptors[id]);
let newDescriptor = registry.descriptors[id];
if (candidate === undefined && newDescriptor !== undefined) {
toAdd.push(newDescriptor);
}
});
Object.keys(self.descriptors).forEach((id: string) => {
let candidate = registry.descriptors[id];
if (candidate) {
let current = self.descriptors[id];
let newDescriptor = registry.descriptors[id];
if (current !== undefined && newDescriptor === undefined) {
// has been deleted
delete self.descriptors[id];
delete self.implementations[id];
......
......@@ -72,6 +72,7 @@
"quotemark": [true, "double", "avoid-escape", "jsx-double"],
"semicolon": [true, "always"],
"strict-type-predicates": true,
"strict-boolean-expressions": [true, "allow-undefined-union"],
"space-before-function-paren": [true, "never"],
"unified-signatures": true,
"variable-name": [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment