From 717c68089d4e86d5d1c118e2145f1dc930ba279f Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 11 Oct 2017 21:36:33 +0100 Subject: [PATCH] build(aio): remove unused imports and local variables (#19682) PR Close #19682 --- aio/src/app/documents/document.service.spec.ts | 3 --- aio/src/app/embedded/api/api-list.component.spec.ts | 2 +- aio/src/app/embedded/api/api-list.component.ts | 2 +- aio/src/app/embedded/api/api.service.spec.ts | 2 +- aio/src/app/embedded/code/code.component.ts | 4 +--- .../app/embedded/contributor/contributor.service.spec.ts | 2 +- aio/src/app/embedded/current-location.component.spec.ts | 2 +- .../embedded/live-example/live-example.component.spec.ts | 5 ++--- .../embedded/resource/resource-list.component.spec.ts | 1 - aio/src/app/embedded/resource/resource.service.spec.ts | 2 +- aio/src/app/embedded/toc/toc.component.spec.ts | 2 +- .../app/layout/doc-viewer/doc-viewer.component.spec.ts | 9 +++------ aio/src/app/layout/doc-viewer/doc-viewer.component.ts | 2 +- aio/src/app/layout/nav-item/nav-item.component.spec.ts | 2 +- aio/src/app/layout/top-menu/top-menu.component.spec.ts | 4 ++-- aio/src/app/navigation/navigation.service.ts | 1 - aio/src/app/shared/custom-md-icon-registry.spec.ts | 2 +- aio/src/app/shared/location.service.ts | 1 - aio/src/app/shared/scroll-spy.service.spec.ts | 3 ++- aio/src/app/shared/select/select.component.spec.ts | 2 +- aio/src/app/shared/toc.service.spec.ts | 3 +-- aio/src/app/shared/web-worker.ts | 2 +- aio/src/app/sw-updates/sw-updates.service.ts | 2 +- aio/tsconfig.json | 1 + 24 files changed, 25 insertions(+), 36 deletions(-) diff --git a/aio/src/app/documents/document.service.spec.ts b/aio/src/app/documents/document.service.spec.ts index 8f7116bcc7..1a41282a75 100644 --- a/aio/src/app/documents/document.service.spec.ts +++ b/aio/src/app/documents/document.service.spec.ts @@ -1,10 +1,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { Injector } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { LocationService } from 'app/shared/location.service'; import { MockLocationService } from 'testing/location.service'; diff --git a/aio/src/app/embedded/api/api-list.component.spec.ts b/aio/src/app/embedded/api/api-list.component.spec.ts index c62618c85c..edb86939f9 100644 --- a/aio/src/app/embedded/api/api-list.component.spec.ts +++ b/aio/src/app/embedded/api/api-list.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { ApiListComponent } from './api-list.component'; diff --git a/aio/src/app/embedded/api/api-list.component.ts b/aio/src/app/embedded/api/api-list.component.ts index 1f4a2f7512..b363fc0e0e 100644 --- a/aio/src/app/embedded/api/api-list.component.ts +++ b/aio/src/app/embedded/api/api-list.component.ts @@ -13,7 +13,7 @@ import { ReplaySubject } from 'rxjs/ReplaySubject'; import { combineLatest } from 'rxjs/observable/combineLatest'; import { LocationService } from 'app/shared/location.service'; -import { ApiItem, ApiSection, ApiService } from './api.service'; +import { ApiSection, ApiService } from './api.service'; import { Option } from 'app/shared/select/select.component'; diff --git a/aio/src/app/embedded/api/api.service.spec.ts b/aio/src/app/embedded/api/api.service.spec.ts index a8452c5469..13641a590b 100644 --- a/aio/src/app/embedded/api/api.service.spec.ts +++ b/aio/src/app/embedded/api/api.service.spec.ts @@ -1,6 +1,6 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Injector } from '@angular/core'; -import { TestBed, inject } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { Logger } from 'app/shared/logger.service'; diff --git a/aio/src/app/embedded/code/code.component.ts b/aio/src/app/embedded/code/code.component.ts index ba8953e2b3..e530b2a016 100644 --- a/aio/src/app/embedded/code/code.component.ts +++ b/aio/src/app/embedded/code/code.component.ts @@ -1,11 +1,9 @@ -import { Component, ElementRef, ViewChild, OnChanges, OnDestroy, Input } from '@angular/core'; +import { Component, ElementRef, ViewChild, OnChanges, Input } from '@angular/core'; import { Logger } from 'app/shared/logger.service'; import { PrettyPrinter } from './pretty-printer.service'; import { CopierService } from 'app/shared/copier.service'; import { MdSnackBar } from '@angular/material'; -const originalLabel = 'Copy Code'; -const copiedLabel = 'Copied!'; const defaultLineNumsCount = 10; // by default, show linenums over this number /** diff --git a/aio/src/app/embedded/contributor/contributor.service.spec.ts b/aio/src/app/embedded/contributor/contributor.service.spec.ts index 02b575a812..d44c1cedd4 100644 --- a/aio/src/app/embedded/contributor/contributor.service.spec.ts +++ b/aio/src/app/embedded/contributor/contributor.service.spec.ts @@ -3,7 +3,7 @@ import { Injector } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { ContributorService } from './contributor.service'; -import { Contributor, ContributorGroup } from './contributors.model'; +import { ContributorGroup } from './contributors.model'; describe('ContributorService', () => { diff --git a/aio/src/app/embedded/current-location.component.spec.ts b/aio/src/app/embedded/current-location.component.spec.ts index e6142b4cd6..58dac0445f 100644 --- a/aio/src/app/embedded/current-location.component.spec.ts +++ b/aio/src/app/embedded/current-location.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { LocationService } from 'app/shared/location.service'; import { MockLocationService } from 'testing/location.service'; import { CurrentLocationComponent } from './current-location.component'; diff --git a/aio/src/app/embedded/live-example/live-example.component.spec.ts b/aio/src/app/embedded/live-example/live-example.component.spec.ts index 87a8a4c08b..10028fccc3 100644 --- a/aio/src/app/embedded/live-example/live-example.component.spec.ts +++ b/aio/src/app/embedded/live-example/live-example.component.spec.ts @@ -1,6 +1,6 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { Component, DebugElement, ElementRef } from '@angular/core'; +import { Component, DebugElement } from '@angular/core'; import { Location } from '@angular/common'; import { LiveExampleComponent, EmbeddedPlunkerComponent } from './live-example.component'; @@ -71,7 +71,6 @@ describe('LiveExampleComponent', () => { describe('when not embedded', () => { function getLiveExampleAnchor() { return getAnchors()[0]; } - function getDownloadAnchor() { return getAnchors()[1]; } it('should create LiveExampleComponent', () => { testComponent(() => { diff --git a/aio/src/app/embedded/resource/resource-list.component.spec.ts b/aio/src/app/embedded/resource/resource-list.component.spec.ts index 3f3d7387b1..5042bf2c20 100644 --- a/aio/src/app/embedded/resource/resource-list.component.spec.ts +++ b/aio/src/app/embedded/resource/resource-list.component.spec.ts @@ -1,7 +1,6 @@ import { ReflectiveInjector } from '@angular/core'; import { PlatformLocation } from '@angular/common'; -import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { ResourceListComponent } from './resource-list.component'; diff --git a/aio/src/app/embedded/resource/resource.service.spec.ts b/aio/src/app/embedded/resource/resource.service.spec.ts index e08e2ace26..cba759d62a 100644 --- a/aio/src/app/embedded/resource/resource.service.spec.ts +++ b/aio/src/app/embedded/resource/resource.service.spec.ts @@ -3,7 +3,7 @@ import { Injector } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { ResourceService } from './resource.service'; -import { Category, SubCategory, Resource } from './resource.model'; +import { Category } from './resource.model'; describe('ResourceService', () => { diff --git a/aio/src/app/embedded/toc/toc.component.spec.ts b/aio/src/app/embedded/toc/toc.component.spec.ts index f6a5c36f9a..ed34577bb3 100644 --- a/aio/src/app/embedded/toc/toc.component.spec.ts +++ b/aio/src/app/embedded/toc/toc.component.spec.ts @@ -1,6 +1,6 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { By, DOCUMENT } from '@angular/platform-browser'; +import { By } from '@angular/platform-browser'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { asap } from 'rxjs/scheduler/asap'; diff --git a/aio/src/app/layout/doc-viewer/doc-viewer.component.spec.ts b/aio/src/app/layout/doc-viewer/doc-viewer.component.spec.ts index 8ffcbda681..57484e9474 100644 --- a/aio/src/app/layout/doc-viewer/doc-viewer.component.spec.ts +++ b/aio/src/app/layout/doc-viewer/doc-viewer.component.spec.ts @@ -1,11 +1,8 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { - Component, ComponentFactoryResolver, DebugElement, - ElementRef, Injector, NgModule, OnInit, ViewChild } from '@angular/core'; -import { By } from '@angular/platform-browser'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { Component, DebugElement, ElementRef, NgModule, OnInit, ViewChild } from '@angular/core'; import { DocViewerComponent } from './doc-viewer.component'; import { DocumentContents } from 'app/documents/document.service'; -import { EmbeddedModule, embeddedComponents, EmbeddedComponents } from 'app/embedded/embedded.module'; +import { EmbeddedModule, EmbeddedComponents } from 'app/embedded/embedded.module'; import { Title } from '@angular/platform-browser'; import { TocService } from 'app/shared/toc.service'; diff --git a/aio/src/app/layout/doc-viewer/doc-viewer.component.ts b/aio/src/app/layout/doc-viewer/doc-viewer.component.ts index 50687406a4..1687f8734c 100644 --- a/aio/src/app/layout/doc-viewer/doc-viewer.component.ts +++ b/aio/src/app/layout/doc-viewer/doc-viewer.component.ts @@ -1,7 +1,7 @@ import { Component, ComponentFactory, ComponentFactoryResolver, ComponentRef, DoCheck, ElementRef, EventEmitter, Injector, Input, OnDestroy, - Output, ViewEncapsulation + Output } from '@angular/core'; import { EmbeddedComponents } from 'app/embedded/embedded.module'; diff --git a/aio/src/app/layout/nav-item/nav-item.component.spec.ts b/aio/src/app/layout/nav-item/nav-item.component.spec.ts index 59765fefaf..cc09f429e9 100644 --- a/aio/src/app/layout/nav-item/nav-item.component.spec.ts +++ b/aio/src/app/layout/nav-item/nav-item.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { SimpleChange, SimpleChanges, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NavItemComponent } from './nav-item.component'; import { NavigationNode } from 'app/navigation/navigation.model'; diff --git a/aio/src/app/layout/top-menu/top-menu.component.spec.ts b/aio/src/app/layout/top-menu/top-menu.component.spec.ts index c7734f5a38..a892003fc7 100644 --- a/aio/src/app/layout/top-menu/top-menu.component.spec.ts +++ b/aio/src/app/layout/top-menu/top-menu.component.spec.ts @@ -1,9 +1,9 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { TopMenuComponent } from './top-menu.component'; -import { NavigationService, NavigationViews, NavigationNode } from 'app/navigation/navigation.service'; +import { NavigationService, NavigationViews } from 'app/navigation/navigation.service'; describe('TopMenuComponent', () => { let component: TopMenuComponent; diff --git a/aio/src/app/navigation/navigation.service.ts b/aio/src/app/navigation/navigation.service.ts index eddcbca91c..40dd895c74 100644 --- a/aio/src/app/navigation/navigation.service.ts +++ b/aio/src/app/navigation/navigation.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; -import { AsyncSubject } from 'rxjs/AsyncSubject'; import { combineLatest } from 'rxjs/observable/combineLatest'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/publishLast'; diff --git a/aio/src/app/shared/custom-md-icon-registry.spec.ts b/aio/src/app/shared/custom-md-icon-registry.spec.ts index 30480555bd..d7361d9ec6 100644 --- a/aio/src/app/shared/custom-md-icon-registry.spec.ts +++ b/aio/src/app/shared/custom-md-icon-registry.spec.ts @@ -1,5 +1,5 @@ import { MdIconRegistry } from '@angular/material'; -import { CustomMdIconRegistry, SVG_ICONS, SvgIconInfo } from './custom-md-icon-registry'; +import { CustomMdIconRegistry, SvgIconInfo } from './custom-md-icon-registry'; describe('CustomMdIconRegistry', () => { it('should get the SVG element for a preloaded icon from the cache', () => { diff --git a/aio/src/app/shared/location.service.ts b/aio/src/app/shared/location.service.ts index 52ecacfa5c..456a1c1fc4 100644 --- a/aio/src/app/shared/location.service.ts +++ b/aio/src/app/shared/location.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { Location, PlatformLocation } from '@angular/common'; -import { Observable } from 'rxjs/Observable'; import { ReplaySubject } from 'rxjs/ReplaySubject'; import 'rxjs/add/operator/do'; diff --git a/aio/src/app/shared/scroll-spy.service.spec.ts b/aio/src/app/shared/scroll-spy.service.spec.ts index c08f0d0e52..a7151e3845 100644 --- a/aio/src/app/shared/scroll-spy.service.spec.ts +++ b/aio/src/app/shared/scroll-spy.service.spec.ts @@ -3,7 +3,7 @@ import { fakeAsync, tick } from '@angular/core/testing'; import { DOCUMENT } from '@angular/platform-browser'; import { ScrollService } from 'app/shared/scroll.service'; -import { ScrollItem, ScrollSpiedElement, ScrollSpiedElementGroup, ScrollSpyInfo, ScrollSpyService } from 'app/shared/scroll-spy.service'; +import { ScrollItem, ScrollSpiedElement, ScrollSpiedElementGroup, ScrollSpyService } from 'app/shared/scroll-spy.service'; describe('ScrollSpiedElement', () => { @@ -197,6 +197,7 @@ describe('ScrollSpyService', () => { .and.callFake(() => actions.push('calibrate')); expect(onResizeSpy).not.toHaveBeenCalled(); + expect(calibrateSpy).not.toHaveBeenCalled(); scrollSpyService.spyOn([]); expect(actions).toEqual(['onResize', 'calibrate']); diff --git a/aio/src/app/shared/select/select.component.spec.ts b/aio/src/app/shared/select/select.component.spec.ts index 5efaed1e50..d81abbadcb 100644 --- a/aio/src/app/shared/select/select.component.spec.ts +++ b/aio/src/app/shared/select/select.component.spec.ts @@ -1,5 +1,5 @@ import { Component, DebugElement } from '@angular/core'; -import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { SelectComponent, Option } from './select.component'; diff --git a/aio/src/app/shared/toc.service.spec.ts b/aio/src/app/shared/toc.service.spec.ts index 85ca45480b..7827922868 100644 --- a/aio/src/app/shared/toc.service.spec.ts +++ b/aio/src/app/shared/toc.service.spec.ts @@ -1,4 +1,4 @@ -import { ReflectiveInjector, SecurityContext } from '@angular/core'; +import { ReflectiveInjector } from '@angular/core'; import { DOCUMENT, DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { Subject } from 'rxjs/Subject'; @@ -268,7 +268,6 @@ describe('TocService', () => { }); it('should calculate and set id of heading without an id', () => { - const tocItem = lastTocList.find(item => item.title === 'H2 Two'); const id = headings[2].getAttribute('id'); expect(id).toEqual('h2-two'); }); diff --git a/aio/src/app/shared/web-worker.ts b/aio/src/app/shared/web-worker.ts index b70f993483..b2e23b854d 100644 --- a/aio/src/app/shared/web-worker.ts +++ b/aio/src/app/shared/web-worker.ts @@ -4,7 +4,7 @@ Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at http://angular.io/license */ -import {NgZone, Injectable} from '@angular/core'; +import {NgZone} from '@angular/core'; import {Observable} from 'rxjs/Observable'; export interface WebWorkerMessage { diff --git a/aio/src/app/sw-updates/sw-updates.service.ts b/aio/src/app/sw-updates/sw-updates.service.ts index 1760a87030..0580be2f8d 100644 --- a/aio/src/app/sw-updates/sw-updates.service.ts +++ b/aio/src/app/sw-updates/sw-updates.service.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable, OnDestroy } from '@angular/core'; +import { Injectable, OnDestroy } from '@angular/core'; import { NgServiceWorker } from '@angular/service-worker'; import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; diff --git a/aio/tsconfig.json b/aio/tsconfig.json index 0589978077..b8ce16de73 100644 --- a/aio/tsconfig.json +++ b/aio/tsconfig.json @@ -8,6 +8,7 @@ "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, + "noUnusedLocals": true, "target": "es5", "typeRoots": [ "node_modules/@types"