Skip to content

Commit

Permalink
Merge pull request #11 from myonara/v5_1_linting
Browse files Browse the repository at this point in the history
V0.5 1 linting
  • Loading branch information
myonara authored Nov 9, 2023
2 parents 4f26872 + abf0ef1 commit 1bf0b48
Show file tree
Hide file tree
Showing 33 changed files with 294 additions and 192 deletions.
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ RUN echo https://alpine.mirror.wearetriple.com/v3.16/main > /etc/apk/repositorie
# ... install them together with angular-cli, prequisite git included.
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh \
&& npm install --location=global @angular/cli \
&& npm install --location=global @angular/cli@16.2.9 \
&& npm install

# fetch the angular sources and stuff
COPY ./UI16/ /app/

# exchange webmud3 in baseref webmud3\UI8\src\index.html
# RUN sed -i 's-%%BASEREF%%-/-' /app/src/index.html

# ok may be we have to do more with the environment...
ARG configuration=production

Expand All @@ -40,14 +37,6 @@ COPY ./backend/ /app/
#fetch the angular distribution for serving from node.js
COPY --from=ng-build-stage /app/dist/out/ /app/dist/

# mkdir runs OLD
# RUN mkdir /run/secrets \
# && mkdir /run/db \
# && npm install --only=prod \
# && chown -R node:node /app

# USER node:node

# mkdir runs
RUN mkdir /run/secrets \
&& mkdir /run/db \
Expand Down
4 changes: 3 additions & 1 deletion LINKS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ https://stackoverflow.com/questions/38112891/angular-2-set-base-href-dynamically
/* eslint @typescript-eslint/no-this-alias: "warn" */
/* Object.prototype.hasOwnProperty.call(gmcp_support, element) */
/* eslint @typescript-eslint/ban-types: "warn" */
/* eslint @typescript-eslint/no-empty-function: "warn" */
/* eslint @typescript-eslint/no-empty-function: "warn" */

