1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

Add eslint-plugin-rxjs & rxjs-angular (#3373)

This commit is contained in:
Oscar Hinton
2022-08-26 18:09:28 +02:00
committed by GitHub
parent feb6e67bc4
commit e7c7037a14
102 changed files with 866 additions and 49 deletions

View File

@@ -20,6 +20,7 @@ import { OrganizationConnectionResponse } from "@bitwarden/common/models/respons
selector: "app-org-manage-scim",
templateUrl: "scim.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ScimComponent implements OnInit {
loading = true;
organizationId: string;
@@ -45,6 +46,7 @@ export class ScimComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();

View File

@@ -29,6 +29,7 @@ const defaultSigningAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha2
selector: "app-org-manage-sso",
templateUrl: "sso.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SsoComponent implements OnInit {
readonly ssoType = SsoType;
@@ -153,6 +154,7 @@ export class SsoComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.ssoConfigForm.get("configType").valueChanges.subscribe((newType: SsoType) => {
if (newType === SsoType.OpenIdConnect) {
this.openIdForm.enable();
@@ -168,10 +170,12 @@ export class SsoComponent implements OnInit {
this.samlForm
.get("spSigningBehavior")
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
.valueChanges.subscribe(() =>
this.samlForm.get("idpX509PublicCert").updateValueAndValidity()
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();

View File

@@ -30,6 +30,7 @@ const DisallowedPlanTypes = [
@Component({
templateUrl: "clients.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ClientsComponent implements OnInit {
@ViewChild("add", { read: ViewContainerRef, static: true }) addModalRef: ViewContainerRef;
@@ -64,11 +65,13 @@ export class ClientsComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.providerId = params.providerId;
await this.load();
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.searchText = qParams.search;
});
@@ -136,6 +139,7 @@ export class ClientsComponent implements OnInit {
(comp) => {
comp.providerId = this.providerId;
comp.organizations = this.addableOrganizations;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onAddedOrganization.subscribe(async () => {
try {
await this.load();

View File

@@ -7,6 +7,7 @@ import { OrganizationPlansComponent } from "src/app/settings/organization-plans.
selector: "app-create-organization",
templateUrl: "create-organization.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class CreateOrganizationComponent implements OnInit {
@ViewChild(OrganizationPlansComponent, { static: true })
orgPlansComponent: OrganizationPlansComponent;
@@ -16,6 +17,7 @@ export class CreateOrganizationComponent implements OnInit {
constructor(private route: ActivatedRoute) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.providerId = params.providerId;
});

View File

@@ -18,6 +18,7 @@ import { EventService } from "src/app/core";
selector: "provider-events",
templateUrl: "events.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class EventsComponent extends BaseEventsComponent implements OnInit {
exportFileName = "provider-events";
providerId: string;
@@ -49,6 +50,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.providerId = params.providerId;
const provider = await this.providerService.get(this.providerId);

View File

@@ -8,6 +8,7 @@ import { Provider } from "@bitwarden/common/models/domain/provider";
selector: "provider-manage",
templateUrl: "manage.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ManageComponent implements OnInit {
provider: Provider;
accessEvents = false;
@@ -15,6 +16,7 @@ export class ManageComponent implements OnInit {
constructor(private route: ActivatedRoute, private providerService: ProviderService) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.provider = await this.providerService.get(params.providerId);
this.accessEvents = this.provider.useEvents;

View File

@@ -34,6 +34,7 @@ import { UserAddEditComponent } from "./user-add-edit.component";
selector: "provider-people",
templateUrl: "people.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class PeopleComponent
extends BasePeopleComponent<ProviderUserUserDetailsResponse>
implements OnInit
@@ -87,6 +88,7 @@ export class PeopleComponent
}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.providerId = params.providerId;
const provider = await this.providerService.get(this.providerId);
@@ -100,6 +102,7 @@ export class PeopleComponent
await this.load();
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.searchText = qParams.search;
if (qParams.viewEvents != null) {

View File

@@ -8,6 +8,7 @@ import { Provider } from "@bitwarden/common/models/domain/provider";
selector: "providers-layout",
templateUrl: "providers-layout.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ProvidersLayoutComponent {
provider: Provider;
private providerId: string;
@@ -16,6 +17,7 @@ export class ProvidersLayoutComponent {
ngOnInit() {
document.body.classList.remove("layout_frontend");
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.params.subscribe(async (params) => {
this.providerId = params.providerId;
await this.load();

View File

@@ -13,6 +13,7 @@ import { ProviderResponse } from "@bitwarden/common/models/response/provider/pro
selector: "provider-account",
templateUrl: "account.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AccountComponent {
selfHosted = false;
loading = true;
@@ -33,6 +34,7 @@ export class AccountComponent {
async ngOnInit() {
this.selfHosted = this.platformUtilsService.isSelfHost();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.providerId = params.providerId;
try {

View File

@@ -7,10 +7,12 @@ import { ProviderService } from "@bitwarden/common/abstractions/provider.service
selector: "provider-settings",
templateUrl: "settings.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SettingsComponent {
constructor(private route: ActivatedRoute, private providerService: ProviderService) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
await this.providerService.get(params.providerId);
});

View File

@@ -14,6 +14,7 @@ import { ProviderSetupRequest } from "@bitwarden/common/models/request/provider/
selector: "provider-setup",
templateUrl: "setup.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SetupComponent implements OnInit {
loading = true;
authed = false;
@@ -38,6 +39,7 @@ export class SetupComponent implements OnInit {
ngOnInit() {
document.body.classList.remove("layout_frontend");
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
const error = qParams.providerId == null || qParams.email == null || qParams.token == null;