1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-10-26 12:43:50 +03:00

bumped eslint

This commit is contained in:
Eugene Pankov 2022-12-05 12:16:27 +01:00
parent b0600b10cc
commit 98476df882
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
40 changed files with 750 additions and 381 deletions

View File

@ -5,8 +5,15 @@ parserOptions:
- '*/tsconfig.typings.json'
extends:
- 'plugin:@typescript-eslint/all'
- plugin:import/recommended
- plugin:import/typescript
plugins:
- '@typescript-eslint'
- 'import'
settings:
import/resolver:
typescript: true
node: true
env:
browser: true
es6: true
@ -126,3 +133,11 @@ rules:
- allowAliases: in-unions-and-intersections
allowLiterals: always
allowCallbacks: always
'@typescript-eslint/sort-type-constituents': off
'@typescript-eslint/parameter-properties':
- error
- prefer: parameter-property
'import/no-named-as-default-member': off
'@typescript-eslint/consistent-type-exports': off
'@typescript-eslint/consistent-generic-constructors': off
'keyword-spacing': off

View File

@ -23,8 +23,8 @@
"@types/node": "16.0.1",
"@types/sortablejs": "^1.15.0",
"@types/webpack-env": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"apply-loader": "2.0.0",
"axios": "^0.27.2",
"browserify-sign": "^4.2.1",
@ -41,7 +41,9 @@
"electron-installer-snap": "^5.1.0",
"electron-notarize": "^1.2.2",
"electron-rebuild": "^3.2.9",
"eslint": "^7.32.0",
"eslint": "^8.29.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"file-loader": "^6.2.0",
"gettext-extractor": "^3.5.4",
"graceful-fs": "^4.2.10",
@ -76,15 +78,15 @@
"style-loader": "^3.3.1",
"svg-inline-loader": "^0.8.2",
"thenby": "^1.3.4",
"ts-loader": "^9.4.1",
"ts-loader": "^9.4.2",
"tslib": "^2.4.0",
"typedoc": "^0.22.18",
"typescript": "^4.3.5",
"utils-decorators": "^1.10.4",
"val-loader": "4.0.0",
"webpack": "^5.72.1",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.7.0",
"webpack-cli": "^5.0.0",
"yaml-loader": "0.6.0",
"zone.js": "^0.11.5"
},

View File

@ -12,7 +12,7 @@ export class RenameTabModalComponent {
@ViewChild('input') input: ElementRef
constructor (
private modalInstance: NgbActiveModal
private modalInstance: NgbActiveModal,
) { }
ngOnInit () {

View File

@ -64,7 +64,7 @@ export class SelectorModalComponent<T> {
this.filteredOptions = this.options.slice().sort(
firstBy<SelectorOption<T>, number>(x => x.weight ?? 0)
.thenBy<SelectorOption<T>, string>(x => x.group ?? '')
.thenBy<SelectorOption<T>, string>(x => x.name)
.thenBy<SelectorOption<T>, string>(x => x.name),
)
.filter(x => !x.freeInputPattern)
} else {

View File

@ -74,7 +74,7 @@ export class SplitTabPaneLabelComponent extends SelfPositioningComponent {
tabElement.offsetTop,
tabElement.clientWidth,
tabElement.clientHeight,
'px'
'px',
)
}
}

View File

@ -77,14 +77,14 @@ export class SplitTabSpannerComponent extends SelfPositioningComponent {
this.container.x,
this.container.y + this.container.h * this.container.getOffsetRatio(this.index),
this.container.w,
0
0,
)
} else {
this.setDimensions(
this.container.x + this.container.w * this.container.getOffsetRatio(this.index),
this.container.y,
0,
this.container.h
this.container.h,
)
}
}

View File

@ -41,7 +41,7 @@ export class ConfigProxy {
enumerable: true,
configurable: false,
get: () => proxy,
}
},
)
} else {
Object.defineProperty(
@ -54,7 +54,7 @@ export class ConfigProxy {
set: (value) => {
this.__setValue(key, value)
},
}
},
)
}
}

View File

@ -47,7 +47,7 @@ export class FileProvidersService {
providers.map(p => ({
name: p.name,
result: p,
}))
})),
)
}
}

View File

