Bläddra i källkod

reenabled @typescript-eslint/no-dynamic-delete

Eugene Pankov 4 år sedan
förälder
incheckning
15073cbc81

+ 0 - 1
.eslintrc.yml

@@ -102,7 +102,6 @@ rules:
   - allowConstantLoopConditions: true
   '@typescript-eslint/no-untyped-public-signature': off # bugs out on constructors
   '@typescript-eslint/restrict-template-expressions': off
-  '@typescript-eslint/no-dynamic-delete': off
   '@typescript-eslint/prefer-readonly-parameter-types': off
   '@typescript-eslint/no-unsafe-member-access': off
   '@typescript-eslint/no-unsafe-call': off

+ 9 - 9
terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug

@@ -22,10 +22,10 @@
         button.btn.btn-primary.ml-2(
             *ngIf='knownUpgrades[plugin.name]',
             (click)='upgradePlugin(plugin)',
-            [disabled]='busy[plugin.name] != undefined'
+            [disabled]='busy.has(plugin.name)'
         )
-            i.fas.fa-fw.fa-arrow-up(*ngIf='busy[plugin.name] != BusyState.Installing')
-            i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
+            i.fas.fa-fw.fa-arrow-up(*ngIf='busy.get(plugin.name) != BusyState.Installing')
+            i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Installing')
             span Upgrade ({{knownUpgrades[plugin.name].version}})
 
         button.btn.btn-link.text-primary.ml-2(
@@ -43,10 +43,10 @@
         button.btn.btn-link.text-danger.ml-2(
             (click)='uninstallPlugin(plugin)',
             *ngIf='!plugin.isBuiltin',
-            [disabled]='busy[plugin.name] != undefined'
+            [disabled]='busy.has(plugin.name)'
         )
-            i.fas.fa-fw.fa-trash(*ngIf='busy[plugin.name] != BusyState.Uninstalling')
-            i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Uninstalling')
+            i.fas.fa-fw.fa-trash(*ngIf='busy.get(plugin.name) != BusyState.Uninstalling')
+            i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Uninstalling')
 
 div
     h3.mt-4 Available
@@ -69,10 +69,10 @@ div
             .list-group-item.d-flex.align-items-center(*ngIf='!isAlreadyInstalled(plugin)')
                 button.btn.btn-primary.mr-3(
                     (click)='installPlugin(plugin)',
-                    [disabled]='busy[plugin.name] != undefined'
+                    [disabled]='busy.has(plugin.name)'
                 )
-                    i.fas.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing')
-                    i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
+                    i.fas.fa-fw.fa-download(*ngIf='busy.get(plugin.name) != BusyState.Installing')
+                    i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy.get(plugin.name) == BusyState.Installing')
 
                 div((click)='showPluginInfo(plugin)')
                     div

+ 7 - 7
terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts

@@ -20,7 +20,7 @@ export class PluginsSettingsTabComponent {
     @Input() availablePluginsQuery$ = new BehaviorSubject<string>('')
     @Input() availablePluginsReady = false
     @Input() knownUpgrades: Record<string, PluginInfo|null> = {}
-    @Input() busy: Record<string, BusyState> = {}
+    @Input() busy = new Map<string, BusyState>()
     @Input() erroredPlugin: string
     @Input() errorMessage: string
 
@@ -67,29 +67,29 @@ export class PluginsSettingsTabComponent {
     }
 
     async installPlugin (plugin: PluginInfo): Promise<void> {
-        this.busy[plugin.name] = BusyState.Installing
+        this.busy.set(plugin.name, BusyState.Installing)
         try {
             await this.pluginManager.installPlugin(plugin)
-            delete this.busy[plugin.name]
+            this.busy.delete(plugin.name)
             this.config.requestRestart()
         } catch (err) {
             this.erroredPlugin = plugin.name
             this.errorMessage = err
-            delete this.busy[plugin.name]
+            this.busy.delete(plugin.name)
             throw err
         }
     }
 
     async uninstallPlugin (plugin: PluginInfo): Promise<void> {
-        this.busy[plugin.name] = BusyState.Uninstalling
+        this.busy.set(plugin.name, BusyState.Uninstalling)
         try {
             await this.pluginManager.uninstallPlugin(plugin)
-            delete this.busy[plugin.name]
+            this.busy.delete(plugin.name)
             this.config.requestRestart()
         } catch (err) {
             this.erroredPlugin = plugin.name
             this.errorMessage = err
-            delete this.busy[plugin.name]
+            this.busy.delete(plugin.name)
             throw err
         }
     }

+ 3 - 3
terminus-terminal/src/services/sessions.service.ts

@@ -331,7 +331,7 @@ export class Session extends BaseSession {
 /** @hidden */
 @Injectable({ providedIn: 'root' })
 export class SessionsService {
-    sessions: Record<string, BaseSession> = {}
+    sessions = new Map<string, BaseSession>()
     logger: Logger
     private lastID = 0
 
@@ -347,9 +347,9 @@ export class SessionsService {
         options.name = `session-${this.lastID}`
         session.start(options)
         session.destroyed$.pipe(first()).subscribe(() => {
-            delete this.sessions[session.name]
+            this.sessions.delete(session.name)
         })
-        this.sessions[session.name] = session
+        this.sessions.set(session.name, session)
         return session
     }
 }