Skip to content

Commit cc5ccdd

Browse files
authored
UI: set and apply ESLint rule comma-dangle = always-multiline (OpenEMS#2430)
eslint src/ --fix
1 parent 2900811 commit cc5ccdd

File tree

374 files changed

+1783
-1783
lines changed

Some content is hidden

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

374 files changed

+1783
-1783
lines changed

ui/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"curly": "error",
6060
"comma-dangle": [
6161
"error",
62-
"never"
62+
"always-multiline"
6363
],
6464
"eol-last": [
6565
"error",

ui/src/app/app-routing.module.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ const routes: Routes = [
6868
{
6969
path: 'live', data: { navbarTitle: environment.uiTitle }, providers: [{
7070
useClass: LiveDataService,
71-
provide: DataService
72-
}], component: EdgeLiveComponent
71+
provide: DataService,
72+
}], component: EdgeLiveComponent,
7373
},
7474
{
7575
path: 'history', providers: [{
7676
useClass: HistoryDataService,
77-
provide: DataService
77+
provide: DataService,
7878
}], component: HistoryParentComponent, children: [
7979
{ path: '', component: EdgeHistoryComponent },
8080
// History Chart Pages
@@ -94,8 +94,8 @@ const routes: Routes = [
9494
{ path: 'gridchart', component: GridChartOverviewComponent },
9595
{ path: 'productionchart', component: ProductionChartOverviewComponent },
9696
{ path: 'selfconsumptionchart', component: SelfconsumptionChartOverviewComponent },
97-
{ path: 'storagechart', component: StorageChartOverviewComponent }
98-
]
97+
{ path: 'storagechart', component: StorageChartOverviewComponent },
98+
],
9999
},
100100

101101
{ path: 'settings', data: { navbarTitleToBeTranslated: 'Menu.edgeSettings' }, component: EdgeSettingsComponent },
@@ -114,21 +114,21 @@ const routes: Routes = [
114114
{ path: 'settings/app/install/:appId', component: EdgeSettingsAppInstall },
115115
{ path: 'settings/app/update/:appId', component: EdgeSettingsAppUpdate },
116116
{ path: 'settings/app/single/:appId', component: EdgeSettingsAppSingle },
117-
{ path: 'settings/alerting', component: EdgeSettingsAlerting }
118-
]
117+
{ path: 'settings/alerting', component: EdgeSettingsAlerting },
118+
],
119119
},
120120

121121
{ path: 'demo', component: LoginComponent },
122122
// Fallback
123-
{ path: '**', pathMatch: 'full', redirectTo: 'login' }
123+
{ path: '**', pathMatch: 'full', redirectTo: 'login' },
124124
];
125125

126126
export const appRoutingProviders: any[] = [];
127127

128128
@NgModule({
129129
imports: [
130-
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
130+
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }),
131131
],
132-
exports: [RouterModule]
132+
exports: [RouterModule],
133133
})
134134
export class AppRoutingModule { }

ui/src/app/app.component.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Language } from './shared/type/language';
1313

