Skip to content

Commit

Permalink
UI: set and apply ESLint rule comma-dangle = always-multiline (#2430)
Browse files Browse the repository at this point in the history
eslint src/ --fix
  • Loading branch information
miettal authored Nov 13, 2023
1 parent 2900811 commit cc5ccdd
Show file tree
Hide file tree
Showing 374 changed files with 1,783 additions and 1,783 deletions.
2 changes: 1 addition & 1 deletion ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"curly": "error",
"comma-dangle": [
"error",
"never"
"always-multiline"
],
"eol-last": [
"error",
Expand Down
20 changes: 10 additions & 10 deletions ui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ const routes: Routes = [
{
path: 'live', data: { navbarTitle: environment.uiTitle }, providers: [{
useClass: LiveDataService,
provide: DataService
}], component: EdgeLiveComponent
provide: DataService,
}], component: EdgeLiveComponent,
},
{
path: 'history', providers: [{
useClass: HistoryDataService,
provide: DataService
provide: DataService,
}], component: HistoryParentComponent, children: [
{ path: '', component: EdgeHistoryComponent },
// History Chart Pages
Expand All @@ -94,8 +94,8 @@ const routes: Routes = [
{ path: 'gridchart', component: GridChartOverviewComponent },
{ path: 'productionchart', component: ProductionChartOverviewComponent },
{ path: 'selfconsumptionchart', component: SelfconsumptionChartOverviewComponent },
{ path: 'storagechart', component: StorageChartOverviewComponent }
]
{ path: 'storagechart', component: StorageChartOverviewComponent },
],
},

{ path: 'settings', data: { navbarTitleToBeTranslated: 'Menu.edgeSettings' }, component: EdgeSettingsComponent },
Expand All @@ -114,21 +114,21 @@ const routes: Routes = [
{ path: 'settings/app/install/:appId', component: EdgeSettingsAppInstall },
{ path: 'settings/app/update/:appId', component: EdgeSettingsAppUpdate },
{ path: 'settings/app/single/:appId', component: EdgeSettingsAppSingle },
{ path: 'settings/alerting', component: EdgeSettingsAlerting }
]
{ path: 'settings/alerting', component: EdgeSettingsAlerting },
],
},

{ path: 'demo', component: LoginComponent },
// Fallback
{ path: '**', pathMatch: 'full', redirectTo: 'login' }
{ path: '**', pathMatch: 'full', redirectTo: 'login' },
];

export const appRoutingProviders: any[] = [];

@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }),
],
exports: [RouterModule]
exports: [RouterModule],
})
export class AppRoutingModule { }
12 changes: 6 additions & 6 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Language } from './shared/type/language';

@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit, OnDestroy {

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

Expand All @@ -60,9 +60,9 @@ export class AppComponent implements OnInit, OnDestroy {
buttons: [
{
text: 'Ok',
role: 'cancel'
}
]
role: 'cancel',
},
],
});
toast.present();
});
Expand All @@ -72,7 +72,7 @@ export class AppComponent implements OnInit, OnDestroy {
// OEM colors exist only after ionic is initialized, so the notch color has to be set here
const notchColor = getComputedStyle(document.documentElement).getPropertyValue('--ion-color-background');
this.meta.updateTag(
{ name: 'theme-color', content: notchColor }
{ name: 'theme-color', content: notchColor },
);
this.service.deviceHeight = this.platform.height();
this.service.deviceWidth = this.platform.width();
Expand Down
10 changes: 5 additions & 5 deletions ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import { UserModule } from './user/user.module';
ChartOptionsPopoverComponent,
PickDatePopoverComponent,
StatusSingleComponent,
SystemLogComponent
SystemLogComponent,
],
entryComponents: [
ChartOptionsPopoverComponent,
PickDatePopoverComponent
PickDatePopoverComponent,
],
imports: [
AngularMyDatePickerModule,
Expand All @@ -56,7 +56,7 @@ import { UserModule } from './user/user.module';
SharedModule,
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: MyTranslateLoader } }),
UserModule,
RegistrationModule
RegistrationModule,
],
providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
Expand All @@ -66,9 +66,9 @@ import { UserModule } from './user/user.module';
// Use factory for formly. This allows us to use translations in validationMessages.
{ provide: FORMLY_CONFIG, multi: true, useFactory: registerTranslateExtension, deps: [TranslateService] },
Pagination,
CheckForUpdateService
CheckForUpdateService,
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/appupdateservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { SwUpdate } from "@angular/service-worker";
import { Service } from "./shared/shared";

@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class CheckForUpdateService {

constructor(private update: SwUpdate,
private service: Service
private service: Service,
) { }

init() {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/changelog/changelog.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { ChangelogViewComponent } from './view/view';

@NgModule({
imports: [
SharedModule
SharedModule,
],
declarations: [
ChangelogComponent,
ChangelogViewComponent
ChangelogViewComponent,
],
exports: [
ChangelogComponent,
ChangelogViewComponent
]
ChangelogViewComponent,
],
})
export class ChangelogModule { }
10 changes: 5 additions & 5 deletions ui/src/app/changelog/view/component/changelog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Changelog } from './changelog.constants';

