Fix linting errors

pull/10200/head
Benjamin Bädorf 3 years ago
parent 0c67a5b821
commit 51dbe6d6c4
No known key found for this signature in database
GPG Key ID: 069CA2D117AB5CCF
  1. 3
      frontend/.eslintrc.js
  2. 2
      frontend/src/app/shared/components/project-include/project-list.component.ts
  3. 9
      frontend/src/app/shared/directives/search-highlight.directive.ts
  4. 4
      frontend/src/app/spot/components/checkbox/checkbox.component.ts
  5. 4
      frontend/src/app/spot/components/chip-field/chip-field.component.ts
  6. 6
      frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
  7. 5
      frontend/src/app/spot/components/filter-chip/filter-chip.component.ts
  8. 4
      frontend/src/app/spot/components/text-field/text-field.component.ts
  9. 4
      frontend/src/app/spot/components/toggle/toggle.component.ts
  10. 1
      frontend/src/app/spot/icon-font/generate.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",

@ -27,7 +27,7 @@ export class OpProjectListComponent {
@Input() selected:string[] = [];
@Input() query:string = '';
@Input() query = '';
public get currentProjectHref():string|null {
return this.currentProjectService.apiv3Path;

@ -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}<span class="op-search-highlight">${result}</span>${end}`;
this.elementRef.nativeElement.replaceChild(newNode, textNode);
el.replaceChild(newNode, textNode);
}
}

@ -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;
}
}

@ -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;
}
}

@ -29,7 +29,7 @@ export class SpotDropModalComponent implements OnDestroy {
@Output() closed = new EventEmitter<void>();
@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;
}

@ -17,6 +17,7 @@ export class SpotFilterChipComponent {
@Input() removable = true;
@Input() title = '';
@Input() icon = '';
@Output() remove = new EventEmitter<void>();
@ -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) {}

@ -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;
}
}

@ -51,11 +51,11 @@ export class SpotToggleComponent<T> 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;
}
}

@ -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]);

Loading…
Cancel
Save