1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Enable directive-class-suffix (#17385)

This commit is contained in:
Oscar Hinton
2025-11-24 18:03:16 +01:00
committed by GitHub
parent 5779df2417
commit 4c36a46ef2
12 changed files with 28 additions and 14 deletions

View File

@@ -30,6 +30,8 @@ import { NavigationProductSwitcherComponent } from "./navigation-switcher.compon
selector: "[mockOrgs]",
standalone: false,
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
class MockOrganizationService implements Partial<OrganizationService> {
private static _orgs = new BehaviorSubject<Organization[]>([]);
@@ -49,6 +51,8 @@ class MockOrganizationService implements Partial<OrganizationService> {
selector: "[mockProviders]",
standalone: false,
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
class MockProviderService implements Partial<ProviderService> {
private static _providers = new BehaviorSubject<Provider[]>([]);

View File

@@ -30,6 +30,8 @@ import { ProductSwitcherService } from "./shared/product-switcher.service";
selector: "[mockOrgs]",
standalone: false,
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
class MockOrganizationService implements Partial<OrganizationService> {
private static _orgs = new BehaviorSubject<Organization[]>([]);
@@ -49,6 +51,8 @@ class MockOrganizationService implements Partial<OrganizationService> {
selector: "[mockProviders]",
standalone: false,
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
class MockProviderService implements Partial<ProviderService> {
private static _providers = new BehaviorSubject<Provider[]>([]);

View File

@@ -63,7 +63,7 @@ export default tseslint.config(
// TODO: Enable these.
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/contextual-lifecycle": "error",
"@angular-eslint/directive-class-suffix": 0,
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/no-empty-lifecycle-method": 0,
"@angular-eslint/no-input-rename": 0,
"@angular-eslint/no-inputs-metadata-property": "error",

View File

@@ -24,6 +24,8 @@ import { KeyService } from "@bitwarden/key-management";
selector: "app-user-verification",
standalone: false,
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class UserVerificationComponent implements ControlValueAccessor, OnInit, OnDestroy {
private _invalidSecret = false;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals

View File

@@ -45,6 +45,8 @@ export function _cipherListVirtualScrollStrategyFactory(cipherListDir: CipherLis
},
],
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class CipherListVirtualScroll extends CdkFixedSizeVirtualScroll {
_scrollStrategy: CipherListVirtualScrollStrategy;

View File

@@ -1,11 +1,11 @@
import { NgModule } from "@angular/core";
import { FormControlComponent } from "./form-control.component";
import { BitHintComponent } from "./hint.component";
import { BitHintDirective } from "./hint.directive";
import { BitLabelComponent } from "./label.component";
@NgModule({
imports: [BitLabelComponent, FormControlComponent, BitHintComponent],
exports: [FormControlComponent, BitLabelComponent, BitHintComponent],
imports: [BitLabelComponent, FormControlComponent, BitHintDirective],
exports: [FormControlComponent, BitLabelComponent, BitHintDirective],
})
export class FormControlModule {}

View File

@@ -9,6 +9,6 @@ let nextId = 0;
class: "tw-text-muted tw-font-normal tw-inline-block tw-mt-1 tw-text-xs",
},
})
export class BitHintComponent {
export class BitHintDirective {
@HostBinding() id = `bit-hint-${nextId++}`;
}

View File

@@ -15,7 +15,7 @@ import {
import { I18nPipe } from "@bitwarden/ui-common";
import { BitHintComponent } from "../form-control/hint.component";
import { BitHintDirective } from "../form-control/hint.directive";
import { BitLabelComponent } from "../form-control/label.component";
import { inputBorderClasses } from "../input/input.directive";
@@ -31,7 +31,7 @@ import { BitFormFieldControl } from "./form-field-control";
})
export class BitFormFieldComponent implements AfterContentChecked {
readonly input = contentChild.required(BitFormFieldControl);
readonly hint = contentChild(BitHintComponent);
readonly hint = contentChild(BitHintDirective);
readonly label = contentChild(BitLabelComponent);
readonly prefixContainer = viewChild<ElementRef<HTMLDivElement>>("prefixContainer");

View File

@@ -13,7 +13,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
import { AriaDisableDirective } from "../a11y";
import { FormControlModule } from "../form-control/form-control.module";
import { BitHintComponent } from "../form-control/hint.component";
import { BitHintDirective } from "../form-control/hint.directive";
import { BitLabelComponent } from "../form-control/label.component";
let nextId = 0;
@@ -56,7 +56,7 @@ export class SwitchComponent implements ControlValueAccessor, AfterViewInit {
protected readonly disabled = model(false);
protected readonly disabledReasonText = input<string | null>(null);
private readonly hintComponent = contentChild<BitHintComponent>(BitHintComponent);
private readonly hintComponent = contentChild<BitHintDirective>(BitHintDirective);
protected readonly disabledReasonTextId = `bit-switch-disabled-text-${nextId++}`;

View File

@@ -35,7 +35,7 @@ import { TableComponent } from "./table.component";
@Directive({
selector: "[bitRowDef]",
})
export class BitRowDef {
export class BitRowDefDirective {
constructor(public template: TemplateRef<any>) {}
}
@@ -69,7 +69,7 @@ export class TableScrollComponent
/** Optional trackBy function. */
readonly trackBy = input<TrackByFunction<any> | undefined>();
protected readonly rowDef = contentChild(BitRowDef);
protected readonly rowDef = contentChild(BitRowDefDirective);
/**
* Height of the thead element (in pixels).

View File

@@ -5,14 +5,14 @@ import { NgModule } from "@angular/core";
import { CellDirective } from "./cell.directive";
import { RowDirective } from "./row.directive";
import { SortableComponent } from "./sortable.component";
import { BitRowDef, TableScrollComponent } from "./table-scroll.component";
import { BitRowDefDirective, TableScrollComponent } from "./table-scroll.component";
import { TableBodyDirective, TableComponent } from "./table.component";
@NgModule({
imports: [
CommonModule,
ScrollingModule,
BitRowDef,
BitRowDefDirective,
CellDirective,
RowDirective,
SortableComponent,
@@ -21,7 +21,7 @@ import { TableBodyDirective, TableComponent } from "./table.component";
TableScrollComponent,
],
exports: [
BitRowDef,
BitRowDefDirective,
CellDirective,
RowDirective,
SortableComponent,

View File

@@ -8,6 +8,8 @@ import { firstValueFrom } from "rxjs";
providers: [TextFieldModule],
hostDirectives: [CdkTextareaAutosize],
})
// FIXME(https://bitwarden.atlassian.net/browse/PM-28232): Use Directive suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class VaultAutosizeReadOnlyTextArea implements AfterViewInit {
constructor(
@Host() private autosize: CdkTextareaAutosize,