diff --git a/example/angular.json b/example/angular.json index dc17b873bded301a8889f21365f6bb4d9617be46..52c50c0b8744735e1d01edac5e9d35d5a4cb3035 100644 --- a/example/angular.json +++ b/example/angular.json @@ -22,10 +22,17 @@ "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", - "assets": ["src/favicon.ico", "src/assets"], - "styles": ["src/styles.scss"], + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], "scripts": [], - "allowedCommonJsDependencies": ["@nshmp/disagg-d3"], + "allowedCommonJsDependencies": [ + "@nshmp/disagg-d3" + ], "vendorChunk": true, "extractLicenses": false, "buildOptimizer": false, @@ -88,8 +95,13 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", - "assets": ["src/favicon.ico", "src/assets"], - "styles": ["src/styles.scss"], + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], "scripts": [] } }, @@ -104,12 +116,22 @@ "devServerTarget": "example:serve:production" } } + }, + "lint": { + "builder": "@angular-eslint/builder:lint", + "options": { + "lintFilePatterns": [ + "src/**/*.ts", + "src/**/*.html" + ] + } } } } }, "defaultProject": "example", "cli": { - "analytics": false + "analytics": false, + "defaultCollection": "@angular-eslint/schematics" } } diff --git a/example/src/app/app.component.html b/example/src/app/app.component.html index 9c03c4bb7b08f0c9c507f9eba5e903cdb78e5f01..ceb531a706ffd0e34e3f659c0dc69f64867461b9 100644 --- a/example/src/app/app.component.html +++ b/example/src/app/app.component.html @@ -1,10 +1,12 @@ <div class="container"> <select name="Component" (change)="onComponentChange($event.target.value)"> - <option *ngFor="let disagg of data.disaggs[0].data" [value]="disagg?.component"> + <option + *ngFor="let disagg of data.disaggs[0].data" + [value]="disagg?.component" + > {{ disagg?.component }} </option> </select> <div #example></div> </div> - diff --git a/example/src/app/app.component.spec.ts b/example/src/app/app.component.spec.ts index 1443a507b8b507550b82b31a0f3e19c2c0e430a3..a375012262473207fc234b3d8abf9cd10de669bb 100644 --- a/example/src/app/app.component.spec.ts +++ b/example/src/app/app.component.spec.ts @@ -1,15 +1,13 @@ -import { TestBed, waitForAsync } from '@angular/core/testing'; +import {TestBed, waitForAsync} from '@angular/core/testing'; -import { AppComponent } from './app.component'; +import {AppComponent} from './app.component'; describe('AppComponent', () => { - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AppComponent], - }).compileComponents(); - }) - ); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AppComponent], + }).compileComponents(); + })); it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); diff --git a/example/src/app/app.component.ts b/example/src/app/app.component.ts index 5531090ba162d575acb90f7204920c9f67721497..e45b49a84afa70dcbc6ab7e254efa50afd27c2f7 100644 --- a/example/src/app/app.component.ts +++ b/example/src/app/app.component.ts @@ -1,14 +1,18 @@ -import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; -import { nshmpHaz} from '@ghsc/nshmp-web-utils'; -import { DisaggGraphView, Disaggregation, DisaggResponse } from '@nshmp/disagg-d3/src/disagg'; -import { Collection } from '@nshmp/disagg-d3/src/mvc'; +import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core'; +import {nshmpHaz} from '@ghsc/nshmp-web-utils'; +import { + DisaggGraphView, + Disaggregation, + DisaggResponse, +} from '@nshmp/disagg-d3/src/disagg'; +import {Collection} from '@nshmp/disagg-d3/src/mvc'; import disagg from '../assets/disagg-response.json'; @Component({ selector: 'app-root', - templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], + templateUrl: './app.component.html', }) export class AppComponent implements AfterViewInit { title = 'Disaggregation'; @@ -23,19 +27,23 @@ export class AppComponent implements AfterViewInit { ngAfterViewInit(): void { const response = new DisaggResponse(this.data); - const disaggs = response.get<Collection<Disaggregation>>('disaggregations').data(); + const disaggs = response + .get<Collection<Disaggregation>>('disaggregations') + .data(); this.disaggCollection.addAll(disaggs); this.disaggCollection.select(this.disaggCollection.data()[0]); this.view = new DisaggGraphView({ - el: this.el.nativeElement, - collection: this.disaggCollection, bounds: this.bounds(this.data), + collection: this.disaggCollection, + el: this.el.nativeElement, }); } - bounds(data: nshmpHaz.disaggService.DisaggResponseData): number[][]{ - const totalComponent = data.disaggs[0].data.find(d => d.component === 'Total'); + bounds(data: nshmpHaz.disaggService.DisaggResponseData): number[][] { + const totalComponent = data.disaggs[0].data.find( + d => d.component === 'Total' + ); return DisaggGraphView.calculateBounds(totalComponent.data); } @@ -44,7 +52,6 @@ export class AppComponent implements AfterViewInit { .data() .find(d => d.get('component') === component); - this.disaggCollection.select(componentData); + this.disaggCollection.select(componentData); } - } diff --git a/example/src/app/app.module.ts b/example/src/app/app.module.ts index 7bcb9e9a51ee440b22d29c6ddec55c5a8484b532..d78405fb248bc26f3bdc6a9d11f557aeedbe6394 100644 --- a/example/src/app/app.module.ts +++ b/example/src/app/app.module.ts @@ -1,12 +1,12 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; +import {NgModule} from '@angular/core'; +import {BrowserModule} from '@angular/platform-browser'; -import { AppComponent } from './app.component'; +import {AppComponent} from './app.component'; @NgModule({ + bootstrap: [AppComponent], declarations: [AppComponent], imports: [BrowserModule], providers: [], - bootstrap: [AppComponent], }) export class AppModule {} diff --git a/example/src/app/app.service.ts b/example/src/app/app.service.ts index 167535a73d2e0905cb8032cf9b132e133ebe8faf..7e5114db29325758170659ecadcd12db68c83988 100644 --- a/example/src/app/app.service.ts +++ b/example/src/app/app.service.ts @@ -1,14 +1,15 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { nshmpHaz } from '@ghsc/nshmp-web-utils'; -import { Observable, throwError } from 'rxjs'; -import { map } from 'rxjs/operators'; +import {HttpClient} from '@angular/common/http'; +import {Injectable} from '@angular/core'; +import {nshmpHaz} from '@ghsc/nshmp-web-utils'; +import {Observable, throwError} from 'rxjs'; +import {map} from 'rxjs/operators'; @Injectable({ providedIn: 'root', }) export class AppService { - url = 'https://earthquake.usgs.gov/nshmp-haz-ws/deagg/E2014B/COUS/-104/39/PGA/760/2475'; + url = + 'https://earthquake.usgs.gov/nshmp-haz-ws/deagg/E2014B/COUS/-104/39/PGA/760/2475'; constructor(private http: HttpClient) {} diff --git a/example/src/main.ts b/example/src/main.ts index d9a2e7e4a582e265db779363bd8b2492c43c141b..947bb036a5016b635f3ddf3a761cd33a3aa3f16b 100644 --- a/example/src/main.ts +++ b/example/src/main.ts @@ -1,8 +1,8 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import {enableProdMode} from '@angular/core'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; +import {AppModule} from './app/app.module'; +import {environment} from './environments/environment'; if (environment.production) { enableProdMode(); @@ -10,4 +10,4 @@ if (environment.production) { platformBrowserDynamic() .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .catch(err => console.error(err)); diff --git a/example/src/test.ts b/example/src/test.ts index cbf2f64dc3b38710b8fe719c5f94951f6d6dd890..13c4986fc40df119b67d21236c03ec624f3c7425 100644 --- a/example/src/test.ts +++ b/example/src/test.ts @@ -2,7 +2,7 @@ import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; +import {getTestBed} from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting, @@ -20,9 +20,13 @@ declare const require: { }; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), { - teardown: { destroyAfterEach: false }, -}); +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), + { + teardown: {destroyAfterEach: false}, + } +); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules.