Browse Source

Enable directive-class-suffix (#17385)

bc/group-mjml-updates
Oscar Hinton 3 weeks ago committed by GitHub
parent
commit
4c36a46ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      apps/web/src/app/layouts/product-switcher/navigation-switcher/navigation-switcher.stories.ts
  2. 4
      apps/web/src/app/layouts/product-switcher/product-switcher.stories.ts
  3. 2
      eslint.config.mjs
  4. 2
      libs/angular/src/auth/components/user-verification.component.ts
  5. 2
      libs/angular/src/directives/cipherListVirtualScroll.directive.ts
  6. 6
      libs/components/src/form-control/form-control.module.ts
  7. 2
      libs/components/src/form-control/hint.directive.ts
  8. 4
      libs/components/src/form-field/form-field.component.ts
  9. 4
      libs/components/src/switch/switch.component.ts
  10. 4
      libs/components/src/table/table-scroll.component.ts
  11. 6
      libs/components/src/table/table.module.ts
  12. 2
      libs/vault/src/directives/readonly-textarea.directive.ts

4
apps/web/src/app/layouts/product-switcher/navigation-switcher/navigation-switcher.stories.ts

@ -30,6 +30,8 @@ import { NavigationProductSwitcherComponent } from "./navigation-switcher.compon @@ -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> { @@ -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[]>([]);

4
apps/web/src/app/layouts/product-switcher/product-switcher.stories.ts

@ -30,6 +30,8 @@ import { ProductSwitcherService } from "./shared/product-switcher.service"; @@ -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> { @@ -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[]>([]);

2
eslint.config.mjs

@ -63,7 +63,7 @@ export default tseslint.config( @@ -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",

2
libs/angular/src/auth/components/user-verification.component.ts

@ -24,6 +24,8 @@ import { KeyService } from "@bitwarden/key-management"; @@ -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

2
libs/angular/src/directives/cipherListVirtualScroll.directive.ts

@ -45,6 +45,8 @@ export function _cipherListVirtualScrollStrategyFactory(cipherListDir: CipherLis @@ -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;

6
libs/components/src/form-control/form-control.module.ts

@ -1,11 +1,11 @@ @@ -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 {}

2
libs/components/src/form-control/hint.component.ts → libs/components/src/form-control/hint.directive.ts

@ -9,6 +9,6 @@ let nextId = 0; @@ -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++}`;
}

4
libs/components/src/form-field/form-field.component.ts

@ -15,7 +15,7 @@ import { @@ -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"; @@ -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");

4
libs/components/src/switch/switch.component.ts

@ -13,7 +13,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; @@ -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 { @@ -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++}`;

4
libs/components/src/table/table-scroll.component.ts

@ -35,7 +35,7 @@ import { TableComponent } from "./table.component"; @@ -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 @@ -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).

6
libs/components/src/table/table.module.ts

@ -5,14 +5,14 @@ import { NgModule } from "@angular/core"; @@ -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"; @@ -21,7 +21,7 @@ import { TableBodyDirective, TableComponent } from "./table.component";
TableScrollComponent,
],
exports: [
BitRowDef,
BitRowDefDirective,
CellDirective,
RowDirective,
SortableComponent,

2
libs/vault/src/directives/readonly-textarea.directive.ts

@ -8,6 +8,8 @@ import { firstValueFrom } from "rxjs"; @@ -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,

Loading…
Cancel
Save