Skip to content

Commit 4c82b84

Browse files
MeAkibmmalerba
authored andcommitted
docs(docs-infra): mark properties as readonly if they shouldn't change (angular#63200)
PR Close angular#63200
1 parent 58cb2be commit 4c82b84

11 files changed

Lines changed: 24 additions & 25 deletions

File tree

adev/shared-docs/components/cookie-popup/cookie-popup.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {LOCAL_STORAGE} from '../../providers/index';
1111
import {setCookieConsent} from '../../utils';
1212

1313
/**
14-
* Decelare gtag as part of the window in this file as gtag is expected to already be loaded.
14+
* Declare gtag as part of the window in this file as gtag is expected to already be loaded.
1515
*/
1616
declare const window: Window & typeof globalThis & {gtag?: Function};
1717

adev/shared-docs/components/search-dialog/search-dialog.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ import {SearchHistoryComponent} from '../search-history/search-history.component
5151
styleUrls: ['./search-dialog.component.scss'],
5252
})
5353
export class SearchDialog {
54-
onClose = output();
55-
dialog = viewChild.required<ElementRef<HTMLDialogElement>>('searchDialog');
56-
items = viewChildren(SearchItem);
57-
textField = viewChild(TextField);
54+
readonly onClose = output();
55+
readonly dialog = viewChild.required<ElementRef<HTMLDialogElement>>('searchDialog');
56+
readonly items = viewChildren(SearchItem);
57+
readonly textField = viewChild(TextField);
5858

5959
readonly history = inject(SearchHistory);
6060
private readonly search = inject(Search);
@@ -67,9 +67,9 @@ export class SearchDialog {
6767
this.injector,
6868
).withWrap();
6969

70-
searchQuery = this.search.searchQuery;
71-
resultsResource = this.search.resultsResource;
72-
searchResults = this.search.searchResults;
70+
readonly searchQuery = this.search.searchQuery;
71+
readonly resultsResource = this.search.resultsResource;
72+
readonly searchResults = this.search.searchResults;
7373

7474
// We use a FormControl instead of relying on NgModel+signal to avoid
7575
// the issue https://github.com/angular/angular/issues/13568

adev/shared-docs/components/top-level-banner/top-level-banner.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ export class TopLevelBannerComponent {
2929
* separately for different events or instances. Without a unique ID,
3030
* closing one banner could inadvertently hide other banners for different events.
3131
*/
32-
id = input.required<string>();
32+
readonly id = input.required<string>();
3333
// Optional URL link that the banner should navigate to when clicked.
34-
link = input<string>();
34+
readonly link = input<string>();
3535
// Text content to be displayed in the banner.
36-
text = input.required<string>();
36+
readonly text = input.required<string>();
3737
// Optional expiry date. Setting the default expiry as a future date so we
3838
// don't have to deal with undefined signal values.
39-
expiry = input(new Date('3000-01-01'), {transform: parseDate});
39+
readonly expiry = input(new Date('3000-01-01'), {transform: parseDate});
4040
// Whether the user has closed the banner or the survey has expired.
41-
hasClosed = linkedSignal(() => {
41+
readonly hasClosed = linkedSignal(() => {
4242
const expired = Date.now() > this.expiry().getTime();
4343

4444
// Needs to be in a try/catch, because some browsers will

adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export const GITHUB_CONTENT_URL = 'https://github.com/angular/angular/blob/main/
6161
},
6262
})
6363
export class DocViewer {
64-
docContent = input<string | undefined>();
65-
hasToc = input(false);
64+
readonly docContent = input<string | undefined>();
65+
readonly hasToc = input(false);
6666
readonly contentLoaded = output<void>();
6767

6868
private readonly destroyRef = inject(DestroyRef);

adev/src/app/features/docs/docs.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export default class DocsComponent {
2121
// In case when exists example-viewer placeholders, then ExampleViewer
2222
// components are going to be rendered.
2323

24-
docContent = input<DocContent>();
24+
readonly docContent = input<DocContent>();
2525
}

adev/src/app/features/home/components/home-animation/home-animation.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
inject,
1616
Injector,
1717
input,
18-
OnDestroy,
1918
output,
2019
signal,
2120
viewChildren,

adev/src/app/features/home/components/home-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CodeEditorComponent {
3535
private readonly environmentInjector = inject(EnvironmentInjector);
3636
private readonly destroyRef = inject(DestroyRef);
3737

38-
tutorialFiles = input.required<string>();
38+
readonly tutorialFiles = input.required<string>();
3939

4040
constructor() {
4141
this.loadEmbeddedEditor();

adev/src/app/features/references/api-items-section/api-items-section.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ import {MatTooltipModule} from '@angular/material/tooltip';
2020
changeDetection: ChangeDetectionStrategy.OnPush,
2121
})
2222
export default class ApiItemsSection {
23-
group = input.required<ApiItemsGroup>();
23+
readonly group = input.required<ApiItemsGroup>();
2424
}

adev/src/app/features/references/api-reference-details-page/api-reference-details-page.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default class ApiReferenceDetailsPage {
3232

3333
private highlightedElement: HTMLElement | null = null;
3434

35-
docContent = input<DocContent | undefined>();
36-
urlFragment = toSignal(this.route.fragment);
35+
readonly docContent = input<DocContent | undefined>();
36+
readonly urlFragment = toSignal(this.route.fragment);
3737

3838
constructor() {
3939
effect(() => this.highlightCard());

adev/src/app/features/references/api-reference-list/api-reference-list.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export default class ApiReferenceList {
6565
private readonly injector = inject(EnvironmentInjector);
6666

6767
// inputs
68-
queryInput = input<string | undefined>('', {alias: 'query'});
69-
typeInput = input<string | undefined>(ALL_TYPES_KEY, {alias: 'type'});
70-
statusInput = input<number | undefined>(DEFAULT_STATUS, {alias: 'status'});
68+
readonly queryInput = input<string | undefined>('', {alias: 'query'});
69+
readonly typeInput = input<string | undefined>(ALL_TYPES_KEY, {alias: 'type'});
70+
readonly statusInput = input<number | undefined>(DEFAULT_STATUS, {alias: 'status'});
7171

7272
// inputs are route binded, they can reset to undefined
7373
// also we want a writable state, so we use a linked signal

0 commit comments

Comments
 (0)