1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-24 11:55:50 +01:00

lint fixes

This commit is contained in:
Kyle Spearrin 2018-02-08 10:37:54 -05:00
parent 7d8b00904a
commit 58e39c0c81
22 changed files with 100 additions and 90 deletions

View File

@ -6,8 +6,8 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';

View File

@ -1,13 +1,10 @@
import * as template from './hint.component.html';
import {
Component,
} from '@angular/core';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { PasswordHintRequest } from 'jslib/models/request/passwordHintRequest';

View File

@ -6,14 +6,13 @@ import {
ViewChild,
ViewContainerRef,
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentComponent } from './environment.component';
import { ModalComponent } from '../modal.component';
import { EnvironmentComponent } from './environment.component';
import { AuthResult } from 'jslib/models/domain/authResult';

View File

@ -1,13 +1,10 @@
import * as template from './register.component.html';
import {
Component,
} from '@angular/core';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { RegisterRequest } from 'jslib/models/request/registerRequest';

View File

@ -7,11 +7,10 @@ import {
OnInit,
Output,
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';

View File

@ -10,11 +10,12 @@ import {
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { ModalComponent } from '../modal.component';
import { TwoFactorOptionsComponent } from './two-factor-options.component';
import { ModalComponent } from '../modal.component';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
@ -79,26 +80,26 @@ export class TwoFactorComponent implements OnInit {
break;
}
const challenges = JSON.parse(params['Challenges']);
const challenges = JSON.parse(params.Challenges);
// TODO: init u2f
break;
case TwoFactorProviderType.Duo:
setTimeout(() => {
(window as any).Duo.init({
host: params['Host'],
sig_request: params['Signature'],
host: params.Host,
sig_request: params.Signature,
submit_callback: async (f: HTMLFormElement) => {
const sig = f.querySelector('input[name="sig_response"]') as HTMLInputElement;
if (sig != null) {
this.token = sig.value;
await this.submit();
}
}
},
});
});
break;
case TwoFactorProviderType.Email:
this.twoFactorEmail = params['Email'];
this.twoFactorEmail = params.Email;
if (this.authService.twoFactorProviders.size > 1) {
await this.sendEmail(false);
}

View File

@ -1,5 +1,8 @@
import {
ToasterConfig,
ToasterContainerComponent,
} from 'angular2-toaster';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { ToasterContainerComponent, ToasterConfig } from 'angular2-toaster';
import { Component } from '@angular/core';

View File

@ -1,39 +1,45 @@
import 'core-js';
import 'zone.js/dist/zone';
import { ToasterModule } from 'angular2-toaster';
import { Angulartics2Module } from 'angulartics2';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { ServicesModule } from './services/services.module';
import { ToasterModule } from 'angular2-toaster';
import { AddEditComponent } from './vault/add-edit.component';
import { ApiActionDirective } from './directives/api-action.directive';
import { AppRoutingModule } from './app-routing.module';
import { ServicesModule } from './services/services.module';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { AttachmentsComponent } from './vault/attachments.component';
import { ModalComponent } from './modal.component';
import { EnvironmentComponent } from './accounts/environment.component';
import { HintComponent } from './accounts/hint.component';
import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { ApiActionDirective } from './directives/api-action.directive';
import { AutofocusDirective } from './directives/autofocus.directive';
import { BlurClickDirective } from './directives/blur-click.directive';
import { BoxRowDirective } from './directives/box-row.directive';
import { CiphersComponent } from './vault/ciphers.component';
import { EnvironmentComponent } from './accounts/environment.component';
import { FallbackSrcDirective } from './directives/fallback-src.directive';
import { FolderAddEditComponent } from './vault/folder-add-edit.component';
import { GroupingsComponent } from './vault/groupings.component';
import { HintComponent } from './accounts/hint.component';
import { I18nPipe } from './pipes/i18n.pipe';
import { IconComponent } from './vault/icon.component';
import { LoginComponent } from './accounts/login.component';
import { ModalComponent } from './modal.component';
import { PasswordGeneratorComponent } from './vault/password-generator.component';
import { RegisterComponent } from './accounts/register.component';
import { SearchCiphersPipe } from './pipes/search-ciphers.pipe';
import { StopClickDirective } from './directives/stop-click.directive';
import { StopPropDirective } from './directives/stop-prop.directive';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
import { I18nPipe } from './pipes/i18n.pipe';
import { SearchCiphersPipe } from './pipes/search-ciphers.pipe';
import { AddEditComponent } from './vault/add-edit.component';
import { AttachmentsComponent } from './vault/attachments.component';
import { CiphersComponent } from './vault/ciphers.component';
import { FolderAddEditComponent } from './vault/folder-add-edit.component';
import { GroupingsComponent } from './vault/groupings.component';
import { IconComponent } from './vault/icon.component';
import { PasswordGeneratorComponent } from './vault/password-generator.component';
import { VaultComponent } from './vault/vault.component';
import { ViewComponent } from './vault/view.component';

View File

@ -9,15 +9,15 @@ import {
})
export class AutofocusDirective {
@Input() set appAutofocus(condition: boolean | string) {
this._autofocus = condition === '' || condition === true;
this.autofocus = condition === '' || condition === true;
}
private _autofocus: boolean;
private autofocus: boolean;
constructor(private el: ElementRef) { }
ngOnInit() {
if (this._autofocus) {
if (this.autofocus) {
this.el.nativeElement.focus();
}
}

View File

@ -1,7 +1,9 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
// tslint:disable-next-line
require('../scss/styles.scss');
// tslint:disable-next-line
require('../scripts/duo.js');
import { AppModule } from './app.module';

View File

@ -19,7 +19,7 @@ export class SearchCiphersPipe implements PipeTransform {
}
searchText = searchText.toLowerCase();
return ciphers.filter(c => {
return ciphers.filter((c) => {
if (c.name != null && c.name.toLowerCase().indexOf(searchText) > -1) {
return true;
}

View File

@ -9,8 +9,8 @@ import { ToasterModule } from 'angular2-toaster';
import { DesktopMessagingService } from '../../services/desktopMessaging.service';
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { I18nService } from '../../services/i18n.service';
import { ValidationService } from './validation.service';
@ -102,12 +102,12 @@ environmentService.setUrlsFromStorage().then(() => {
return syncService.fullSync(true);
});
function initFactory(i18n: I18nService, platformUtilsService: DesktopPlatformUtilsService): Function {
function initFactory(i18n: I18nService, platformUtils: DesktopPlatformUtilsService): Function {
return async () => {
await i18n.init();
await authService.init();
const htmlEl = window.document.documentElement;
htmlEl.classList.add('os_' + platformUtilsService.getDeviceString());
htmlEl.classList.add('os_' + platformUtils.getDeviceString());
htmlEl.classList.add('locale_' + i18n.translationLocale);
};
}
@ -136,7 +136,7 @@ function initFactory(i18n: I18nService, platformUtilsService: DesktopPlatformUti
provide: APP_INITIALIZER,
useFactory: initFactory,
deps: [
I18nServiceAbstraction,
I18nServiceAbstraction,
PlatformUtilsServiceAbstraction,
],
multi: true,

View File

@ -8,8 +8,8 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from 'jslib/enums/cipherType';
import { FieldType } from 'jslib/enums/fieldType';
@ -144,7 +144,8 @@ export class AddEditComponent implements OnChanges {
await this.formPromise;
this.cipher.id = cipher.id;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Cipher' : 'Added Cipher' });
this.toasterService.popAsync('success', null, this.i18nService.t(this.editMode ? 'editedItem' : 'addedItem'));
this.toasterService.popAsync('success', null,
this.i18nService.t(this.editMode ? 'editedItem' : 'addedItem'));
this.onSavedCipher.emit(this.cipher);
} catch { }
}
@ -177,7 +178,7 @@ export class AddEditComponent implements OnChanges {
async delete() {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteItemConfirmation'), this.i18nService.t('deleteItem'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning')
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) {
return;
}
@ -195,7 +196,7 @@ export class AddEditComponent implements OnChanges {
if (this.cipher.login != null && this.cipher.login.password != null && this.cipher.login.password.length) {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('overwritePasswordConfirmation'), this.i18nService.t('overwritePassword'),
this.i18nService.t('yes'), this.i18nService.t('no'))
this.i18nService.t('yes'), this.i18nService.t('no'));
if (!confirmed) {
return;
}

View File

@ -8,8 +8,8 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -19,8 +19,8 @@ import { TokenService } from 'jslib/abstractions/token.service';
import { Cipher } from 'jslib/models/domain/cipher';
import { CipherView } from 'jslib/models/view/cipherView';
import { AttachmentView } from 'jslib/models/view/attachmentView';
import { CipherView } from 'jslib/models/view/cipherView';
@Component({
selector: 'app-vault-attachments',
@ -53,14 +53,14 @@ export class AttachmentsComponent implements OnInit {
if (!this.canAccessAttachments) {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('premiumRequiredDesc'), this.i18nService.t('premiumRequired'),
this.i18nService.t('learnMore'), this.i18nService.t('cancel'))
this.i18nService.t('learnMore'), this.i18nService.t('cancel'));
if (confirmed) {
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
}
} else if (!this.hasUpdatedKey) {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('updateKey'), this.i18nService.t('featureUnavailable'),
this.i18nService.t('learnMore'), this.i18nService.t('cancel'), 'warning')
this.i18nService.t('learnMore'), this.i18nService.t('cancel'), 'warning');
if (confirmed) {
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/update-encryption-key/');
}
@ -110,7 +110,7 @@ export class AttachmentsComponent implements OnInit {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteAttachmentConfirmation'), this.i18nService.t('deleteAttachment'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning')
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) {
return;
}

View File

@ -7,10 +7,10 @@ import {
Output,
} from '@angular/core';
import { CipherView } from 'jslib/models/view/cipherView';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CipherView } from 'jslib/models/view/cipherView';
@Component({
selector: 'app-vault-ciphers',
template: template,
@ -30,7 +30,7 @@ export class CiphersComponent {
async load(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter;
let ciphers = await this.cipherService.getAllDecrypted();
const ciphers = await this.cipherService.getAllDecrypted();
if (this.filter == null) {
this.ciphers = ciphers;

View File

@ -8,8 +8,8 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
@ -58,7 +58,7 @@ export class FolderAddEditComponent implements OnInit {
try {
const folder = await this.folderService.encrypt(this.folder);
this.formPromise = this.folderService.saveWithServer(folder);;
this.formPromise = this.folderService.saveWithServer(folder);
await this.formPromise;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Folder' : 'Added Folder' });
this.toasterService.popAsync('success', null,
@ -70,7 +70,7 @@ export class FolderAddEditComponent implements OnInit {
async delete() {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteFolderConfirmation'), this.i18nService.t('deleteFolder'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning')
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) {
return;
}

View File

@ -10,8 +10,8 @@ import {
import { CipherType } from 'jslib/enums/cipherType';
import { FolderView } from 'jslib/models/view/folderView';
import { CollectionView } from 'jslib/models/view/collectionView';
import { FolderView } from 'jslib/models/view/folderView';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service';

View File

@ -1,7 +1,7 @@
import * as template from './password-generator.component.html';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import {
Component,

View File

@ -1,5 +1,6 @@
import * as template from './vault.component.html';
import { Location } from '@angular/common';
import {
Component,
ComponentFactoryResolver,
@ -7,21 +8,19 @@ import {
ViewChild,
ViewContainerRef,
} from '@angular/core';
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { Location } from '@angular/common';
import { ModalComponent } from '../modal.component';
import { AttachmentsComponent } from './attachments.component';
import { AddEditComponent } from './add-edit.component';
import { AttachmentsComponent } from './attachments.component';
import { CiphersComponent } from './ciphers.component';
import { FolderAddEditComponent } from './folder-add-edit.component';
import { GroupingsComponent } from './groupings.component';
import { PasswordGeneratorComponent } from './password-generator.component';
import { ModalComponent } from '../modal.component';
import { CipherType } from 'jslib/enums/cipherType';
@ -56,32 +55,32 @@ export class VaultComponent implements OnInit {
async ngOnInit() {
this.route.queryParams.subscribe(async (params) => {
if (params['cipherId']) {
if (params.cipherId) {
const cipherView = new CipherView();
cipherView.id = params['cipherId'];
if (params['action'] === 'edit') {
cipherView.id = params.cipherId;
if (params.action === 'edit') {
this.editCipher(cipherView);
} else {
this.viewCipher(cipherView);
}
} else if (params['action'] === 'add') {
} else if (params.action === 'add') {
this.addCipher();
}
if (params['favorites']) {
if (params.favorites) {
this.groupingsComponent.selectedFavorites = true;
await this.filterFavorites();
} else if (params['type']) {
const t = parseInt(params['type']);
} else if (params.type) {
const t = parseInt(params.type, null);
this.groupingsComponent.selectedType = t;
await this.filterCipherType(t);
} else if (params['folderId']) {
} else if (params.folderId) {
this.groupingsComponent.selectedFolder = true;
this.groupingsComponent.selectedFolderId = params['folderId'];
await this.filterFolder(params['folderId']);
} else if (params['collectionId']) {
this.groupingsComponent.selectedCollectionId = params['collectionId'];
await this.filterCollection(params['collectionId']);
this.groupingsComponent.selectedFolderId = params.folderId;
await this.filterFolder(params.folderId);
} else if (params.collectionId) {
this.groupingsComponent.selectedCollectionId = params.collectionId;
await this.filterCollection(params.collectionId);
} else {
this.groupingsComponent.selectedAll = true;
await this.ciphersComponent.load();

View File

@ -9,8 +9,8 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from 'jslib/enums/cipherType';
import { FieldType } from 'jslib/enums/fieldType';

View File

@ -1,5 +1,6 @@
import { StorageService } from 'jslib/abstractions';
// tslint:disable-next-line
const Store = require('electron-store');
const store = new Store();

View File

@ -116,6 +116,11 @@ const renderer = {
path: 'fonts/',
filename: 'css/fonts.css'
}),
// ref: https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)esm5/,
path.resolve(__dirname, './src')
),
new webpack.optimize.CommonsChunkPlugin({
name: 'app/vendor',
chunks: ['app/main'],