@ -52,7 +52,7 @@ export class HomeBaseService {
if (!window.localStorage.analyticsUserID) {
window.localStorage.analyticsUserID = uuidv4()
}
this.mixpanel = mixpanel.init('bb4638b0860eef14c04d4fbc5eb365fa')
this.mixpanel = (mixpanel as any).init('bb4638b0860eef14c04d4fbc5eb365fa')
if (!window.localStorage.installEventSent) {
this.mixpanel.track('freshInstall', this.getAnalyticsProperties())
window.localStorage.installEventSent = true

View File

@ -218,7 +218,7 @@ export class HotkeysService {
let matched = true
for (const item of sequence) {
const nextOffset = currentSequence.slice(lastIndex).findIndex(
x => x.toLowerCase() === item.toLowerCase()
x => x.toLowerCase() === item.toLowerCase(),
)
if (nextOffset === -1) {
matched = false
@ -274,7 +274,7 @@ export class HotkeysService {
return (
await Promise.all(
this.config.enabledServices(this.hotkeyProviders)
.map(async x => x.provide())
.map(async x => x.provide()),
)
).reduce((a, b) => a.concat(b))
}

View File

@ -67,7 +67,7 @@ export class TranslateServiceWrapper extends TranslateService {
}
this.translations[this.defaultLang][key] ??= this.compiler.compile(
this._defaultTranslation[key] || key,
this.defaultLang
this.defaultLang,
)
return super.getParsedResult(translations, key, interpolateParams ?? {})
}

View File

@ -14,7 +14,7 @@ export class TabRecoveryService {
private constructor (
@Inject(TabRecoveryProvider) private tabRecoveryProviders: TabRecoveryProvider<BaseTabComponent>[]|null,
private config: ConfigService,
log: LogService
log: LogService,
) {
this.logger = log.create('tabRecovery')
}
@ -25,8 +25,8 @@ export class TabRecoveryService {
}
window.localStorage.tabsRecovery = JSON.stringify(
(await Promise.all(
tabs.map(async tab => this.getFullRecoveryToken(tab, { includeState: true }))
)).filter(token => !!token)
tabs.map(async tab => this.getFullRecoveryToken(tab, { includeState: true })),
)).filter(token => !!token),
)
}

View File

@ -34,15 +34,9 @@ export function wrapPromise <T> (zone: NgZone, promise: Promise<T>): Promise<T>
}
export class ResettableTimeout {
private fn: () => void
private timeout: number
private id: any
private id: any = null
constructor (fn: () => void, timeout: number) {
this.fn = fn
this.timeout = timeout
this.id = null
}
constructor (private fn: () => void, private timeout: number) {}
set (timeout?: number): void {
this.clear()

View File

@ -78,7 +78,7 @@ export class ElectronDockingService extends DockingService {
getScreens (): Screen[] {
const primaryDisplayID = this.electron.screen.getPrimaryDisplay().id
return this.electron.screen.getAllDisplays().sort((a, b) =>
a.bounds.x === b.bounds.x ? a.bounds.y - b.bounds.y : a.bounds.x - b.bounds.x
a.bounds.x === b.bounds.x ? a.bounds.y - b.bounds.y : a.bounds.x - b.bounds.x,
).map((display, index) => {
return {
...display,

View File

@ -135,7 +135,7 @@ export class ElectronUpdaterService extends UpdaterService {
],
defaultId: 0,
cancelId: 1,
}
},
)).response === 0) {
await this.downloaded
this.autoUpdater.quitAndInstall()

View File

@ -178,7 +178,7 @@ export class PrivateKeyLocator extends AutoPrivateKeyLocator {
if (/^id_[\w\d]+$/.test(file)) {
const privateKeyContents = await fs.readFile(
path.join(keysPath, file),
{ encoding: null }
{ encoding: null },
)
results.push([file, privateKeyContents])
}

View File

@ -36,7 +36,7 @@ export class LocalProfileSettingsComponent implements ProfileSettingsComponent<L
// TODO
// defaultPath: shell.fsBase,
properties: ['openDirectory', 'showHiddenFiles'],
}
},
)).filePaths
this.profile.options.cwd = paths[0]
}

View File

@ -119,7 +119,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
],
defaultId: 0,
cancelId: 1,
}
},
)).response === 0
}

View File

@ -132,5 +132,5 @@ export default class LocalTerminalModule { // eslint-disable-line @typescript-es
}
export { TerminalTabComponent }
export { TerminalService, ShellProvider }
export { TerminalService }
export * from './api'

View File

