mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-23 03:33:28 +00:00
[AC-1743] pt. 2: Update eslintrc and fix any errors (#393)
* Sync eslintrc with clients repo * Autofix one eslint error * Add type attributes to buttons for eslint * Properly destroy ApiKeyComponent * Fix eslint issues related to state * Fix eslint warnings for default named imports * Ran prettier * Be more proactive about an unsubscribe * Rework subscription
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Component, Input, ViewChild, ViewContainerRef } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { takeUntil } from "rxjs";
|
||||
|
||||
import { ModalService } from "@/jslib/angular/src/services/modal.service";
|
||||
import { AuthService } from "@/jslib/common/src/abstractions/auth.service";
|
||||
@@ -17,6 +18,12 @@ import { EnvironmentComponent } from "./environment.component";
|
||||
selector: "app-apiKey",
|
||||
templateUrl: "apiKey.component.html",
|
||||
})
|
||||
// There is an eslint exception made here due to semantics.
|
||||
// The eslint rule expects a typical takeUntil() pattern involving component destruction.
|
||||
// The only subscription in this component is closed from a child component, confusing eslint.
|
||||
// https://github.com/cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-takeuntil.md
|
||||
//
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
export class ApiKeyComponent {
|
||||
@ViewChild("environment", { read: ViewContainerRef, static: true })
|
||||
environmentModal: ViewContainerRef;
|
||||
@@ -87,15 +94,17 @@ export class ApiKeyComponent {
|
||||
}
|
||||
|
||||
async settings() {
|
||||
const [modalRef, childComponent] = await this.modalService.openViewRef(
|
||||
const [modalRef, childComponent] = await this.modalService.openViewRef<EnvironmentComponent>(
|
||||
EnvironmentComponent,
|
||||
this.environmentModal
|
||||
);
|
||||
|
||||
childComponent.onSaved.subscribe(() => {
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
childComponent.onSaved.pipe(takeUntil(modalRef.onClosed)).subscribe(() => {
|
||||
modalRef.close();
|
||||
});
|
||||
}
|
||||
|
||||
toggleSecret() {
|
||||
this.showSecret = !this.showSecret;
|
||||
document.getElementById("client_secret").focus();
|
||||
|
||||
Reference in New Issue
Block a user