(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
3 changes: 1 addition & 2 deletions UI16/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility"
],
"rules": {
}
"rules": {}
}
]
}
6 changes: 3 additions & 3 deletions UI16/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.5.0",
"scripts": {
"format": "prettier --write \"src/**/*.ts\"",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"no-prepare": "npm run build",
"no-prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags",
Expand Down Expand Up @@ -63,4 +63,4 @@
"tslint": "~6.1.0",
"typescript": "~4.9.5"
}
}
}
9 changes: 6 additions & 3 deletions UI16/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ const standardRoutes: Routes = [{ path: '**', redirectTo: '/' }];
let count = 0;
let rootFlag = false;
Object.keys(mroutes).forEach((key: string) => {
if (Object.prototype.hasOwnProperty.call(mroutes, key) && key.startsWith('/')) {
if (
Object.prototype.hasOwnProperty.call(mroutes, key) &&
key.startsWith('/')
) {
const path = key.substring(1);
let component: any = undefined;
switch (mroutes[key]) {
Expand Down Expand Up @@ -80,8 +83,8 @@ const standardRoutes: Routes = [{ path: '**', redirectTo: '/' }];
if (!rootFlag) {
console.error('No root node!');
}
if (count==0) {
console.error("no routes");
if (count == 0) {
console.error('no routes');
}
return [...routes, ...standardRoutes];
},
Expand Down
1 change: 0 additions & 1 deletion UI16/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { ModelessModule } from './modeless/modeless.module';
// import { environment } from '../environments/environment';
import { MudConfigService } from './mud-config.service';
import { getBaseLocation } from './app-common-functions';

/* eslint @typescript-eslint/ban-types: "warn" */
export function setupAppConfigServiceFactory(
service: MudConfigService,
Expand Down
2 changes: 1 addition & 1 deletion UI16/src/app/gmcp/gmcp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GmcpService {
}
return -1;
}
/* eslint @typescript-eslint/no-this-alias: "warn" */
/* eslint @typescript-eslint/no-this-alias: "warn" */
public menuAction(actual_menu: GmcpMenu) {
console.debug('GmcpService-menuAction', actual_menu);
const mud_id = actual_menu.cfg.mud_id;
Expand Down
4 changes: 1 addition & 3 deletions UI16/src/app/menu/main-menu/main-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ import { Component, OnInit } from '@angular/core';
templateUrl: './main-menu.component.html',
styleUrls: ['./main-menu.component.scss'],
})
export class MainMenuComponent {

}
export class MainMenuComponent {}
29 changes: 23 additions & 6 deletions UI16/src/app/menu/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { MenuItem } from 'primeng/api';
import { MenuType, OneMenu } from './one-menu';

/* eslint @typescript-eslint/ban-types: "warn" */
/* eslint @typescript-eslint/ban-types: "warn" */
@Injectable({
providedIn: 'root',
})
Expand Down Expand Up @@ -51,30 +51,47 @@ export class MenuService {
command: this.all_menus[menuID].executer,
};
if (submenu <= 0) {
if (!Object.prototype.hasOwnProperty.call(this.all_menus[menuID], 'items')) {
if (
!Object.prototype.hasOwnProperty.call(this.all_menus[menuID], 'items')
) {
this.all_menus[menuID].items = [];
}
this.all_menus[menuID].items.push(myItem);
return true;
}
if (!Object.prototype.hasOwnProperty.call(this.all_menus[menuID], 'items')) {
if (
!Object.prototype.hasOwnProperty.call(this.all_menus[menuID], 'items')
) {
return false; // no previous element to insert to.
}
const ix1 = this.all_menus[menuID].items.length - 1;
if (submenu == 1) {
if (!Object.prototype.hasOwnProperty.call(this.all_menus[menuID].items[ix1], 'items')) {
if (
!Object.prototype.hasOwnProperty.call(
this.all_menus[menuID].items[ix1],
'items',
)
) {
this.all_menus[menuID].items[ix1].items = [];
}
this.all_menus[menuID].items[ix1].items.push(myItem);
return true;
}
if (!Object.prototype.hasOwnProperty.call(this.all_menus[menuID].items[ix1], 'items')) {
if (
!Object.prototype.hasOwnProperty.call(
this.all_menus[menuID].items[ix1],
'items',
)
) {
return false; // no previous element on level 1 to insert to
}
const ix2 = this.all_menus[menuID].items[ix1].items.length;
if (submenu == 2) {
if (
!Object.prototype.hasOwnProperty.call(this.all_menus[menuID].items[ix1].items[ix2], 'items')
!Object.prototype.hasOwnProperty.call(
this.all_menus[menuID].items[ix1].items[ix2],
'items',
)
) {
this.all_menus[menuID].items[ix1].items[ix2].items = [];
}
Expand Down
2 changes: 1 addition & 1 deletion UI16/src/app/menu/one-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class OneMenu {
menuType: MenuType = MenuType.OTHER;
menuID: string;
items: MenuItem[] = [];
/* eslint @typescript-eslint/ban-types: "warn" */
/* eslint @typescript-eslint/ban-types: "warn" */
executer: Function;
constructor(type: MenuType, id: string, callback: Function) {
this.menuType = type;
Expand Down
6 changes: 3 additions & 3 deletions UI16/src/app/modeless/dirlist/dirlist.component.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<div class="noselect">
<div><b>{{path}}</b></div>
<table>
<ng-container *ngFor="let entry of entries">
<ng-container *ngFor="let entry of entries; index as i">
<tr *ngIf="entry.isdir===0">
<td><a (keydown)="fileOpen(entry.name)" tabindex="0">{{entry.name}}</a></td>
<td><a (click)="fileOpen(entry.name)" (keypress)="fileOpen(entry.name,$event)" [tabindex]="i">{{entry.name}}</a></td>
<td>{{entry.size}}</td>
<td>{{entry.filedate}}</td>
<td>{{entry.filetime}}</td>
</tr>
<tr *ngIf="entry.isdir!==0">
<td><a (keydown)="changeDir(entry.name)" tabindex="0">{{entry.name}}/</a></td>
<td><a (click)="changeDir(entry.name)" (keypress)="changeDir(entry.name,$event)" [tabindex]="i">{{entry.name}}/</a></td>
<td></td>
<td>{{entry.filedate}}</td>
<td>{{entry.filetime}}</td>
Expand Down
4 changes: 2 additions & 2 deletions UI16/src/app/modeless/dirlist/dirlist.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export class DirlistComponent implements OnInit {
this.entries = this.musi.entries;
console.debug('DirlistComponent-updateDirList', this.path);
}
fileOpen(file: string) {
fileOpen(file: string, event = undefined) {
this.config.outGoingEvents.next('FileOpen:' + this.path + ':' + file);
}
changeDir(dir: string) {
changeDir(dir: string, event = undefined) {
this.config.outGoingEvents.next('ChangeDir:' + this.path + ':' + dir);
}
ngOnInit(): void {
Expand Down
14 changes: 11 additions & 3 deletions UI16/src/app/modeless/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,18 @@ export class EditorComponent implements OnInit, AfterViewInit {
}
onSave(event: any, closeable: boolean) {
if (this.readonly) return;
if (typeof this.aceEditor === 'undefined') return;
const itext = this.aceEditor.getValue();
// console.log("save-text", itext);
this.fileinfo.content = itext;
this.fileinfo.closable = closeable;
this.fileinfo.save01_start(this.fileinfo.file);
this.config.outGoingEvents.next('Save:' + closeable);
}

/* eslint @typescript-eslint/no-this-alias: "warn" */
onCancel(event) {
if (typeof this.aceEditor === 'undefined') return;
const other = this;
if (this.text == this.aceEditor.getValue()) {
other.config.outGoingEvents.next('Cancel:');
Expand Down Expand Up @@ -153,13 +155,19 @@ export class EditorComponent implements OnInit, AfterViewInit {
}
}
private updateMyStyle(twidth, theight) {
if (typeof this.aceEditor === 'undefined') return;
//this.cwidth = twidth;
//this.cheight = theight;
this.aceEditor.resize(true);
this.aceEditor.renderer.updateFull();
}

public changeTheme() {
if (
typeof this.aceEditor === 'undefined' ||
typeof this.currentTheme === 'undefined'
)
return;
this.aceEditor.setTheme('ace/theme/' + this.currentTheme.code);
this.cookieService.set('editortheme', this.currentTheme.code);
}
Expand Down Expand Up @@ -245,7 +253,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
break;
case 'saved:false':
case 'saved:true':
other.text = this.aceEditor.getValue();
other.text = other.aceEditor.getValue();
other._config.data['content'] = other.text;
break;
}
Expand All @@ -269,7 +277,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
}
this.aceEditor.setAutoScrollEditorIntoView(true);
let themeNow = this.cookieService.get('editortheme');
if (themeNow == '') {
if (themeNow === '') {
themeNow = 'twilight';
}
this.aceEditor.setTheme('ace/theme/' + themeNow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ import { Component, OnInit } from '@angular/core';
templateUrl: './flexible-area.component.html',
styleUrls: ['./flexible-area.component.scss'],
})
export class FlexibleAreaComponent {
}
export class FlexibleAreaComponent {}
1 change: 0 additions & 1 deletion UI16/src/app/modeless/window/window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ export class WindowComponent {
return;
}
}

}
18 changes: 9 additions & 9 deletions UI16/src/app/mud/ansi-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export class AnsiData {
ansiPos = 0;
fgcolor = '#ffffff';
bgcolor = '#000000';
bold = false;
faint = false;
blink = false;
italic = false;
underline = false;
reverse = false;
concealed = false;
crossedout = false;
optionInvert = false;
bold = false;
faint = false;
blink = false;
italic = false;
underline = false;
reverse = false;
concealed = false;
crossedout = false;
optionInvert = false;
timeString = '';
text = '';
}
2 changes: 1 addition & 1 deletion UI16/src/app/mud/ansi.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class AnsiService {
let char = data.ansi[data.ansiPos];
let escape = '';
let stop = false;
let i=0;
let i = 0;
let codes;
if (char == '[') {
do {
Expand Down
11 changes: 8 additions & 3 deletions UI16/src/app/mud/files.service.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { Injectable } from '@angular/core';
import { FileInfo } from './file-info';
import { HttpClient } from '@angular/common/http';
/* eslint @typescript-eslint/no-this-alias: "warn" */
/* eslint @typescript-eslint/no-this-alias: "warn" */
@Injectable({
providedIn: 'root',
})
export class FilesService {
private filemap: object = {};

startFilesModule() {return;}
startFilesModule() {
return;
}

processFileInfo(fileinfo: FileInfo): FileInfo {
const url = fileinfo.lasturl;
const filepath = fileinfo.file;
console.debug('FilesService-processFileInfo-start', fileinfo);
if (Object.prototype.hasOwnProperty.call(this.filemap, filepath) && fileinfo.saveActive) {
if (
Object.prototype.hasOwnProperty.call(this.filemap, filepath) &&
fileinfo.saveActive
) {
const cfileinfo: FileInfo = this.filemap[filepath];
cfileinfo.save02_url(url);
cfileinfo.alreadyLoaded = true;
Expand Down
6 changes: 3 additions & 3 deletions UI16/src/app/mud/mud-signals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class FileEntries {
filetime = '';
isdir = 0;
}
/* eslint @typescript-eslint/no-empty-function: "warn" */
/* eslint @typescript-eslint/no-empty-function: "warn" */
export class FileInfo {
lasturl = '';
file = '';
Expand Down Expand Up @@ -133,8 +133,8 @@ export class MudSignalHelpers {
musi.signal,
);
// console.debug('mudclient-socketService.mudReceiveSignals',_id,musi);
let audio,newfile,filewincfg:WindowConfig;
let nooldcfg,newcfg,xsplit;
let audio, newfile, filewincfg: WindowConfig;
let nooldcfg, newcfg, xsplit;
switch (musi.signal) {
case 'NOECHO-START':
other.v.inpType = 'password';
Expand Down
Loading

0 comments on commit 1bf0b48

Please sign in to comment.