mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Linter updates and fixes (#1604)
This commit is contained in:
@@ -66,7 +66,7 @@ export default class ContextMenusBackground {
|
||||
}
|
||||
|
||||
const ciphers = await this.cipherService.getAllDecrypted();
|
||||
const cipher = ciphers.find((c) => c.id === id);
|
||||
const cipher = ciphers.find(c => c.id === id);
|
||||
if (cipher == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,12 +78,12 @@ import TabsBackground from './tabs.background';
|
||||
import WebRequestBackground from './webRequest.background';
|
||||
import WindowsBackground from './windows.background';
|
||||
|
||||
import { PopupUtilsService } from '../popup/services/popup-utils.service';
|
||||
import AutofillService from '../services/autofill.service';
|
||||
import BrowserMessagingService from '../services/browserMessaging.service';
|
||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||
import BrowserStorageService from '../services/browserStorage.service';
|
||||
import I18nService from '../services/i18n.service';
|
||||
import { PopupUtilsService } from '../popup/services/popup-utils.service';
|
||||
|
||||
import { AutofillService as AutofillServiceAbstraction } from '../services/abstractions/autofill.service';
|
||||
|
||||
@@ -164,7 +164,7 @@ export default class MainBackground {
|
||||
return Promise.reject(e);
|
||||
}
|
||||
|
||||
return promise.then((result) => result.response === 'unlocked');
|
||||
return promise.then(result => result.response === 'unlocked');
|
||||
}
|
||||
});
|
||||
this.storageService = new BrowserStorageService();
|
||||
@@ -279,7 +279,7 @@ export default class MainBackground {
|
||||
await this.webRequestBackground.init();
|
||||
await this.windowsBackground.init();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(async () => {
|
||||
await this.environmentService.setUrlsFromStorage();
|
||||
await this.setIcon();
|
||||
@@ -422,11 +422,11 @@ export default class MainBackground {
|
||||
return;
|
||||
}
|
||||
|
||||
const getStorage = (): Promise<any> => new Promise((resolve) => {
|
||||
const getStorage = (): Promise<any> => new Promise(resolve => {
|
||||
chrome.storage.local.get(null, (o: any) => resolve(o));
|
||||
});
|
||||
|
||||
const clearStorage = (): Promise<void> => new Promise((resolve) => {
|
||||
const clearStorage = (): Promise<void> => new Promise(resolve => {
|
||||
chrome.storage.local.clear(() => resolve());
|
||||
});
|
||||
|
||||
@@ -527,7 +527,7 @@ export default class MainBackground {
|
||||
ciphers.sort((a, b) => this.cipherService.sortCiphersByLastUsedThenName(a, b));
|
||||
|
||||
if (contextMenuEnabled) {
|
||||
ciphers.forEach((cipher) => {
|
||||
ciphers.forEach(cipher => {
|
||||
this.loadLoginContextMenuOptions(cipher);
|
||||
});
|
||||
}
|
||||
@@ -560,7 +560,7 @@ export default class MainBackground {
|
||||
|
||||
const tabs = await BrowserApi.getActiveTabs();
|
||||
if (tabs != null) {
|
||||
tabs.forEach((tab) => {
|
||||
tabs.forEach(tab => {
|
||||
if (tab.id != null) {
|
||||
this.browserActionSetBadgeText('', tab.id);
|
||||
this.sidebarActionSetBadgeText('', tab.id);
|
||||
@@ -703,7 +703,7 @@ export default class MainBackground {
|
||||
// Browser API Helpers
|
||||
|
||||
private contextMenusRemoveAll() {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
chrome.contextMenus.removeAll(() => {
|
||||
resolve();
|
||||
if (chrome.runtime.lastError) {
|
||||
@@ -714,7 +714,7 @@ export default class MainBackground {
|
||||
}
|
||||
|
||||
private contextMenusCreate(options: any) {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
chrome.contextMenus.create(options, () => {
|
||||
resolve();
|
||||
if (chrome.runtime.lastError) {
|
||||
@@ -739,7 +739,7 @@ export default class MainBackground {
|
||||
if (this.platformUtilsService.isFirefox()) {
|
||||
await theAction.setIcon(options);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
theAction.setIcon(options, () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
import { AppIdService } from 'jslib/abstractions/appId.service';
|
||||
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
|
||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
import { SymmetricCryptoKey } from 'jslib/models/domain';
|
||||
@@ -38,7 +38,7 @@ export class NativeMessagingBackground {
|
||||
|
||||
if (BrowserApi.isChromeApi) {
|
||||
// Reload extension to activate nativeMessaging
|
||||
chrome.permissions.onAdded.addListener((permissions) => {
|
||||
chrome.permissions.onAdded.addListener(permissions => {
|
||||
BrowserApi.reloadExtension(null);
|
||||
});
|
||||
}
|
||||
@@ -264,7 +264,7 @@ export class NativeMessagingBackground {
|
||||
this.sendUnencrypted({
|
||||
command: 'setupEncryption',
|
||||
publicKey: Utils.fromBufferToB64(publicKey),
|
||||
userId: await this.userService.getUserId()
|
||||
userId: await this.userService.getUserId(),
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => this.secureSetupResolve = resolve);
|
||||
|
||||
@@ -4,10 +4,7 @@ import { CipherView } from 'jslib/models/view/cipherView';
|
||||
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||
import { LoginView } from 'jslib/models/view/loginView';
|
||||
|
||||
import { AutofillService } from '../services/abstractions/autofill.service';
|
||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||
@@ -16,6 +13,9 @@ import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
import { SystemService } from 'jslib/abstractions/system.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
import { AutofillService } from '../services/abstractions/autofill.service';
|
||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||
|
||||
import { BrowserApi } from '../browser/browserApi';
|
||||
|
||||
@@ -185,7 +185,7 @@ export default class RuntimeBackground {
|
||||
const totpCode = await this.autofillService.doAutoFill({
|
||||
cipher: this.main.loginToAutoFill,
|
||||
pageDetails: this.pageDetailsToAutoFill,
|
||||
fillNewPassword: true
|
||||
fillNewPassword: true,
|
||||
});
|
||||
|
||||
if (totpCode != null) {
|
||||
@@ -306,7 +306,7 @@ export default class RuntimeBackground {
|
||||
}
|
||||
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(loginInfo.url);
|
||||
const usernameMatches = ciphers.filter((c) =>
|
||||
const usernameMatches = ciphers.filter(c =>
|
||||
c.login.username != null && c.login.username.toLowerCase() === normalizedUsername);
|
||||
if (usernameMatches.length === 0) {
|
||||
const disabledAddLogin = await this.storageService.get<boolean>(
|
||||
@@ -354,7 +354,7 @@ export default class RuntimeBackground {
|
||||
let id: string = null;
|
||||
const ciphers = await this.cipherService.getAllDecryptedForUrl(changeData.url);
|
||||
if (changeData.currentPassword != null) {
|
||||
const passwordMatches = ciphers.filter((c) => c.login.password === changeData.currentPassword);
|
||||
const passwordMatches = ciphers.filter(c => c.login.password === changeData.currentPassword);
|
||||
if (passwordMatches.length === 1) {
|
||||
id = passwordMatches[0].id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user