mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-08 21:40:03 +00:00
lint
This commit is contained in:
parent
4534eefc1d
commit
a159890cba
@ -36,7 +36,9 @@ rules:
|
|||||||
'@typescript-eslint/prefer-readonly': off
|
'@typescript-eslint/prefer-readonly': off
|
||||||
'@typescript-eslint/require-await': off
|
'@typescript-eslint/require-await': off
|
||||||
'@typescript-eslint/strict-boolean-expressions': 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/typedef': off
|
||||||
'@typescript-eslint/consistent-type-imports': off
|
'@typescript-eslint/consistent-type-imports': off
|
||||||
'@typescript-eslint/sort-type-union-intersection-members': off
|
'@typescript-eslint/sort-type-union-intersection-members': off
|
||||||
@ -95,7 +97,9 @@ rules:
|
|||||||
- error
|
- error
|
||||||
- single
|
- single
|
||||||
- allowTemplateLiterals: true
|
- 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-non-null-assertion': off
|
||||||
'@typescript-eslint/no-unnecessary-condition':
|
'@typescript-eslint/no-unnecessary-condition':
|
||||||
- error
|
- error
|
||||||
|
@ -453,7 +453,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
async splitTab (tab: BaseTabComponent, dir: SplitDirection): Promise<BaseTabComponent|null> {
|
async splitTab (tab: BaseTabComponent, dir: SplitDirection): Promise<BaseTabComponent|null> {
|
||||||
const newTab = await this.tabsService.duplicate(tab)
|
const newTab = await this.tabsService.duplicate(tab)
|
||||||
if (newTab) {
|
if (newTab) {
|
||||||
this.addTab(newTab, tab, dir)
|
await this.addTab(newTab, tab, dir)
|
||||||
}
|
}
|
||||||
return newTab
|
return newTab
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ export class WelcomeTabComponent extends BaseTabComponent {
|
|||||||
this.setTitle('Welcome')
|
this.setTitle('Welcome')
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAndDisable () {
|
async closeAndDisable () {
|
||||||
this.config.store.enableWelcomeTab = false
|
this.config.store.enableWelcomeTab = false
|
||||||
this.config.store.pluginBlacklist = []
|
this.config.store.pluginBlacklist = []
|
||||||
if (!this.enableGlobalHotkey) {
|
if (!this.enableGlobalHotkey) {
|
||||||
this.config.store.hotkeys['toggle-window'] = []
|
this.config.store.hotkeys['toggle-window'] = []
|
||||||
}
|
}
|
||||||
this.config.save()
|
await this.config.save()
|
||||||
this.hostWindow.reload()
|
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
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-empty-function
|
||||||
setValue (_key: string, _value: any) { }
|
setValue (_key: string, _value: any) { }
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-empty-function
|
// 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' })
|
@Injectable({ providedIn: 'root' })
|
||||||
@ -195,10 +195,10 @@ export class ConfigService {
|
|||||||
/**
|
/**
|
||||||
* Writes config YAML as string
|
* Writes config YAML as string
|
||||||
*/
|
*/
|
||||||
writeRaw (data: string): void {
|
async writeRaw (data: string): Promise<void> {
|
||||||
this._store = yaml.load(data)
|
this._store = yaml.load(data)
|
||||||
this.save()
|
await this.save()
|
||||||
this.load()
|
await this.load()
|
||||||
this.emitChange()
|
this.emitChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,9 @@ export class HotkeysService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.config.ready$.toPromise().then(() => {
|
this.config.ready$.toPromise().then(async () => {
|
||||||
this.getHotkeyDescriptions().then(hotkeys => {
|
const hotkeys = await this.getHotkeyDescriptions()
|
||||||
this.hotkeyDescriptions = hotkeys
|
this.hotkeyDescriptions = hotkeys
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
|
@ -270,7 +270,7 @@ export class VaultFileProvider extends FileProvider {
|
|||||||
}
|
}
|
||||||
const transfer = transfers[0]
|
const transfer = transfers[0]
|
||||||
const id = (await wrapPromise(this.zone, promisify(crypto.randomBytes)(32))).toString('hex')
|
const id = (await wrapPromise(this.zone, promisify(crypto.randomBytes)(32))).toString('hex')
|
||||||
this.vault.addSecret({
|
await this.vault.addSecret({
|
||||||
type: VAULT_SECRET_TYPE_FILE,
|
type: VAULT_SECRET_TYPE_FILE,
|
||||||
key: {
|
key: {
|
||||||
id,
|
id,
|
||||||
|
@ -120,7 +120,7 @@ export class ElectronUpdaterService extends UpdaterService {
|
|||||||
|
|
||||||
async update (): Promise<void> {
|
async update (): Promise<void> {
|
||||||
if (!this.electronUpdaterAvailable) {
|
if (!this.electronUpdaterAvailable) {
|
||||||
this.electron.shell.openExternal(this.updateURL)
|
await this.electron.shell.openExternal(this.updateURL)
|
||||||
} else {
|
} else {
|
||||||
if ((await this.platform.showMessageBox(
|
if ((await this.platform.showMessageBox(
|
||||||
{
|
{
|
||||||
|
@ -264,7 +264,8 @@ export class Session extends BaseSession {
|
|||||||
return new Promise<ChildProcess[]>((resolve, reject) => {
|
return new Promise<ChildProcess[]>((resolve, reject) => {
|
||||||
psNode.lookup({ ppid: this.truePID }, (err, processes) => {
|
psNode.lookup({ ppid: this.truePID }, (err, processes) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
reject(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
resolve(processes as ChildProcess[])
|
resolve(processes as ChildProcess[])
|
||||||
})
|
})
|
||||||
|
@ -176,7 +176,8 @@ export class SFTPFileHandle {
|
|||||||
while (true) {
|
while (true) {
|
||||||
const wait = this.sftp.write(this.handle, chunk, 0, chunk.length, this.position, err => {
|
const wait = this.sftp.write(this.handle, chunk, 0, chunk.length, this.position, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
reject(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
this.position += chunk.length
|
this.position += chunk.length
|
||||||
resolve()
|
resolve()
|
||||||
@ -405,7 +406,8 @@ export class SSHSession extends BaseSession {
|
|||||||
const forward = this.forwardedPorts.find(x => x.port === details.destPort)
|
const forward = this.forwardedPorts.find(x => x.port === details.destPort)
|
||||||
if (!forward) {
|
if (!forward) {
|
||||||
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Rejected incoming forwarded connection for unrecognized port ${details.destPort}`)
|
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Rejected incoming forwarded connection for unrecognized port ${details.destPort}`)
|
||||||
return reject()
|
reject()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
const socket = new Socket()
|
const socket = new Socket()
|
||||||
socket.connect(forward.targetPort, forward.targetAddress)
|
socket.connect(forward.targetPort, forward.targetAddress)
|
||||||
@ -560,7 +562,8 @@ export class SSHSession extends BaseSession {
|
|||||||
if (err) {
|
if (err) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// 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}`)
|
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()
|
const socket = accept()
|
||||||
stream.pipe(socket)
|
stream.pipe(socket)
|
||||||
@ -587,7 +590,8 @@ export class SSHSession extends BaseSession {
|
|||||||
if (err) {
|
if (err) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||||
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote rejected port forwarding for ${fw}: ${err}`)
|
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote rejected port forwarding for ${fw}: ${err}`)
|
||||||
return reject(err)
|
reject(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
@ -19,11 +19,10 @@ export class SFTPDeleteModalComponent extends BaseComponent {
|
|||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit (): void {
|
async ngOnInit (): Promise<void> {
|
||||||
this.destroyed$.subscribe(() => this.cancel())
|
this.destroyed$.subscribe(() => this.cancel())
|
||||||
this.run(this.item).then(() => {
|
await this.run(this.item)
|
||||||
this.modalInstance.close()
|
this.modalInstance.close()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel (): void {
|
cancel (): void {
|
||||||
|
@ -33,7 +33,7 @@ export class SFTPPanelComponent {
|
|||||||
|
|
||||||
async ngOnInit (): Promise<void> {
|
async ngOnInit (): Promise<void> {
|
||||||
this.sftp = await this.session.openSFTP()
|
this.sftp = await this.session.openSFTP()
|
||||||
this.navigate(this.path)
|
await this.navigate(this.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
async navigate (newPath: string): Promise<void> {
|
async navigate (newPath: string): Promise<void> {
|
||||||
@ -75,25 +75,23 @@ export class SFTPPanelComponent {
|
|||||||
|
|
||||||
async open (item: SFTPFile): Promise<void> {
|
async open (item: SFTPFile): Promise<void> {
|
||||||
if (item.isDirectory) {
|
if (item.isDirectory) {
|
||||||
this.navigate(item.fullPath)
|
await this.navigate(item.fullPath)
|
||||||
} else if (item.isSymlink) {
|
} else if (item.isSymlink) {
|
||||||
const target = path.resolve(this.path, await this.sftp.readlink(item.fullPath))
|
const target = path.resolve(this.path, await this.sftp.readlink(item.fullPath))
|
||||||
const stat = await this.sftp.stat(target)
|
const stat = await this.sftp.stat(target)
|
||||||
if (stat.isDirectory) {
|
if (stat.isDirectory) {
|
||||||
this.navigate(item.fullPath)
|
await this.navigate(item.fullPath)
|
||||||
} else {
|
} else {
|
||||||
this.download(item.fullPath, stat.size)
|
await this.download(item.fullPath, stat.size)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.download(item.fullPath, item.size)
|
await this.download(item.fullPath, item.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async upload (): Promise<void> {
|
async upload (): Promise<void> {
|
||||||
const transfers = await this.platform.startUpload({ multiple: true })
|
const transfers = await this.platform.startUpload({ multiple: true })
|
||||||
for (const transfer of transfers) {
|
await Promise.all(transfers.map(t => this.uploadOne(t)))
|
||||||
this.uploadOne(transfer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadOne (transfer: FileUpload): Promise<void> {
|
async uploadOne (transfer: FileUpload): Promise<void> {
|
||||||
@ -111,7 +109,7 @@ export class SFTPPanelComponent {
|
|||||||
handle.close()
|
handle.close()
|
||||||
transfer.close()
|
transfer.close()
|
||||||
if (this.path === savedPath) {
|
if (this.path === savedPath) {
|
||||||
this.navigate(this.path)
|
await this.navigate(this.path)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
transfer.cancel()
|
transfer.cancel()
|
||||||
|
@ -98,7 +98,8 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
|
|||||||
(err, stream) => {
|
(err, stream) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
jumpSession.emitServiceMessage(colors.bgRed.black(' X ') + ` Could not set up port forward on ${jumpConnection.name}`)
|
jumpSession.emitServiceMessage(colors.bgRed.black(' X ') + ` Could not set up port forward on ${jumpConnection.name}`)
|
||||||
return reject(err)
|
reject(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
resolve(stream)
|
resolve(stream)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user