Eugene Pankov %!s(int64=6) %!d(string=hai) anos
pai
achega
a5ecdeb5ea
Modificáronse 62 ficheiros con 271 adicións e 280 borrados
  1. 2 2
      app/src/app.module.ts
  2. 2 2
      app/src/entry.preload.ts
  3. 2 2
      app/src/entry.ts
  4. 16 16
      app/src/plugins.ts
  5. 5 5
      terminus-community-color-schemes/src/colorSchemes.ts
  6. 1 1
      terminus-core/src/components/appRoot.component.ts
  7. 1 1
      terminus-core/src/components/checkbox.component.ts
  8. 29 29
      terminus-core/src/components/splitTab.component.ts
  9. 3 3
      terminus-core/src/components/splitTabSpanner.component.ts
  10. 2 2
      terminus-core/src/components/tabHeader.component.ts
  11. 11 11
      terminus-core/src/services/app.service.ts
  12. 6 6
      terminus-core/src/services/config.service.ts
  13. 8 8
      terminus-core/src/services/docking.service.ts
  14. 2 2
      terminus-core/src/services/homeBase.service.ts
  15. 1 1
      terminus-core/src/services/hostApp.service.ts
  16. 28 28
      terminus-core/src/services/hotkeys.service.ts
  17. 6 16
      terminus-core/src/services/hotkeys.util.ts
  18. 4 4
      terminus-core/src/services/shellIntegration.service.ts
  19. 5 5
      terminus-core/src/services/tabRecovery.service.ts
  20. 5 5
      terminus-core/src/services/tabs.service.ts
  21. 6 6
      terminus-core/src/services/touchbar.service.ts
  22. 3 3
      terminus-core/src/services/updater.service.ts
  23. 4 4
      terminus-core/src/tabContextMenu.ts
  24. 1 1
      terminus-core/tsconfig.json
  25. 1 1
      terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts
  26. 1 1
      terminus-settings/src/buttonProvider.ts
  27. 2 2
      terminus-settings/src/components/settingsTab.component.ts
  28. 4 4
      terminus-ssh/src/api.ts
  29. 7 7
      terminus-ssh/src/components/editConnectionModal.component.ts
  30. 2 2
      terminus-ssh/src/components/sshModal.component.ts
  31. 7 7
      terminus-ssh/src/components/sshSettingsTab.component.ts
  32. 1 1
      terminus-ssh/src/components/sshTab.component.ts
  33. 10 10
      terminus-ssh/src/services/ssh.service.ts
  34. 5 5
      terminus-terminal/src/api/baseTerminalTab.component.ts
  35. 3 3
      terminus-terminal/src/buttonProvider.ts
  36. 4 4
      terminus-terminal/src/colorSchemes.ts
  37. 1 1
      terminus-terminal/src/components/appearanceSettingsTab.component.ts
  38. 1 1
      terminus-terminal/src/components/colorPicker.component.ts
  39. 2 2
      terminus-terminal/src/components/environmentEditor.component.ts
  40. 4 4
      terminus-terminal/src/components/shellSettingsTab.component.ts
  41. 4 4
      terminus-terminal/src/components/terminalTab.component.ts
  42. 2 2
      terminus-terminal/src/contextMenu.ts
  43. 1 1
      terminus-terminal/src/frontends/frontend.ts
  44. 7 7
      terminus-terminal/src/frontends/hterm.ts
  45. 6 6
      terminus-terminal/src/frontends/htermFrontend.ts
  46. 5 5
      terminus-terminal/src/frontends/xtermFrontend.ts
  47. 1 1
      terminus-terminal/src/hotkeys.ts
  48. 5 5
      terminus-terminal/src/index.ts
  49. 3 3
      terminus-terminal/src/pathDrop.ts
  50. 6 6
      terminus-terminal/src/services/sessions.service.ts
  51. 6 6
      terminus-terminal/src/services/terminal.service.ts
  52. 1 1
      terminus-terminal/src/services/terminalFrontend.service.ts
  53. 1 1
      terminus-terminal/src/services/uac.service.ts
  54. 1 1
      terminus-terminal/src/shells/custom.ts
  55. 1 1
      terminus-terminal/src/shells/cygwin32.ts
  56. 1 1
      terminus-terminal/src/shells/cygwin64.ts
  57. 1 1
      terminus-terminal/src/shells/linuxDefault.ts
  58. 1 1
      terminus-terminal/src/shells/macDefault.ts
  59. 3 3
      terminus-terminal/src/shells/winDefault.ts
  60. 5 5
      terminus-terminal/src/shells/wsl.ts
  61. 1 1
      terminus-terminal/src/tabContextMenu.ts
  62. 1 0
      tslint.json

+ 2 - 2
app/src/app.module.ts

@@ -4,7 +4,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
 import { ToastrModule } from 'ngx-toastr'
 
 export function getRootModule (plugins: any[]) {
-    let imports = [
+    const imports = [
         BrowserModule,
         ...plugins,
         NgbModule.forRoot(),
@@ -15,7 +15,7 @@ export function getRootModule (plugins: any[]) {
             extendedTimeOut: 5000,
         }),
     ]
-    let bootstrap = [
+    const bootstrap = [
         ...(plugins.filter(x => x.bootstrap).map(x => x.bootstrap)),
     ]
 

+ 2 - 2
app/src/entry.preload.ts

@@ -16,8 +16,8 @@ Raven.config(
     {
         release: require('electron').remote.app.getVersion(),
         dataCallback: (data: any) => {
-            const normalize = (filename) => {
-                let splitArray = filename.split('/')
+            const normalize = (filename: string) => {
+                const splitArray = filename.split('/')
                 return splitArray[splitArray.length - 1]
             }
 

+ 2 - 2
app/src/entry.ts

@@ -32,10 +32,10 @@ async function bootstrap (plugins: IPluginInfo[], safeMode = false): Promise<NgM
     if (safeMode) {
         plugins = plugins.filter(x => x.isBuiltin)
     }
-    let pluginsModules = await loadPlugins(plugins, (current, total) => {
+    const pluginsModules = await loadPlugins(plugins, (current, total) => {
         (document.querySelector('.progress .bar') as HTMLElement).style.width = 100 * current / total + '%'
     })
-    let module = getRootModule(pluginsModules)
+    const module = getRootModule(pluginsModules)
     window['rootModule'] = module
     return platformBrowserDynamic().bootstrapModule(module)
 }

+ 16 - 16
app/src/plugins.ts

@@ -12,7 +12,7 @@ function normalizePath (path: string): string {
     return path
 }
 
-nodeRequire.main.paths.map(x => nodeModule.globalPaths.push(normalizePath(x)))
+nodeRequire.main.paths.map((x: string) => nodeModule.globalPaths.push(normalizePath(x)))
 
 if (process.env.TERMINUS_DEV) {
     nodeModule.globalPaths.unshift(path.dirname(require('electron').remote.app.getAppPath()))
@@ -38,7 +38,7 @@ if (process.env.TERMINUS_PLUGINS) {
     process.env.TERMINUS_PLUGINS.split(':').map(x => nodeModule.globalPaths.push(normalizePath(x)))
 }
 
-export declare type ProgressCallback = (current, total) => void
+export declare type ProgressCallback = (current: number, total: number) => void
 
 export interface IPluginInfo {
     name: string
@@ -80,7 +80,7 @@ builtinModules.forEach(m => {
 })
 
 const originalRequire = (global as any).require
-;(global as any).require = function (query) {
+;(global as any).require = function (query: string) {
     if (cachedBuiltinModules[query]) {
         return cachedBuiltinModules[query]
     }
@@ -88,9 +88,9 @@ const originalRequire = (global as any).require
 }
 
 export async function findPlugins (): Promise<IPluginInfo[]> {
-    let paths = nodeModule.globalPaths
+    const paths = nodeModule.globalPaths
     let foundPlugins: IPluginInfo[] = []
-    let candidateLocations: { pluginDir: string, packageName: string }[] = []
+    const candidateLocations: { pluginDir: string, packageName: string }[] = []
     const PREFIX = 'terminus-'
 
     for (let pluginDir of paths) {
@@ -98,28 +98,28 @@ export async function findPlugins (): Promise<IPluginInfo[]> {
         if (!await fs.exists(pluginDir)) {
             continue
         }
-        let pluginNames = await fs.readdir(pluginDir)
+        const pluginNames = await fs.readdir(pluginDir)
         if (await fs.exists(path.join(pluginDir, 'package.json'))) {
             candidateLocations.push({
                 pluginDir: path.dirname(pluginDir),
                 packageName: path.basename(pluginDir)
             })
         }
-        for (let packageName of pluginNames) {
+        for (const packageName of pluginNames) {
             if (packageName.startsWith(PREFIX)) {
                 candidateLocations.push({ pluginDir, packageName })
             }
         }
     }
 
-    for (let { pluginDir, packageName } of candidateLocations) {
-        let pluginPath = path.join(pluginDir, packageName)
-        let infoPath = path.join(pluginPath, 'package.json')
+    for (const { pluginDir, packageName } of candidateLocations) {
+        const pluginPath = path.join(pluginDir, packageName)
+        const infoPath = path.join(pluginPath, 'package.json')
         if (!await fs.exists(infoPath)) {
             continue
         }
 
-        let name = packageName.substring(PREFIX.length)
+        const name = packageName.substring(PREFIX.length)
 
         if (foundPlugins.some(x => x.name === name)) {
             console.info(`Plugin ${packageName} already exists, overriding`)
@@ -127,7 +127,7 @@ export async function findPlugins (): Promise<IPluginInfo[]> {
         }
 
         try {
-            let info = JSON.parse(await fs.readFile(infoPath, { encoding: 'utf-8' }))
+            const info = JSON.parse(await fs.readFile(infoPath, { encoding: 'utf-8' }))
             if (!info.keywords || !(info.keywords.includes('terminus-plugin') || info.keywords.includes('terminus-builtin-plugin'))) {
                 continue
             }
@@ -153,17 +153,17 @@ export async function findPlugins (): Promise<IPluginInfo[]> {
 }
 
 export async function loadPlugins (foundPlugins: IPluginInfo[], progress: ProgressCallback): Promise<any[]> {
-    let plugins: any[] = []
+    const plugins: any[] = []
     progress(0, 1)
     let index = 0
-    for (let foundPlugin of foundPlugins) {
+    for (const foundPlugin of foundPlugins) {
         console.info(`Loading ${foundPlugin.name}: ${nodeRequire.resolve(foundPlugin.path)}`)
         progress(index, foundPlugins.length)
         try {
             const label = 'Loading ' + foundPlugin.name
             console.time(label)
-            let packageModule = nodeRequire(foundPlugin.path)
-            let pluginModule = packageModule.default.forRoot ? packageModule.default.forRoot() : packageModule.default
+            const packageModule = nodeRequire(foundPlugin.path)
+            const pluginModule = packageModule.default.forRoot ? packageModule.default.forRoot() : packageModule.default
             pluginModule['pluginName'] = foundPlugin.name
             pluginModule['bootstrap'] = packageModule.bootstrap
             plugins.push(pluginModule)

+ 5 - 5
terminus-community-color-schemes/src/colorSchemes.ts

@@ -6,13 +6,13 @@ const schemeContents = require.context('../schemes/', true, /.*/)
 @Injectable()
 export class ColorSchemes extends TerminalColorSchemeProvider {
     async getSchemes (): Promise<ITerminalColorScheme[]> {
-        let schemes: ITerminalColorScheme[] = []
+        const schemes: ITerminalColorScheme[] = []
 
         schemeContents.keys().forEach(schemeFile => {
-            let lines = (schemeContents(schemeFile).default as string).split('\n')
+            const lines = (schemeContents(schemeFile).default as string).split('\n')
 
             // process #define variables
-            let variables: any = {}
+            const variables: any = {}
             lines
                 .filter(x => x.startsWith('#define'))
                 .map(x => x.split(' ').map(v => v.trim()))
@@ -20,7 +20,7 @@ export class ColorSchemes extends TerminalColorSchemeProvider {
                     variables[variableName] = variableValue
                 })
 
-            let values: any = {}
+            const values: any = {}
             lines
                 .filter(x => x.startsWith('*.'))
                 .map(x => x.substring(2))
@@ -29,7 +29,7 @@ export class ColorSchemes extends TerminalColorSchemeProvider {
                     values[key] = variables[value] ? variables[value] : value
                 })
 
-            let colors: string[] = []
+            const colors: string[] = []
             let colorIndex = 0
             while (values[`color${colorIndex}`]) {
                 colors.push(values[`color${colorIndex}`])

+ 1 - 1
terminus-core/src/components/appRoot.component.ts

@@ -91,7 +91,7 @@ export class AppRootComponent {
 
         this.hotkeys.matchedHotkey.subscribe((hotkey) => {
             if (hotkey.startsWith('tab-')) {
-                let index = parseInt(hotkey.split('-')[1])
+                const index = parseInt(hotkey.split('-')[1])
                 if (index <= this.app.tabs.length) {
                     this.app.selectTab(this.app.tabs[index - 1])
                 }

+ 1 - 1
terminus-core/src/components/checkbox.component.ts

@@ -23,7 +23,7 @@ export class CheckboxComponent implements ControlValueAccessor {
         }
 
         this.model = !this.model
-        for (let fx of this.changed) {
+        for (const fx of this.changed) {
             fx(this.model)
         }
     }

+ 29 - 29
terminus-core/src/components/splitTab.component.ts

@@ -35,7 +35,7 @@ export class SplitContainer {
      */
     getAllTabs () {
         let r = []
-        for (let child of this.children) {
+        for (const child of this.children) {
             if (child instanceof SplitContainer) {
                 r = r.concat(child.getAllTabs())
             } else {
@@ -50,7 +50,7 @@ export class SplitContainer {
      */
     normalize () {
         for (let i = 0; i < this.children.length; i++) {
-            let child = this.children[i]
+            const child = this.children[i]
 
             if (child instanceof SplitContainer) {
                 child.normalize()
@@ -63,7 +63,7 @@ export class SplitContainer {
                 } else if (child.children.length === 1) {
                     this.children[i] = child.children[0]
                 } else if (child.orientation === this.orientation) {
-                    let ratio = this.ratios[i]
+                    const ratio = this.ratios[i]
                     this.children.splice(i, 1)
                     this.ratios.splice(i, 1)
                     for (let j = 0; j < child.children.length; j++) {
@@ -76,7 +76,7 @@ export class SplitContainer {
         }
 
         let s = 0
-        for (let x of this.ratios) {
+        for (const x of this.ratios) {
             s += x
         }
         this.ratios = this.ratios.map(x => x / s)
@@ -94,8 +94,8 @@ export class SplitContainer {
     }
 
     async serialize () {
-        let children = []
-        for (let child of this.children) {
+        const children = []
+        for (const child of this.children) {
             if (child instanceof SplitContainer) {
                 children.push(await child.serialize())
             } else {
@@ -257,7 +257,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
 
     focus (tab: BaseTabComponent) {
         this.focusedTab = tab
-        for (let x of this.getAllTabs()) {
+        for (const x of this.getAllTabs()) {
             if (x !== tab) {
                 x.emitBlurred()
             }
@@ -294,7 +294,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
             (target.orientation === 'v' && ['l', 'r'].includes(side)) ||
             (target.orientation === 'h' && ['t', 'b'].includes(side))
         ) {
-            let newContainer = new SplitContainer()
+            const newContainer = new SplitContainer()
             newContainer.orientation = (target.orientation === 'v') ? 'h' : 'v'
             newContainer.children = [relative]
             newContainer.ratios = [1]
@@ -326,8 +326,8 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     removeTab (tab: BaseTabComponent) {
-        let parent = this.getParentOf(tab)
-        let index = parent.children.indexOf(tab)
+        const parent = this.getParentOf(tab)
+        const index = parent.children.indexOf(tab)
         parent.ratios.splice(index, 1)
         parent.children.splice(index, 1)
 
@@ -350,7 +350,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     navigate (dir: SplitDirection) {
         let rel: BaseTabComponent | SplitContainer = this.focusedTab
         let parent = this.getParentOf(rel)
-        let orientation = ['l', 'r'].includes(dir) ? 'h' : 'v'
+        const orientation = ['l', 'r'].includes(dir) ? 'h' : 'v'
 
         while (parent !== this.root && parent.orientation !== orientation) {
             rel = parent
@@ -361,7 +361,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
             return
         }
 
-        let index = parent.children.indexOf(rel)
+        const index = parent.children.indexOf(rel)
         if (['l', 't'].includes(dir)) {
             if (index > 0) {
                 this.focusAnyIn(parent.children[index - 1])
@@ -374,7 +374,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     async splitTab (tab: BaseTabComponent, dir: SplitDirection) {
-        let newTab = await this.tabsService.duplicate(tab)
+        const newTab = await this.tabsService.duplicate(tab)
         this.addTab(newTab, tab, dir)
     }
 
@@ -383,9 +383,9 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
      */
     getParentOf (tab: BaseTabComponent | SplitContainer, root?: SplitContainer): SplitContainer {
         root = root || this.root
-        for (let child of root.children) {
+        for (const child of root.children) {
             if (child instanceof SplitContainer) {
-                let r = this.getParentOf(tab, child)
+                const r = this.getParentOf(tab, child)
                 if (r) {
                     return r
                 }
@@ -419,7 +419,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     private attachTabView (tab: BaseTabComponent) {
-        let ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any>
+        const ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any>
         this.viewRefs.set(tab, ref)
 
         ref.rootNodes[0].addEventListener('click', () => this.focus(tab))
@@ -436,7 +436,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     private detachTabView (tab: BaseTabComponent) {
-        let ref = this.viewRefs.get(tab)
+        const ref = this.viewRefs.get(tab)
         this.viewRefs.delete(tab)
         this.viewContainer.remove(this.viewContainer.indexOf(ref))
     }
@@ -448,8 +448,8 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     private layoutInternal (root: SplitContainer, x: number, y: number, w: number, h: number) {
-        let size = (root.orientation === 'v') ? h : w
-        let sizes = root.ratios.map(x => x * size)
+        const size = (root.orientation === 'v') ? h : w
+        const sizes = root.ratios.map(x => x * size)
 
         root.x = x
         root.y = y
@@ -458,14 +458,14 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
 
         let offset = 0
         root.children.forEach((child, i) => {
-            let childX = (root.orientation === 'v') ? x : (x + offset)
-            let childY = (root.orientation === 'v') ? (y + offset) : y
-            let childW = (root.orientation === 'v') ? w : sizes[i]
-            let childH = (root.orientation === 'v') ? sizes[i] : h
+            const childX = (root.orientation === 'v') ? x : (x + offset)
+            const childY = (root.orientation === 'v') ? (y + offset) : y
+            const childW = (root.orientation === 'v') ? w : sizes[i]
+            const childH = (root.orientation === 'v') ? sizes[i] : h
             if (child instanceof SplitContainer) {
                 this.layoutInternal(child, childX, childY, childW, childH)
             } else {
-                let element = this.viewRefs.get(child).rootNodes[0]
+                const element = this.viewRefs.get(child).rootNodes[0]
                 element.style.position = 'absolute'
                 element.style.left = `${childX}%`
                 element.style.top = `${childY}%`
@@ -486,19 +486,19 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
     }
 
     private async recoverContainer (root: SplitContainer, state: any) {
-        let children: (SplitContainer | BaseTabComponent)[] = []
+        const children: (SplitContainer | BaseTabComponent)[] = []
         root.orientation = state.orientation
         root.ratios = state.ratios
         root.children = children
-        for (let childState of state.children) {
+        for (const childState of state.children) {
             if (childState.type === 'app:split-tab') {
-                let child = new SplitContainer()
+                const child = new SplitContainer()
                 await this.recoverContainer(child, childState)
                 children.push(child)
             } else {
-                let recovered = await this.tabRecovery.recoverTab(childState)
+                const recovered = await this.tabRecovery.recoverTab(childState)
                 if (recovered) {
-                    let tab = this.tabsService.create(recovered.type, recovered.options)
+                    const tab = this.tabsService.create(recovered.type, recovered.options)
                     children.push(tab)
                     this.attachTabView(tab)
                 } else {

+ 3 - 3
terminus-core/src/components/splitTabSpanner.component.ts

@@ -25,13 +25,13 @@ export class SplitTabSpannerComponent {
     ngAfterViewInit () {
         this.element.nativeElement.addEventListener('mousedown', e => {
             this.isActive = true
-            let start = this.isVertical ? e.pageY : e.pageX
+            const start = this.isVertical ? e.pageY : e.pageX
             let current = start
-            let oldPosition = this.isVertical ? this.element.nativeElement.offsetTop : this.element.nativeElement.offsetLeft
+            const oldPosition = this.isVertical ? this.element.nativeElement.offsetTop : this.element.nativeElement.offsetLeft
 
             const dragHandler = e => {
                 current = this.isVertical ? e.pageY : e.pageX
-                let newPosition = oldPosition + (current - start)
+                const newPosition = oldPosition + (current - start)
                 if (this.isVertical) {
                     this.element.nativeElement.style.top = `${newPosition - this.marginOffset}px`
                 } else {

+ 2 - 2
terminus-core/src/components/tabHeader.component.ts

@@ -52,7 +52,7 @@ export class TabHeaderComponent {
     }
 
     showRenameTabModal (): void {
-        let modal = this.ngbModal.open(RenameTabModalComponent)
+        const modal = this.ngbModal.open(RenameTabModalComponent)
         modal.componentInstance.value = this.tab.customTitle || this.tab.title
         modal.result.then(result => {
             this.tab.setTitle(result)
@@ -62,7 +62,7 @@ export class TabHeaderComponent {
 
     async buildContextMenu (): Promise<Electron.MenuItemConstructorOptions[]> {
         let items: Electron.MenuItemConstructorOptions[] = []
-        for (let section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this.tab, this)))) {
+        for (const section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this.tab, this)))) {
             items.push({ type: 'separator' })
             items = items.concat(section)
         }

+ 11 - 11
terminus-core/src/services/app.service.ts

@@ -68,7 +68,7 @@ export class AppService {
         private tabsService: TabsService,
     ) {
         this.tabRecovery.recoverTabs().then(tabs => {
-            for (let tab of tabs) {
+            for (const tab of tabs) {
                 this.openNewTabRaw(tab.type, tab.options)
             }
 
@@ -98,7 +98,7 @@ export class AppService {
         })
 
         tab.destroyed$.subscribe(() => {
-            let newIndex = Math.max(0, this.tabs.indexOf(tab) - 1)
+            const newIndex = Math.max(0, this.tabs.indexOf(tab) - 1)
             this.tabs = this.tabs.filter((x) => x !== tab)
             if (tab === this._activeTab) {
                 this.selectTab(this.tabs[newIndex])
@@ -113,7 +113,7 @@ export class AppService {
      * @param inputs  Properties to be assigned on the new tab component instance
      */
     openNewTabRaw (type: TabComponentType, inputs?: any): BaseTabComponent {
-        let tab = this.tabsService.create(type, inputs)
+        const tab = this.tabsService.create(type, inputs)
         this.addTabRaw(tab)
         return tab
     }
@@ -123,8 +123,8 @@ export class AppService {
      * @param inputs  Properties to be assigned on the new tab component instance
      */
     openNewTab (type: TabComponentType, inputs?: any): BaseTabComponent {
-        let splitTab = this.tabsService.create(SplitTabComponent) as SplitTabComponent
-        let tab = this.tabsService.create(type, inputs)
+        const splitTab = this.tabsService.create(SplitTabComponent) as SplitTabComponent
+        const tab = this.tabsService.create(type, inputs)
         splitTab.addTab(tab, null, 'r')
         this.addTabRaw(splitTab)
         return tab
@@ -164,7 +164,7 @@ export class AppService {
 
     nextTab () {
         if (this.tabs.length > 1) {
-            let tabIndex = this.tabs.indexOf(this._activeTab)
+            const tabIndex = this.tabs.indexOf(this._activeTab)
             if (tabIndex < this.tabs.length - 1) {
                 this.selectTab(this.tabs[tabIndex + 1])
             } else if (this.config.store.appearance.cycleTabs) {
@@ -175,7 +175,7 @@ export class AppService {
 
     previousTab () {
         if (this.tabs.length > 1) {
-            let tabIndex = this.tabs.indexOf(this._activeTab)
+            const tabIndex = this.tabs.indexOf(this._activeTab)
             if (tabIndex > 0) {
                 this.selectTab(this.tabs[tabIndex - 1])
             } else if (this.config.store.appearance.cycleTabs) {
@@ -200,19 +200,19 @@ export class AppService {
     }
 
     async duplicateTab (tab: BaseTabComponent) {
-        let dup = await this.tabsService.duplicate(tab)
+        const dup = await this.tabsService.duplicate(tab)
         if (dup) {
             this.addTabRaw(dup)
         }
     }
 
     async closeAllTabs () {
-        for (let tab of this.tabs) {
+        for (const tab of this.tabs) {
             if (!await tab.canClose()) {
                 return
             }
         }
-        for (let tab of this.tabs) {
+        for (const tab of this.tabs) {
             tab.destroy()
         }
     }
@@ -230,7 +230,7 @@ export class AppService {
      */
     observeTabCompletion (tab: BaseTabComponent): Observable<void> {
         if (!this.completionObservers.has(tab)) {
-            let observer = new CompletionObserver(tab)
+            const observer = new CompletionObserver(tab)
             observer.destroyed$.subscribe(() => {
                 this.stopObservingTabCompletion(tab)
             })

+ 6 - 6
terminus-core/src/services/config.service.ts

@@ -21,12 +21,12 @@ function isNonStructuralObjectMember (v) {
 /** @hidden */
 export class ConfigProxy {
     constructor (real: any, defaults: any) {
-        for (let key in defaults) {
+        for (const key in defaults) {
             if (isStructuralMember(defaults[key])) {
                 if (!real[key]) {
                     real[key] = {}
                 }
-                let proxy = new ConfigProxy(real[key], defaults[key])
+                const proxy = new ConfigProxy(real[key], defaults[key])
                 Object.defineProperty(
                     this,
                     key,
@@ -177,9 +177,9 @@ export class ConfigService {
     enabledServices<T> (services: T[]): T[] {
         if (!this.servicesCache) {
             this.servicesCache = {}
-            let ngModule = window['rootModule'].ngInjectorDef
-            for (let imp of ngModule.imports) {
-                let module = (imp['ngModule'] || imp)
+            const ngModule = window['rootModule'].ngInjectorDef
+            for (const imp of ngModule.imports) {
+                const module = (imp['ngModule'] || imp)
                 if (module.ngInjectorDef && module.ngInjectorDef.providers) {
                     this.servicesCache[module['pluginName']] = module.ngInjectorDef.providers.map(provider => {
                         return provider['useClass'] || provider
@@ -188,7 +188,7 @@ export class ConfigService {
             }
         }
         return services.filter(service => {
-            for (let pluginName in this.servicesCache) {
+            for (const pluginName in this.servicesCache) {
                 if (this.servicesCache[pluginName].includes(service.constructor)) {
                     return !this.store.pluginBlacklist.includes(pluginName)
                 }

+ 8 - 8
terminus-core/src/services/docking.service.ts

@@ -21,7 +21,7 @@ export class DockingService {
     }
 
     dock () {
-        let dockSide = this.config.store.appearance.dock
+        const dockSide = this.config.store.appearance.dock
 
         if (dockSide === 'off') {
             this.hostApp.setAlwaysOnTop(false)
@@ -34,9 +34,9 @@ export class DockingService {
             display = this.getCurrentScreen()
         }
 
-        let newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
-        let fill = this.config.store.appearance.dockFill
-        let [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
+        const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
+        const fill = this.config.store.appearance.dockFill
+        const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
 
         if (dockSide === 'left' || dockSide === 'right') {
             newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
@@ -80,14 +80,14 @@ export class DockingService {
     }
 
     private repositionWindow () {
-        let [x, y] = this.hostApp.getWindow().getPosition()
-        for (let screen of this.electron.screen.getAllDisplays()) {
-            let bounds = screen.bounds
+        const [x, y] = this.hostApp.getWindow().getPosition()
+        for (const screen of this.electron.screen.getAllDisplays()) {
+            const bounds = screen.bounds
             if (x >= bounds.x && x <= bounds.x + bounds.width && y >= bounds.y && y <= bounds.y + bounds.height) {
                 return
             }
         }
-        let screen = this.electron.screen.getPrimaryDisplay()
+        const screen = this.electron.screen.getPrimaryDisplay()
         this.hostApp.getWindow().setPosition(screen.bounds.x, screen.bounds.y)
     }
 }

+ 2 - 2
terminus-core/src/services/homeBase.service.ts

@@ -29,12 +29,12 @@ export class HomeBaseService {
     reportBug () {
         let body = `Version: ${this.appVersion}\n`
         body += `Platform: ${os.platform()} ${os.release()}\n`
-        let label = {
+        const label = {
             darwin: 'OS: macOS',
             windows: 'OS: Windows',
             linux: 'OS: Linux',
         }[os.platform()]
-        let plugins = (window as any).installedPlugins.filter(x => !x.isBuiltin).map(x => x.name)
+        const plugins = (window as any).installedPlugins.filter(x => !x.isBuiltin).map(x => x.name)
         body += `Plugins: ${plugins.join(', ') || 'none'}\n\n`
         this.electron.shell.openExternal(`https://github.com/eugeny/terminus/issues/new?body=${encodeURIComponent(body)}&labels=${label}`)
     }

+ 1 - 1
terminus-core/src/services/hostApp.service.ts

@@ -170,7 +170,7 @@ export class HostAppService {
     }
 
     toggleFullscreen () {
-        let window = this.getWindow()
+        const window = this.getWindow()
         window.setFullScreen(!this.isFullScreen)
     }
 

+ 28 - 28
terminus-core/src/services/hotkeys.service.ts

@@ -1,6 +1,6 @@
 import { Injectable, Inject, NgZone, EventEmitter } from '@angular/core'
 import { IHotkeyDescription, HotkeyProvider } from '../api/hotkeyProvider'
-import { NativeKeyEvent, stringifyKeySequence } from './hotkeys.util'
+import { stringifyKeySequence } from './hotkeys.util'
 import { ConfigService } from '../services/config.service'
 import { ElectronService } from '../services/electron.service'
 
@@ -13,13 +13,13 @@ export interface PartialHotkeyMatch {
 const KEY_TIMEOUT = 2000
 
 interface EventBufferEntry {
-    event: NativeKeyEvent
+    event: KeyboardEvent
     time: number
 }
 
 @Injectable({ providedIn: 'root' })
 export class HotkeysService {
-    key = new EventEmitter<NativeKeyEvent>()
+    key = new EventEmitter<KeyboardEvent>()
     matchedHotkey = new EventEmitter<string>()
     globalHotkey = new EventEmitter()
     private currentKeystrokes: EventBufferEntry[] = []
@@ -33,9 +33,9 @@ export class HotkeysService {
         private config: ConfigService,
         @Inject(HotkeyProvider) private hotkeyProviders: HotkeyProvider[],
     ) {
-        let events = ['keydown', 'keyup']
-        events.forEach((event) => {
-            document.addEventListener(event, (nativeEvent) => {
+        const events = ['keydown', 'keyup']
+        events.forEach(event => {
+            document.addEventListener(event, (nativeEvent: KeyboardEvent) => {
                 if (document.querySelectorAll('input:focus').length === 0) {
                     this.pushKeystroke(event, nativeEvent)
                     this.processKeystrokes()
@@ -58,8 +58,8 @@ export class HotkeysService {
      * @param name DOM event name
      * @param nativeEvent event object
      */
-    pushKeystroke (name, nativeEvent) {
-        nativeEvent.event = name
+    pushKeystroke (name: string, nativeEvent: KeyboardEvent) {
+        (nativeEvent as any).event = name
         this.currentKeystrokes.push({ event: nativeEvent, time: performance.now() })
     }
 
@@ -69,7 +69,7 @@ export class HotkeysService {
     processKeystrokes () {
         if (this.isEnabled()) {
             this.zone.run(() => {
-                let matched = this.getCurrentFullyMatchedHotkey()
+                const matched = this.getCurrentFullyMatchedHotkey()
                 if (matched) {
                     console.log('Matched hotkey', matched)
                     this.matchedHotkey.emit(matched)
@@ -79,7 +79,7 @@ export class HotkeysService {
         }
     }
 
-    emitKeyEvent (nativeEvent) {
+    emitKeyEvent (nativeEvent: KeyboardEvent) {
         this.zone.run(() => {
             this.key.emit(nativeEvent)
         })
@@ -100,7 +100,7 @@ export class HotkeysService {
         if (typeof value === 'string') {
             value = [value]
         }
-        value.forEach(item => {
+        value.forEach((item: string | string[]) => {
             item = (typeof item === 'string') ? [item] : item
 
             try {
@@ -121,13 +121,13 @@ export class HotkeysService {
         return this.getHotkeysConfigRecursive(this.config.store.hotkeys)
     }
 
-    private getHotkeysConfigRecursive (branch) {
-        let keys = {}
-        for (let key in branch) {
+    private getHotkeysConfigRecursive (branch: any) {
+        const keys = {}
+        for (const key in branch) {
             let value = branch[key]
             if (value instanceof Object && !(value instanceof Array)) {
-                let subkeys = this.getHotkeysConfigRecursive(value)
-                for (let subkey in subkeys) {
+                const subkeys = this.getHotkeysConfigRecursive(value)
+                for (const subkey in subkeys) {
                     keys[key + '.' + subkey] = subkeys[subkey]
                 }
             } else {
@@ -135,7 +135,7 @@ export class HotkeysService {
                     value = [value]
                 }
                 if (value) {
-                    value = value.map(item => (typeof item === 'string') ? [item] : item)
+                    value = value.map((item: string | string[]) => (typeof item === 'string') ? [item] : item)
                     keys[key] = value
                 }
             }
@@ -144,15 +144,15 @@ export class HotkeysService {
     }
 
     private getCurrentFullyMatchedHotkey (): string {
-        let currentStrokes = this.getCurrentKeystrokes()
-        let config = this.getHotkeysConfig()
-        for (let id in config) {
-            for (let sequence of config[id]) {
+        const currentStrokes = this.getCurrentKeystrokes()
+        const config = this.getHotkeysConfig()
+        for (const id in config) {
+            for (const sequence of config[id]) {
                 if (currentStrokes.length < sequence.length) {
                     continue
                 }
                 if (sequence.every(
-                    (x, index) =>
+                    (x: string, index: number) =>
                         x.toLowerCase() ===
                             currentStrokes[currentStrokes.length - sequence.length + index].toLowerCase()
                 )) {
@@ -164,14 +164,14 @@ export class HotkeysService {
     }
 
     getCurrentPartiallyMatchedHotkeys (): PartialHotkeyMatch[] {
-        let currentStrokes = this.getCurrentKeystrokes()
-        let config = this.getHotkeysConfig()
-        let result = []
-        for (let id in config) {
-            for (let sequence of config[id]) {
+        const currentStrokes = this.getCurrentKeystrokes()
+        const config = this.getHotkeysConfig()
+        const result = []
+        for (const id in config) {
+            for (const sequence of config[id]) {
                 for (let matchLength = Math.min(currentStrokes.length, sequence.length); matchLength > 0; matchLength--) {
                     if (sequence.slice(0, matchLength).every(
-                        (x, index) =>
+                        (x: string, index: number) =>
                             x.toLowerCase() ===
                                 currentStrokes[currentStrokes.length - matchLength + index].toLowerCase()
                     )) {

+ 6 - 16
terminus-core/src/services/hotkeys.util.ts

@@ -10,24 +10,14 @@ export const altKeyName = {
     linux: 'Alt',
 }[process.platform]
 
-export interface NativeKeyEvent {
-    event?: string
-    altKey: boolean
-    ctrlKey: boolean
-    metaKey: boolean
-    shiftKey: boolean
-    key: string
-    keyCode: string
-}
-
-export function stringifyKeySequence (events: NativeKeyEvent[]): string[] {
-    let items: string[] = []
+export function stringifyKeySequence (events: KeyboardEvent[]): string[] {
+    const items: string[] = []
     events = events.slice()
 
     while (events.length > 0) {
-        let event = events.shift()
-        if (event.event === 'keydown') {
-            let itemKeys: string[] = []
+        const event = events.shift()
+        if ((event as any).event === 'keydown') {
+            const itemKeys: string[] = []
             if (event.ctrlKey) {
                 itemKeys.push('Ctrl')
             }
@@ -46,7 +36,7 @@ export function stringifyKeySequence (events: NativeKeyEvent[]): string[] {
                 continue
             }
 
-            let key = (event as any).code
+            let key = event.code
             key = key.replace('Key', '')
             key = key.replace('Arrow', '')
             key = key.replace('Digit', '')

+ 4 - 4
terminus-core/src/services/shellIntegration.service.ts

@@ -61,11 +61,11 @@ export class ShellIntegrationService {
     async install () {
         const exe = process.env.PORTABLE_EXECUTABLE_FILE || this.electron.app.getPath('exe')
         if (this.hostApp.platform === Platform.macOS) {
-            for (let wf of this.automatorWorkflows) {
+            for (const wf of this.automatorWorkflows) {
                 await exec(`cp -r "${this.automatorWorkflowsLocation}/${wf}" "${this.automatorWorkflowsDestination}"`)
             }
         } else if (this.hostApp.platform === Platform.Windows) {
-            for (let registryKey of this.registryKeys) {
+            for (const registryKey of this.registryKeys) {
                 wnr.createRegistryKey(wnr.HK.CU, registryKey.path)
                 wnr.createRegistryKey(wnr.HK.CU, registryKey.path + '\\command')
                 wnr.setRegistryValue(wnr.HK.CU, registryKey.path, 'Icon', wnr.REG.SZ, exe)
@@ -76,11 +76,11 @@ export class ShellIntegrationService {
 
     async remove () {
         if (this.hostApp.platform === Platform.macOS) {
-            for (let wf of this.automatorWorkflows) {
+            for (const wf of this.automatorWorkflows) {
                 await exec(`rm -rf "${this.automatorWorkflowsDestination}/${wf}"`)
             }
         } else if (this.hostApp.platform === Platform.Windows) {
-            for (let registryKey of this.registryKeys) {
+            for (const registryKey of this.registryKeys) {
                 wnr.deleteRegistryKey(wnr.HK.CU, registryKey.path)
             }
         }

+ 5 - 5
terminus-core/src/services/tabRecovery.service.ts

@@ -28,9 +28,9 @@ export class TabRecoveryService {
     }
 
     async recoverTab (token: any): Promise<RecoveredTab> {
-        for (let provider of this.config.enabledServices(this.tabRecoveryProviders)) {
+        for (const provider of this.config.enabledServices(this.tabRecoveryProviders)) {
             try {
-                let tab = await provider.recover(token)
+                const tab = await provider.recover(token)
                 if (tab) {
                     return tab
                 }
@@ -43,9 +43,9 @@ export class TabRecoveryService {
 
     async recoverTabs (): Promise<RecoveredTab[]> {
         if (window.localStorage.tabsRecovery) {
-            let tabs: RecoveredTab[] = []
-            for (let token of JSON.parse(window.localStorage.tabsRecovery)) {
-                let tab = await this.recoverTab(token)
+            const tabs: RecoveredTab[] = []
+            for (const token of JSON.parse(window.localStorage.tabsRecovery)) {
+                const tab = await this.recoverTab(token)
                 if (tab) {
                     tabs.push(tab)
                 }

+ 5 - 5
terminus-core/src/services/tabs.service.ts

@@ -17,9 +17,9 @@ export class TabsService {
      * Instantiates a tab component and assigns given inputs
      */
     create (type: TabComponentType, inputs?: any): BaseTabComponent {
-        let componentFactory = this.componentFactoryResolver.resolveComponentFactory(type)
-        let componentRef = componentFactory.create(this.injector)
-        let tab = componentRef.instance
+        const componentFactory = this.componentFactoryResolver.resolveComponentFactory(type)
+        const componentRef = componentFactory.create(this.injector)
+        const tab = componentRef.instance
         tab.hostView = componentRef.hostView
         Object.assign(tab, inputs || {})
         return tab
@@ -29,11 +29,11 @@ export class TabsService {
      * Duplicates an existing tab instance (using the tab recovery system)
      */
     async duplicate (tab: BaseTabComponent): Promise<BaseTabComponent> {
-        let token = await tab.getRecoveryToken()
+        const token = await tab.getRecoveryToken()
         if (!token) {
             return null
         }
-        let dup = await this.tabRecovery.recoverTab(token)
+        const dup = await this.tabRecovery.recoverTab(token)
         if (dup) {
             return this.create(dup.type, dup.options)
         }

+ 6 - 6
terminus-core/src/services/touchbar.service.ts

@@ -28,19 +28,19 @@ export class TouchbarService {
         app.tabsChanged$.subscribe(() => this.updateTabs())
         app.activeTabChange$.subscribe(() => this.updateTabs())
 
-        let activityIconPath = `${electron.app.getAppPath()}/assets/activity.png`
-        let activityIcon = this.electron.nativeImage.createFromPath(activityIconPath)
+        const activityIconPath = `${electron.app.getAppPath()}/assets/activity.png`
+        const activityIcon = this.electron.nativeImage.createFromPath(activityIconPath)
         app.tabOpened$.subscribe(tab => {
             tab.titleChange$.subscribe(title => {
-                let segment = this.tabSegments[app.tabs.indexOf(tab)]
+                const segment = this.tabSegments[app.tabs.indexOf(tab)]
                 if (segment) {
                     segment.label = this.shortenTitle(title)
                     this.tabsSegmentedControl.segments = this.tabSegments
                 }
             })
             tab.activity$.subscribe(hasActivity => {
-                let showIcon = this.app.activeTab !== tab && hasActivity
-                let segment = this.tabSegments[app.tabs.indexOf(tab)]
+                const showIcon = this.app.activeTab !== tab && hasActivity
+                const segment = this.tabSegments[app.tabs.indexOf(tab)]
                 if (segment) {
                     segment.icon = showIcon ? activityIcon : null
                 }
@@ -87,7 +87,7 @@ export class TouchbarService {
             })
         })
 
-        let touchBar = new this.electron.TouchBar({
+        const touchBar = new this.electron.TouchBar({
             items: [
                 this.tabsSegmentedControl,
                 new this.electron.TouchBar.TouchBarSpacer({ size: 'flexible' }),

+ 3 - 3
terminus-core/src/services/updater.service.ts

@@ -49,9 +49,9 @@ export class UpdaterService {
     async check (): Promise<boolean> {
         if (!this.electronUpdaterAvailable) {
             this.logger.debug('Checking for updates')
-            let response = await axios.get(UPDATES_URL)
-            let data = response.data
-            let version = data.tag_name.substring(1)
+            const response = await axios.get(UPDATES_URL)
+            const data = response.data
+            const version = data.tag_name.substring(1)
             if (this.electron.app.getVersion() !== version) {
                 this.logger.info('Update available')
                 this.updateURL = data.html_url

+ 4 - 4
terminus-core/src/tabContextMenu.ts

@@ -27,7 +27,7 @@ export class CloseContextMenu extends TabContextMenuItemProvider {
             {
                 label: 'Close other tabs',
                 click: () => this.zone.run(() => {
-                    for (let t of this.app.tabs.filter(x => x !== tab)) {
+                    for (const t of this.app.tabs.filter(x => x !== tab)) {
                         this.app.closeTab(t, true)
                     }
                 })
@@ -35,7 +35,7 @@ export class CloseContextMenu extends TabContextMenuItemProvider {
             {
                 label: 'Close tabs to the right',
                 click: () => this.zone.run(() => {
-                    for (let t of this.app.tabs.slice(this.app.tabs.indexOf(tab) + 1)) {
+                    for (const t of this.app.tabs.slice(this.app.tabs.indexOf(tab) + 1)) {
                         this.app.closeTab(t, true)
                     }
                 })
@@ -43,7 +43,7 @@ export class CloseContextMenu extends TabContextMenuItemProvider {
             {
                 label: 'Close tabs to the left',
                 click: () => this.zone.run(() => {
-                    for (let t of this.app.tabs.slice(0, this.app.tabs.indexOf(tab))) {
+                    for (const t of this.app.tabs.slice(0, this.app.tabs.indexOf(tab))) {
                         this.app.closeTab(t, true)
                     }
                 })
@@ -111,7 +111,7 @@ export class TaskCompletionContextMenu extends TabContextMenuItemProvider {
     }
 
     async getItems (tab: BaseTabComponent): Promise<Electron.MenuItemConstructorOptions[]> {
-        let process = await tab.getCurrentProcess()
+        const process = await tab.getCurrentProcess()
         if (process) {
             return [
                 {

+ 1 - 1
terminus-core/tsconfig.json

@@ -2,6 +2,6 @@
   "extends": "../tsconfig.json",
   "exclude": ["node_modules", "dist"],
   "compilerOptions": {
-    "baseUrl": "src",
+    "baseUrl": "src"
   }
 }

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

@@ -44,7 +44,7 @@ export class PluginsSettingsTabComponent {
                 })
             )
         this.availablePlugins$.pipe(first()).subscribe(available => {
-            for (let plugin of this.pluginManager.installedPlugins) {
+            for (const plugin of this.pluginManager.installedPlugins) {
                 this.knownUpgrades[plugin.name] = available.find(x => x.name === plugin.name && semver.gt(x.version, plugin.version))
             }
         })

+ 1 - 1
terminus-settings/src/buttonProvider.ts

@@ -34,7 +34,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
     }
 
     open (): void {
-        let settingsTab = this.app.tabs.find(tab => tab instanceof SettingsTabComponent)
+        const settingsTab = this.app.tabs.find(tab => tab instanceof SettingsTabComponent)
         if (settingsTab) {
             this.app.selectTab(settingsTab)
         } else {

+ 2 - 2
terminus-settings/src/components/settingsTab.component.ts

@@ -124,7 +124,7 @@ export class SettingsTabComponent extends BaseTabComponent {
 
     getHotkey (id: string) {
         let ptr = this.config.store.hotkeys
-        for (let token of id.split(/\./g)) {
+        for (const token of id.split(/\./g)) {
             ptr = ptr[token]
         }
         return ptr
@@ -133,7 +133,7 @@ export class SettingsTabComponent extends BaseTabComponent {
     setHotkey (id: string, value) {
         let ptr = this.config.store
         let prop = 'hotkeys'
-        for (let token of id.split(/\./g)) {
+        for (const token of id.split(/\./g)) {
             ptr = ptr[prop]
             prop = token
         }

+ 4 - 4
terminus-ssh/src/api.ts

@@ -43,16 +43,16 @@ export class SSHSession extends BaseSession {
         this.open = true
 
         this.shell.on('data', data => {
-            let dataString = data.toString()
+            const dataString = data.toString()
             this.emitOutput(dataString)
 
             if (this.scripts) {
                 let found = false
-                for (let script of this.scripts) {
+                for (const script of this.scripts) {
                     let match = false
                     let cmd = ''
                     if (script.isRegex) {
-                        let re = new RegExp(script.expect, 'g')
+                        const re = new RegExp(script.expect, 'g')
                         if (dataString.match(re)) {
                             cmd = dataString.replace(re, script.send)
                             match = true
@@ -128,7 +128,7 @@ export class SSHSession extends BaseSession {
 
     private executeUnconditionalScripts () {
         if (this.scripts) {
-            for (let script of this.scripts) {
+            for (const script of this.scripts) {
                 if (!script.expect) {
                     console.log('Executing script:', script.send)
                     this.shell.write(script.send + '\n')

+ 7 - 7
terminus-ssh/src/components/editConnectionModal.component.ts

@@ -26,7 +26,7 @@ export class EditConnectionModalComponent {
     ) {
         this.newScript = { expect: '', send: '' }
 
-        for (let k of Object.values(SSHAlgorithmType)) {
+        for (const k of Object.values(SSHAlgorithmType)) {
             this.supportedAlgorithms[k] = ALGORITHMS[{
                 [SSHAlgorithmType.KEX]: 'SUPPORTED_KEX',
                 [SSHAlgorithmType.HOSTKEY]: 'SUPPORTED_SERVER_HOST_KEY',
@@ -45,13 +45,13 @@ export class EditConnectionModalComponent {
     async ngOnInit () {
         this.hasSavedPassword = !!(await this.passwordStorage.loadPassword(this.connection))
         this.connection.algorithms = this.connection.algorithms || {}
-        for (let k of Object.values(SSHAlgorithmType)) {
+        for (const k of Object.values(SSHAlgorithmType)) {
             if (!this.connection.algorithms[k]) {
                 this.connection.algorithms[k] = this.defaultAlgorithms[k]
             }
 
             this.algorithms[k] = {}
-            for (let alg of this.connection.algorithms[k]) {
+            for (const alg of this.connection.algorithms[k]) {
                 this.algorithms[k][alg] = true
             }
         }
@@ -63,7 +63,7 @@ export class EditConnectionModalComponent {
     }
 
     selectPrivateKey () {
-        let path = this.electron.dialog.showOpenDialog(
+        const path = this.electron.dialog.showOpenDialog(
             this.hostApp.getWindow(),
             {
                 title: 'Select private key',
@@ -75,7 +75,7 @@ export class EditConnectionModalComponent {
     }
 
     save () {
-        for (let k of Object.values(SSHAlgorithmType)) {
+        for (const k of Object.values(SSHAlgorithmType)) {
             this.connection.algorithms[k] = Object.entries(this.algorithms[k])
                 .filter(([k, v]) => !!v)
                 .map(([k, v]) => k)
@@ -88,7 +88,7 @@ export class EditConnectionModalComponent {
     }
 
     moveScriptUp (script: LoginScript) {
-        let index = this.connection.scripts.indexOf(script)
+        const index = this.connection.scripts.indexOf(script)
         if (index > 0) {
             this.connection.scripts.splice(index, 1)
             this.connection.scripts.splice(index - 1, 0, script)
@@ -96,7 +96,7 @@ export class EditConnectionModalComponent {
     }
 
     moveScriptDown (script: LoginScript) {
-        let index = this.connection.scripts.indexOf(script)
+        const index = this.connection.scripts.indexOf(script)
         if (index >= 0 && index < this.connection.scripts.length - 1) {
             this.connection.scripts.splice(index, 1)
             this.connection.scripts.splice(index + 1, 0, script)

+ 2 - 2
terminus-ssh/src/components/sshModal.component.ts

@@ -47,7 +47,7 @@ export class SSHModalComponent {
             host = host.split(':')[0]
         }
 
-        let connection: SSHConnection = {
+        const connection: SSHConnection = {
             name: this.quickTarget,
             host, user, port
         }
@@ -88,7 +88,7 @@ export class SSHModalComponent {
             connections = connections.filter(connection => (connection.name + connection.group).toLowerCase().includes(this.quickTarget))
         }
 
-        for (let connection of connections) {
+        for (const connection of connections) {
             connection.group = connection.group || null
             let group = this.childGroups.find(x => x.name === connection.group)
             if (!group) {

+ 7 - 7
terminus-ssh/src/components/sshSettingsTab.component.ts

@@ -25,14 +25,14 @@ export class SSHSettingsTabComponent {
     }
 
     createConnection () {
-        let connection: SSHConnection = {
+        const connection: SSHConnection = {
             name: '',
             host: '',
             port: 22,
             user: 'root',
         }
 
-        let modal = this.ngbModal.open(EditConnectionModalComponent)
+        const modal = this.ngbModal.open(EditConnectionModalComponent)
         modal.componentInstance.connection = connection
         modal.result.then(result => {
             this.connections.push(result)
@@ -43,7 +43,7 @@ export class SSHSettingsTabComponent {
     }
 
     editConnection (connection: SSHConnection) {
-        let modal = this.ngbModal.open(EditConnectionModalComponent)
+        const modal = this.ngbModal.open(EditConnectionModalComponent)
         modal.componentInstance.connection = Object.assign({}, connection)
         modal.result.then(result => {
             Object.assign(connection, result)
@@ -71,12 +71,12 @@ export class SSHSettingsTabComponent {
     }
 
     editGroup (group: ISSHConnectionGroup) {
-        let modal = this.ngbModal.open(PromptModalComponent)
+        const modal = this.ngbModal.open(PromptModalComponent)
         modal.componentInstance.prompt = 'New group name'
         modal.componentInstance.value = group.name
         modal.result.then(result => {
             if (result) {
-                for (let connection of this.connections.filter(x => x.group === group.name)) {
+                for (const connection of this.connections.filter(x => x.group === group.name)) {
                     connection.group = result
                 }
                 this.config.store.ssh.connections = this.connections
@@ -96,7 +96,7 @@ export class SSHSettingsTabComponent {
                 defaultId: 1,
             }
         )).response === 1) {
-            for (let connection of this.connections.filter(x => x.group === group.name)) {
+            for (const connection of this.connections.filter(x => x.group === group.name)) {
                 connection.group = null
             }
             this.config.save()
@@ -108,7 +108,7 @@ export class SSHSettingsTabComponent {
         this.connections = this.config.store.ssh.connections
         this.childGroups = []
 
-        for (let connection of this.connections) {
+        for (const connection of this.connections) {
             connection.group = connection.group || null
             let group = this.childGroups.find(x => x.name === connection.group)
             if (!group) {

+ 1 - 1
terminus-ssh/src/components/sshTab.component.ts

@@ -44,7 +44,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
         this.session = new SSHSession(this.connection)
         this.attachSessionHandlers()
         this.write(`Connecting to ${this.connection.host}`)
-        let interval = setInterval(() => this.write('.'), 500)
+        const interval = setInterval(() => this.write('.'), 500)
         try {
             await this.ssh.connectSession(this.session, message => {
                 this.write('\r\n' + message)

+ 10 - 10
terminus-ssh/src/services/ssh.service.ts

@@ -55,7 +55,7 @@ export class SSHService {
         }
 
         if (!privateKeyPath) {
-            let userKeyPath = path.join(process.env.HOME, '.ssh', 'id_rsa')
+            const userKeyPath = path.join(process.env.HOME, '.ssh', 'id_rsa')
             if (await fs.exists(userKeyPath)) {
                 log(`Using user's default private key: ${userKeyPath}`)
                 privateKeyPath = userKeyPath
@@ -78,7 +78,7 @@ export class SSHService {
                     encrypted = encrypted || privateKey.includes('Encryption:') && !privateKey.includes('Encryption: none')
                 }
                 if (encrypted) {
-                    let modal = this.ngbModal.open(PromptModalComponent)
+                    const modal = this.ngbModal.open(PromptModalComponent)
                     log('Key requires passphrase')
                     modal.componentInstance.prompt = 'Private key passphrase'
                     modal.componentInstance.password = true
@@ -89,7 +89,7 @@ export class SSHService {
             }
         }
 
-        let ssh = new Client()
+        const ssh = new Client()
         let connected = false
         let savedPassword: string = null
         await new Promise(async (resolve, reject) => {
@@ -113,9 +113,9 @@ export class SSHService {
             ssh.on('keyboard-interactive', (name, instructions, instructionsLang, prompts, finish) => this.zone.run(async () => {
                 log(`Keyboard-interactive auth requested: ${name}`)
                 this.logger.info('Keyboard-interactive auth:', name, instructions, instructionsLang)
-                let results = []
-                for (let prompt of prompts) {
-                    let modal = this.ngbModal.open(PromptModalComponent)
+                const results = []
+                for (const prompt of prompts) {
+                    const modal = this.ngbModal.open(PromptModalComponent)
                     modal.componentInstance.prompt = prompt.prompt
                     modal.componentInstance.password = !prompt.echo
                     results.push(await modal.result)
@@ -133,7 +133,7 @@ export class SSHService {
 
             let agent: string = null
             if (this.hostApp.platform === Platform.Windows) {
-                let pageantRunning = new Promise<boolean>(resolve => {
+                const pageantRunning = new Promise<boolean>(resolve => {
                     windowsProcessTree.getProcessList(list => {
                         resolve(list.some(x => x.name === 'pageant.exe'))
                     }, 0)
@@ -180,7 +180,7 @@ export class SSHService {
                 }
 
                 if (!keychainPasswordUsed) {
-                    let password = await this.passwordStorage.loadPassword(session.connection)
+                    const password = await this.passwordStorage.loadPassword(session.connection)
                     if (password) {
                         log('Trying saved password')
                         keychainPasswordUsed = true
@@ -188,7 +188,7 @@ export class SSHService {
                     }
                 }
 
-                let modal = this.ngbModal.open(PromptModalComponent)
+                const modal = this.ngbModal.open(PromptModalComponent)
                 modal.componentInstance.prompt = `Password for ${session.connection.user}@${session.connection.host}`
                 modal.componentInstance.password = true
                 try {
@@ -201,7 +201,7 @@ export class SSHService {
         })
 
         try {
-            let shell: any = await new Promise<any>((resolve, reject) => {
+            const shell: any = await new Promise<any>((resolve, reject) => {
                 ssh.shell({ term: 'xterm-256color' }, (err, shell) => {
                     if (err) {
                         reject(err)

+ 5 - 5
terminus-terminal/src/api/baseTerminalTab.component.ts

@@ -211,7 +211,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
 
     async buildContextMenu (): Promise<Electron.MenuItemConstructorOptions[]> {
         let items: Electron.MenuItemConstructorOptions[] = []
-        for (let section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this)))) {
+        for (const section of await Promise.all(this.contextMenuProviders.map(x => x.getItems(this)))) {
             items = items.concat(section)
             items.push({ type: 'separator' })
         }
@@ -220,7 +220,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
     }
 
     protected detachTermContainerHandlers () {
-        for (let subscription of this.termContainerSubscriptions) {
+        for (const subscription of this.termContainerSubscriptions) {
             subscription.unsubscribe()
         }
         this.termContainerSubscriptions = []
@@ -277,7 +277,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
                         }
                     } else if (event.altKey) {
                         event.preventDefault()
-                        let delta = Math.round(wheelDeltaY / 50)
+                        const delta = Math.round(wheelDeltaY / 50)
                         this.sendInput(((delta > 0) ? '\u001bOA' : '\u001bOB').repeat(Math.abs(delta)))
                     }
                 }
@@ -316,9 +316,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
      * Feeds input into the terminal frontend
      */
     write (data: string) {
-        let percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
+        const percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
         if (percentageMatch) {
-            let percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
+            const percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
             if (percentage > 0 && percentage <= 100) {
                 this.setProgress(percentage)
                 this.logger.debug('Detected progress:', percentage)

+ 3 - 3
terminus-terminal/src/buttonProvider.ts

@@ -18,8 +18,8 @@ export class ButtonProvider extends ToolbarButtonProvider {
         super()
         if (!electron.remote.process.env.TERMINUS_DEV) {
             setImmediate(async () => {
-                let argv: string[] = electron.remote.process.argv
-                for (let arg of argv.slice(1).concat([electron.remote.process.argv0])) {
+                const argv: string[] = electron.remote.process.argv
+                for (const arg of argv.slice(1).concat([electron.remote.process.argv0])) {
                     if (await fs.exists(arg)) {
                         if ((await fs.stat(arg)).isDirectory()) {
                             this.terminal.openTab(null, arg)
@@ -44,7 +44,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
                 icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/profiles.svg')),
                 title: 'New terminal with profile',
                 submenu: async () => {
-                    let profiles = await this.terminal.getProfiles()
+                    const profiles = await this.terminal.getProfiles()
                     return profiles.map(profile => ({
                         icon: profile.icon,
                         title: profile.name,

+ 4 - 4
terminus-terminal/src/colorSchemes.ts

@@ -8,15 +8,15 @@ import { ITerminalColorScheme } from './api/interfaces'
 @Injectable()
 export class HyperColorSchemes extends TerminalColorSchemeProvider {
     async getSchemes (): Promise<ITerminalColorScheme[]> {
-        let pluginsPath = path.join(process.env.HOME, '.hyper_plugins', 'node_modules')
+        const pluginsPath = path.join(process.env.HOME, '.hyper_plugins', 'node_modules')
         if (!(await fs.exists(pluginsPath))) return []
-        let plugins = await fs.readdir(pluginsPath)
+        const plugins = await fs.readdir(pluginsPath)
 
-        let themes: ITerminalColorScheme[] = []
+        const themes: ITerminalColorScheme[] = []
 
         plugins.forEach(plugin => {
             try {
-                let module = (global as any).require(path.join(pluginsPath, plugin))
+                const module = (global as any).require(path.join(pluginsPath, plugin))
                 if (module.decorateConfig) {
                     let config: any
                     try {

+ 1 - 1
terminus-terminal/src/components/appearanceSettingsTab.component.ts

@@ -31,7 +31,7 @@ export class AppearanceSettingsTabComponent {
 
     async ngOnInit () {
         if (this.hostApp.platform === Platform.Windows || this.hostApp.platform === Platform.macOS) {
-            let fonts = await new Promise<any[]>((resolve) => fontManager.findFonts({ monospace: true }, resolve))
+            const fonts = await new Promise<any[]>((resolve) => fontManager.findFonts({ monospace: true }, resolve))
             this.fonts = fonts.map(x => (x.family + ' ' + x.style).trim())
             this.fonts.sort()
         }

+ 1 - 1
terminus-terminal/src/components/colorPicker.component.ts

@@ -29,7 +29,7 @@ export class ColorPickerComponent {
         if (!this.isOpen) {
             return
         }
-        let windowRef = (this.popover as any)._windowRef
+        const windowRef = (this.popover as any)._windowRef
         if (!windowRef) {
             return
         }

+ 2 - 2
terminus-terminal/src/components/environmentEditor.component.ts

@@ -22,8 +22,8 @@ export class EnvironmentEditorComponent {
     }
 
     getModel () {
-        let model = {}
-        for (let pair of this.vars) {
+        const model = {}
+        for (const pair of this.vars) {
             model[pair.key] = pair.value
         }
         return model

+ 4 - 4
terminus-terminal/src/components/shellSettingsTab.component.ts

@@ -51,8 +51,8 @@ export class ShellSettingsTabComponent {
     }
 
     pickWorkingDirectory () {
-        let shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
-        let paths = this.electron.dialog.showOpenDialog(
+        const shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
+        const paths = this.electron.dialog.showOpenDialog(
             this.hostApp.getWindow(),
             {
                 defaultPath: shell.fsBase,
@@ -65,7 +65,7 @@ export class ShellSettingsTabComponent {
     }
 
     newProfile (shell: IShell) {
-        let profile: Profile = {
+        const profile: Profile = {
             name: shell.name,
             sessionOptions: this.terminalService.optionsFromShell(shell),
         }
@@ -75,7 +75,7 @@ export class ShellSettingsTabComponent {
     }
 
     editProfile (profile: Profile) {
-        let modal = this.ngbModal.open(EditProfileModalComponent)
+        const modal = this.ngbModal.open(EditProfileModalComponent)
         modal.componentInstance.profile = Object.assign({}, profile)
         modal.result.then(result => {
             Object.assign(profile, result)

+ 4 - 4
terminus-terminal/src/components/terminalTab.component.ts

@@ -22,7 +22,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
         this.logger = this.log.create('terminalTab')
         this.session = new Session(this.config)
 
-        let isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
+        const isConPTY = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY
 
         this.homeEndSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => {
             if (!this.hasFocus) {
@@ -58,7 +58,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
     }
 
     async getRecoveryToken (): Promise<any> {
-        let cwd = this.session ? await this.session.getWorkingDirectory() : null
+        const cwd = this.session ? await this.session.getWorkingDirectory() : null
         return {
             type: 'app:terminal-tab',
             sessionOptions: {
@@ -69,7 +69,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
     }
 
     async getCurrentProcess (): Promise<BaseTabProcess> {
-        let children = await this.session.getChildProcesses()
+        const children = await this.session.getChildProcesses()
         if (!children.length) {
             return null
         }
@@ -79,7 +79,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
     }
 
     async canClose (): Promise<boolean> {
-        let children = await this.session.getChildProcesses()
+        const children = await this.session.getChildProcesses()
         if (children.length === 0) {
             return true
         }

+ 2 - 2
terminus-terminal/src/contextMenu.ts

@@ -21,9 +21,9 @@ export class NewTabContextMenu extends TerminalContextMenuItemProvider {
     }
 
     async getItems (tab: BaseTerminalTabComponent): Promise<Electron.MenuItemConstructorOptions[]> {
-        let profiles = await this.terminalService.getProfiles()
+        const profiles = await this.terminalService.getProfiles()
 
-        let items: Electron.MenuItemConstructorOptions[] = [
+        const items: Electron.MenuItemConstructorOptions[] = [
             {
                 label: 'New terminal',
                 click: () => this.zone.run(() => {

+ 1 - 1
terminus-terminal/src/frontends/frontend.ts

@@ -43,7 +43,7 @@ export abstract class Frontend {
     detach (host: HTMLElement): void { } // tslint:disable-line
 
     destroy (): void {
-        for (let o of [
+        for (const o of [
             this.ready,
             this.title,
             this.alternateScreenActive,

+ 7 - 7
terminus-terminal/src/frontends/hterm.ts

@@ -46,7 +46,7 @@ hterm.lib.wc.charWidthDisregardAmbiguous = codepoint => {
 }
 
 hterm.hterm.Terminal.prototype.applyCursorShape = function () {
-    let modes = [
+    const modes = [
         [hterm.hterm.Terminal.cursorShape.BLOCK, true],
         [this.defaultCursorShape || hterm.hterm.Terminal.cursorShape.BLOCK, false],
         [hterm.hterm.Terminal.cursorShape.BLOCK, false],
@@ -55,7 +55,7 @@ hterm.hterm.Terminal.prototype.applyCursorShape = function () {
         [hterm.hterm.Terminal.cursorShape.BEAM, true],
         [hterm.hterm.Terminal.cursorShape.BEAM, false],
     ]
-    let modeNumber = this.cursorMode || 1
+    const modeNumber = this.cursorMode || 1
     if (modeNumber >= modes.length) {
         console.warn('Unknown cursor style: ' + modeNumber)
         return
@@ -76,14 +76,14 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
 }
 
 hterm.hterm.VT.OSC['4'] = function (parseState) {
-    let args = parseState.args[0].split(';')
+    const args = parseState.args[0].split(';')
 
-    let pairCount = args.length / 2
-    let colorPalette = this.terminal.getTextAttributes().colorPalette
-    let responseArray = []
+    const pairCount = args.length / 2
+    const colorPalette = this.terminal.getTextAttributes().colorPalette
+    const responseArray = []
 
     for (let pairNumber = 0; pairNumber < pairCount; ++pairNumber) {
-        let colorIndex = parseInt(args[pairNumber * 2])
+        const colorIndex = parseInt(args[pairNumber * 2])
         let colorValue = args[pairNumber * 2 + 1]
 
         if (colorIndex >= colorPalette.length) {

+ 6 - 6
terminus-terminal/src/frontends/htermFrontend.ts

@@ -54,7 +54,7 @@ export class HTermFrontend extends Frontend {
     }
 
     configure (): void {
-        let config = this.configService.store
+        const config = this.configService.store
 
         this.configuredFontSize = config.terminal.fontSize
         this.configuredLinePadding = config.terminal.linePadding
@@ -157,7 +157,7 @@ export class HTermFrontend extends Frontend {
     }
 
     private setFontSize () {
-        let size = this.configuredFontSize * Math.pow(1.1, this.zoom)
+        const size = this.configuredFontSize * Math.pow(1.1, this.zoom)
         preferenceManager.set('font-size', size)
         if (this.term) {
             setTimeout(() => {
@@ -229,7 +229,7 @@ export class HTermFrontend extends Frontend {
 
         this.term.ringBell = () => this.bell.next()
 
-        for (let screen of [this.term.primaryScreen_, this.term.alternateScreen_]) {
+        for (const screen of [this.term.primaryScreen_, this.term.alternateScreen_]) {
             const _insertString = screen.insertString.bind(screen)
             screen.insertString = (data) => {
                 _insertString(data)
@@ -238,7 +238,7 @@ export class HTermFrontend extends Frontend {
 
             const _deleteChars = screen.deleteChars.bind(screen)
             screen.deleteChars = (count) => {
-                let ret = _deleteChars(count)
+                const ret = _deleteChars(count)
                 this.contentUpdated.next()
                 return ret
             }
@@ -246,7 +246,7 @@ export class HTermFrontend extends Frontend {
             const _expandSelection = screen.expandSelection.bind(screen)
             screen.expandSelection = (selection) => {
                 // Drop whitespace at the end of selection
-                let range = selection.getRangeAt(0)
+                const range = selection.getRangeAt(0)
                 if (range.endOffset > 0 && range.endContainer.nodeType === 3 && range.endContainer.textContent !== '') {
                     while (/[\s\S]+\s$/.test(range.endContainer.textContent.substr(0,range.endOffset))) {
                         range.setEnd(range.endContainer, range.endOffset - 1)
@@ -258,7 +258,7 @@ export class HTermFrontend extends Frontend {
 
         const _measureCharacterSize = this.term.scrollPort_.measureCharacterSize.bind(this.term.scrollPort_)
         this.term.scrollPort_.measureCharacterSize = () => {
-            let size = _measureCharacterSize()
+            const size = _measureCharacterSize()
             size.height += this.configuredLinePadding
             return size
         }

+ 5 - 5
terminus-terminal/src/frontends/xtermFrontend.ts

@@ -123,7 +123,7 @@ export class XTermFrontend extends Frontend {
         host.addEventListener('mouseup', event => this.mouseEvent.next(event as MouseEvent))
         host.addEventListener('mousewheel', event => this.mouseEvent.next(event as MouseEvent))
 
-        let ro = new window['ResizeObserver'](() => this.resizeHandler())
+        const ro = new window['ResizeObserver'](() => this.resizeHandler())
         ro.observe(host)
     }
 
@@ -167,7 +167,7 @@ export class XTermFrontend extends Frontend {
     }
 
     configure (): void {
-        let config = this.configService.store
+        const config = this.configService.store
 
         setImmediate(() => {
             if (this.xterm.cols && this.xterm.rows && this.xtermCore.charMeasure) {
@@ -194,7 +194,7 @@ export class XTermFrontend extends Frontend {
 
         this.copyOnSelect = config.terminal.copyOnSelect
 
-        let theme: ITheme = {
+        const theme: ITheme = {
             foreground: config.terminal.colorScheme.foreground,
             background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : (config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground),
             cursor: config.terminal.colorScheme.cursor,
@@ -252,7 +252,7 @@ export class XTermFrontend extends Frontend {
 
     private getHexColor (mode: number, color: number): string {
         if (mode === Attributes.CM_RGB) {
-            let rgb = AttributeData.toColorRGB(color)
+            const rgb = AttributeData.toColorRGB(color)
             return rgb.map(x => x.toString(16).padStart(2, '0')).join('')
         }
         if (mode === Attributes.CM_P16 || mode === Attributes.CM_P256) {
@@ -265,7 +265,7 @@ export class XTermFrontend extends Frontend {
         let html = '<div>'
         let lastStyle = null
         const line = (this.xterm.buffer.getLine(y) as any)._line
-        let cell = new CellData()
+        const cell = new CellData()
         for (let i = start; i < end; i++) {
             line.loadCell(i, cell)
             const fg = this.getHexColor(cell.getFgColorMode(), cell.getFgColor())

+ 1 - 1
terminus-terminal/src/hotkeys.ts

@@ -74,7 +74,7 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
     ) { super() }
 
     async provide (): Promise<IHotkeyDescription[]> {
-        let profiles = await this.terminal.getProfiles()
+        const profiles = await this.terminal.getProfiles()
         return [
             ...this.hotkeys,
             ...profiles.map(profile => ({

+ 5 - 5
terminus-terminal/src/index.ts

@@ -131,7 +131,7 @@ export default class TerminalModule {
         hostApp: HostAppService,
         dockMenu: DockMenuService,
     ) {
-        let events = [
+        const events = [
             {
                 name: 'keydown',
                 htermHandler: 'onKeyDown_',
@@ -142,7 +142,7 @@ export default class TerminalModule {
             },
         ]
         events.forEach((event) => {
-            let oldHandler = hterm.hterm.Keyboard.prototype[event.htermHandler]
+            const oldHandler = hterm.hterm.Keyboard.prototype[event.htermHandler]
             hterm.hterm.Keyboard.prototype[event.htermHandler] = function (nativeEvent) {
                 hotkeys.pushKeystroke(event.name, nativeEvent)
                 if (hotkeys.getCurrentPartiallyMatchedHotkeys().length === 0) {
@@ -169,8 +169,8 @@ export default class TerminalModule {
                 hostApp.newWindow()
             }
             if (hotkey.startsWith('profile.')) {
-                let profiles = await terminal.getProfiles()
-                let profile = profiles.find(x => slug(x.name).toLowerCase() === hotkey.split('.')[1])
+                const profiles = await terminal.getProfiles()
+                const profile = profiles.find(x => slug(x.name).toLowerCase() === hotkey.split('.')[1])
                 if (profile) {
                     terminal.openTabWithOptions(profile.sessionOptions)
                 }
@@ -205,7 +205,7 @@ export default class TerminalModule {
         })
 
         hostApp.cliOpenProfile$.subscribe(async profileName => {
-            let profile = config.store.terminal.profiles.find(x => x.name === profileName)
+            const profile = config.store.terminal.profiles.find(x => x.name === profileName)
             if (!profile) {
                 console.error('Requested profile', profileName, 'not found')
                 return

+ 3 - 3
terminus-terminal/src/pathDrop.ts

@@ -15,7 +15,7 @@ export class PathDropDecorator extends TerminalDecorator {
                     event.preventDefault()
                 }),
                 terminal.frontend.drop$.subscribe(event => {
-                    for (let file of event.dataTransfer.files as any) {
+                    for (const file of event.dataTransfer.files as any) {
                         this.injectPath(terminal, file.path)
                     }
                     event.preventDefault()
@@ -32,8 +32,8 @@ export class PathDropDecorator extends TerminalDecorator {
         terminal.sendInput(path + ' ')
     }
 
-    detach (terminal: TerminalTabComponent): void {
-        for (let s of this.subscriptions) {
+    detach (_terminal: TerminalTabComponent): void {
+        for (const s of this.subscriptions) {
             s.unsubscribe()
         }
     }

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

@@ -94,7 +94,7 @@ export class Session extends BaseSession {
     start (options: SessionOptions) {
         this.name = options.name
 
-        let env = {
+        const env = {
             ...process.env,
             TERM: 'xterm-256color',
             TERM_PROGRAM: 'Terminus',
@@ -103,7 +103,7 @@ export class Session extends BaseSession {
         }
 
         if (process.platform === 'darwin' && !process.env.LC_ALL) {
-            let locale = process.env.LC_CTYPE || 'en_US.UTF-8'
+            const locale = process.env.LC_CTYPE || 'en_US.UTF-8'
             Object.assign(env, {
                 LANG: locale,
                 LC_ALL: locale,
@@ -175,9 +175,9 @@ export class Session extends BaseSession {
 
     processOSC1337 (data) {
         if (data.includes(OSC1337Prefix)) {
-            let preData = data.substring(0, data.indexOf(OSC1337Prefix))
+            const preData = data.substring(0, data.indexOf(OSC1337Prefix))
             let params = data.substring(data.indexOf(OSC1337Prefix) + OSC1337Prefix.length)
-            let postData = params.substring(params.indexOf(OSC1337Suffix) + OSC1337Suffix.length)
+            const postData = params.substring(params.indexOf(OSC1337Suffix) + OSC1337Suffix.length)
             params = params.substring(0, params.indexOf(OSC1337Suffix))
 
             if (params.startsWith('CurrentDir=')) {
@@ -216,7 +216,7 @@ export class Session extends BaseSession {
             return []
         }
         if (process.platform === 'darwin') {
-            let processes = await macOSNativeProcessList.getProcessList()
+            const processes = await macOSNativeProcessList.getProcessList()
             return processes.filter(x => x.ppid === this.truePID).map(p => ({
                 pid: p.pid,
                 ppid: p.ppid,
@@ -304,7 +304,7 @@ export class Session extends BaseSession {
     }
 
     private guessWindowsCWD (data: string) {
-        let match = windowsDirectoryRegex.exec(data)
+        const match = windowsDirectoryRegex.exec(data)
         if (match) {
             this.guessedCWD = match[0]
         }

+ 6 - 6
terminus-terminal/src/services/terminal.service.ts

@@ -35,12 +35,12 @@ export class TerminalService {
     }
 
     private async getShells (): Promise<IShell[]> {
-        let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
+        const shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
         return shellLists.reduce((a, b) => a.concat(b), [])
     }
 
     async getProfiles (includeHidden?: boolean): Promise<Profile[]> {
-        let shells = await this.shells$.toPromise()
+        const shells = await this.shells$.toPromise()
         return [
             ...this.config.store.terminal.profiles,
             ...shells.filter(x => includeHidden || !x.hidden).map(shell => ({
@@ -54,7 +54,7 @@ export class TerminalService {
 
     private async reloadShells () {
         this.shells = new AsyncSubject<IShell[]>()
-        let shells = await this.getShells()
+        const shells = await this.getShells()
         this.logger.debug('Shells list:', shells)
         this.shells.next(shells)
         this.shells.complete()
@@ -66,7 +66,7 @@ export class TerminalService {
      */
     async openTab (profile?: Profile, cwd?: string, pause?: boolean): Promise<TerminalTabComponent> {
         if (!profile) {
-            let profiles = await this.getProfiles(true)
+            const profiles = await this.getProfiles(true)
             profile = profiles.find(x => slug(x.name).toLowerCase() === this.config.store.terminal.profile) || profiles[0]
         }
 
@@ -82,7 +82,7 @@ export class TerminalService {
                 cwd = await this.app.activeTab.session.getWorkingDirectory()
             }
             if (this.app.activeTab instanceof SplitTabComponent) {
-                let focusedTab = this.app.activeTab.getFocusedTab()
+                const focusedTab = this.app.activeTab.getFocusedTab()
 
                 if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
                     cwd = await focusedTab.session.getWorkingDirectory()
@@ -93,7 +93,7 @@ export class TerminalService {
         }
 
         this.logger.info(`Starting profile ${profile.name}`, profile)
-        let sessionOptions = {
+        const sessionOptions = {
             ...profile.sessionOptions,
             pauseAfterExit: pause,
             cwd,

+ 1 - 1
terminus-terminal/src/services/terminalFrontend.service.ts

@@ -18,7 +18,7 @@ export class TerminalFrontendService {
 
     getFrontend (session?: BaseSession): Frontend {
         if (!session) {
-            let frontend: Frontend = new ({
+            const frontend: Frontend = new ({
                 'xterm': XTermFrontend,
                 'xterm-webgl': XTermWebGLFrontend,
                 'hterm': HTermFrontend,

+ 1 - 1
terminus-terminal/src/services/uac.service.ts

@@ -33,7 +33,7 @@ export class UACService {
             )
         }
 
-        let options = { ...sessionOptions }
+        const options = { ...sessionOptions }
         options.args = [options.command, ...options.args]
         options.command = helperPath
         return options

+ 1 - 1
terminus-terminal/src/shells/custom.ts

@@ -14,7 +14,7 @@ export class CustomShellProvider extends ShellProvider {
     }
 
     async provide (): Promise<IShell[]> {
-        let args = this.config.store.terminal.customShell.split(' ')
+        const args = this.config.store.terminal.customShell.split(' ')
         return [{
             id: 'custom',
             name: 'Custom shell',

+ 1 - 1
terminus-terminal/src/shells/cygwin32.ts

@@ -25,7 +25,7 @@ export class Cygwin32ShellProvider extends ShellProvider {
             return []
         }
 
-        let cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
+        const cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
 
         if (!cygwinPath) {
             return []

+ 1 - 1
terminus-terminal/src/shells/cygwin64.ts

@@ -25,7 +25,7 @@ export class Cygwin64ShellProvider extends ShellProvider {
             return []
         }
 
-        let cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\Cygwin\\setup', 'rootdir')
+        const cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\Cygwin\\setup', 'rootdir')
 
         if (!cygwinPath) {
             return []

+ 1 - 1
terminus-terminal/src/shells/linuxDefault.ts

@@ -22,7 +22,7 @@ export class LinuxDefaultShellProvider extends ShellProvider {
         if (this.hostApp.platform !== Platform.Linux) {
             return []
         }
-        let line = (await fs.readFile('/etc/passwd', { encoding: 'utf-8' }))
+        const line = (await fs.readFile('/etc/passwd', { encoding: 'utf-8' }))
             .split('\n').find(x => x.startsWith(process.env.LOGNAME + ':'))
         if (!line) {
             this.logger.warn('Could not detect user shell')

+ 1 - 1
terminus-terminal/src/shells/macDefault.ts

@@ -18,7 +18,7 @@ export class MacOSDefaultShellProvider extends ShellProvider {
         if (this.hostApp.platform !== Platform.macOS) {
             return []
         }
-        let shellEntry = (await exec(`/usr/bin/dscl . -read /Users/${process.env.LOGNAME} UserShell`))[0].toString()
+        const shellEntry = (await exec(`/usr/bin/dscl . -read /Users/${process.env.LOGNAME} UserShell`))[0].toString()
         return [{
             id: 'default',
             name: 'User default',

+ 3 - 3
terminus-terminal/src/shells/winDefault.ts

@@ -32,10 +32,10 @@ export class WindowsDefaultShellProvider extends ShellProvider {
             return []
         }
         // Figure out a sensible default
-        let shellLists = await Promise.all(this.providers.map(x => x.provide()))
-        for (let list of shellLists) {
+        const shellLists = await Promise.all(this.providers.map(x => x.provide()))
+        for (const list of shellLists) {
             if (list.length) {
-                let shell = list[list.length - 1]
+                const shell = list[list.length - 1]
 
                 return [{
                     ...shell,

+ 5 - 5
terminus-terminal/src/shells/wsl.ts

@@ -29,7 +29,7 @@ export class WSLShellProvider extends ShellProvider {
         const bashPath = `${process.env.windir}\\system32\\bash.exe`
         const wslPath = `${process.env.windir}\\system32\\wsl.exe`
 
-        let shells: IShell[] = [{
+        const shells: IShell[] = [{
             id: 'wsl',
             name: 'WSL / Default distro',
             command: wslPath,
@@ -40,7 +40,7 @@ export class WSLShellProvider extends ShellProvider {
         }]
 
         const lxssPath = 'Software\\Microsoft\\Windows\\CurrentVersion\\Lxss'
-        let lxss = wnr.getRegistryKey(wnr.HK.CU, lxssPath)
+        const lxss = wnr.getRegistryKey(wnr.HK.CU, lxssPath)
         if (!lxss || !lxss.DefaultDistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
             if (await fs.exists(bashPath)) {
                 return [{
@@ -56,12 +56,12 @@ export class WSLShellProvider extends ShellProvider {
                 return []
             }
         }
-        for (let child of wnr.listRegistrySubkeys(wnr.HK.CU, lxssPath)) {
-            let childKey = wnr.getRegistryKey(wnr.HK.CU, lxssPath + '\\' + child)
+        for (const child of wnr.listRegistrySubkeys(wnr.HK.CU, lxssPath)) {
+            const childKey = wnr.getRegistryKey(wnr.HK.CU, lxssPath + '\\' + child)
             if (!childKey.DistributionName) {
                 continue
             }
-            let name = childKey.DistributionName.value
+            const name = childKey.DistributionName.value
             shells.push({
                 id: `wsl-${slug(name)}`,
                 name: `WSL / ${name}`,

+ 1 - 1
terminus-terminal/src/tabContextMenu.ts

@@ -22,7 +22,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
             {
                 label: 'Save as profile',
                 click: () => this.zone.run(async () => {
-                    let profile = {
+                    const profile = {
                         sessionOptions: {
                             ...tab.sessionOptions,
                             cwd: (await tab.session.getWorkingDirectory()) || tab.sessionOptions.cwd,

+ 1 - 0
tslint.json

@@ -10,6 +10,7 @@
       "spaces"
     ],
     "ter-indent": [true, 4],
+    "prefer-const": true,
     "trailing-comma": [
       true,
       {