mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-27 12:26:38 +01:00
Match linter rules
This commit is contained in:
parent
62a43e536c
commit
e76e56d824
@ -26,8 +26,8 @@
|
||||
"symlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
|
||||
"symlink:mac": "npm run symlink:lin",
|
||||
"symlink:lin": "rm -rf ./jslib && ln -s ../jslib ./jslib",
|
||||
"lint": "tslint src/**/*.ts",
|
||||
"lint:fix": "tslint src/**/*.ts --fix",
|
||||
"lint": "tslint 'src/**/*.ts'",
|
||||
"lint:fix": "tslint 'src/**/*.ts' --fix",
|
||||
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
|
||||
"build:main": "webpack --config webpack.main.js",
|
||||
"build:renderer": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
@ -43,7 +43,7 @@ export class LockComponent extends BaseLockComponent implements OnDestroy {
|
||||
|
||||
async ngOnInit() {
|
||||
await super.ngOnInit();
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (this.supportsBiometric && params.promptBiometric) {
|
||||
setTimeout(() => this.unlockBiometric(), 1000);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
Component,
|
||||
ComponentFactoryResolver,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
ViewChild,
|
||||
ViewContainerRef,
|
||||
} from '@angular/core';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
Component,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
} from '@angular/core';
|
||||
|
||||
import {
|
||||
|
@ -22,8 +22,8 @@ import { ConstantsService } from 'jslib/services/constants.service';
|
||||
|
||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
import { isWindowsStore } from 'jslib/electron/utils';
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
@ -81,15 +81,15 @@ export class SettingsComponent implements OnInit {
|
||||
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
||||
|
||||
const minToTrayKey = isMac ? 'enableMinToMenuBar' : 'enableMinToTray';
|
||||
this.enableMinToTrayText = this.i18nService.t(minToTrayKey)
|
||||
this.enableMinToTrayText = this.i18nService.t(minToTrayKey);
|
||||
this.enableMinToTrayDescText = this.i18nService.t(minToTrayKey + 'Desc');
|
||||
|
||||
const closeToTrayKey = isMac ? 'enableCloseToMenuBar' : 'enableCloseToTray';
|
||||
this.enableCloseToTrayText = this.i18nService.t(closeToTrayKey)
|
||||
this.enableCloseToTrayText = this.i18nService.t(closeToTrayKey);
|
||||
this.enableCloseToTrayDescText = this.i18nService.t(closeToTrayKey + 'Desc');
|
||||
|
||||
const startToTrayKey = isMac ? 'startToMenuBar' : 'startToTray';
|
||||
this.startToTrayText = this.i18nService.t(startToTrayKey)
|
||||
this.startToTrayText = this.i18nService.t(startToTrayKey);
|
||||
this.startToTrayDescText = this.i18nService.t(startToTrayKey + 'Desc');
|
||||
|
||||
this.vaultTimeouts = [
|
||||
@ -114,7 +114,7 @@ export class SettingsComponent implements OnInit {
|
||||
]);
|
||||
|
||||
const localeOptions: any[] = [];
|
||||
i18nService.supportedTranslationLocales.forEach((locale) => {
|
||||
i18nService.supportedTranslationLocales.forEach(locale => {
|
||||
let name = locale;
|
||||
if (i18nService.localeNames.has(locale)) {
|
||||
name += (' - ' + i18nService.localeNames.get(locale));
|
||||
|
@ -90,8 +90,8 @@ import localePtBr from '@angular/common/locales/pt';
|
||||
import localePtPt from '@angular/common/locales/pt-PT';
|
||||
import localeRo from '@angular/common/locales/ro';
|
||||
import localeRu from '@angular/common/locales/ru';
|
||||
import localeSr from '@angular/common/locales/sr';
|
||||
import localeSk from '@angular/common/locales/sk';
|
||||
import localeSr from '@angular/common/locales/sr';
|
||||
import localeSv from '@angular/common/locales/sv';
|
||||
import localeTh from '@angular/common/locales/th';
|
||||
import localeTr from '@angular/common/locales/tr';
|
||||
|
@ -15,5 +15,5 @@ if (!isDev()) {
|
||||
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
|
||||
|
||||
// Disable drag and drop to prevent malicious links from executing in the context of the app
|
||||
document.addEventListener('dragover', (event) => event.preventDefault());
|
||||
document.addEventListener('drop', (event) => event.preventDefault());
|
||||
document.addEventListener('dragover', event => event.preventDefault());
|
||||
document.addEventListener('drop', event => event.preventDefault());
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
Component,
|
||||
NgZone,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
|
||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {
|
||||
Component,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
|
||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
|
@ -194,7 +194,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
async load() {
|
||||
let loaded = false;
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async params => {
|
||||
if (loaded) {
|
||||
return;
|
||||
}
|
||||
@ -423,7 +423,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.attachmentsModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef,
|
||||
true, (comp) => comp.cipherId = cipher.id);
|
||||
true, comp => comp.cipherId = cipher.id);
|
||||
let madeAttachmentChanges = false;
|
||||
childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true);
|
||||
childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true);
|
||||
@ -445,7 +445,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.shareModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<ShareComponent>(ShareComponent, this.shareModalRef, true,
|
||||
(comp) => comp.cipherId = cipher.id);
|
||||
comp => comp.cipherId = cipher.id);
|
||||
|
||||
childComponent.onSharedCipher.subscribe(async () => {
|
||||
this.modal.close();
|
||||
@ -465,7 +465,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.collectionsModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<CollectionsComponent>(CollectionsComponent, this.collectionsModalRef,
|
||||
true, (comp) => comp.cipherId = cipher.id);
|
||||
true, comp => comp.cipherId = cipher.id);
|
||||
|
||||
childComponent.onSavedCollections.subscribe(() => {
|
||||
this.modal.close();
|
||||
@ -484,7 +484,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.passwordHistoryModalRef.createComponent(factory).instance;
|
||||
this.modal.show<PasswordHistoryComponent>(PasswordHistoryComponent,
|
||||
this.passwordHistoryModalRef, true, (comp) => comp.cipherId = cipher.id);
|
||||
this.passwordHistoryModalRef, true, comp => comp.cipherId = cipher.id);
|
||||
this.modal.onClosed.subscribe(async () => {
|
||||
this.modal = null;
|
||||
});
|
||||
@ -505,7 +505,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
async filterFavorites() {
|
||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
||||
await this.ciphersComponent.reload((c) => c.favorite);
|
||||
await this.ciphersComponent.reload(c => c.favorite);
|
||||
this.clearFilters();
|
||||
this.favorites = true;
|
||||
this.go();
|
||||
@ -522,7 +522,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
async filterCipherType(type: CipherType) {
|
||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
||||
await this.ciphersComponent.reload((c) => c.type === type);
|
||||
await this.ciphersComponent.reload(c => c.type === type);
|
||||
this.clearFilters();
|
||||
this.type = type;
|
||||
this.go();
|
||||
@ -531,7 +531,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
async filterFolder(folderId: string) {
|
||||
folderId = folderId === 'none' ? null : folderId;
|
||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
||||
await this.ciphersComponent.reload((c) => c.folderId === folderId);
|
||||
await this.ciphersComponent.reload(c => c.folderId === folderId);
|
||||
this.clearFilters();
|
||||
this.folderId = folderId == null ? 'none' : folderId;
|
||||
this.go();
|
||||
@ -539,7 +539,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
async filterCollection(collectionId: string) {
|
||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||
await this.ciphersComponent.reload((c) => c.collectionIds != null &&
|
||||
await this.ciphersComponent.reload(c => c.collectionIds != null &&
|
||||
c.collectionIds.indexOf(collectionId) > -1);
|
||||
this.clearFilters();
|
||||
this.collectionId = collectionId;
|
||||
@ -555,7 +555,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
|
||||
this.passwordGeneratorModalRef, true, (comp) => comp.showSelect = showSelect);
|
||||
this.passwordGeneratorModalRef, true, comp => comp.showSelect = showSelect);
|
||||
|
||||
childComponent.onSelected.subscribe((password: string) => {
|
||||
this.modal.close();
|
||||
@ -596,7 +596,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<FolderAddEditComponent>(
|
||||
FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = null);
|
||||
FolderAddEditComponent, this.folderAddEditModalRef, true, comp => comp.folderId = null);
|
||||
|
||||
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
||||
this.modal.close();
|
||||
@ -616,7 +616,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
||||
const childComponent = this.modal.show<FolderAddEditComponent>(
|
||||
FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = folderId);
|
||||
FolderAddEditComponent, this.folderAddEditModalRef, true, comp => comp.folderId = folderId);
|
||||
|
||||
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
||||
this.modal.close();
|
||||
@ -699,7 +699,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updateCollectionProperties() {
|
||||
if (this.collectionId != null) {
|
||||
const collection = this.groupingsComponent.collections.filter((c) => c.id === this.collectionId);
|
||||
const collection = this.groupingsComponent.collections.filter(c => c.id === this.collectionId);
|
||||
if (collection.length > 0) {
|
||||
this.addOrganizationId = collection[0].organizationId;
|
||||
this.addCollectionIds = [this.collectionId];
|
||||
|
@ -16,7 +16,7 @@ if (process.argv.some(arg => arg.indexOf('chrome-extension://') !== -1 || arg.in
|
||||
});
|
||||
}
|
||||
|
||||
process.stdout.on('error', (e) => {
|
||||
process.stdout.on('error', e => {
|
||||
if (e.code === 'EPIPE') {
|
||||
process.exit(0);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ export class Main {
|
||||
app.setPath('logs', path.join(app.getPath('userData'), 'logs'));
|
||||
|
||||
const args = process.argv.slice(1);
|
||||
const watch = args.some((val) => val === '--watch');
|
||||
const watch = args.some(val => val === '--watch');
|
||||
|
||||
if (watch) {
|
||||
// tslint:disable-next-line
|
||||
@ -92,7 +92,7 @@ export class Main {
|
||||
this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults);
|
||||
|
||||
this.windowMain = new WindowMain(this.storageService, true, undefined, undefined,
|
||||
(arg) => this.processDeepLink(arg), (win) => this.trayMain.setupWindowListeners(win));
|
||||
arg => this.processDeepLink(arg), win => this.trayMain.setupWindowListeners(win));
|
||||
this.messagingMain = new MessagingMain(this, this.storageService);
|
||||
this.updaterMain = new UpdaterMain(this.i18nService, this.windowMain, 'desktop', () => {
|
||||
this.menuMain.updateMenuItem.enabled = false;
|
||||
@ -105,7 +105,7 @@ export class Main {
|
||||
this.powerMonitorMain = new PowerMonitorMain(this);
|
||||
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.storageService);
|
||||
|
||||
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
||||
this.messagingService = new ElectronMainMessagingService(this.windowMain, message => {
|
||||
this.messagingMain.onMessage(message);
|
||||
});
|
||||
|
||||
@ -172,7 +172,7 @@ export class Main {
|
||||
}
|
||||
|
||||
private processDeepLink(argv: string[]): void {
|
||||
argv.filter((s) => s.indexOf('bitwarden://') === 0).forEach((s) => {
|
||||
argv.filter(s => s.indexOf('bitwarden://') === 0).forEach(s => {
|
||||
const url = new URL(s);
|
||||
const code = url.searchParams.get('code');
|
||||
const receivedState = url.searchParams.get('state');
|
||||
|
@ -37,7 +37,7 @@ export class MessagingMain {
|
||||
break;
|
||||
case 'minimizeOnCopy':
|
||||
this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey).then(
|
||||
(shouldMinimize) => {
|
||||
shouldMinimize => {
|
||||
if (shouldMinimize && this.main.windowMain.win !== null) {
|
||||
this.main.windowMain.win.minimize();
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { promises as fs, existsSync } from 'fs';
|
||||
import { existsSync, promises as fs } from 'fs';
|
||||
import * as ipc from 'node-ipc';
|
||||
import { homedir, userInfo } from 'os';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
import { homedir, userInfo } from 'os';
|
||||
|
||||
import { LogService } from 'jslib/abstractions/log.service';
|
||||
import { ipcMain } from 'electron';
|
||||
import { LogService } from 'jslib/abstractions/log.service';
|
||||
import { WindowMain } from 'jslib/electron/window.main';
|
||||
|
||||
export class NativeMessagingMain {
|
||||
@ -31,11 +31,11 @@ export class NativeMessagingMain {
|
||||
if (this.socket != null && msg != null) {
|
||||
this.send(msg, this.socket);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
ipc.server.on('connect', () => {
|
||||
this.connected = true;
|
||||
})
|
||||
});
|
||||
|
||||
ipc.server.on(
|
||||
'socket.disconnected',
|
||||
@ -66,7 +66,7 @@ export class NativeMessagingMain {
|
||||
'description': 'Bitwarden desktop <-> browser bridge',
|
||||
'path': this.binaryPath(),
|
||||
'type': 'stdio',
|
||||
}
|
||||
};
|
||||
|
||||
const firefoxJson = {...baseJson, ...{ 'allowed_extensions': ['{446900e4-71c2-419f-a6a7-df9c091e268b}']}};
|
||||
const chromeJson = {...baseJson, ...{
|
||||
@ -168,11 +168,11 @@ export class NativeMessagingMain {
|
||||
const createKey = util.promisify(regedit.createKey);
|
||||
const putValue = util.promisify(regedit.putValue);
|
||||
|
||||
this.logService.debug(`Adding registry: ${location}`)
|
||||
this.logService.debug(`Adding registry: ${location}`);
|
||||
|
||||
// Check installed
|
||||
try {
|
||||
await list(check)
|
||||
await list(check);
|
||||
} catch {
|
||||
this.logService.warning(`Not finding registry ${check} skipping.`);
|
||||
return;
|
||||
@ -188,7 +188,7 @@ export class NativeMessagingMain {
|
||||
value: jsonFile,
|
||||
type: 'REG_DEFAULT',
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
return putValue(obj);
|
||||
} catch (error) {
|
||||
@ -202,7 +202,7 @@ export class NativeMessagingMain {
|
||||
const list = util.promisify(regedit.list);
|
||||
const deleteKey = util.promisify(regedit.deleteKey);
|
||||
|
||||
this.logService.debug(`Removing registry: ${key}`)
|
||||
this.logService.debug(`Removing registry: ${key}`);
|
||||
|
||||
try {
|
||||
await list(key);
|
||||
|
@ -10,7 +10,7 @@ if (process.platform === 'darwin') {
|
||||
}
|
||||
|
||||
export default class IPC {
|
||||
onMessage: (message: object) => void
|
||||
onMessage: (message: object) => void;
|
||||
|
||||
private connected = false;
|
||||
|
||||
@ -24,7 +24,7 @@ export default class IPC {
|
||||
);
|
||||
|
||||
// Notify browser extension, connection is established to desktop application.
|
||||
this.onMessage({command: 'connected'})
|
||||
this.onMessage({command: 'connected'});
|
||||
});
|
||||
|
||||
ipc.of.bitwarden.on('disconnect', () => {
|
||||
@ -32,7 +32,7 @@ export default class IPC {
|
||||
console.error('disconnected from world');
|
||||
|
||||
// Notify browser extension, no connection to desktop application.
|
||||
this.onMessage({command: 'disconnected'})
|
||||
this.onMessage({command: 'disconnected'});
|
||||
});
|
||||
|
||||
ipc.of.bitwarden.on('message', (message: any) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import NativeMessage from './nativemessage';
|
||||
import IPC from './ipc';
|
||||
import NativeMessage from './nativemessage';
|
||||
|
||||
// Proxy is a lightweight application which provides bi-directional communication
|
||||
// between the browser extension and a running desktop application.
|
||||
|
@ -10,10 +10,10 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey';
|
||||
import { StorageService } from 'jslib/abstractions';
|
||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey';
|
||||
|
||||
const MessageValidTimeout = 10 * 1000;
|
||||
const EncryptionAlgorithm = 'sha1';
|
||||
|
11
tslint.json
11
tslint.json
@ -49,6 +49,15 @@
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"max-classes-per-file": false
|
||||
"max-classes-per-file": false,
|
||||
"ordered-imports": true,
|
||||
"arrow-parens": [
|
||||
true,
|
||||
"ban-single-arg-parens"
|
||||
],
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user