mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 17:07:15 +00:00
lint
This commit is contained in:
parent
4534eefc1d
commit
a159890cba
12 changed files with 40 additions and 34 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
{
|
||||
|
|
|
@ -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[])
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue