Skip to content

Commit

Permalink
chore(frontend): fixed eslint import
Browse files Browse the repository at this point in the history
- used autofix to fix some of the issues
- fixed automatixc sorting in vscode
  • Loading branch information
myst committed May 30, 2024
1 parent 88da68a commit 5f4a5ef
Show file tree
Hide file tree
Showing 39 changed files with 90 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"typescript.preferences.importModuleSpecifier": "non-relative",
"editor.codeActionsOnSave": {
"source.organizeImports": "always",
"source.fixAll": "explicit",
"source.removeUnusedImports": "explicit"
},
"editor.formatOnSave": true
}
}
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint"
"lint": "ng lint",
"lint:fix": "ng lint --fix"
},
"private": true,
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, HostListener } from '@angular/core';

import { ServerConfigService } from './shared/server-config.service';
import { WindowService } from './shared/window.service';

Expand Down
9 changes: 5 additions & 4 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CookieService } from 'ngx-cookie-service';
import { AppComponent } from './app.component';
import { WINDOW_PROVIDERS } from './shared/WINDOW_PROVIDERS';
import { PrimeModule } from './shared/prime.module';
// import { ServiceWorkerModule } from '@angular/service-worker';
// import { environment } from '../environments/environment';
import { CoreModule } from '@mudlet3/frontend/core';
import { GmcpModule } from '@mudlet3/frontend/features/gmcp';
import { MudconfigModule } from '@mudlet3/frontend/features/mudconfig';
import { SettingsModule } from '@mudlet3/frontend/features/settings';
import { WidgetsModule } from '@mudlet3/frontend/features/widgets';
import { CookieService } from 'ngx-cookie-service';
import { SharedModule } from 'primeng/api';

import { AppComponent } from './app.component';
import { MudConfigService } from './features/config/mud-config.service';
import { ModelessModule } from './features/modeless/modeless.module';
import { PrimeModule } from './shared/prime.module';
import { WINDOW_PROVIDERS } from './shared/WINDOW_PROVIDERS';

/* eslint @typescript-eslint/ban-types: "warn" */
export function setupAppConfigServiceFactory(
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/core/core.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NgModule } from '@angular/core';

import { MenuModule } from './menu/menu.module';
import { MudModule } from './mud/mud.module';

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/app/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
export { MenuService } from './menu/menu.service';

/* Mud Core Module */
export { MudModule } from './mud/mud.module';

export { CoreModule } from './core.module';
export { MudModule } from './mud/mud.module';
1 change: 1 addition & 0 deletions frontend/src/app/core/menu/menu.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { PrimeModule } from '@mudlet3/frontend/shared';

import { MudmenuComponent } from './mud-menu/mud-menu.component';

@NgModule({
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/core/menu/menu.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EventEmitter, Injectable, Output } from '@angular/core';
import { MenuItem, MenuItemCommandEvent } from 'primeng/api';
import { BehaviorSubject, Observable } from 'rxjs';

import { MudService } from '../../core/mud/mud.service';
import { MenuState, MenuType } from './types/menu-state';

Expand Down Expand Up @@ -41,15 +42,15 @@ export class MenuService {
id: 'MUD:CONNECT',
label: 'Verbinden',
icon: 'pi pi-sign-in',
command: (event: MenuItemCommandEvent) => this.connectClicked.emit(event),
command: (event: MenuItemCommandEvent) => { this.connectClicked.emit(event); },
};

const disconnectItem: MenuItem = {
id: 'MUD:DISCONNECT',
label: 'Trennen',
icon: 'pi pi-sign-out',
command: (event: MenuItemCommandEvent) =>
this.disconnectClicked.emit(event),
{ this.disconnectClicked.emit(event); },
};

const items: MenuItem[] = [
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/core/menu/mud-menu/mud-menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, EventEmitter, Output } from '@angular/core';
import { MenuItemCommandEvent } from 'primeng/api';
import { Observable } from 'rxjs';

import { MenuService } from '../menu.service';
import { MenuState } from '../types/menu-state';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ViewChild,
} from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';

import { IMudMessage } from '../../types/mud-message';

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, Input } from '@angular/core';
import { BehaviorSubject, Observable, map, startWith } from 'rxjs';
import { BehaviorSubject, map, Observable, startWith } from 'rxjs';

