From a4127f2571a0fb137cddd55151b481a1e28dd4cf Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 6 Dec 2017 14:23:34 -0500 Subject: [PATCH] dont allow shorthand property assignments --- src/background/main.background.ts | 5 +++-- src/popup/app/components/action-buttons.component.ts | 2 +- src/popup/app/components/cipher-items.component.ts | 6 +++--- src/popup/app/components/icon.component.ts | 2 +- src/popup/app/components/pop-out.component.ts | 2 +- src/popup/app/current/current.component.ts | 4 ++-- src/popup/app/lock/lock.component.ts | 2 +- src/popup/app/settings/about.component.ts | 2 +- src/popup/app/settings/credits.component.ts | 2 +- src/popup/app/settings/environment.component.ts | 2 +- src/popup/app/settings/folders/add-folder.component.ts | 2 +- src/popup/app/settings/folders/edit-folder.component.ts | 2 +- src/popup/app/settings/folders/folders.component.ts | 2 +- src/popup/app/settings/help.component.ts | 2 +- src/popup/app/settings/options.component.ts | 2 +- src/popup/app/settings/premium.component.ts | 2 +- src/popup/app/settings/settings.component.ts | 2 +- src/popup/app/settings/sync.component.ts | 2 +- src/popup/app/tools/export.component.ts | 2 +- src/popup/app/tools/password-generator-history.component.ts | 2 +- src/popup/app/tools/password-generator.component.ts | 2 +- src/popup/app/tools/tools.component.ts | 2 +- src/services/i18n.service.ts | 4 ++-- tslint.json | 1 + 24 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 3b9298c92d..637024d50e 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -420,18 +420,19 @@ export default class MainBackground { return; } + const self = this; const tab = await this.tabsQueryFirst({ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT }); if (!tab) { return; } - const disabled = await this.utilsService.getObjFromStorage(ConstantsService.disableContextMenuItemKey); + const disabled = await self.utilsService.getObjFromStorage(ConstantsService.disableContextMenuItemKey); if (!disabled) { await this.buildContextMenu(); this.contextMenuReady(tab, true); } else { await this.contextMenusRemoveAll(); - this.contextMenuReady(tab, false); + self.contextMenuReady(tab, false); } } diff --git a/src/popup/app/components/action-buttons.component.ts b/src/popup/app/components/action-buttons.component.ts index 552f0a8b79..a04ff170f6 100644 --- a/src/popup/app/components/action-buttons.component.ts +++ b/src/popup/app/components/action-buttons.component.ts @@ -47,5 +47,5 @@ export const ActionButtonsComponent = { onView: '&', }, controller: ActionButtonsController, - template, + template: template, }; diff --git a/src/popup/app/components/cipher-items.component.ts b/src/popup/app/components/cipher-items.component.ts index 93b5da03c3..c6387c0a26 100644 --- a/src/popup/app/components/cipher-items.component.ts +++ b/src/popup/app/components/cipher-items.component.ts @@ -11,11 +11,11 @@ export class CipherItemsController implements ng.IController { } view(cipher: any) { - return this.onView({cipher}); + return this.onView({ cipher: cipher }); } select(cipher: any) { - return this.onSelected({cipher}); + return this.onSelected({ cipher: cipher }); } } @@ -27,5 +27,5 @@ export const CipherItemsComponent = { onView: '&', }, controller: CipherItemsController, - template, + template: template, }; diff --git a/src/popup/app/components/icon.component.ts b/src/popup/app/components/icon.component.ts index 9d129564ba..de3c0dc877 100644 --- a/src/popup/app/components/icon.component.ts +++ b/src/popup/app/components/icon.component.ts @@ -78,5 +78,5 @@ export const IconComponent = { cipher: '<', }, controller: IconController, - template, + template: template, }; diff --git a/src/popup/app/components/pop-out.component.ts b/src/popup/app/components/pop-out.component.ts index 3ba85bf66f..5af16e1691 100644 --- a/src/popup/app/components/pop-out.component.ts +++ b/src/popup/app/components/pop-out.component.ts @@ -56,5 +56,5 @@ export class PopOutController implements ng.IController { export const PopOutComponent = { bindings: {}, controller: PopOutController, - template, + template: template, }; diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index 6cbf384cec..78284ae455 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -69,7 +69,7 @@ export class CurrentController { } this.autofillService.doAutoFill({ - cipher, + cipher: cipher, pageDetails: this.pageDetails, fromBackground: false, }).then((totpCode: string) => { @@ -165,5 +165,5 @@ export class CurrentController { export const CurrentComponent = { bindings: {}, controller: CurrentController, - template, + template: template, }; diff --git a/src/popup/app/lock/lock.component.ts b/src/popup/app/lock/lock.component.ts index 244386f6a5..50b4047220 100644 --- a/src/popup/app/lock/lock.component.ts +++ b/src/popup/app/lock/lock.component.ts @@ -59,5 +59,5 @@ export class LockController { export const LockComponent = { bindings: {}, controller: LockController, - template, + template: template, }; diff --git a/src/popup/app/settings/about.component.ts b/src/popup/app/settings/about.component.ts index a8e2f0d2c9..9098e40a12 100644 --- a/src/popup/app/settings/about.component.ts +++ b/src/popup/app/settings/about.component.ts @@ -15,5 +15,5 @@ export class AboutController { export const AboutComponent = { bindings: {}, controller: AboutController, - template, + template: template, }; diff --git a/src/popup/app/settings/credits.component.ts b/src/popup/app/settings/credits.component.ts index 36f27e73f0..aab107787c 100644 --- a/src/popup/app/settings/credits.component.ts +++ b/src/popup/app/settings/credits.component.ts @@ -19,5 +19,5 @@ export class CreditsController { export const CreditsComponent = { bindings: {}, controller: CreditsController, - template, + template: template, }; diff --git a/src/popup/app/settings/environment.component.ts b/src/popup/app/settings/environment.component.ts index 9cdaccf819..be886e5863 100644 --- a/src/popup/app/settings/environment.component.ts +++ b/src/popup/app/settings/environment.component.ts @@ -51,5 +51,5 @@ export class EnvironmentController { export const EnvironmentComponent = { bindings: {}, controller: EnvironmentController, - template, + template: template, }; diff --git a/src/popup/app/settings/folders/add-folder.component.ts b/src/popup/app/settings/folders/add-folder.component.ts index d7678865ee..14382d181d 100644 --- a/src/popup/app/settings/folders/add-folder.component.ts +++ b/src/popup/app/settings/folders/add-folder.component.ts @@ -40,5 +40,5 @@ export class AddFolderController { export const AddFolderComponent = { bindings: {}, controller: AddFolderController, - template, + template: template, }; diff --git a/src/popup/app/settings/folders/edit-folder.component.ts b/src/popup/app/settings/folders/edit-folder.component.ts index 9235fdb757..f923a99cb3 100644 --- a/src/popup/app/settings/folders/edit-folder.component.ts +++ b/src/popup/app/settings/folders/edit-folder.component.ts @@ -74,5 +74,5 @@ export const EditFolderComponent = { $transition$: '<', }, controller: EditFolderController, - template, + template: template, }; diff --git a/src/popup/app/settings/folders/folders.component.ts b/src/popup/app/settings/folders/folders.component.ts index ea7aeba8ce..cc7d045abb 100644 --- a/src/popup/app/settings/folders/folders.component.ts +++ b/src/popup/app/settings/folders/folders.component.ts @@ -35,5 +35,5 @@ export class FoldersController { export const FoldersComponent = { bindings: {}, controller: FoldersController, - template, + template: template, }; diff --git a/src/popup/app/settings/help.component.ts b/src/popup/app/settings/help.component.ts index 2b55547b24..51794fb22e 100644 --- a/src/popup/app/settings/help.component.ts +++ b/src/popup/app/settings/help.component.ts @@ -31,5 +31,5 @@ export class HelpController { export const HelpComponent = { bindings: {}, controller: HelpController, - template, + template: template, }; diff --git a/src/popup/app/settings/options.component.ts b/src/popup/app/settings/options.component.ts index 193153c699..e09614f0b7 100644 --- a/src/popup/app/settings/options.component.ts +++ b/src/popup/app/settings/options.component.ts @@ -91,5 +91,5 @@ export class OptionsController { export const OptionsComponent = { bindings: {}, controller: OptionsController, - template, + template: template, }; diff --git a/src/popup/app/settings/premium.component.ts b/src/popup/app/settings/premium.component.ts index e4b4c345f5..94e2da4adb 100644 --- a/src/popup/app/settings/premium.component.ts +++ b/src/popup/app/settings/premium.component.ts @@ -56,5 +56,5 @@ export class PremiumController { export const PremiumComponent = { bindings: {}, controller: PremiumController, - template, + template: template, }; diff --git a/src/popup/app/settings/settings.component.ts b/src/popup/app/settings/settings.component.ts index 7fd8e99394..103c7a6994 100644 --- a/src/popup/app/settings/settings.component.ts +++ b/src/popup/app/settings/settings.component.ts @@ -148,5 +148,5 @@ export class SettingsController { export const SettingsComponent = { bindings: {}, controller: SettingsController, - template, + template: template, }; diff --git a/src/popup/app/settings/sync.component.ts b/src/popup/app/settings/sync.component.ts index 6a642d933c..3e71d6d211 100644 --- a/src/popup/app/settings/sync.component.ts +++ b/src/popup/app/settings/sync.component.ts @@ -38,5 +38,5 @@ export class SyncController { export const SyncComponent = { bindings: {}, controller: SyncController, - template, + template: template, }; diff --git a/src/popup/app/tools/export.component.ts b/src/popup/app/tools/export.component.ts index 4663a3ba8f..0fa9f63145 100644 --- a/src/popup/app/tools/export.component.ts +++ b/src/popup/app/tools/export.component.ts @@ -166,5 +166,5 @@ export class ExportController { export const ExportComponent = { bindings: {}, controller: ExportController, - template, + template: template, }; diff --git a/src/popup/app/tools/password-generator-history.component.ts b/src/popup/app/tools/password-generator-history.component.ts index f99c2b39ec..0bc4bc1c7d 100644 --- a/src/popup/app/tools/password-generator-history.component.ts +++ b/src/popup/app/tools/password-generator-history.component.ts @@ -50,5 +50,5 @@ export const PasswordGeneratorHistoryComponent = { $transition$: '<', }, controller: PasswordGeneratorHistoryController, - template, + template: template, }; diff --git a/src/popup/app/tools/password-generator.component.ts b/src/popup/app/tools/password-generator.component.ts index 0727f54192..fcccbee4aa 100644 --- a/src/popup/app/tools/password-generator.component.ts +++ b/src/popup/app/tools/password-generator.component.ts @@ -140,5 +140,5 @@ export const PasswordGeneratorComponent = { $transition$: '<', }, controller: PasswordGeneratorController, - template, + template: template, }; diff --git a/src/popup/app/tools/tools.component.ts b/src/popup/app/tools/tools.component.ts index 7f55134f38..900c3170c9 100644 --- a/src/popup/app/tools/tools.component.ts +++ b/src/popup/app/tools/tools.component.ts @@ -56,5 +56,5 @@ export class ToolsController { export const ToolsComponent = { bindings: {}, controller: ToolsController, - template, + template: template, }; diff --git a/src/services/i18n.service.ts b/src/services/i18n.service.ts index 19747d4ae4..a294015f3c 100644 --- a/src/services/i18n.service.ts +++ b/src/services/i18n.service.ts @@ -18,10 +18,10 @@ export default function i18nService(utilsService: UtilsService) { } return new Proxy({}, { - get(target, name) { + get: (target, name) => { return chrome.i18n.getMessage(name); }, - set(target, name, value) { + set: (target, name, value) => { return false; }, }); diff --git a/tslint.json b/tslint.json index c58665a8ca..b6d5571669 100644 --- a/tslint.json +++ b/tslint.json @@ -36,6 +36,7 @@ ], "no-empty": [ true, "allow-empty-catch" ], "object-literal-sort-keys": false, + "object-literal-shorthand": [ true, "never" ], "prefer-for-of": false, "quotemark": [ true, "single" ], "whitespace": [