Skip to content

Commit

Permalink
UI: add ESlint rule for unused imports (#2221)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Rieger <[email protected]>
  • Loading branch information
sfeilmeier and lukasrgr authored Jun 9, 2023
1 parent 2c36e41 commit 0d6e3f2
Show file tree
Hide file tree
Showing 33 changed files with 72 additions and 40 deletions.
4 changes: 4 additions & 0 deletions ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
],
"createDefaultProgram": true
},
"plugins": [
"unused-imports"
],
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"unused-imports/no-unused-imports": "error",
"semi": [
"warn",
"always"
Expand Down
46 changes: 46 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsdoc": "45.0.0",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-unused-imports": "^2.0.0",
"jasmine-core": "~4.5.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.4.2",
Expand All @@ -70,4 +71,4 @@
"lint": "ng lint",
"test": "ng test"
}
}
}
1 change: 0 additions & 1 deletion ui/src/app/changelog/view/component/changelog.constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Role } from "src/app/shared/type/role";
import { environment } from "src/environments";

export class Changelog {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
import { Edge, EdgeConfig, Service } from 'src/app/shared/shared';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DefaultTypes } from 'src/app/shared/service/defaulttypes';
import { Edge, EdgeConfig, Service } from 'src/app/shared/shared';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { AbstractFlatWidget } from 'src/app/shared/genericComponents/flat/abstract-flat-widget';
import { ChannelAddress, CurrentData, Utils } from 'src/app/shared/shared';
import { Mode, WorkMode } from 'src/app/shared/type/general';
import { WorkMode } from 'src/app/shared/type/general';
import { ModalComponent } from '../modal/modal';