import { IMudMessage } from '../../types/mud-message';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
KeypadData,
WindowConfig,
} from '@mudlet3/frontend/shared';

import { Observable } from 'rxjs';

import { MudService } from '../mud.service';
import { IMudMessage } from '../types/mud-message';
import { tableOutput } from '../utils/table-output';
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/core/mud/mud.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { WidgetsModule } from '@mudlet3/frontend/features/widgets';
import { PrimeModule } from '@mudlet3/frontend/shared';

import { MenuModule } from '../menu/menu.module';
import { MudInputComponent } from './components/mud-input/mud-input.component';
import { MudOutputComponent } from './components/mud-output/mud-output.component';
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/core/mud/mud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IoMud, SocketsService } from '@mudlet3/frontend/features/sockets';
import { wordWrap } from '@mudlet3/frontend/shared';
import { BehaviorSubject, Observable } from 'rxjs';
import { IMudMessage } from 'src/app/core/mud/types/mud-message';

import { mudProcessData } from './utils/mud-process-data';

@Injectable({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/features/ansi/utils/process-ansi-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IAnsiData } from '@mudlet3/frontend/features/ansi';
import { WithRequired } from '@mudlet3/frontend/shared';

import { processAnsiSequences } from './process-ansi-sequences';

function isAnsiDataWithText(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FormatData } from 'src/app/features/ansi/types/format-data';

import { processAnsiCodes } from './process-ansi-codes';

/**
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/config/mud-config.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import { IMudConfig } from './types/mud-config';

import { DefaultWebmudConfig } from './models/default-webmud-config';
import config from './models/mud_config.json';
import { IMudConfig } from './types/mud-config';
import { IWebmudConfig } from './types/webmud-config';

@Injectable({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/gmcp/gmcp.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

@NgModule({
imports: [CommonModule],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/features/gmcp/gmcp.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EventEmitter, Injectable } from '@angular/core';
import { Observable } from 'rxjs';

import { UnitopiaService } from '../mudconfig/unitopia.service';
import { GmcpConfig } from './gmcp-config';
import { GmcpMenu } from './gmcp-menu';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/features/gmcp/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { GmcpService } from './gmcp.service';
export { GmcpModule } from './gmcp.module';
export { GmcpModule } from './gmcp.module';
export { GmcpService } from './gmcp.service';
11 changes: 5 additions & 6 deletions frontend/src/app/features/modeless/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ import {
Output,
ViewChild,
} from '@angular/core';
import {
ConfirmationService,
MenuItem,
MenuItemCommandEvent,
} from 'primeng/api';

import {
FileInfo,
WindowConfig,
WindowService,
} from '@mudlet3/frontend/shared';
import * as ace from 'ace-builds';
import { CookieService } from 'ngx-cookie-service';
import {
ConfirmationService,
MenuItem,
MenuItemCommandEvent,
} from 'primeng/api';

const ithemes: string[] = [
'ambiance',
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/app/features/modeless/modeless.module.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ResizableDraggableComponent } from './resizable-draggable/resizable-draggable.component';
import { FlexibleAreaComponent } from './flexible-area/flexible-area.component';
import { WindowComponent } from './window/window.component';
import { PrimeModule } from '@mudlet3/frontend/shared';

import { CharStatComponent } from './char-stat/char-stat.component';
import { DirlistComponent } from './dirlist/dirlist.component';
import { EditorComponent } from './editor/editor.component';
import { FlexibleAreaComponent } from './flexible-area/flexible-area.component';
import { KeyoneComponent } from './keyone/keyone.component';
import { KeypadComponent } from './keypad/keypad.component';
import { KeypadConfigComponent } from './keypad-config/keypad-config.component';
import { KeyoneComponent } from './keyone/keyone.component';
import { CharStatComponent } from './char-stat/char-stat.component';
import { PrimeModule } from '@mudlet3/frontend/shared';
import { ResizableDraggableComponent } from './resizable-draggable/resizable-draggable.component';
import { WindowComponent } from './window/window.component';

@NgModule({
declarations: [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/mudconfig/mudconfig.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

@NgModule({
imports: [CommonModule],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/features/mudconfig/unitopia.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';

import { GmcpConfig } from '../gmcp/gmcp-config';
import { GmcpMenu } from '../gmcp/gmcp-menu';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { WindowConfig } from '@mudlet3/frontend/shared';

import * as ace from 'ace-builds';

@Component({
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/features/settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { SettingsModule } from './settings.module';
export { ColorSettingsComponent } from './color-settings/color-settings.component';
export { ColorSettingsComponent } from './color-settings/color-settings.component';
export { SettingsModule } from './settings.module';
2 changes: 2 additions & 0 deletions frontend/src/app/features/settings/settings.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { PrimeModule } from '@mudlet3/frontend/shared';

import { ColorSettingsComponent } from './color-settings/color-settings.component';
import { EditorSearchComponent } from './editor-search/editor-search.component';

Expand All @@ -11,4 +12,5 @@ import { EditorSearchComponent } from './editor-search/editor-search.component';
imports: [CommonModule, BrowserModule, FormsModule, PrimeModule],
exports: [ColorSettingsComponent, EditorSearchComponent],
})
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class SettingsModule {}
13 changes: 7 additions & 6 deletions frontend/src/app/features/sockets/io-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Manager } from 'socket.io-client';

import { IoPlatform } from './io-platform';
import { IoSocket } from './io-socket';

Expand Down Expand Up @@ -66,7 +67,7 @@ export class IoManager {
return;
}
Object.values(other.socketList).forEach((sock: IoSocket) => {
if (typeof sock !== 'undefined' && sock != null) {
if (typeof sock !== 'undefined') {
sock.send2AllMuds(msg, action);
} else {
console.trace('send2AllMuds with empty sock', action, msg);
Expand All @@ -75,15 +76,15 @@ export class IoManager {
}

public reportId(type: string, id: string, ob: any) {
if (type == 'IoSocket') {
if (type === 'IoSocket') {
this.socketList[id] = ob;
}
this.uplink.reportId(type, id, ob);
}

public getIdObject(type: string): IoSocket | this | IoPlatform | IoManager {
if (type == 'IoManager') {
return this;
public getIdObject(type: string): IoSocket | IoManager | IoPlatform {
if (type === 'IoManager') {
return this as IoManager;
}
return this.uplink.getIdObject(type);
}
Expand All @@ -92,7 +93,7 @@ export class IoManager {
if (typeof this.serverID === 'undefined') {
this.serverID = id;
this.reportId('IoSocket', this.serverID, this);
} else if (this.serverID != id) {
} else if (this.serverID !== id) {
console.warn('serverID-Change', this.serverID, id);
this.reportId('IoManager', this.serverID, null);
this.serverID = id;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/features/sockets/io-mud.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MudConfig } from '@mudlet3/frontend/features/mudconfig';
import { FileInfo, MudSignals } from '@mudlet3/frontend/shared';
import { Observer } from 'rxjs';
import { OneKeypadData } from '../../shared/keypad-data';

import { MudConfig } from '@mudlet3/frontend/features/mudconfig';
import { OneKeypadData } from '../../shared/keypad-data';
import { IoManager } from './io-manager';
import { IoPlatform } from './io-platform';
import { IoSocket } from './io-socket';
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/app/features/sockets/io-platform.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { GmcpService } from '@mudlet3/frontend/features/gmcp';

import { ServerConfigService } from '../../shared/server-config.service';
import { IoManager } from './io-manager';
import { IoMud } from './io-mud';
import { IoSocket } from './io-socket';

export class IoPlatform {
private idLookup: Record<string, IoMud | IoSocket | IoManager | IoPlatform> =
{};
private idLookup: Record<string, IoMud | IoSocket | IoManager | this> = {};
private managerList: Record<string, IoManager> = {};
constructor(
public srvcfg: ServerConfigService,
public gmcpsrv: GmcpService,
) {}
public reportId(type: string, id: string, ob: any) {
if (type == 'IoManager') {
if (type === 'IoManager') {
this.managerList[id] = ob;
}
if (ob == null) {
if (ob === null) {
delete this.idLookup[type + ':' + id];
}
this.idLookup[type + ':' + id] = ob;
Expand Down
Loading

0 comments on commit 5f4a5ef

Please sign in to comment.