提交 dc9508f8 编写于 作者: E Eugene Pankov

lint & enabled linter on Azure pipelines

上级 b6aa1f76
...@@ -31,6 +31,7 @@ rules: ...@@ -31,6 +31,7 @@ rules:
'@typescript-eslint/promise-function-async': off '@typescript-eslint/promise-function-async': off
'@typescript-eslint/no-unnecessary-type-assertion': off '@typescript-eslint/no-unnecessary-type-assertion': off
'@typescript-eslint/require-array-sort-compare': off '@typescript-eslint/require-array-sort-compare': off
'@typescript-eslint/no-floating-promises': off
'@typescript-eslint/no-use-before-define': '@typescript-eslint/no-use-before-define':
- error - error
- classes: false - classes: false
......
...@@ -176,7 +176,7 @@ export async function loadPlugins (foundPlugins: PluginInfo[], progress: Progres ...@@ -176,7 +176,7 @@ export async function loadPlugins (foundPlugins: PluginInfo[], progress: Progres
pluginModule['bootstrap'] = packageModule.bootstrap pluginModule['bootstrap'] = packageModule.bootstrap
plugins.push(pluginModule) plugins.push(pluginModule)
console.timeEnd(label) console.timeEnd(label)
await (new Promise(x => setTimeout(x, 50))) await new Promise(x => setTimeout(x, 50))
} catch (error) { } catch (error) {
console.error(`Could not load ${foundPlugin.name}:`, error) console.error(`Could not load ${foundPlugin.name}:`, error)
} }
......
...@@ -86,6 +86,9 @@ jobs: ...@@ -86,6 +86,9 @@ jobs:
- script: yarn run build - script: yarn run build
displayName: 'Build' displayName: 'Build'
- script: yarn run lint
displayName: 'Lint'
- script: node scripts/prepackage-plugins.js - script: node scripts/prepackage-plugins.js
displayName: 'Prepackage plugins' displayName: 'Prepackage plugins'
......
...@@ -128,8 +128,8 @@ export class AppRootComponent { ...@@ -128,8 +128,8 @@ export class AppRootComponent {
}) })
this.hostApp.windowCloseRequest$.subscribe(async () => { this.hostApp.windowCloseRequest$.subscribe(async () => {
await this.app.closeAllTabs() && this.hostApp.closeWindow(); await this.app.closeAllTabs() && this.hostApp.closeWindow()
}); })
if (window['safeModeReason']) { if (window['safeModeReason']) {
ngbModal.open(SafeModeModalComponent) ngbModal.open(SafeModeModalComponent)
......
...@@ -10,7 +10,7 @@ import { AppService } from '../services/app.service' ...@@ -10,7 +10,7 @@ import { AppService } from '../services/app.service'
import { HostAppService, Platform } from '../services/hostApp.service' import { HostAppService, Platform } from '../services/hostApp.service'
/** @hidden */ /** @hidden */
export interface ISortableComponent { export interface SortableComponentProxy {
setDragHandle (_: HTMLElement) setDragHandle (_: HTMLElement)
} }
...@@ -34,7 +34,7 @@ export class TabHeaderComponent { ...@@ -34,7 +34,7 @@ export class TabHeaderComponent {
private hostApp: HostAppService, private hostApp: HostAppService,
private ngbModal: NgbModal, private ngbModal: NgbModal,
private hotkeys: HotkeysService, private hotkeys: HotkeysService,
@Inject(SortableComponent) private parentDraggable: ISortableComponent, @Inject(SortableComponent) private parentDraggable: SortableComponentProxy,
@Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[], @Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[],
) { ) {
this.hotkeys.matchedHotkey.subscribe((hotkey) => { this.hotkeys.matchedHotkey.subscribe((hotkey) => {
......
...@@ -209,16 +209,16 @@ export class AppService { ...@@ -209,16 +209,16 @@ export class AppService {
/** /**
* Attempts to close all tabs, returns false if one of the tabs blocked closure * Attempts to close all tabs, returns false if one of the tabs blocked closure
*/ */
async closeAllTabs () : Promise<boolean> { async closeAllTabs (): Promise<boolean> {
for (const tab of this.tabs) { for (const tab of this.tabs) {
if (!await tab.canClose()) { if (!await tab.canClose()) {
return false; return false
} }
} }
for (const tab of this.tabs) { for (const tab of this.tabs) {
tab.destroy() tab.destroy()
} }
return true; return true
} }
/** @hidden */ /** @hidden */
......
...@@ -71,8 +71,8 @@ export class ConfigProxy { ...@@ -71,8 +71,8 @@ export class ConfigProxy {
} }
} }
getValue (_key: string): any { } getValue (_key: string): any { } // eslint-disable-line @typescript-eslint/no-empty-function
setValue (_key: string, _value: any) { } setValue (_key: string, _value: any) { } // eslint-disable-line @typescript-eslint/no-empty-function
} }
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
......
...@@ -30,8 +30,8 @@ export class DockingService { ...@@ -30,8 +30,8 @@ export class DockingService {
} }
const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 } const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
const fill = this.config.store.appearance.dockFill <= 1 ? this.config.store.appearance.dockFill : 1; const fill = this.config.store.appearance.dockFill <= 1 ? this.config.store.appearance.dockFill : 1
const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize() const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
if (dockSide === 'left' || dockSide === 'right') { if (dockSide === 'left' || dockSide === 'right') {
...@@ -64,15 +64,15 @@ export class DockingService { ...@@ -64,15 +64,15 @@ export class DockingService {
} }
getScreens () { getScreens () {
const primaryDisplayID = this.electron.screen.getPrimaryDisplay().id; const primaryDisplayID = this.electron.screen.getPrimaryDisplay().id
return this.electron.screen.getAllDisplays().sort((a,b) => ( 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) => { ).map((display,index) => {
return { return {
id: display.id, id: display.id,
name: display.id === primaryDisplayID ? 'Primary Display' : `Display ${index +1}`, name: display.id === primaryDisplayID ? 'Primary Display' : `Display ${index +1}`,
} }
}); })
} }
private repositionWindow () { private repositionWindow () {
......
...@@ -29,7 +29,7 @@ export class UpdaterService { ...@@ -29,7 +29,7 @@ export class UpdaterService {
this.autoUpdater = electron.remote.require('electron-updater').autoUpdater this.autoUpdater = electron.remote.require('electron-updater').autoUpdater
this.autoUpdater.autoInstallOnAppQuit = !!config.store.enableAutomaticUpdates; this.autoUpdater.autoInstallOnAppQuit = !!config.store.enableAutomaticUpdates
this.autoUpdater.on('update-available', () => { this.autoUpdater.on('update-available', () => {
this.logger.info('Update available') this.logger.info('Update available')
...@@ -76,20 +76,19 @@ export class UpdaterService { ...@@ -76,20 +76,19 @@ export class UpdaterService {
this.electron.shell.openExternal(this.updateURL) this.electron.shell.openExternal(this.updateURL)
} else { } else {
if (process.platform === 'win32') { if (process.platform === 'win32') {
let downloadpath = await this.autoUpdater.downloadUpdate(); let downloadpath = await this.autoUpdater.downloadUpdate()
fs.exists(downloadpath[0], (exists) => { fs.exists(downloadpath[0], (exists) => {
if (exists) { if (exists) {
fs.copyFile(downloadpath[0], os.tmpdir() + 'terminus-installer-temp.exe', (err) => { fs.copyFile(downloadpath[0], os.tmpdir() + 'terminus-installer-temp.exe', (err) => {
if (!err) { if (!err) {
spawn(os.tmpdir() + 'terminus-installer-temp.exe', ['--force-run'], {detached: true, stdio: 'ignore'}); spawn(os.tmpdir() + 'terminus-installer-temp.exe', ['--force-run'], { detached: true, stdio: 'ignore' })
} }
}); })
} }
}) })
} else { } else {
await this.downloaded; await this.downloaded
this.autoUpdater.quitAndInstall(false, true); this.autoUpdater.quitAndInstall(false, true)
} }
} }
} }
......
...@@ -70,12 +70,12 @@ export class SettingsTabComponent extends BaseTabComponent { ...@@ -70,12 +70,12 @@ export class SettingsTabComponent extends BaseTabComponent {
onConfigChange() onConfigChange()
const onScreenChange = () => { const onScreenChange = () => {
this.zone.run(() => this.screens = this.docking.getScreens()); this.zone.run(() => this.screens = this.docking.getScreens())
} }
electron.screen.on('display-added', onScreenChange); electron.screen.on('display-added', onScreenChange)
electron.screen.on('display-removed', onScreenChange); electron.screen.on('display-removed', onScreenChange)
electron.screen.on('display-metrics-changed', onScreenChange); electron.screen.on('display-metrics-changed', onScreenChange)
hotkeys.getHotkeyDescriptions().then(descriptions => { hotkeys.getHotkeyDescriptions().then(descriptions => {
this.hotkeyDescriptions = descriptions this.hotkeyDescriptions = descriptions
......
...@@ -138,7 +138,7 @@ export class SSHService { ...@@ -138,7 +138,7 @@ export class SSHService {
let agent: string = null let agent: string = null
if (this.hostApp.platform === Platform.Windows) { if (this.hostApp.platform === Platform.Windows) {
const pageantRunning = new Promise<boolean>(resolve => { const pageantRunning = new Promise<boolean>(resolve => {
windowsProcessTreeNative.getProcessList(list => { windowsProcessTreeNative.getProcessList(list => { // eslint-disable-line block-scoped-var
resolve(list.some(x => x.name === 'pageant.exe')) resolve(list.some(x => x.name === 'pageant.exe'))
}, 0) }, 0)
}) })
......
...@@ -15,7 +15,7 @@ import { TerminalContextMenuItemProvider } from './contextMenuProvider' ...@@ -15,7 +15,7 @@ import { TerminalContextMenuItemProvider } from './contextMenuProvider'
/** @hidden */ /** @hidden */
export interface IToastrService { export interface ToastrServiceProxy {
info (_: string) info (_: string)
} }
/** /**
...@@ -80,7 +80,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit ...@@ -80,7 +80,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
protected sessions: SessionsService, protected sessions: SessionsService,
protected electron: ElectronService, protected electron: ElectronService,
protected terminalContainersService: TerminalFrontendService, protected terminalContainersService: TerminalFrontendService,
@Inject(ToastrService) protected toastr: IToastrService, @Inject(ToastrService) protected toastr: ToastrServiceProxy,
protected log: LogService, protected log: LogService,
@Optional() @Inject(TerminalDecorator) protected decorators: TerminalDecorator[], @Optional() @Inject(TerminalDecorator) protected decorators: TerminalDecorator[],
@Optional() @Inject(TerminalContextMenuItemProvider) protected contextMenuProviders: TerminalContextMenuItemProvider[], @Optional() @Inject(TerminalContextMenuItemProvider) protected contextMenuProviders: TerminalContextMenuItemProvider[],
......
...@@ -284,7 +284,7 @@ export class Session extends BaseSession { ...@@ -284,7 +284,7 @@ export class Session extends BaseSession {
} catch (e) { } catch (e) {
return null return null
} }
let cwd = lines[(lines[1] === 'fcwd') ? 2 : 1].substring(1) let cwd = lines[lines[1] === 'fcwd' ? 2 : 1].substring(1)
if (cwd.startsWith(catalinaDataVolumePrefix)) { if (cwd.startsWith(catalinaDataVolumePrefix)) {
cwd = cwd.substring(catalinaDataVolumePrefix.length) cwd = cwd.substring(catalinaDataVolumePrefix.length)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册