Skip to content

Commit

Permalink
Fix obvious linting errors and change default error to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelBradley committed Mar 15, 2023
1 parent 228b7d3 commit 7e6de4f
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 57 deletions.
10 changes: 7 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
],
"rules": {
"@angular-eslint/component-selector": [
"error",
"warn",
{
"prefix": "app",
"style": "kebab-case",
"type": "element"
"type": ["element", "attribute"]
}
],
"@angular-eslint/directive-selector": [
Expand All @@ -34,7 +34,11 @@
"@typescript-eslint/no-explicit-any": "off", //Too Many, needed to turn off
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"prefer-const": "warn"
"prefer-const": "warn",
"@typescript-eslint/ban-types": "warn",
"no-var": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-inferrable-types": "off"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/menupanel/common/filterpanel/filterpanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AdvancedComponentService } from 'app/services/ui/advanced-component.ser
import { FilterService, LayerTimes } from 'app/services/filter/filter.service';
import { LegendUiService } from 'app/services/legend/legend-ui.service';

declare var gtag: Function;
declare let gtag: Function;

@Component({
selector: 'app-filter-panel',
Expand Down Expand Up @@ -257,7 +257,7 @@ export class FilterPanelComponent implements OnInit {
this.csWMSService.getNvclFilter(layer, param).subscribe(response => {
if (response.indexOf('<ogc:Intersects>') >= 0) {
const ogcIntersects = UtilitiesService.getPolygonFilter(response);
// tslint:disable-next-line:max-line-length
// eslint-disable-next-line max-len
response = '<ogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:gml=\"http://www.opengis.net/gml\">' + ogcIntersects + '</ogc:Filter>';
}
layer.ogcFilter = response;
Expand Down
10 changes: 5 additions & 5 deletions src/app/menupanel/layerpanel/layerpanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum FilterMode {
Active = "Active Layer",
Image = "Image Layer",
Data = "Data Layer"
};
}

@Component({
selector: '[appLayerPanel]',
Expand Down Expand Up @@ -238,7 +238,7 @@ export class LayerPanelComponent implements OnInit {

/**
* Set a layer's split direction so that it will appear in either the left, right or both (None) panes.
*
*
* @param event the event trigger
* @param layer the layer to set split direction on
* @param direction the split direction for the layer to occupy
Expand All @@ -264,7 +264,7 @@ export class LayerPanelComponent implements OnInit {

/**
* Gets the layer's split direction
*
*
* @param layerId layer id string
* @returns a string "none" or "left" or "right"
*/
Expand All @@ -285,7 +285,7 @@ export class LayerPanelComponent implements OnInit {

/**
* Only show the split map buttons if the layer has a WMS resource.
*
*
* @param layer current LayerModel
*/
public getApplicableSplitLayer(layer: LayerModel): boolean {
Expand All @@ -308,7 +308,7 @@ export class LayerPanelComponent implements OnInit {

/**
* Gets a layers "UILayerModel"
*
*
* @param layerId layer id string
* @returns UILayerModel object
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { DisclaimerModalComponent } from '../../modalwindow/disclaimer/disclaimer.modal.component';

Expand All @@ -7,13 +7,10 @@ import { DisclaimerModalComponent } from '../../modalwindow/disclaimer/disclaime
templateUrl: './portal-details-panel.component.html',
styleUrls: ['./portal-details-panel.component.css']
})
export class PortalDetailsPanelComponent implements OnInit {
export class PortalDetailsPanelComponent {

constructor(private modalService: BsModalService) { }

ngOnInit() {
}

OpenDisclaimerModal(): void {
this.modalService.show(DisclaimerModalComponent);
}
Expand Down
7 changes: 2 additions & 5 deletions src/app/modalwindow/disclaimer/disclaimer.modal.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-disclaimer-modal-window',
templateUrl: './disclaimer.modal.component.html',
styleUrls: ['./disclaimer.modal.component.css']
})
export class DisclaimerModalComponent implements OnInit {
export class DisclaimerModalComponent {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { AfterViewInit, Component } from '@angular/core';
import { Component } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { LayerModel } from '@auscope/portal-core-ui';

Expand All @@ -10,7 +10,7 @@ import { LayerModel } from '@auscope/portal-core-ui';
templateUrl: './layer.analytic.modal.component.html'
})

export class LayerAnalyticModalComponent implements AfterViewInit {
export class LayerAnalyticModalComponent {
public analyticMap;
public layer: LayerModel;

Expand All @@ -19,9 +19,5 @@ export class LayerAnalyticModalComponent implements AfterViewInit {

}

ngAfterViewInit() {

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,14 @@ export class NVCLBoreholeAnalyticComponent
this.nvclBoreholeAnalyticService
.checkNVCLAnalyticalJobStatus(this.nvclform.email)
.subscribe(response => {
const me = this;
me.currentStatus = response;
this.currentStatus = response;

me.nvclBoreholeAnalyticService.setUserEmail(me.nvclform.email);
for (const i in me.currentStatus) {
me.nvclBoreholeAnalyticService
.getNVCLJobPublishStatus(me.currentStatus[i].jobid)
this.nvclBoreholeAnalyticService.setUserEmail(this.nvclform.email);
for (const i in this.currentStatus) {
this.nvclBoreholeAnalyticService
.getNVCLJobPublishStatus(this.currentStatus[i].jobid)
.subscribe(response => {
me.currentStatus[i].published =
this.currentStatus[i].published =
response === 'true' ? true : false;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export class NVCLDatasetListComponent implements OnInit {
}

public drawGraph(logIds: Array<string>, logNames: Array<string>) {
const me = this;
this.processingGraph = true;
this.nvclService.getNVCL2_0_JSONDataBinned(this.onlineResource.url, logIds).
subscribe(response => {
Expand All @@ -177,7 +176,6 @@ export class NVCLDatasetListComponent implements OnInit {
}

public drawGraphJob(jobIds: Array<string>) {
const me = this;
this.processingGraph = true;
this.nvclService.getNVCL2_0_JobsScalarBinned(this.featureId, jobIds).
subscribe(response => {
Expand Down Expand Up @@ -279,10 +277,10 @@ export class NVCLDatasetListComponent implements OnInit {
if (logIds.length <= 0) {
alert('No logs selected');
}
const me = this;

setTimeout(() => {
me.processingGraph = true;
me.drawGraph(logIds, logNames);
this.processingGraph = true;
this.drawGraph(logIds, logNames);
}, 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { UtilitiesService } from '@auscope/portal-core-ui';
import { Injectable, Inject} from '@angular/core';
import {HttpClient, HttpParams, HttpHeaders, HttpResponse} from '@angular/common/http';
import { environment } from '../../../../../environments/environment';
declare var gtag: Function;
declare let gtag: Function;
@Injectable()
export class NVCLService {

public isAnalytic: BehaviorSubject<boolean>; // observable used in querier to control Analytic TAB

/**
* returns the observable of "isAnalytic" variable
* returns the observable of "isAnalytic" variable
*/
getAnalytic(): Observable<boolean> {
//console.log("[nvclservice]getAnalytic().this.isAnalytic="+this.isAnalytic.asObservable()._isScalar);
Expand Down Expand Up @@ -180,7 +180,7 @@ export class NVCLService {
if (environment.googleAnalyticsKey && typeof gtag === 'function') {
/**
* do not "log" the "email" to "Google Analytics" - as this is an ethics issue
*
*
* console.log("getNVCLTSGDownload() serviceUrl:"+serviceUrl+",downloadEmail:"+downloadEmail+",datasetId:"+datasetId);
* gtag('event', 'NVCLDownload', {'event_category': 'NVCLDownload', 'event_action': serviceUrl, 'event_label': downloadEmail, 'value': datasetId});
*/
Expand Down Expand Up @@ -250,7 +250,7 @@ export class NVCLService {

/**
* Returns true iff this is an NVCL v2 layer
*
*
* @param layer layer id string
* @returns true iff this is an NVCL v2 layer
*/
Expand Down
22 changes: 12 additions & 10 deletions src/app/modalwindow/querier/querier.modal.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/member-ordering */
import { ApplicationRef, ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
import { environment } from '../../../environments/environment';
import { config } from '../../../environments/config';
Expand Down Expand Up @@ -46,7 +47,7 @@ export class QuerierModalComponent implements OnInit {
public hasMsclAnalytics = false; // Display 'Analytics' tab to analyse GML observations

// Show a message to zoom in
public showZoomMsg: boolean = false;
public showZoomMsg = false;

/* Transforms FileNode into displayable node */
private _transformer = (node: FileNode, level: number) => {
Expand All @@ -63,22 +64,23 @@ export class QuerierModalComponent implements OnInit {
public treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
public flatTreeDataSource = {}; // Tree structure is assigned to this


// Does the 'FlatNode' have children?
public hasChild = (_: number, node: FlatNode) => node.expandable;


/**
*
*
* Reflects the value of nvclService.getAnalytic(); updates the html Analytic TAB
*
*
* When a "borehole name" is clicked on, onDataChange() is fired and a detectChanges() event causes
* nvclService.getNVCLDatasets() to be called from nvcl.datasetlist.component.ts
* This will set the "isAnalytic" variable in the service nvcl.service.ts to be set (boolean).
*
*
* Note: to support this, nvcl.service was removed as a provide from this component and datasetlist
* The reason for this is to prevent the service from being instantiated for each component.
* The app.module.ts code was updated to add this service in the providers list - making it a global instance
*
*
* If this was not done the two components would not see the same state of the service variable "isAnalytic"
*/
public flagNVCLAnalytic: boolean;
Expand Down Expand Up @@ -110,7 +112,7 @@ export class QuerierModalComponent implements OnInit {

/**
* Returns true iff layer is NVCL layer
*
*
* @param layer layer identifier string
* @returns true iff layer is NVCL layer
*/
Expand All @@ -120,8 +122,8 @@ export class QuerierModalComponent implements OnInit {

/**
* Returns true if this supports open in new window
*
* @param doc
*
* @param doc
* @returns boolean
*/
public supportOpenInNewWindow(doc: QuerierInfoModel): boolean {
Expand Down Expand Up @@ -190,7 +192,7 @@ export class QuerierModalComponent implements OnInit {

/**
* This gets called from the UI when user clicks on first link in popup
*
*
* @param document
*/
public transformToHtml(document): void {
Expand Down Expand Up @@ -286,7 +288,7 @@ export class QuerierModalComponent implements OnInit {
}
// Parse the response and build a recursive tree of FileNode objects and assign them to the tree
const data = this.buildFileTree(JSON.parse(`{"${name}":${JSON.stringify(result)}}`), 0);
this.flatTreeControl[name] = new FlatTreeControl<FlatNode>(node => node.level, node => node.expandable);
this.flatTreeControl[name] = new FlatTreeControl<FlatNode>(node => node.level, node => node.expandable);
this.flatTreeDataSource[name] = new MatTreeFlatDataSource(this.flatTreeControl[name], this.treeFlattener);
this.flatTreeDataSource[name].data = data;
this.flatTreeControl[name].expandAll();
Expand Down
7 changes: 2 additions & 5 deletions src/app/toppanel/help-menu/help-menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: '[app-help-menu]',
templateUrl: './help-menu.component.html',
styleUrls: ['./help-menu.component.scss']
})
export class HelpMenuComponent implements OnInit {
export class HelpMenuComponent {

constructor() { }

ngOnInit(): void {
}

}

0 comments on commit 7e6de4f

Please sign in to comment.