Skip to content

Commit e75b04f

Browse files
MeAkibmmalerba
authored andcommitted
docs(docs-infra): properties should be readonly (angular#63492)
PR Close angular#63492
1 parent e48ba58 commit e75b04f

File tree

35 files changed

+68
-68
lines changed

35 files changed

+68
-68
lines changed

adev/shared-docs/components/breadcrumb/breadcrumb.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {RouterLink} from '@angular/router';
2121
export class Breadcrumb {
2222
private readonly navigationState = inject(NavigationState);
2323

24-
breadcrumbItems = computed(() => {
24+
readonly breadcrumbItems = computed(() => {
2525
const breadcrumbs: NavigationItem[] = [];
2626
let activeItem = this.navigationState.activeNavigationItem()?.parent;
2727

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class CookiePopup {
2727
private readonly localStorage = inject(LOCAL_STORAGE);
2828

2929
/** Whether the user has accepted the cookie disclaimer. */
30-
hasAccepted = signal<boolean>(false);
30+
readonly hasAccepted = signal<boolean>(false);
3131

3232
constructor() {
3333
// Needs to be in a try/catch, because some browsers will

adev/shared-docs/components/table-of-contents/table-of-contents.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TableOfContents {
3838

3939
tableOfContentItems = this.tableOfContentsLoader.tableOfContentItems;
4040

41-
activeItemId = signal<string | null>(null);
41+
readonly activeItemId = signal<string | null>(null);
4242
TableOfContentsLevel = TableOfContentsLevel;
4343

4444
constructor() {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ export class ExampleViewer {
7272
CodeExampleViewMode = CodeExampleViewMode;
7373
exampleComponent?: Type<unknown>;
7474

75-
expandable = signal<boolean>(false);
76-
expanded = signal<boolean>(false);
77-
snippetCode = signal<Snippet | undefined>(undefined);
78-
tabs = computed(() =>
75+
readonly expandable = signal<boolean>(false);
76+
readonly expanded = signal<boolean>(false);
77+
readonly snippetCode = signal<Snippet | undefined>(undefined);
78+
readonly tabs = computed(() =>
7979
this.exampleMetadata()?.files.map((file) => ({
8080
name:
8181
file.title ?? (this.shouldDisplayFullName() ? file.name : this.getFileExtension(file.name)),
8282
code: file.sanitizedContent,
8383
})),
8484
);
85-
view = computed(() =>
85+
readonly view = computed(() =>
8686
this.exampleMetadata()?.files.length === 1
8787
? CodeExampleViewMode.SNIPPET
8888
: CodeExampleViewMode.MULTI_FILE,

adev/shared-docs/directives/search-item/search-item.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class SearchItem implements Highlightable {
2121
// We can't migrate them to signals yet
2222
@Input() disabled = false;
2323

24-
item = input<SearchResultItem | undefined>();
24+
readonly item = input<SearchResultItem | undefined>();
2525

2626
private readonly elementRef = inject(ElementRef<HTMLLIElement>);
2727

adev/shared-docs/services/navigation-state.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class NavigationState {
2121
private readonly _isMobileNavVisible = signal<boolean>(false);
2222
private readonly _level = linkedSignal(() => this._expandedItems().length);
2323

24-
primaryActiveRouteItem = signal<string | null>(null);
24+
readonly primaryActiveRouteItem = signal<string | null>(null);
2525
activeNavigationItem = this._activeNavigationItem.asReadonly();
2626
expandedItems = this._expandedItems.asReadonly();
2727
isMobileNavVisible = this._isMobileNavVisible.asReadonly();

adev/src/app/core/layout/secondary-navigation/secondary-navigation.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class SecondaryNavigation {
5858

5959
navigationItems: NavigationItem[] | undefined;
6060

61-
translateX = computed(() => {
61+
readonly translateX = computed(() => {
6262
const level = this.navigationState.level();
6363
return `translateX(${-level * 100}%)`;
6464
});

adev/src/app/core/services/version-manager.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class VersionManager {
5353
});
5454

5555
// This handle the fallback if the resource fails.
56-
versions = computed(() => {
56+
readonly versions = computed(() => {
5757
return this.remoteVersions.hasValue() ? this.remoteVersions.value() : this.localVersions;
5858
});
5959

@@ -93,7 +93,7 @@ export class VersionManager {
9393
},
9494
);
9595

96-
currentDocsVersion = computed(() => {
96+
readonly currentDocsVersion = computed(() => {
9797
// In devmode the version is 0, so we'll target next (which is first on the list)
9898
if (VERSION.major === '0') {
9999
return this.versions()[0];

adev/src/app/editor/code-editor/code-mirror-editor.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ const INITIAL_STATES = {
6565
@Injectable({providedIn: 'root'})
6666
export class CodeMirrorEditor {
6767
// TODO: handle files created by the user, e.g. after running `ng generate component`
68-
files = signal<EditorFile[]>(INITIAL_STATES.files);
69-
openFiles = signal<EditorFile[]>(INITIAL_STATES.files);
70-
currentFile = signal<EditorFile>(INITIAL_STATES.currentFile);
68+
readonly files = signal<EditorFile[]>(INITIAL_STATES.files);
69+
readonly openFiles = signal<EditorFile[]>(INITIAL_STATES.files);
70+
readonly currentFile = signal<EditorFile>(INITIAL_STATES.currentFile);
7171

7272
// An instance of web worker used to run virtual TypeScript environment in the browser.
7373
// It allows to enrich CodeMirror UX for TypeScript files.

adev/src/app/editor/embedded-editor.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const LARGE_EDITOR_HEIGHT_BREAKPOINT = 550;
5353
})
5454
export class EmbeddedEditor {
5555
// Prevents from adding, removing or renaming files
56-
restrictedMode = input<boolean>(false);
56+
readonly restrictedMode = input<boolean>(false);
5757

5858
readonly editorContainer = viewChild<ElementRef<HTMLDivElement>>('editorContainer');
5959
readonly matTabGroup = viewChild(MatTabGroup);
@@ -66,7 +66,7 @@ export class EmbeddedEditor {
6666
private readonly nodeRuntimeState = inject(NodeRuntimeState);
6767
private readonly nodeRuntimeSandbox = inject(NodeRuntimeSandbox);
6868

69-
protected splitDirection = signal<'horizontal' | 'vertical'>('vertical');
69+
protected readonly splitDirection = signal<'horizontal' | 'vertical'>('vertical');
7070

7171
readonly MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES = MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES;
7272

0 commit comments

Comments
 (0)