@Component({
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/live/common/production/flat/flat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChannelAddress, EdgeConfig, Utils } from 'src/app/shared/shared';
import { EdgeConfig, Utils } from 'src/app/shared/shared';
import { Component } from '@angular/core';
import { AbstractFlatWidget } from 'src/app/shared/genericComponents/flat/abstract-flat-widget';
import { ModalComponent } from '../modal/modal';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/live/common/production/modal/modal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { AbstractModal } from 'src/app/shared/genericComponents/modal/abstractModal';
import { ChannelAddress, CurrentData, EdgeConfig, Utils } from 'src/app/shared/shared';
import { ChannelAddress, EdgeConfig, Utils } from 'src/app/shared/shared';

@Component({
templateUrl: './modal.html'
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/edge/settings/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { UpdateAppComponent } from './update.component';
import { KeyModalComponent } from './keypopup/modal.component';
import { FormControl, ValidationErrors } from '@angular/forms';
import { FormlyModule, FORMLY_CONFIG } from '@ngx-formly/core';
import { TranslateExtension } from 'src/app/shared/translate.extension';
import { TranslateService } from '@ngx-translate/core';
import { FormlySafeInputModalComponent } from './formly/safe-input/formly-safe-input-modal.component';
import { FormlySafeInputWrapperComponent } from './formly/safe-input/formly-safe-input.extended';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/settings/app/formly/formly-text.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ViewEncapsulation } from "@angular/core";
import { FieldType, FieldTypeConfig, FieldWrapper } from "@ngx-formly/core";
import { FieldType, FieldTypeConfig } from "@ngx-formly/core";

@Component({
selector: 'formly-text',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/settings/app/formly/input-with-unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FieldType, FieldWrapper } from '@ngx-formly/core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
selector: 'formly-input-with-unit',
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/edge/settings/app/jsonrpc/updateAppInstance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { JsonrpcRequest, JsonrpcResponseSuccess } from "../../../../shared/jsonrpc/base";
import { GetAppInstances } from "./getAppInstances";
import { GetApps } from "./getApps";

/**
* Updates an instance of an {@link OpenemsApp}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { JsonrpcRequest, JsonrpcResponseSuccess } from "src/app/shared/jsonrpc/base";
import { ComponentJsonApiRequest } from "src/app/shared/jsonrpc/request/componentJsonApiRequest";
import { AddAppInstance } from "../jsonrpc/addAppInstance";
import { App } from "./app";
import { JsonrpcRequest } from "src/app/shared/jsonrpc/base";


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { JsonrpcRequest, JsonrpcResponseSuccess } from "src/app/shared/jsonrpc/base";
import { App } from "./app";


/**
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/edge/settings/app/keypopup/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Router } from '@angular/router';
import { ModalController } from '@ionic/angular';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { Edge, Service, Websocket } from 'src/app/shared/shared';
import { environment } from 'src/environments';
import { GetApps } from '../jsonrpc/getApps';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/edge/settings/profile/profile.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PopoverController, ViewWillEnter } from '@ionic/angular';
import { PopoverController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { CategorizedComponents } from 'src/app/shared/edge/edgeconfig';
import { JsonrpcResponseError } from 'src/app/shared/jsonrpc/base';
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/edge/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ProductType } from 'src/app/shared/type/widget';
import { environment } from 'src/environments';
import { Edge, Service, Utils } from '../../shared/shared';
import { canSeeAppCenter } from './app/permissions';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { environment } from 'src/environments';
import { Edge, Service, Utils, Websocket } from '../../../shared/shared';
import { Edge, Service, Utils } from '../../../shared/shared';

@Component({
selector: SystemUpdateComponent.SELECTOR,
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/shared/edge/meter/asymmetric/modal.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { filter } from 'rxjs/operators';
import { Component, OnInit } from '@angular/core';
import { AbstractModalLine } from 'src/app/shared/genericComponents/modal/abstract-modal-line';
import { TextIndentation } from 'src/app/shared/genericComponents/modal/modal-line/modal-line';
import { ChannelAddress, CurrentData, Utils } from 'src/app/shared/shared';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ChangeDetectionStrategy, OnChanges, SimpleChanges, OnInit } from '@angular/core';
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { FieldWrapper } from '@ngx-formly/core';

@Component({
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/formly/formly-select-field.extended.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectorRef, Component } from "@angular/core";
import { Component } from "@angular/core";
import { ModalController } from "@ionic/angular";
import { FieldWrapper } from "@ngx-formly/core";
import { FormlySelectFieldModalComponent } from "./formly-select-field-modal.component";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/formly/panel-wrapper.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ViewChild, ViewContainerRef } from "@angular/core";
import { Component } from "@angular/core";
import { FieldWrapper } from "@ngx-formly/core";

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Inject, Injectable, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { Directive, Inject, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ModalController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatNumber } from '@angular/common';
import { ChangeDetectorRef, Directive, Input, OnChanges, OnInit } from '@angular/core';
import { ChangeDetectorRef, Directive, Input, OnInit } from '@angular/core';
import { ActivatedRoute, Data } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import * as Chart from 'chart.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChannelAddress } from "../../../shared/type/channeladdress";
import { format } from 'date-fns';
import { JsonrpcRequest } from "../base";
import { JsonRpcUtils } from "../jsonrpcutils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { ChannelAddress } from "../../../shared/type/channeladdress";
import { format } from 'date-fns';
import { JsonrpcRequest } from "../base";
import { JsonRpcUtils } from "../jsonrpcutils";
import { DefaultTypes } from "../../service/defaulttypes";
import { Resolution, Unit } from "src/app/edge/history/shared";
import { Resolution } from "src/app/edge/history/shared";

/**
* Represents a JSON-RPC Request to query Historic Timeseries Data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { ChannelAddress } from "../../type/channeladdress";
import { format } from 'date-fns';
import { JsonrpcRequest } from "../base";
import { JsonRpcUtils } from "../jsonrpcutils";
import { DefaultTypes } from "../../service/defaulttypes";
import { NumericValueAccessor } from "@ionic/angular";
import { Resolution, Unit } from "src/app/edge/history/shared";
import { Resolution } from "src/app/edge/history/shared";

/**
* Represents a JSON-RPC Request to query Timeseries Energy data.
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/shared/jsonrpc/request/subscribeEdgesRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Edge } from "../../edge/edge";
import { JsonrpcRequest } from "../base";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { JsonrpcResponseSuccess } from "../base";
import { AddEdgeToUserRequest } from "../request/addEdgeToUserRequest";

/**
* Represents a JSON-RPC Response for a {@link AddEdgeToUserRequest}.
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/jsonrpc/response/edgeRpcResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonrpcRequest, JsonrpcResponse, JsonrpcResponseSuccess } from "../base";
import { JsonrpcRequest, JsonrpcResponseSuccess } from "../base";

/**
* Wraps a JSON-RPC Response for a EdgeRpcRequest.
Expand Down
4 changes: 1 addition & 3 deletions ui/src/app/shared/service/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Directive } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { Router } from '@angular/router';

import { GetEdgeConfigRequest } from '../jsonrpc/request/getEdgeConfigRequest';
import { SubscribeEdgesRequest } from '../jsonrpc/request/subscribeEdgesRequest';
import { ChannelAddress, Edge } from '../shared';
import { Service } from './service';
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/shared/type/widget.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Edge } from '../edge/edge';
import { EdgeConfig } from '../edge/edgeconfig';
import { Service, Utils } from '../shared';

export enum WidgetClass {
'Energymonitor',
Expand Down

0 comments on commit 0d6e3f2

Please sign in to comment.