@ -1,4 +1,4 @@
import * as fs from 'mz/fs'
import * as fsSync from 'fs'
import { Injectable } from '@angular/core'
import { Logger, LogService, ConfigService, ProfilesService, PartialProfile } from 'tabby-core'
import { TerminalTabComponent } from '../components/terminalTab.component'
@ -39,7 +39,7 @@ export class TerminalService {
cwd = cwd ?? fullProfile.options.cwd
if (cwd && !fs.existsSync(cwd)) {
if (cwd && !fsSync.existsSync(cwd)) {
console.warn('Ignoring non-existent CWD:', cwd)
cwd = null
}

View File

@ -1,5 +1,6 @@
import * as psNode from 'ps-node'
import * as fs from 'mz/fs'
import * as fsSync from 'fs'
import { Injector } from '@angular/core'
import { HostAppService, ConfigService, WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild, Platform, BootstrapData, BOOTSTRAP_DATA, LogService } from 'tabby-core'
import { BaseSession } from 'tabby-terminal'
@ -169,7 +170,7 @@ export class Session extends BaseSession {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
let cwd = options.cwd || process.env.HOME
if (!fs.existsSync(cwd)) {
if (!fsSync.existsSync(cwd)) {
console.warn('Ignoring non-existent CWD:', cwd)
cwd = undefined
}

View File

@ -74,7 +74,7 @@ export class WSLShellProvider extends ShellProvider {
}
}
if (!lxss || !lxss.DefaultDistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
if (!lxss?.DefaultDistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
if (await fs.exists(bashPath)) {
return [{
id: 'wsl',

View File

@ -36,7 +36,7 @@ export class PluginsSettingsTabComponent {
constructor (
private config: ConfigService,
private platform: PlatformService,
public pluginManager: PluginManagerService
public pluginManager: PluginManagerService,
) {
}
@ -51,7 +51,7 @@ export class PluginsSettingsTabComponent {
return this.pluginManager.listAvailable(query).pipe(tap(() => {
this.availablePluginsReady = true
}))
})
}),
)
this.availablePlugins$.pipe(first(), map((plugins: PluginInfo[]) => {
plugins.sort((a, b) => a.name > b.name ? 1 : -1)
@ -69,7 +69,7 @@ export class PluginsSettingsTabComponent {
distinctUntilChanged(),
flatMap(query => {
return this.pluginManager.listInstalled(query)
})
}),
).subscribe(plugin => {
this.installedPlugins$ = plugin
})

View File

@ -51,7 +51,7 @@ export class PluginManagerService {
_listAvailableInternal (namePrefix: string, keyword: string, query?: string): Observable<PluginInfo[]> {
return from(
axios.get(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`)
axios.get(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`),
).pipe(
map(response => response.data.objects
.filter(item => !item.keywords?.includes('tabby-dummy-transition-plugin'))
@ -61,9 +61,9 @@ export class PluginManagerService {
description: item.package.description,
version: item.package.version,
homepage: item.package.links.homepage,
author: (item.package.author || {}).name,
author: item.package.author?.name,
isOfficial: item.package.publisher.username === OFFICIAL_NPM_ACCOUNT,
}))
})),
),
map(plugins => plugins.filter(x => x.packageName.startsWith(namePrefix))),
map(plugins => plugins.filter(x => !PLUGIN_BLACKLIST.includes(x.packageName))),

View File

@ -29,7 +29,7 @@ export class SerialProfileSettingsComponent implements ProfileSettingsComponent<
map((q: string) => [
null,
...BAUD_RATES.filter(x => !q || x.toString().startsWith(q)),
])
]),
)
portsFormatter = port => {

View File

@ -7,8 +7,8 @@ import { ConfigProxy, ConfigService, Profile, ProfileProvider, ProfileSettingsCo
const iconsData = require('../../../tabby-core/src/icons.json')
const iconsClassList = Object.keys(iconsData).map(
icon => iconsData[icon].map(
style => `fa${style[0]} fa-${icon}`
)
style => `fa${style[0]} fa-${icon}`,
),
).flat()
/** @hidden */
@ -36,7 +36,7 @@ export class EditProfileModalComponent<P extends Profile> {
this.groupNames = [...new Set(
(config.store.profiles as Profile[])
.map(x => x.group)
.filter(x => !!x)
.filter(x => !!x),
)].sort() as string[]
}
@ -46,8 +46,8 @@ export class EditProfileModalComponent<P extends Profile> {
map((q: string) =>
TAB_COLORS
.filter(x => !q || x.name.toLowerCase().startsWith(q.toLowerCase()))
.map(x => x.value)
)
.map(x => x.value),
),
)
colorsFormatter = value => {
@ -76,13 +76,13 @@ export class EditProfileModalComponent<P extends Profile> {
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map(q => this.groupNames.filter(x => !q || x.toLowerCase().includes(q.toLowerCase())))
map(q => this.groupNames.filter(x => !q || x.toLowerCase().includes(q.toLowerCase()))),
)
iconSearch: OperatorFunction<string, string[]> = (text$: Observable<string>) =>
text$.pipe(
debounceTime(200),
map(term => iconsClassList.filter(v => v.toLowerCase().includes(term.toLowerCase())).slice(0, 10))
map(term => iconsClassList.filter(v => v.toLowerCase().includes(term.toLowerCase())).slice(0, 10)),
)
save () {

View File

@ -140,7 +140,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
],
defaultId: 1,
cancelId: 1,
}
},
)).response === 0) {
this.profilesService.providerForProfile(profile)?.deleteProfile(
this.profilesService.getConfigProxyForProfile(profile))
@ -205,7 +205,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
],
defaultId: 1,
cancelId: 1,
}
},
)).response === 0) {
if ((await this.platform.showMessageBox(
{
@ -217,7 +217,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
],
defaultId: 0,
cancelId: 0,
}
},
)).response === 0) {
for (const profile of this.profiles.filter(x => x.group === group.name)) {
delete profile.group

View File

@ -18,8 +18,8 @@ export class SettingsTabBodyComponent {
setImmediate(() => {
this.component = this.placeholder.createComponent(
this.componentFactoryResolver.resolveComponentFactory(
this.provider.getComponentType()
)
this.provider.getComponentType(),
),
)
})
}

View File

@ -51,7 +51,7 @@ export class VaultSettingsTabComponent extends BaseComponent {
],
defaultId: 1,
cancelId: 1,
}
},
)).response === 0) {
await this.vault.setEnabled(false)
}

