This commit is contained in:
Eugene Pankov 2021-07-07 21:33:26 +02:00
parent 4534eefc1d
commit a159890cba
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
12 changed files with 40 additions and 34 deletions

View file

@ -36,7 +36,9 @@ rules:
'@typescript-eslint/prefer-readonly': off
'@typescript-eslint/require-await': off
'@typescript-eslint/strict-boolean-expressions': off
'@typescript-eslint/no-misused-promises': off
'@typescript-eslint/no-misused-promises':
- error
- checksVoidReturn: false
'@typescript-eslint/typedef': off
'@typescript-eslint/consistent-type-imports': off
'@typescript-eslint/sort-type-union-intersection-members': off
@ -95,7 +97,9 @@ rules:
- error
- single
- allowTemplateLiterals: true
'@typescript-eslint/no-confusing-void-expression': off
'@typescript-eslint/no-confusing-void-expression':
- error
- ignoreArrowShorthand: true
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-unnecessary-condition':
- error

View file

@ -453,7 +453,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
async splitTab (tab: BaseTabComponent, dir: SplitDirection): Promise<BaseTabComponent|null> {
const newTab = await this.tabsService.duplicate(tab)
if (newTab) {
this.addTab(newTab, tab, dir)
await this.addTab(newTab, tab, dir)
}
return newTab
}

View file

@ -21,13 +21,13 @@ export class WelcomeTabComponent extends BaseTabComponent {
this.setTitle('Welcome')
}
closeAndDisable () {
async closeAndDisable () {
this.config.store.enableWelcomeTab = false
this.config.store.pluginBlacklist = []
if (!this.enableGlobalHotkey) {
this.config.store.hotkeys['toggle-window'] = []
}
this.config.save()
await this.config.save()
this.hostWindow.reload()
}
}

View file

@ -88,7 +88,7 @@ export class ConfigProxy {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-empty-function
setValue (_key: string, _value: any) { }
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-empty-function
getDefault (_key: string) { }
getDefault (_key: string): any { }
}
@Injectable({ providedIn: 'root' })
@ -195,10 +195,10 @@ export class ConfigService {
/**
* Writes config YAML as string
*/
writeRaw (data: string): void {
async writeRaw (data: string): Promise<void> {
this._store = yaml.load(data)
this.save()
this.load()
await this.save()
await this.load()
this.emitChange()
}

View file

@ -46,10 +46,9 @@ export class HotkeysService {
}
})
})
this.config.ready$.toPromise().then(() => {
this.getHotkeyDescriptions().then(hotkeys => {
this.hotkeyDescriptions = hotkeys
})
this.config.ready$.toPromise().then(async () => {
const hotkeys = await this.getHotkeyDescriptions()
this.hotkeyDescriptions = hotkeys
})
// deprecated

View file

@ -270,7 +270,7 @@ export class VaultFileProvider extends FileProvider {
}
const transfer = transfers[0]
const id = (await wrapPromise(this.zone, promisify(crypto.randomBytes)(32))).toString('hex')
this.vault.addSecret({
await this.vault.addSecret({
type: VAULT_SECRET_TYPE_FILE,
key: {
id,

View file

@ -120,7 +120,7 @@ export class ElectronUpdaterService extends UpdaterService {
async update (): Promise<void> {
if (!this.electronUpdaterAvailable) {
this.electron.shell.openExternal(this.updateURL)
await this.electron.shell.openExternal(this.updateURL)
} else {
if ((await this.platform.showMessageBox(
{

View file

@ -264,7 +264,8 @@ export class Session extends BaseSession {
return new Promise<ChildProcess[]>((resolve, reject) => {
psNode.lookup({ ppid: this.truePID }, (err, processes) => {
if (err) {
return reject(err)
reject(err)
return
}
resolve(processes as ChildProcess[])
})

View file

@ -176,7 +176,8 @@ export class SFTPFileHandle {
while (true) {
const wait = this.sftp.write(this.handle, chunk, 0, chunk.length, this.position, err => {
if (err) {
return reject(err)
reject(err)
return
}
this.position += chunk.length
resolve()
@ -405,7 +406,8 @@ export class SSHSession extends BaseSession {
const forward = this.forwardedPorts.find(x => x.port === details.destPort)
if (!forward) {
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Rejected incoming forwarded connection for unrecognized port ${details.destPort}`)
return reject()
reject()
return
}
const socket = new Socket()
socket.connect(forward.targetPort, forward.targetAddress)
@ -560,7 +562,8 @@ export class SSHSession extends BaseSession {
if (err) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote has rejected the forwarded connection to ${targetAddress}:${targetPort} via ${fw}: ${err}`)
return reject()
reject()
return
}
const socket = accept()
stream.pipe(socket)
@ -587,7 +590,8 @@ export class SSHSession extends BaseSession {
if (err) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote rejected port forwarding for ${fw}: ${err}`)
return reject(err)
reject(err)
return
}
resolve()
})

View file

@ -19,11 +19,10 @@ export class SFTPDeleteModalComponent extends BaseComponent {
super()
}
ngOnInit (): void {
async ngOnInit (): Promise<void> {
this.destroyed$.subscribe(() => this.cancel())
this.run(this.item).then(() => {
this.modalInstance.close()
})
await this.run(this.item)
this.modalInstance.close()
}
cancel (): void {

View file

@ -33,7 +33,7 @@ export class SFTPPanelComponent {
async ngOnInit (): Promise<void> {
this.sftp = await this.session.openSFTP()
this.navigate(this.path)
await this.navigate(this.path)
}
async navigate (newPath: string): Promise<void> {
@ -75,25 +75,23 @@ export class SFTPPanelComponent {
async open (item: SFTPFile): Promise<void> {
if (item.isDirectory) {
this.navigate(item.fullPath)
await this.navigate(item.fullPath)
} else if (item.isSymlink) {
const target = path.resolve(this.path, await this.sftp.readlink(item.fullPath))
const stat = await this.sftp.stat(target)
if (stat.isDirectory) {
this.navigate(item.fullPath)
await this.navigate(item.fullPath)
} else {
this.download(item.fullPath, stat.size)
await this.download(item.fullPath, stat.size)
}
} else {
this.download(item.fullPath, item.size)
await this.download(item.fullPath, item.size)
}
}
async upload (): Promise<void> {
const transfers = await this.platform.startUpload({ multiple: true })
for (const transfer of transfers) {
this.uploadOne(transfer)
}
await Promise.all(transfers.map(t => this.uploadOne(t)))
}
async uploadOne (transfer: FileUpload): Promise<void> {
@ -111,7 +109,7 @@ export class SFTPPanelComponent {
handle.close()
transfer.close()
if (this.path === savedPath) {
this.navigate(this.path)
await this.navigate(this.path)
}
} catch (e) {
transfer.cancel()

View file

@ -98,7 +98,8 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
(err, stream) => {
if (err) {
jumpSession.emitServiceMessage(colors.bgRed.black(' X ') + ` Could not set up port forward on ${jumpConnection.name}`)
return reject(err)
reject(err)
return
}
resolve(stream)
}