diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 72f41374c4..744637820d 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -62,6 +62,9 @@ module.exports = {
},
],
+ // Sometimes we need to shush the TypeScript compiler
+ "no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
+
// Who cares about line length
"max-len": "off",
diff --git a/frontend/src/app/shared/components/project-include/project-list.component.ts b/frontend/src/app/shared/components/project-include/project-list.component.ts
index 009383fdcf..7ac3155370 100644
--- a/frontend/src/app/shared/components/project-include/project-list.component.ts
+++ b/frontend/src/app/shared/components/project-include/project-list.component.ts
@@ -27,7 +27,7 @@ export class OpProjectListComponent {
@Input() selected:string[] = [];
- @Input() query:string = '';
+ @Input() query = '';
public get currentProjectHref():string|null {
return this.currentProjectService.apiv3Path;
diff --git a/frontend/src/app/shared/directives/search-highlight.directive.ts b/frontend/src/app/shared/directives/search-highlight.directive.ts
index 31f6ed8e36..2e5d558a41 100644
--- a/frontend/src/app/shared/directives/search-highlight.directive.ts
+++ b/frontend/src/app/shared/directives/search-highlight.directive.ts
@@ -13,13 +13,14 @@ export class OpSearchHighlightDirective implements AfterViewChecked {
constructor(readonly elementRef:ElementRef) { }
- ngAfterViewChecked() {
+ ngAfterViewChecked():void {
if (!this.query) {
return;
}
+ const el = this.elementRef.nativeElement as HTMLElement;
- const textNode = Array.from(this.elementRef.nativeElement.childNodes).find((n:Node) => n.nodeType === n.TEXT_NODE) as Node|undefined;
+ const textNode = Array.from(el.childNodes).find((n:Node) => n.nodeType === n.TEXT_NODE) as Node;
const content = textNode?.textContent || '';
if (!content) {
return;
@@ -32,11 +33,11 @@ export class OpSearchHighlightDirective implements AfterViewChecked {
}
const start = content.slice(0, startIndex);
- const result = content.slice(startIndex, startIndex + query.length);
+ const result = content.slice(startIndex, startIndex + query.length);
const end = content.slice(startIndex + query.length);
const newNode = document.createElement('span');
newNode.innerHTML = `${start}${result}${end}`;
- this.elementRef.nativeElement.replaceChild(newNode, textNode);
+ el.replaceChild(newNode, textNode);
}
}
diff --git a/frontend/src/app/spot/components/checkbox/checkbox.component.ts b/frontend/src/app/spot/components/checkbox/checkbox.component.ts
index d641a35aa9..c7765cfd97 100644
--- a/frontend/src/app/spot/components/checkbox/checkbox.component.ts
+++ b/frontend/src/app/spot/components/checkbox/checkbox.component.ts
@@ -63,11 +63,11 @@ export class SpotCheckboxComponent implements ControlValueAccessor {
onTouched = (_:SpotCheckboxState):void => {};
- registerOnChange(fn:any):void {
+ registerOnChange(fn:(_:SpotCheckboxState) => void):void {
this.onChange = fn;
}
- registerOnTouched(fn:any):void {
+ registerOnTouched(fn:(_:SpotCheckboxState) => void):void {
this.onTouched = fn;
}
}
diff --git a/frontend/src/app/spot/components/chip-field/chip-field.component.ts b/frontend/src/app/spot/components/chip-field/chip-field.component.ts
index 0c72a467bb..758234a20c 100644
--- a/frontend/src/app/spot/components/chip-field/chip-field.component.ts
+++ b/frontend/src/app/spot/components/chip-field/chip-field.component.ts
@@ -88,11 +88,11 @@ export class SpotChipFieldComponent implements ControlValueAccessor {
onTouched = (_:string[]):void => {};
- registerOnChange(fn:any):void {
+ registerOnChange(fn:(_:string[]) => void):void {
this.onChange = fn;
}
- registerOnTouched(fn:any):void {
+ registerOnTouched(fn:(_:string[]) => void):void {
this.onTouched = fn;
}
}
diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
index a52ebe24b8..b6d05dd627 100644
--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
@@ -29,7 +29,7 @@ export class SpotDropModalComponent implements OnDestroy {
@Output() closed = new EventEmitter();
- @Input('alignment') public alignment:SpotDropModalAlignmentOption = SpotDropModalAlignmentOption.BottomLeft;
+ @Input() public alignment:SpotDropModalAlignmentOption = SpotDropModalAlignmentOption.BottomLeft;
@Input('open')
set open(value:boolean) {
@@ -80,7 +80,7 @@ export class SpotDropModalComponent implements OnDestroy {
document.body.removeEventListener('click', this.escapeListener);
}
- private closeEventListener = this.close.bind(this);
+ private closeEventListener = this.close.bind(this) as () => void;
private onEscape = (evt:KeyboardEvent) => {
if (evt.keyCode === KeyCodes.ESCAPE) {
@@ -88,5 +88,5 @@ export class SpotDropModalComponent implements OnDestroy {
}
};
- private escapeListener = this.onEscape.bind(this);
+ private escapeListener = this.onEscape.bind(this) as () => void;
}
diff --git a/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts b/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
index 528b7251da..3fabaf1089 100644
--- a/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
+++ b/frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
@@ -17,6 +17,7 @@ export class SpotFilterChipComponent {
@Input() removable = true;
@Input() title = '';
+
@Input() icon = '';
@Output() remove = new EventEmitter();
@@ -25,11 +26,11 @@ export class SpotFilterChipComponent {
remove: this.i18n.t('js.spot.filter_chip.remove'),
};
- public get iconClasses() {
+ public get iconClasses():string[] {
return [
'spot-icon',
`spot-icon_${this.icon}`,
- ];
+ ];
}
constructor(readonly i18n:I18nService) {}
diff --git a/frontend/src/app/spot/components/text-field/text-field.component.ts b/frontend/src/app/spot/components/text-field/text-field.component.ts
index 9ffecb5abb..bf5a41ad05 100644
--- a/frontend/src/app/spot/components/text-field/text-field.component.ts
+++ b/frontend/src/app/spot/components/text-field/text-field.component.ts
@@ -53,11 +53,11 @@ export class SpotTextFieldComponent implements ControlValueAccessor {
onTouched = (_:string):void => {};
- registerOnChange(fn:any):void {
+ registerOnChange(fn:(_:string) => void):void {
this.onChange = fn;
}
- registerOnTouched(fn:any):void {
+ registerOnTouched(fn:(_:string) => void):void {
this.onTouched = fn;
}
}
diff --git a/frontend/src/app/spot/components/toggle/toggle.component.ts b/frontend/src/app/spot/components/toggle/toggle.component.ts
index 907b41993f..38823f76f3 100644
--- a/frontend/src/app/spot/components/toggle/toggle.component.ts
+++ b/frontend/src/app/spot/components/toggle/toggle.component.ts
@@ -51,11 +51,11 @@ export class SpotToggleComponent implements ControlValueAccessor {
onTouched = (_:T):void => {};
- registerOnChange(fn:any):void {
+ registerOnChange(fn:(_:T) => void):void {
this.onChange = fn;
}
- registerOnTouched(fn:any):void {
+ registerOnTouched(fn:(_:T) => void):void {
this.onTouched = fn;
}
}
diff --git a/frontend/src/app/spot/icon-font/generate.js b/frontend/src/app/spot/icon-font/generate.js
index 7ab418bd93..e5008228d4 100644
--- a/frontend/src/app/spot/icon-font/generate.js
+++ b/frontend/src/app/spot/icon-font/generate.js
@@ -2,7 +2,6 @@
const webfontsGenerator = require('webfonts-generator');
const path = require('path');
-const fs = require('fs');
const glob = require("glob")
const TEMPLATE_DIR = path.resolve(process.argv[2]);