diff --git a/data/templates/environment.pull-request.ts.liquid b/data/templates/environment.pull-request.ts.liquid index de519d4a..4243dec8 100644 --- a/data/templates/environment.pull-request.ts.liquid +++ b/data/templates/environment.pull-request.ts.liquid @@ -9,6 +9,6 @@ const CLOUDFLARE_PAGES_PREVIEW_BRANCH_ALIAS_URL = new URL( `https://${PR_BRANCH_NAME}.${CLOUDFLARE_PAGES_DOMAIN}`, ) export const environment: Environment = { - production: false, + isProduction: false, appBaseUrl: CLOUDFLARE_PAGES_PREVIEW_BRANCH_ALIAS_URL, } diff --git a/eslint.config.mjs b/eslint.config.mjs index 588dda91..09fff960 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -34,12 +34,14 @@ export const NAMING_CONVENTION_SELECTORS = [ format: ['camelCase', 'UPPER_CASE'], }, // https://github.com/typescript-eslint/typescript-eslint/blob/v8.16.0/packages/eslint-plugin/docs/rules/naming-convention.mdx#enforce-that-private-members-are-prefixed-with-an-underscore - { + // 👇 `modifiers` matches code with ALL modifiers specified + // To specify the same for several modifiers, repeating the rule for each one + ...['private', 'protected'].map((modifier) => ({ selector: 'memberLike', - modifiers: ['private', 'protected'], + modifiers: [modifier], format: ['camelCase'], leadingUnderscore: 'require', - }, + })), // https://github.com/typescript-eslint/typescript-eslint/blob/v8.16.0/packages/eslint-plugin/docs/rules/naming-convention.mdx#enforce-that-interface-names-do-not-begin-with-an-i { selector: 'typeLike', diff --git a/eslint.config.typed.mjs b/eslint.config.typed.mjs index 6de042e8..3bc92dab 100644 --- a/eslint.config.typed.mjs +++ b/eslint.config.typed.mjs @@ -23,12 +23,19 @@ export default tsEslint.config( // https://github.com/typescript-eslint/typescript-eslint/blob/v8.16.0/packages/eslint-plugin/docs/rules/naming-convention.mdx#enforce-that-boolean-variables-are-prefixed-with-an-allowed-verb { selector: [ - 'variable', + // `member-like` without: + // - `property`: will be specified later, with exceptions + // - `enumMember`: no types allowed + // - `method`: no types allowed 'classicAccessor', 'autoAccessor', + 'parameterProperty', + // All `property` but `objectLiteralProperty` 'classProperty', + 'typeProperty', + // The rest 'parameter', - 'parameterProperty', + 'variable', ], types: ['boolean'], format: ['PascalCase'], diff --git a/src/app/common/material-symbol.directive.ts b/src/app/common/material-symbol.directive.ts index 39bf0aa3..53af2029 100644 --- a/src/app/common/material-symbol.directive.ts +++ b/src/app/common/material-symbol.directive.ts @@ -4,10 +4,8 @@ import { Directive, ElementRef } from '@angular/core' selector: '[appMaterialSymbol]', }) export class MaterialSymbolDirective { - constructor(private el: ElementRef) { - ;(this.el.nativeElement as HTMLElement).classList.add( - MATERIAL_SYMBOLS_CLASS, - ) + constructor(elRef: ElementRef) { + elRef.nativeElement.classList.add(MATERIAL_SYMBOLS_CLASS) } } diff --git a/src/app/common/test-id.directive.ts b/src/app/common/test-id.directive.ts index 254dec32..79385569 100644 --- a/src/app/common/test-id.directive.ts +++ b/src/app/common/test-id.directive.ts @@ -4,13 +4,10 @@ import { Directive, effect, ElementRef, input } from '@angular/core' export class TestIdDirective { readonly appTestId = input.required() - constructor(private el: ElementRef) { + constructor(elRef: ElementRef) { effect(() => { if (isDevMode) { - ;(this.el.nativeElement as Element).setAttribute( - TEST_ID_ATTRIBUTE, - this.appTestId(), - ) + elRef.nativeElement.setAttribute(TEST_ID_ATTRIBUTE, this.appTestId()) } }) } diff --git a/src/app/header/light-dark-toggle/color-scheme.service.spec.ts b/src/app/header/light-dark-toggle/color-scheme.service.spec.ts index d7927910..21933337 100644 --- a/src/app/header/light-dark-toggle/color-scheme.service.spec.ts +++ b/src/app/header/light-dark-toggle/color-scheme.service.spec.ts @@ -245,17 +245,17 @@ class MockHTMLElementWithAttributes implements Pick { - private attributes = new Map() + private readonly _attributes = new Map() getAttribute(qualifiedName: string) { - return this.attributes.get(qualifiedName) ?? null + return this._attributes.get(qualifiedName) ?? null } setAttribute(qualifiedName: string, value: string) { - return this.attributes.set(qualifiedName, value) + return this._attributes.set(qualifiedName, value) } removeAttribute(qualifiedName: string): void { - this.attributes.delete(qualifiedName) + this._attributes.delete(qualifiedName) } } diff --git a/src/app/header/light-dark-toggle/color-scheme.service.ts b/src/app/header/light-dark-toggle/color-scheme.service.ts index a417d9cc..a68ba028 100644 --- a/src/app/header/light-dark-toggle/color-scheme.service.ts +++ b/src/app/header/light-dark-toggle/color-scheme.service.ts @@ -20,14 +20,14 @@ export class ColorSchemeService { @Inject(WINDOW) private _window: Window, ) { this._htmlElement = document.documentElement - this.listenForMatchMediaPreferenceChanges() + this._listenForMatchMediaPreferenceChanges() } - private get isDarkPreferred(): boolean { - return !!this.matchMediaQuery && this.matchMediaQuery.matches + private get _isDarkPreferred(): boolean { + return !!this._matchMediaQuery && this._matchMediaQuery.matches } - private get matchMediaQuery() { + private get _matchMediaQuery() { if (!this._window.matchMedia) { return null } @@ -39,7 +39,7 @@ export class ColorSchemeService { HTML_COLOR_SCHEME_ATTRIBUTE, ) as Scheme if (!manuallySetScheme) { - this.setManual(this.isDarkPreferred ? Scheme.Light : Scheme.Dark) + this.setManual(this._isDarkPreferred ? Scheme.Light : Scheme.Dark) return } @@ -56,8 +56,8 @@ export class ColorSchemeService { this._htmlElement.removeAttribute(HTML_COLOR_SCHEME_ATTRIBUTE) } - private listenForMatchMediaPreferenceChanges() { - this.matchMediaQuery?.addEventListener('change', () => { + private _listenForMatchMediaPreferenceChanges() { + this._matchMediaQuery?.addEventListener('change', () => { this.setSystem() }) } diff --git a/src/app/header/light-dark-toggle/light-dark-toggle.component.html b/src/app/header/light-dark-toggle/light-dark-toggle.component.html index 75dbd225..d7306d4f 100644 --- a/src/app/header/light-dark-toggle/light-dark-toggle.component.html +++ b/src/app/header/light-dark-toggle/light-dark-toggle.component.html @@ -1,14 +1,14 @@ diff --git a/src/app/header/light-dark-toggle/light-dark-toggle.component.ts b/src/app/header/light-dark-toggle/light-dark-toggle.component.ts index 03f5bcc3..5a4446ec 100644 --- a/src/app/header/light-dark-toggle/light-dark-toggle.component.ts +++ b/src/app/header/light-dark-toggle/light-dark-toggle.component.ts @@ -10,10 +10,10 @@ import { ToolbarButtonComponent } from '../toolbar-button/toolbar-button.compone styleUrl: './light-dark-toggle.component.scss', }) export class LightDarkToggleComponent { - protected readonly MaterialSymbol = { + protected readonly _materialSymbol = { DarkMode, LightMode, } - constructor(protected readonly colorSchemeService: ColorSchemeService) {} + constructor(protected readonly _colorSchemeService: ColorSchemeService) {} } diff --git a/src/app/header/tabs/tabs.component.html b/src/app/header/tabs/tabs.component.html index 5ef9bccc..c38a0633 100644 --- a/src/app/header/tabs/tabs.component.html +++ b/src/app/header/tabs/tabs.component.html @@ -1,6 +1,6 @@