1414
@Component({
1515
selector: 'app-root',
16-
templateUrl: 'app.component.html'
16+
templateUrl: 'app.component.html',
1717
})
1818
export class AppComponent implements OnInit, OnDestroy {
1919

@@ -35,7 +35,7 @@ export class AppComponent implements OnInit, OnDestroy {
3535
public websocket: Websocket,
3636
private globalRouteChangeHandler: GlobalRouteChangeHandler,
3737
private titleService: Title,
38-
private meta: Meta
38+
private meta: Meta,
3939
) {
4040
service.setLang(Language.getByKey(localStorage.LANGUAGE) ?? Language.getByBrowserLang(navigator.language));
4141

@@ -60,9 +60,9 @@ export class AppComponent implements OnInit, OnDestroy {
6060
buttons: [
6161
{
6262
text: 'Ok',
63-
role: 'cancel'
64-
}
65-
]
63+
role: 'cancel',
64+
},
65+
],
6666
});
6767
toast.present();
6868
});
@@ -72,7 +72,7 @@ export class AppComponent implements OnInit, OnDestroy {
7272
// OEM colors exist only after ionic is initialized, so the notch color has to be set here
7373
const notchColor = getComputedStyle(document.documentElement).getPropertyValue('--ion-color-background');
7474
this.meta.updateTag(
75-
{ name: 'theme-color', content: notchColor }
75+
{ name: 'theme-color', content: notchColor },
7676
);
7777
this.service.deviceHeight = this.platform.height();
7878
this.service.deviceWidth = this.platform.width();

ui/src/app/app.module.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ import { UserModule } from './user/user.module';
3636
ChartOptionsPopoverComponent,
3737
PickDatePopoverComponent,
3838
StatusSingleComponent,
39-
SystemLogComponent
39+
SystemLogComponent,
4040
],
4141
entryComponents: [
4242
ChartOptionsPopoverComponent,
43-
PickDatePopoverComponent
43+
PickDatePopoverComponent,
4444
],
4545
imports: [
4646
AngularMyDatePickerModule,
@@ -56,7 +56,7 @@ import { UserModule } from './user/user.module';
5656
SharedModule,
5757
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: MyTranslateLoader } }),
5858
UserModule,
59-
RegistrationModule
59+
RegistrationModule,
6060
],
6161
providers: [
6262
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
@@ -66,9 +66,9 @@ import { UserModule } from './user/user.module';
6666
// Use factory for formly. This allows us to use translations in validationMessages.
6767
{ provide: FORMLY_CONFIG, multi: true, useFactory: registerTranslateExtension, deps: [TranslateService] },
6868
Pagination,
69-
CheckForUpdateService
69+
CheckForUpdateService,
7070
],
71-
bootstrap: [AppComponent]
71+
bootstrap: [AppComponent],
7272
})
7373
export class AppModule {
7474
constructor() {

ui/src/app/appupdateservice.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { SwUpdate } from "@angular/service-worker";
44
import { Service } from "./shared/shared";
55

66
@Injectable({
7-
providedIn: 'root'
7+
providedIn: 'root',
88
})
99
export class CheckForUpdateService {
1010

1111
constructor(private update: SwUpdate,
12-
private service: Service
12+
private service: Service,
1313
) { }
1414

1515
init() {

ui/src/app/changelog/changelog.module.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { ChangelogViewComponent } from './view/view';
55

66
@NgModule({
77
imports: [
8-
SharedModule
8+
SharedModule,
99
],
1010
declarations: [
1111
ChangelogComponent,
12-
ChangelogViewComponent
12+
ChangelogViewComponent,
1313
],
1414
exports: [
1515
ChangelogComponent,
16-
ChangelogViewComponent
17-
]
16+
ChangelogViewComponent,
17+
],
1818
})
1919
export class ChangelogModule { }

ui/src/app/changelog/view/component/changelog.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Changelog } from './changelog.constants';
88

99
@Component({
1010
selector: 'changelog',
11-
templateUrl: './changelog.component.html'
11+
templateUrl: './changelog.component.html',
1212
})
1313
export class ChangelogComponent implements OnInit {
1414

@@ -19,7 +19,7 @@ export class ChangelogComponent implements OnInit {
1919
constructor(
2020
public translate: TranslateService,
2121
public service: Service,
22-
private route: ActivatedRoute
22+
private route: ActivatedRoute,
2323
) { }
2424

2525
ngOnInit() {
@@ -39,9 +39,9 @@ export class ChangelogComponent implements OnInit {
3939
{
4040
version: 'x.y.z',
4141
changes: [
42-
Changelog.link("OpenEMS Releases", 'https://github.com/OpenEMS/openems/releases')
43-
]
44-
}
42+
Changelog.link("OpenEMS Releases", 'https://github.com/OpenEMS/openems/releases'),
43+
],
44+
},
4545
];
4646

4747
}

ui/src/app/changelog/view/view.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { Component } from "@angular/core";
22

33
@Component({
44
selector: 'changelogViewComponent',
5-
templateUrl: './view.html'
5+
templateUrl: './view.html',
66
})
77
export class ChangelogViewComponent { }

ui/src/app/edge/edge.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ChannelAddress, Edge, Service, Websocket } from "src/app/shared/shared"
99
template: `
1010
<ion-content></ion-content>
1111
<ion-router-outlet id="content"></ion-router-outlet>
12-
`
12+
`,
1313
})
1414
export class EdgeComponent implements OnInit, OnDestroy {
1515

@@ -19,7 +19,7 @@ export class EdgeComponent implements OnInit, OnDestroy {
1919
private router: Router,
2020
private activatedRoute: ActivatedRoute,
2121
private service: Service,
22-
private websocket: Websocket
22+
private websocket: Websocket,
2323
) { }
2424

2525
public ngOnInit(): void {
@@ -34,7 +34,7 @@ export class EdgeComponent implements OnInit, OnDestroy {
3434

3535
// Subscribe on these channels for the state in HeaderComponent
3636
edge.subscribeChannels(this.websocket, '', [
37-
new ChannelAddress('_sum', 'State')
37+
new ChannelAddress('_sum', 'State'),
3838
]);
3939
});
4040
}).catch(() => {

ui/src/app/edge/edge.module.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { EdgeComponent } from './edge.component';
66

77
@NgModule({
88
declarations: [
9-
EdgeComponent
9+
EdgeComponent,
1010
],
1111
imports: [
1212
HistoryModule,
1313
LiveModule,
14-
SharedModule
14+
SharedModule,
1515
],
1616
exports: [
17-
EdgeComponent
18-
]
17+
EdgeComponent,
18+
],
1919
})
2020
export class EdgeModule { }

ui/src/app/edge/history/abstracthistorychart.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ export abstract class AbstractHistoryChart {
3838
// Colors for Phase 1-3
3939
protected phase1Color = {
4040
backgroundColor: 'rgba(255,127,80,0.05)',
41-
borderColor: 'rgba(255,127,80,1)'
41+
borderColor: 'rgba(255,127,80,1)',
4242
};
4343
protected phase2Color = {
4444
backgroundColor: 'rgba(0,0,255,0.1)',
45-
borderColor: 'rgba(0,0,255,1)'
45+
borderColor: 'rgba(0,0,255,1)',
4646
};
4747
protected phase3Color = {
4848
backgroundColor: 'rgba(128,128,0,0.1)',
49-
borderColor: 'rgba(128,128,0,1)'
49+
borderColor: 'rgba(128,128,0,1)',
5050
};
5151

5252
constructor(
5353
public readonly spinnerId: string,
5454
protected service: Service,
55-
protected translate: TranslateService
55+
protected translate: TranslateService,
5656
) {
5757
}
5858

@@ -92,7 +92,7 @@ export abstract class AbstractHistoryChart {
9292
}).catch(error => {
9393
this.errorResponse = error;
9494
resolve(new QueryHistoricTimeseriesDataResponse(error.id, {
95-
timestamps: [null], data: { null: null }
95+
timestamps: [null], data: { null: null },
9696
}));
9797
});
9898
});
@@ -129,12 +129,12 @@ export abstract class AbstractHistoryChart {
129129
this.service.getConfig().then(config => {
130130
edge.sendRequest(this.service.websocket, new QueryHistoricTimeseriesEnergyPerPeriodRequest(DateUtils.maxDate(fromDate, this.edge?.firstSetupProtocol), toDate, channelAddresses, resolution)).then(response => {
131131
resolve(response as QueryHistoricTimeseriesEnergyPerPeriodResponse ?? new QueryHistoricTimeseriesEnergyPerPeriodResponse(response.id, {
132-
timestamps: [null], data: { null: null }
132+
timestamps: [null], data: { null: null },
133133
}));
134134
}).catch((response) => {
135135
this.errorResponse = response;
136136
resolve(new QueryHistoricTimeseriesDataResponse("0", {
137-
timestamps: [null], data: { null: null }
137+
timestamps: [null], data: { null: null },
138138
}));
139139
});
140140
});

ui/src/app/edge/history/abstracthistorywidget.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export abstract class AbstractHistoryWidget {
1414
// private ngUnsubscribe: Subject<void> = new Subject<void>();
1515

1616
constructor(
17-
protected service: Service
17+
protected service: Service,
1818
) { }
1919

2020
/**

ui/src/app/edge/history/channelthreshold/channelthresholdchartoverview/channelthresholdchartoverview.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Edge, EdgeConfig, Service, Utils } from '../../../../shared/shared';
44

55
@Component({
66
selector: ChannelthresholdChartOverviewComponent.SELECTOR,
7-
templateUrl: './channelthresholdchartoverview.component.html'
7+
templateUrl: './channelthresholdchartoverview.component.html',
88
})
99
export class ChannelthresholdChartOverviewComponent implements OnInit {
1010

@@ -23,7 +23,7 @@ export class ChannelthresholdChartOverviewComponent implements OnInit {
2323

2424
constructor(
2525
public service: Service,
26-
private route: ActivatedRoute
26+
private route: ActivatedRoute,
2727
) { }
2828

2929
ngOnInit() {

ui/src/app/edge/history/channelthreshold/singlechart.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Data, TooltipItem } from '../shared';
1111

1212
@Component({
1313
selector: 'channelthresholdSingleChart',
14-
templateUrl: '../abstracthistorychart.html'
14+
templateUrl: '../abstracthistorychart.html',
1515
})
1616
export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart implements OnInit, OnChanges, OnDestroy {
1717

@@ -25,7 +25,7 @@ export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart i
2525
constructor(
2626
protected override service: Service,
2727
protected override translate: TranslateService,
28-
private route: ActivatedRoute
28+
private route: ActivatedRoute,
2929
) {
3030
super("channelthreshold-single-chart", service, translate);
3131
}
@@ -66,11 +66,11 @@ export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart i
6666
});
6767
datasets.push({
6868
label: address.channelId,
69-
data: data
69+
data: data,
7070
});
7171
this.colors.push({
7272
backgroundColor: 'rgba(0,191,255,0.05)',
73-
borderColor: 'rgba(0,191,255,1)'
73+
borderColor: 'rgba(0,191,255,1)',
7474
});
7575
}
7676
this.datasets = datasets;

0 commit comments

Comments
 (0)