View File

@ -98,7 +98,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
const jumpSession = await this.setupOneSession(
this.injector,
this.profilesService.getConfigProxyForProfile(jumpConnection)
this.profilesService.getConfigProxyForProfile(jumpConnection),
)
jumpSession.ref()
@ -118,7 +118,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
return
}
resolve(stream)
}
},
))
}
}
@ -252,7 +252,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
],
defaultId: 0,
cancelId: 1,
}
},
)).response === 0
}

View File

@ -75,4 +75,4 @@ export default class SSHModule { }
export * from './api'
export { SFTPFile, SFTPSession } from './session/sftp'
export { SFTPPanelComponent, SFTPContextMenuItemProvider }
export { SFTPPanelComponent }

View File

@ -554,7 +554,7 @@ export class SSHSession {
socket.on('close', () => {
stream.close()
})
}
},
)
}).then(() => {
this.emitServiceMessage(colors.bgGreen.black(' -> ') + ` Forwarded ${fw}`)

View File

@ -126,7 +126,7 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
],
defaultId: 0,
cancelId: 1,
}
},
)).response === 0
}
}

View File

@ -483,7 +483,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
buttons,
defaultId: 0,
cancelId: 1,
}
},
)).response
if (result === 1) {
return

View File

@ -79,7 +79,7 @@ export class SessionMiddlewareStack extends SessionMiddleware {
for (let i = 0; i < this.stack.length - 1; i++) {
this.subs.subscribe(
this.stack[i].outputToTerminal$,
x => this.stack[i + 1].feedFromSession(x)
x => this.stack[i + 1].feedFromSession(x),
)
}
this.subs.subscribe(
@ -90,7 +90,7 @@ export class SessionMiddlewareStack extends SessionMiddleware {
for (let i = this.stack.length - 2; i >= 0; i--) {
this.subs.subscribe(
this.stack[i + 1].outputToSession$,
x => this.stack[i].feedFromTerminal(x)
x => this.stack[i].feedFromTerminal(x),
)
}
this.subs.subscribe(

View File

@ -91,7 +91,7 @@ export class ColorSchemeSettingsTabComponent {
],
defaultId: 1,
cancelId: 1,
}
},
)).response === 0) {
this.customColorSchemes = this.customColorSchemes.filter(x => x.name !== scheme.name)
this.config.store.terminal.customColorSchemes = this.customColorSchemes

View File

@ -34,7 +34,7 @@ export class LoginScriptsSettingsComponent {
],
defaultId: 0,
cancelId: 1,
}
},
)).response === 0) {
this.scripts = this.scripts.filter(x => x !== script)
}

View File

@ -451,13 +451,13 @@ export class XTermFrontend extends Frontend {
findNext (term: string, searchOptions?: SearchOptions): SearchState {
return this.wrapSearchResult(
this.search.findNext(term, this.getSearchOptions(searchOptions))
this.search.findNext(term, this.getSearchOptions(searchOptions)),
)
}
findPrevious (term: string, searchOptions?: SearchOptions): SearchState {
return this.wrapSearchResult(
this.search.findPrevious(term, this.getSearchOptions(searchOptions))
this.search.findPrevious(term, this.getSearchOptions(searchOptions)),
)
}

View File

@ -29,7 +29,7 @@ export class LoginScriptProcessor extends SessionMiddleware {
constructor (
private logger: Logger,
options: LoginScriptsOptions
options: LoginScriptsOptions,
) {
super()
this.remainingScripts = deepClone(options.scripts ?? [])

971
yarn.lock

File diff suppressed because it is too large Load Diff