Skip to content

Commit 5ec61b3

Browse files
committed
build(eslint): enable rule @typescript-eslint/prefer-readonly
1 parent 1a20450 commit 5ec61b3

220 files changed

Lines changed: 500 additions & 486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const tsConfig = defineConfig({
3737
'vitest/prefer-each': 'error',
3838
'vitest/prefer-comparison-matcher': 'error',
3939
'@typescript-eslint/no-unused-vars': ['off'],
40+
'@typescript-eslint/prefer-readonly': 'error',
4041
'@angular-eslint/directive-selector': [
4142
'error',
4243
{

projects/charts-ng/common/si-chart-base.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export class SiChartBaseComponent implements AfterViewInit, OnChanges, OnInit, O
277277
protected activeTheme: any;
278278
protected autoZoomUpdate = true;
279279

280-
private prevAxisPointer: any = {};
280+
private readonly prevAxisPointer: any = {};
281281
private lastValidDataZoom: any = {};
282282
private presetDataZoomRange?: DataZoomRange;
283283
private dataZoomSetupDone = false;

projects/charts-ng/progress-bar/si-chart-progress-bar.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ export class SiChartProgressBarComponent extends SiChartBaseComponent {
3333
/** Used to display the label in inline or above the progress-bar. */
3434
readonly labelPosition = input<string>();
3535

36-
private maxValue = 100;
37-
private xAxisConfig: ChartXAxis = { type: 'value', max: this.maxValue };
38-
private yAxis: ChartYAxis = {
36+
private readonly maxValue = 100;
37+
private readonly xAxisConfig: ChartXAxis = { type: 'value', max: this.maxValue };
38+
private readonly yAxis: ChartYAxis = {
3939
type: 'category',
4040
data: [],
4141
axisLabel: {

projects/charts-ng/progress/si-chart-progress.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class SiChartProgressComponent extends SiChartBaseComponent {
3939
private itemGap!: number;
4040

4141
// base radius of an item
42-
private baseRadius = 98;
42+
private readonly baseRadius = 98;
4343

4444
private sizeFactor!: number;
4545

projects/dashboards-demo/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export class AppComponent implements OnInit {
4242
collapsed = false;
4343
theme: ThemeType = 'light';
4444

45-
private translate = inject(TranslateService);
46-
private themeService = inject(SiThemeService);
47-
private route = inject(ActivatedRoute);
45+
private readonly translate = inject(TranslateService);
46+
private readonly themeService = inject(SiThemeService);
47+
private readonly route = inject(ActivatedRoute);
4848

4949
constructor() {
5050
this.route.queryParams.subscribe(params => {

projects/dashboards-demo/src/app/components/dashboard-filters/dashboard-filters.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export class DashboardFiltersComponent implements OnInit {
2020
readonly days = days;
2121
readonly severity = severity;
2222

23-
private formBuilder = inject(FormBuilder);
24-
private dataService = inject(DataService);
25-
private destroyRef = inject(DestroyRef);
23+
private readonly formBuilder = inject(FormBuilder);
24+
private readonly dataService = inject(DataService);
25+
private readonly destroyRef = inject(DestroyRef);
2626

2727
ngOnInit(): void {
2828
const formControls = {

projects/dashboards-demo/src/app/pages/custom-catalog/custom-catalog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class CustomCatalogPageComponent {
5656
}
5757
];
5858

59-
private widgetStore = inject<AppWidgetStorage>(SI_WIDGET_STORE);
59+
private readonly widgetStore = inject<AppWidgetStorage>(SI_WIDGET_STORE);
6060

6161
onEditableChange(editable: boolean): void {
6262
this.emptyText = editable ? EMPTY_TEXT_EDIT : EMPTY_TEXT;

projects/dashboards-demo/src/app/pages/routed-dashboard/routed-dashboard.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ export class RoutedDashboardPageComponent implements OnInit {
6767

6868
protected dashboardId?: string;
6969

70-
appStateService = inject(AppStateService);
71-
private route = inject(ActivatedRoute);
70+
readonly appStateService = inject(AppStateService);
71+
private readonly route = inject(ActivatedRoute);
7272

7373
protected readonly primaryActions = signal<DashboardToolbarItem[]>([]);
7474
protected readonly secondaryActions = signal<DashboardToolbarItem[]>([]);
75-
private widgetStore = inject<AppWidgetStorage>(SI_WIDGET_STORE);
76-
private destroyRef = inject(DestroyRef);
75+
private readonly widgetStore = inject<AppWidgetStorage>(SI_WIDGET_STORE);
76+
private readonly destroyRef = inject(DestroyRef);
7777

7878
ngOnInit(): void {
7979
this.route.paramMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(params => {

projects/dashboards-demo/src/app/widgets/charts/cartesian/cartesian.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class CartesianComponent implements OnInit, WidgetInstance {
4141

4242
data!: Observable<CartesianChartData>;
4343

44-
private dataService = inject(DataService);
44+
private readonly dataService = inject(DataService);
4545

4646
ngOnInit(): void {
4747
this.data = (this.dataService as any)[this.config().payload.datasourceId]();

projects/dashboards-demo/src/app/widgets/charts/circle/circle.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class CircleComponent implements OnInit, WidgetInstance {
2121
readonly config = input.required<WidgetConfig>();
2222
data!: Observable<CircleChartSeries[]>;
2323

24-
private dataService = inject(DataService);
24+
private readonly dataService = inject(DataService);
2525

2626
ngOnInit(): void {
2727
this.data = (this.dataService as any)[this.config().payload.datasourceId]();

0 commit comments

Comments
 (0)