1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

Add AC Team eslint configuration (#9971)

This commit is contained in:
Thomas Rittson
2024-07-09 23:33:07 +10:00
committed by GitHub
parent 1cb063689f
commit f9b623b37c
22 changed files with 95 additions and 38 deletions

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -24,7 +24,7 @@ export class PaidOrganizationOnlyComponent {}
@Component({ @Component({
template: "<h1>This is the organization upgrade screen!</h1>", template: "<h1>This is the organization upgrade screen!</h1>",
}) })
export class OrganizationUpgradeScreen {} export class OrganizationUpgradeScreenComponent {}
const orgFactory = (props: Partial<Organization> = {}) => const orgFactory = (props: Partial<Organization> = {}) =>
Object.assign( Object.assign(
@@ -62,7 +62,7 @@ describe("Is Paid Org Guard", () => {
}, },
{ {
path: "organizations/:organizationId/billing/subscription", path: "organizations/:organizationId/billing/subscription",
component: OrganizationUpgradeScreen, component: OrganizationUpgradeScreenComponent,
}, },
]), ]),
], ],

View File

@@ -1,5 +1,5 @@
import { KeyValue } from "@angular/common"; import { KeyValue } from "@angular/common";
import { Component, EventEmitter, Input, Output, OnInit, OnDestroy } from "@angular/core"; import { Component, Input, OnInit, OnDestroy } from "@angular/core";
import { FormControl, FormGroup } from "@angular/forms"; import { FormControl, FormGroup } from "@angular/forms";
import { Subject, takeUntil } from "rxjs"; import { Subject, takeUntil } from "rxjs";
@@ -14,8 +14,6 @@ export class NestedCheckboxComponent implements OnInit, OnDestroy {
@Input() parentId: string; @Input() parentId: string;
@Input() checkboxes: FormGroup<Record<string, FormControl<boolean>>>; @Input() checkboxes: FormGroup<Record<string, FormControl<boolean>>>;
@Output() onSavedUser = new EventEmitter();
@Output() onDeletedUser = new EventEmitter();
get parentIndeterminate() { get parentIndeterminate() {
return ( return (

View File

@@ -31,7 +31,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
@Input() email: string; @Input() email: string;
@Input() id: string; @Input() id: string;
@Input() organizationId: string; @Input() organizationId: string;
@Output() onPasswordReset = new EventEmitter(); @Output() passwordReset = new EventEmitter();
@ViewChild(PasswordStrengthComponent) passwordStrengthComponent: PasswordStrengthComponent; @ViewChild(PasswordStrengthComponent) passwordStrengthComponent: PasswordStrengthComponent;
enforcedPolicyOptions: MasterPasswordPolicyOptions; enforcedPolicyOptions: MasterPasswordPolicyOptions;
@@ -156,7 +156,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
null, null,
this.i18nService.t("resetPasswordSuccess"), this.i18nService.t("resetPasswordSuccess"),
); );
this.onPasswordReset.emit(); this.passwordReset.emit();
} catch (e) { } catch (e) {
this.logService.error(e); this.logService.error(e);
} }

View File

@@ -635,7 +635,7 @@ export class MembersComponent extends NewBasePeopleComponent<OrganizationUserVie
comp.id = user != null ? user.id : null; comp.id = user != null ? user.id : null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onPasswordReset.subscribe(() => { comp.passwordReset.subscribe(() => {
modal.close(); modal.close();
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { ControlsOf } from "@bitwarden/angular/types/controls-of"; import { ControlsOf } from "@bitwarden/angular/types/controls-of";
@@ -21,7 +21,7 @@ export class MasterPasswordPolicy extends BasePolicy {
selector: "policy-master-password", selector: "policy-master-password",
templateUrl: "master-password.component.html", templateUrl: "master-password.component.html",
}) })
export class MasterPasswordPolicyComponent extends BasePolicyComponent { export class MasterPasswordPolicyComponent extends BasePolicyComponent implements OnInit {
MinPasswordLength = Utils.minimumPasswordLength; MinPasswordLength = Utils.minimumPasswordLength;
data: FormGroup<ControlsOf<MasterPasswordPolicyOptions>> = this.formBuilder.group({ data: FormGroup<ControlsOf<MasterPasswordPolicyOptions>> = this.formBuilder.group({

View File

@@ -1,5 +1,12 @@
import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog"; import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog";
import { ChangeDetectorRef, Component, Inject, ViewChild, ViewContainerRef } from "@angular/core"; import {
AfterViewInit,
ChangeDetectorRef,
Component,
Inject,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from "@angular/forms";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction"; import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
@@ -28,7 +35,7 @@ export enum PolicyEditDialogResult {
selector: "app-policy-edit", selector: "app-policy-edit",
templateUrl: "policy-edit.component.html", templateUrl: "policy-edit.component.html",
}) })
export class PolicyEditComponent { export class PolicyEditComponent implements AfterViewInit {
@ViewChild("policyForm", { read: ViewContainerRef, static: true }) @ViewChild("policyForm", { read: ViewContainerRef, static: true })
policyFormRef: ViewContainerRef; policyFormRef: ViewContainerRef;

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from "@angular/forms";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
@@ -22,7 +22,7 @@ export class ResetPasswordPolicy extends BasePolicy {
selector: "policy-reset-password", selector: "policy-reset-password",
templateUrl: "reset-password.component.html", templateUrl: "reset-password.component.html",
}) })
export class ResetPasswordPolicyComponent extends BasePolicyComponent { export class ResetPasswordPolicyComponent extends BasePolicyComponent implements OnInit {
data = this.formBuilder.group({ data = this.formBuilder.group({
autoEnrollEnabled: false, autoEnrollEnabled: false,
}); });

View File

@@ -1,4 +1,4 @@
import { Component, ViewChild, ViewContainerRef } from "@angular/core"; import { Component, OnDestroy, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms"; import { FormBuilder, Validators } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { combineLatest, from, lastValueFrom, of, Subject, switchMap, takeUntil } from "rxjs"; import { combineLatest, from, lastValueFrom, of, Subject, switchMap, takeUntil } from "rxjs";
@@ -27,7 +27,7 @@ import { DeleteOrganizationDialogResult, openDeleteOrganizationDialog } from "./
selector: "app-org-account", selector: "app-org-account",
templateUrl: "account.component.html", templateUrl: "account.component.html",
}) })
export class AccountComponent { export class AccountComponent implements OnInit, OnDestroy {
@ViewChild("apiKeyTemplate", { read: ViewContainerRef, static: true }) @ViewChild("apiKeyTemplate", { read: ViewContainerRef, static: true })
apiKeyModalRef: ViewContainerRef; apiKeyModalRef: ViewContainerRef;
@ViewChild("rotateApiKeyTemplate", { read: ViewContainerRef, static: true }) @ViewChild("rotateApiKeyTemplate", { read: ViewContainerRef, static: true })

View File

@@ -1,5 +1,5 @@
import { DialogRef } from "@angular/cdk/dialog"; import { DialogRef } from "@angular/cdk/dialog";
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { concatMap, takeUntil, map, lastValueFrom } from "rxjs"; import { concatMap, takeUntil, map, lastValueFrom } from "rxjs";
import { first, tap } from "rxjs/operators"; import { first, tap } from "rxjs/operators";
@@ -24,7 +24,7 @@ import { TwoFactorVerifyComponent } from "../../../auth/settings/two-factor-veri
templateUrl: "../../../auth/settings/two-factor-setup.component.html", templateUrl: "../../../auth/settings/two-factor-setup.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent implements OnInit {
tabbedHeader = false; tabbedHeader = false;
constructor( constructor(
dialogService: DialogService, dialogService: DialogService,

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -19,7 +19,10 @@ import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent
templateUrl: "../../../tools/reports/pages/exposed-passwords-report.component.html", templateUrl: "../../../tools/reports/pages/exposed-passwords-report.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportComponent { export class ExposedPasswordsReportComponent
extends BaseExposedPasswordsReportComponent
implements OnInit
{
manageableCiphers: Cipher[]; manageableCiphers: Cipher[];
constructor( constructor(

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -18,7 +18,10 @@ import { InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponen
templateUrl: "../../../tools/reports/pages/inactive-two-factor-report.component.html", templateUrl: "../../../tools/reports/pages/inactive-two-factor-report.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent { export class InactiveTwoFactorReportComponent
extends BaseInactiveTwoFactorReportComponent
implements OnInit
{
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,
modalService: ModalService, modalService: ModalService,

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -18,7 +18,10 @@ import { ReusedPasswordsReportComponent as BaseReusedPasswordsReportComponent }
templateUrl: "../../../tools/reports/pages/reused-passwords-report.component.html", templateUrl: "../../../tools/reports/pages/reused-passwords-report.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportComponent { export class ReusedPasswordsReportComponent
extends BaseReusedPasswordsReportComponent
implements OnInit
{
manageableCiphers: Cipher[]; manageableCiphers: Cipher[];
constructor( constructor(

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -17,7 +17,10 @@ import { UnsecuredWebsitesReportComponent as BaseUnsecuredWebsitesReportComponen
templateUrl: "../../../tools/reports/pages/unsecured-websites-report.component.html", templateUrl: "../../../tools/reports/pages/unsecured-websites-report.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent { export class UnsecuredWebsitesReportComponent
extends BaseUnsecuredWebsitesReportComponent
implements OnInit
{
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,
modalService: ModalService, modalService: ModalService,

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -19,7 +19,10 @@ import { WeakPasswordsReportComponent as BaseWeakPasswordsReportComponent } from
templateUrl: "../../../tools/reports/pages/weak-passwords-report.component.html", templateUrl: "../../../tools/reports/pages/weak-passwords-report.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportComponent { export class WeakPasswordsReportComponent
extends BaseWeakPasswordsReportComponent
implements OnInit
{
manageableCiphers: Cipher[]; manageableCiphers: Cipher[];
constructor( constructor(

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../../libs/admin-console/.eslintrc.json"
}

View File

@@ -1,4 +1,4 @@
import { Component } from "@angular/core"; import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom, from, map } from "rxjs"; import { firstValueFrom, from, map } from "rxjs";
import { switchMap, takeUntil } from "rxjs/operators"; import { switchMap, takeUntil } from "rxjs/operators";
@@ -33,7 +33,7 @@ const DisallowedPlanTypes = [
@Component({ @Component({
templateUrl: "clients.component.html", templateUrl: "clients.component.html",
}) })
export class ClientsComponent extends BaseClientsComponent { export class ClientsComponent extends BaseClientsComponent implements OnInit, OnDestroy {
providerId: string; providerId: string;
addableOrganizations: Organization[]; addableOrganizations: Organization[];
loading = true; loading = true;

View File

@@ -1,4 +1,4 @@
import { Component, ViewChild, ViewContainerRef } from "@angular/core"; import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { lastValueFrom } from "rxjs"; import { lastValueFrom } from "rxjs";
import { first } from "rxjs/operators"; import { first } from "rxjs/operators";
@@ -34,7 +34,10 @@ import { UserAddEditComponent } from "./user-add-edit.component";
templateUrl: "people.component.html", templateUrl: "people.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class PeopleComponent extends BasePeopleComponent<ProviderUserUserDetailsResponse> { export class PeopleComponent
extends BasePeopleComponent<ProviderUserUserDetailsResponse>
implements OnInit
{
@ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef; @ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
@ViewChild("groupsTemplate", { read: ViewContainerRef, static: true }) @ViewChild("groupsTemplate", { read: ViewContainerRef, static: true })
groupsModalRef: ViewContainerRef; groupsModalRef: ViewContainerRef;
@@ -154,11 +157,11 @@ export class PeopleComponent extends BasePeopleComponent<ProviderUserUserDetails
comp.name = this.userNamePipe.transform(user); comp.name = this.userNamePipe.transform(user);
comp.providerId = this.providerId; comp.providerId = this.providerId;
comp.providerUserId = user != null ? user.id : null; comp.providerUserId = user != null ? user.id : null;
comp.onSavedUser.subscribe(() => { comp.savedUser.subscribe(() => {
modal.close(); modal.close();
this.load(); this.load();
}); });
comp.onDeletedUser.subscribe(() => { comp.deletedUser.subscribe(() => {
modal.close(); modal.close();
this.removeUser(user); this.removeUser(user);
}); });

View File

@@ -18,8 +18,8 @@ export class UserAddEditComponent implements OnInit {
@Input() name: string; @Input() name: string;
@Input() providerUserId: string; @Input() providerUserId: string;
@Input() providerId: string; @Input() providerId: string;
@Output() onSavedUser = new EventEmitter(); @Output() savedUser = new EventEmitter();
@Output() onDeletedUser = new EventEmitter(); @Output() deletedUser = new EventEmitter();
loading = true; loading = true;
editMode = false; editMode = false;
@@ -82,7 +82,7 @@ export class UserAddEditComponent implements OnInit {
null, null,
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name), this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
); );
this.onSavedUser.emit(); this.savedUser.emit();
} catch (e) { } catch (e) {
this.logService.error(e); this.logService.error(e);
} }
@@ -111,7 +111,7 @@ export class UserAddEditComponent implements OnInit {
null, null,
this.i18nService.t("removedUserId", this.name), this.i18nService.t("removedUserId", this.name),
); );
this.onDeletedUser.emit(); this.deletedUser.emit();
} catch (e) { } catch (e) {
this.logService.error(e); this.logService.error(e);
} }

View File

@@ -0,0 +1,22 @@
{
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@angular-eslint/recommended"],
"rules": {
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/contextual-lifecycle": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/no-empty-lifecycle-method": "error",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-inputs-metadata-property": "error",
"@angular-eslint/no-output-native": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error"
}
}
]
}