fix eslint

This commit is contained in:
mProjectsCode 2022-11-29 19:45:55 +01:00
parent f5b9020dc8
commit 48bef13e4d
25 changed files with 126 additions and 149 deletions

View file

@ -40,6 +40,7 @@ export class PropertyMapper {
// @ts-ignore
newObj[propertyMapping.newProperty] = value;
} else if (propertyMapping.mapping === PropertyMappingOption.Remove) {
// do nothing
} else if (propertyMapping.mapping === PropertyMappingOption.Default) {
// @ts-ignore
newObj[key] = value;

View file

@ -85,7 +85,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
export const lockedPropertyMappings: string[] = ['type', 'id', 'dataSource'];
export function getDefaultSettings(plugin: MediaDbPlugin): MediaDbPluginSettings {
let defaultSettings = DEFAULT_SETTINGS;
const defaultSettings = DEFAULT_SETTINGS;
// construct property mapping defaults
const propertyMappingModels: PropertyMappingModel[] = [];
@ -406,7 +406,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
containerEl.createEl('h3', { text: 'Property Mappings' });
let propertyMappingExplanation = containerEl.createEl('div');
const propertyMappingExplanation = containerEl.createEl('div');
propertyMappingExplanation.innerHTML = `
<p>Allow you to remap the metadata fields of newly created media db entries.</p>
<p>
@ -425,8 +425,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
target: this.containerEl,
props: {
models: this.plugin.settings.propertyMappingModels.map(x => x.copy()),
save: (model: PropertyMappingModel) => {
let propertyMappingModels: PropertyMappingModel[] = [];
save: (model: PropertyMappingModel): void => {
const propertyMappingModels: PropertyMappingModel[] = [];
for (const model2 of this.plugin.settings.propertyMappingModels) {
if (model2.type === model.type) {

View file

@ -53,7 +53,7 @@ export class Suggest<T> {
this.setSelectedItem(item, false);
}
setSuggestions(values: T[]) {
setSuggestions(values: T[]): void {
this.containerEl.empty();
const suggestionEls: HTMLDivElement[] = [];
@ -68,14 +68,14 @@ export class Suggest<T> {
this.setSelectedItem(0, false);
}
useSelectedItem(event: MouseEvent | KeyboardEvent) {
useSelectedItem(event: MouseEvent | KeyboardEvent): void {
const currentValue = this.values[this.selectedItem];
if (currentValue) {
this.owner.selectSuggestion(currentValue, event);
}
}
setSelectedItem(selectedIndex: number, scrollIntoView: boolean) {
setSelectedItem(selectedIndex: number, scrollIntoView: boolean): void {
const normalizedIndex = this.suggestions.length > 0 ? wrapAround(selectedIndex, this.suggestions.length) : 0;
const prevSelectedSuggestion = this.suggestions[this.selectedItem];
const selectedSuggestion = this.suggestions[normalizedIndex];
@ -141,7 +141,7 @@ export abstract class TextInputSuggest<T> implements ISuggestOwner<T> {
{
name: 'sameWidth',
enabled: true,
fn: ({ state, instance }) => {
fn: ({ state, instance }): void => {
// Note: positioning needs to be calculated twice -
// first pass - positioning it according to the width of the popper
// second pass - position it with the width bound to the reference element