@Component({
selector: 'changelog',
templateUrl: './changelog.component.html'
templateUrl: './changelog.component.html',
})
export class ChangelogComponent implements OnInit {

Expand All @@ -19,7 +19,7 @@ export class ChangelogComponent implements OnInit {
constructor(
public translate: TranslateService,
public service: Service,
private route: ActivatedRoute
private route: ActivatedRoute,
) { }

ngOnInit() {
Expand All @@ -39,9 +39,9 @@ export class ChangelogComponent implements OnInit {
{
version: 'x.y.z',
changes: [
Changelog.link("OpenEMS Releases", 'https://github.com/OpenEMS/openems/releases')
]
}
Changelog.link("OpenEMS Releases", 'https://github.com/OpenEMS/openems/releases'),
],
},
];

}
2 changes: 1 addition & 1 deletion ui/src/app/changelog/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Component } from "@angular/core";

@Component({
selector: 'changelogViewComponent',
templateUrl: './view.html'
templateUrl: './view.html',
})
export class ChangelogViewComponent { }
6 changes: 3 additions & 3 deletions ui/src/app/edge/edge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ChannelAddress, Edge, Service, Websocket } from "src/app/shared/shared"
template: `
<ion-content></ion-content>
<ion-router-outlet id="content"></ion-router-outlet>
`
`,
})
export class EdgeComponent implements OnInit, OnDestroy {

Expand All @@ -19,7 +19,7 @@ export class EdgeComponent implements OnInit, OnDestroy {
private router: Router,
private activatedRoute: ActivatedRoute,
private service: Service,
private websocket: Websocket
private websocket: Websocket,
) { }

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

// Subscribe on these channels for the state in HeaderComponent
edge.subscribeChannels(this.websocket, '', [
new ChannelAddress('_sum', 'State')
new ChannelAddress('_sum', 'State'),
]);
});
}).catch(() => {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/edge/edge.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { EdgeComponent } from './edge.component';

@NgModule({
declarations: [
EdgeComponent
EdgeComponent,
],
imports: [
HistoryModule,
LiveModule,
SharedModule
SharedModule,
],
exports: [
EdgeComponent
]
EdgeComponent,
],
})
export class EdgeModule { }
14 changes: 7 additions & 7 deletions ui/src/app/edge/history/abstracthistorychart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ export abstract class AbstractHistoryChart {
// Colors for Phase 1-3
protected phase1Color = {
backgroundColor: 'rgba(255,127,80,0.05)',
borderColor: 'rgba(255,127,80,1)'
borderColor: 'rgba(255,127,80,1)',
};
protected phase2Color = {
backgroundColor: 'rgba(0,0,255,0.1)',
borderColor: 'rgba(0,0,255,1)'
borderColor: 'rgba(0,0,255,1)',
};
protected phase3Color = {
backgroundColor: 'rgba(128,128,0,0.1)',
borderColor: 'rgba(128,128,0,1)'
borderColor: 'rgba(128,128,0,1)',
};

constructor(
public readonly spinnerId: string,
protected service: Service,
protected translate: TranslateService
protected translate: TranslateService,
) {
}

Expand Down Expand Up @@ -92,7 +92,7 @@ export abstract class AbstractHistoryChart {
}).catch(error => {
this.errorResponse = error;
resolve(new QueryHistoricTimeseriesDataResponse(error.id, {
timestamps: [null], data: { null: null }
timestamps: [null], data: { null: null },
}));
});
});
Expand Down Expand Up @@ -129,12 +129,12 @@ export abstract class AbstractHistoryChart {
this.service.getConfig().then(config => {
edge.sendRequest(this.service.websocket, new QueryHistoricTimeseriesEnergyPerPeriodRequest(DateUtils.maxDate(fromDate, this.edge?.firstSetupProtocol), toDate, channelAddresses, resolution)).then(response => {
resolve(response as QueryHistoricTimeseriesEnergyPerPeriodResponse ?? new QueryHistoricTimeseriesEnergyPerPeriodResponse(response.id, {
timestamps: [null], data: { null: null }
timestamps: [null], data: { null: null },
}));
}).catch((response) => {
this.errorResponse = response;
resolve(new QueryHistoricTimeseriesDataResponse("0", {
timestamps: [null], data: { null: null }
timestamps: [null], data: { null: null },
}));
});
});
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/history/abstracthistorywidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export abstract class AbstractHistoryWidget {
// private ngUnsubscribe: Subject<void> = new Subject<void>();

constructor(
protected service: Service
protected service: Service,
) { }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Edge, EdgeConfig, Service, Utils } from '../../../../shared/shared';

@Component({
selector: ChannelthresholdChartOverviewComponent.SELECTOR,
templateUrl: './channelthresholdchartoverview.component.html'
templateUrl: './channelthresholdchartoverview.component.html',
})
export class ChannelthresholdChartOverviewComponent implements OnInit {

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

constructor(
public service: Service,
private route: ActivatedRoute
private route: ActivatedRoute,
) { }

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Data, TooltipItem } from '../shared';

@Component({
selector: 'channelthresholdSingleChart',
templateUrl: '../abstracthistorychart.html'
templateUrl: '../abstracthistorychart.html',
})
export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart implements OnInit, OnChanges, OnDestroy {

Expand All @@ -25,7 +25,7 @@ export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart i
constructor(
protected override service: Service,
protected override translate: TranslateService,
private route: ActivatedRoute
private route: ActivatedRoute,
) {
super("channelthreshold-single-chart", service, translate);
}
Expand Down Expand Up @@ -66,11 +66,11 @@ export class ChannelthresholdSingleChartComponent extends AbstractHistoryChart i
});
datasets.push({
label: address.channelId,
data: data
data: data,
});
this.colors.push({
backgroundColor: 'rgba(0,191,255,0.05)',
borderColor: 'rgba(0,191,255,1)'
borderColor: 'rgba(0,191,255,1)',
});
}
this.datasets = datasets;
Expand Down
Loading

0 comments on commit cc5ccdd

Please sign in to comment.