From 2019050db2d118c385d3b43dea538abb0df1c7a3 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 26 May 2016 15:07:51 -0700 Subject: [PATCH] chore(lint): enable duplicateModuleImport tslint check --- .../common/src/directives/ng_style.ts | 2 +- .../src/animation/animation_parser.ts | 8 +---- .../@angular/compiler/src/compile_metadata.ts | 4 +-- modules/@angular/compiler/src/identifiers.ts | 5 ++- .../compiler/src/metadata_resolver.ts | 33 ++++++++++++------- .../src/view_compiler/property_binder.ts | 3 +- .../testing/test_component_builder.ts | 3 +- .../compiler/testing/view_resolver_mock.ts | 3 +- .../compiler_cli/src/static_reflector.ts | 8 ++--- modules/@angular/core/private_export.ts | 1 + .../animation/animation_sequence_player.ts | 3 +- .../@angular/http/src/backends/xhr_backend.ts | 3 +- modules/@angular/http/src/static_request.ts | 3 +- .../@angular/platform-browser/src/browser.ts | 3 +- .../platform-browser/src/dom/dom_renderer.ts | 4 +-- .../src/web_workers/worker/renderer.ts | 3 +- modules/@angular/router/src/recognize.ts | 3 +- modules/@angular/router/src/router.ts | 6 ++-- .../router/src/router_providers_common.ts | 4 +-- tslint.json | 1 + 20 files changed, 46 insertions(+), 57 deletions(-) diff --git a/modules/@angular/common/src/directives/ng_style.ts b/modules/@angular/common/src/directives/ng_style.ts index 88f1c6f957..e721e3061d 100644 --- a/modules/@angular/common/src/directives/ng_style.ts +++ b/modules/@angular/common/src/directives/ng_style.ts @@ -1,6 +1,6 @@ -import {KeyValueChangeRecord} from '@angular/core'; import { DoCheck, + KeyValueChangeRecord, KeyValueDiffer, KeyValueDiffers, ElementRef, diff --git a/modules/@angular/compiler/src/animation/animation_parser.ts b/modules/@angular/compiler/src/animation/animation_parser.ts index b6f8ffa003..a17600c547 100644 --- a/modules/@angular/compiler/src/animation/animation_parser.ts +++ b/modules/@angular/compiler/src/animation/animation_parser.ts @@ -1,23 +1,18 @@ import {ListWrapper, StringMapWrapper} from '../facade/collection'; import {Math} from '../facade/math'; -import {ANY_STATE, EMPTY_STATE} from '../../core_private'; +import {ANY_STATE, FILL_STYLE_FLAG} from '../../core_private'; import { - IS_DART, RegExpWrapper, isArray, isPresent, isBlank, - isNumber, isString, isStringMap, NumberWrapper } from '../facade/lang'; -import {FILL_STYLE_FLAG} from '../../core_private'; - import { CompileAnimationEntryMetadata, - CompileAnimationStateMetadata, CompileAnimationStateDeclarationMetadata, CompileAnimationStateTransitionMetadata, CompileAnimationMetadata, @@ -32,7 +27,6 @@ import { import { AnimationAst, AnimationEntryAst, - AnimationStateAst, AnimationStateTransitionAst, AnimationStateDeclarationAst, AnimationKeyframeAst, diff --git a/modules/@angular/compiler/src/compile_metadata.ts b/modules/@angular/compiler/src/compile_metadata.ts index 8541d75dec..7b7bff93d3 100644 --- a/modules/@angular/compiler/src/compile_metadata.ts +++ b/modules/@angular/compiler/src/compile_metadata.ts @@ -1,10 +1,10 @@ import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; -import {reflector} from '../core_private'; import { CHANGE_DETECTION_STRATEGY_VALUES, VIEW_ENCAPSULATION_VALUES, LifecycleHooks, - LIFECYCLE_HOOKS_VALUES + LIFECYCLE_HOOKS_VALUES, + reflector } from '../core_private'; import { diff --git a/modules/@angular/compiler/src/identifiers.ts b/modules/@angular/compiler/src/identifiers.ts index bfee5374d0..d656002a71 100644 --- a/modules/@angular/compiler/src/identifiers.ts +++ b/modules/@angular/compiler/src/identifiers.ts @@ -11,7 +11,6 @@ import { ViewEncapsulation, TemplateRef } from '@angular/core'; -import {SecurityContext} from '../core_private'; import { AppElement, AppView, @@ -22,7 +21,6 @@ import { devModeEqual, flattenNestedViewRenderNodes, interpolate, - RenderDebugInfo, StaticNodeDebugInfo, TemplateRef_, uninitialized, @@ -47,7 +45,8 @@ import { NoOpAnimationPlayer as NoOpAnimationPlayer_, AnimationGroupPlayer as AnimationGroupPlayer_, AnimationSequencePlayer as AnimationSequencePlayer_, - AnimationStyleUtil + AnimationStyleUtil, + SecurityContext } from '../core_private'; import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata'; diff --git a/modules/@angular/compiler/src/metadata_resolver.ts b/modules/@angular/compiler/src/metadata_resolver.ts index 4f717d138f..031a6f653c 100644 --- a/modules/@angular/compiler/src/metadata_resolver.ts +++ b/modules/@angular/compiler/src/metadata_resolver.ts @@ -1,4 +1,14 @@ import { + AnimationMetadata, + AnimationEntryMetadata, + AnimationStateMetadata, + AnimationStateDeclarationMetadata, + AnimationStateTransitionMetadata, + AnimationStyleMetadata, + AnimationKeyframesSequenceMetadata, + AnimationAnimateMetadata, + AnimationWithStepsMetadata, + AnimationGroupMetadata, AttributeMetadata, OptionalMetadata, ComponentMetadata, @@ -30,7 +40,6 @@ import { import {StringMapWrapper} from '../src/facade/collection'; import {BaseException} from '../src/facade/exceptions'; import * as cpl from './compile_metadata'; -import * as anmd from '@angular/core'; import {DirectiveResolver} from './directive_resolver'; import {PipeResolver} from './pipe_resolver'; import {ViewResolver} from './view_resolver'; @@ -75,36 +84,36 @@ export class CompileMetadataResolver { return sanitizeIdentifier(identifier); } - getAnimationEntryMetadata(entry: anmd.AnimationEntryMetadata): cpl.CompileAnimationEntryMetadata { + getAnimationEntryMetadata(entry: AnimationEntryMetadata): cpl.CompileAnimationEntryMetadata { var defs = entry.definitions.map(def => this.getAnimationStateMetadata(def)); return new cpl.CompileAnimationEntryMetadata(entry.name, defs); } - getAnimationStateMetadata(value: anmd.AnimationStateMetadata): cpl.CompileAnimationStateMetadata { - if (value instanceof anmd.AnimationStateDeclarationMetadata) { + getAnimationStateMetadata(value: AnimationStateMetadata): cpl.CompileAnimationStateMetadata { + if (value instanceof AnimationStateDeclarationMetadata) { var styles = this.getAnimationStyleMetadata(value.styles); return new cpl.CompileAnimationStateDeclarationMetadata(value.stateNameExpr, styles); - } else if (value instanceof anmd.AnimationStateTransitionMetadata) { + } else if (value instanceof AnimationStateTransitionMetadata) { return new cpl.CompileAnimationStateTransitionMetadata(value.stateChangeExpr, this.getAnimationMetadata(value.animation)); } return null; } - getAnimationStyleMetadata(value: anmd.AnimationStyleMetadata): cpl.CompileAnimationStyleMetadata { + getAnimationStyleMetadata(value: AnimationStyleMetadata): cpl.CompileAnimationStyleMetadata { return new cpl.CompileAnimationStyleMetadata(value.offset, value.styles); } - getAnimationMetadata(value: anmd.AnimationMetadata): cpl.CompileAnimationMetadata { - if (value instanceof anmd.AnimationStyleMetadata) { + getAnimationMetadata(value: AnimationMetadata): cpl.CompileAnimationMetadata { + if (value instanceof AnimationStyleMetadata) { return this.getAnimationStyleMetadata(value); - } else if (value instanceof anmd.AnimationKeyframesSequenceMetadata) { + } else if (value instanceof AnimationKeyframesSequenceMetadata) { return new cpl.CompileAnimationKeyframesSequenceMetadata(value.steps.map(entry => this.getAnimationStyleMetadata(entry))); - } else if (value instanceof anmd.AnimationAnimateMetadata) { + } else if (value instanceof AnimationAnimateMetadata) { let animateData = this.getAnimationMetadata(value.styles); return new cpl.CompileAnimationAnimateMetadata(value.timings, animateData); - } else if (value instanceof anmd.AnimationWithStepsMetadata) { + } else if (value instanceof AnimationWithStepsMetadata) { var steps = value.steps.map(step => this.getAnimationMetadata(step)); - if (value instanceof anmd.AnimationGroupMetadata) { + if (value instanceof AnimationGroupMetadata) { return new cpl.CompileAnimationGroupMetadata(steps); } else { return new cpl.CompileAnimationSequenceMetadata(steps); diff --git a/modules/@angular/compiler/src/view_compiler/property_binder.ts b/modules/@angular/compiler/src/view_compiler/property_binder.ts index e4ca96bfb7..88f1800239 100644 --- a/modules/@angular/compiler/src/view_compiler/property_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/property_binder.ts @@ -1,5 +1,4 @@ -import {SecurityContext} from '../../core_private'; -import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../../core_private'; +import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy, SecurityContext} from '../../core_private'; import {isBlank, isPresent} from '../../src/facade/lang'; diff --git a/modules/@angular/compiler/testing/test_component_builder.ts b/modules/@angular/compiler/testing/test_component_builder.ts index 9db17088f0..543bda9794 100644 --- a/modules/@angular/compiler/testing/test_component_builder.ts +++ b/modules/@angular/compiler/testing/test_component_builder.ts @@ -1,4 +1,5 @@ import { + AnimationEntryMetadata, OpaqueToken, ComponentRef, ComponentFactory, @@ -28,8 +29,6 @@ export class TestComponentRenderer { insertRootElement(rootElementId: string) {} } -import {AnimationEntryMetadata} from '@angular/core'; - export var ComponentFixtureAutoDetect = new OpaqueToken("ComponentFixtureAutoDetect"); export var ComponentFixtureNoNgZone = new OpaqueToken("ComponentFixtureNoNgZone"); diff --git a/modules/@angular/compiler/testing/view_resolver_mock.ts b/modules/@angular/compiler/testing/view_resolver_mock.ts index 04a91ae2be..3829450b12 100644 --- a/modules/@angular/compiler/testing/view_resolver_mock.ts +++ b/modules/@angular/compiler/testing/view_resolver_mock.ts @@ -1,8 +1,7 @@ -import {Injectable, ViewMetadata, Type, BaseException} from '@angular/core'; +import {Injectable, ViewMetadata, Type, BaseException, AnimationEntryMetadata, resolveForwardRef} from '@angular/core'; import {ViewResolver} from '../index'; import {Map} from '../src/facade/collection'; import {isPresent, stringify, isBlank, isArray} from '../src/facade/lang'; -import {AnimationEntryMetadata, resolveForwardRef} from '@angular/core'; @Injectable() export class MockViewResolver extends ViewResolver { diff --git a/modules/@angular/compiler_cli/src/static_reflector.ts b/modules/@angular/compiler_cli/src/static_reflector.ts index 80f2ac8bda..114ee8e835 100644 --- a/modules/@angular/compiler_cli/src/static_reflector.ts +++ b/modules/@angular/compiler_cli/src/static_reflector.ts @@ -13,10 +13,7 @@ import { ViewChildrenMetadata, ViewQueryMetadata, QueryMetadata, -} from '@angular/core'; -import {ReflectorReader} from './core_private'; -import {Provider} from '@angular/core'; -import { + Provider, HostMetadata, OptionalMetadata, InjectableMetadata, @@ -24,6 +21,7 @@ import { SkipSelfMetadata, InjectMetadata, } from "@angular/core"; +import {ReflectorReader} from "./core_private"; /** * The host of the static resolver is expected to be able to provide module metadata in the form of @@ -407,4 +405,4 @@ function mapStringMap(input: {[key: string]: any}, function isPrimitive(o: any): boolean { return o === null || (typeof o !== "function" && typeof o !== "object"); -} \ No newline at end of file +} diff --git a/modules/@angular/core/private_export.ts b/modules/@angular/core/private_export.ts index 6d8ea5d1bf..ae09b621f3 100644 --- a/modules/@angular/core/private_export.ts +++ b/modules/@angular/core/private_export.ts @@ -21,6 +21,7 @@ import * as provider_util from './src/di/provider_util'; import * as console from './src/console'; import {Provider} from './index'; import * as reflection from './src/reflection/reflection'; +// tslint:disable-next-line import {Reflector} from './src/reflection/reflection'; import { diff --git a/modules/@angular/core/src/animation/animation_sequence_player.ts b/modules/@angular/core/src/animation/animation_sequence_player.ts index d09cee9449..94f4c25a15 100644 --- a/modules/@angular/core/src/animation/animation_sequence_player.ts +++ b/modules/@angular/core/src/animation/animation_sequence_player.ts @@ -1,6 +1,5 @@ -import {isPresent} from '../facade/lang'; +import {isPresent, scheduleMicroTask} from '../facade/lang'; import {NoOpAnimationPlayer, AnimationPlayer} from './animation_player'; -import {scheduleMicroTask} from '../facade/lang'; export class AnimationSequencePlayer implements AnimationPlayer { private _currentIndex: number = 0; diff --git a/modules/@angular/http/src/backends/xhr_backend.ts b/modules/@angular/http/src/backends/xhr_backend.ts index a32df75604..8a997f51a7 100644 --- a/modules/@angular/http/src/backends/xhr_backend.ts +++ b/modules/@angular/http/src/backends/xhr_backend.ts @@ -1,5 +1,5 @@ import {ConnectionBackend, Connection} from '../interfaces'; -import {ReadyState, RequestMethod, ResponseType} from '../enums'; +import {ReadyState, RequestMethod, ResponseType, ContentType} from '../enums'; import {Request} from '../static_request'; import {Response} from '../static_response'; import {Headers} from '../headers'; @@ -10,7 +10,6 @@ import {isPresent, isString} from '../../src/facade/lang'; import {Observable} from 'rxjs/Observable'; import {Observer} from 'rxjs/Observer'; import {isSuccess, getResponseURL} from '../http_utils'; -import {ContentType} from '../enums'; const XSSI_PREFIX = ')]}\',\n'; diff --git a/modules/@angular/http/src/static_request.ts b/modules/@angular/http/src/static_request.ts index 4fbd8cf4b8..4dd768086e 100644 --- a/modules/@angular/http/src/static_request.ts +++ b/modules/@angular/http/src/static_request.ts @@ -1,7 +1,6 @@ -import {RequestMethod} from './enums'; +import {ContentType, RequestMethod} from './enums'; import {RequestArgs} from './interfaces'; import {Headers} from './headers'; -import {ContentType} from './enums'; import {URLSearchParams} from './url_search_params'; import {normalizeMethodName} from './http_utils'; import {isPresent, StringWrapper} from '../src/facade/lang'; diff --git a/modules/@angular/platform-browser/src/browser.ts b/modules/@angular/platform-browser/src/browser.ts index 4110d768ca..cd03d7209f 100644 --- a/modules/@angular/platform-browser/src/browser.ts +++ b/modules/@angular/platform-browser/src/browser.ts @@ -18,7 +18,7 @@ import { ComponentRef } from "@angular/core"; import {isBlank, isPresent} from "./facade/lang"; -import {wtfInit, SanitizationService, ReflectionCapabilities, AnimationDriver, NoOpAnimationDriver} from '../core_private'; +import {reflector, wtfInit, SanitizationService, ReflectionCapabilities, AnimationDriver, NoOpAnimationDriver} from '../core_private'; import {WebAnimationsDriver} from '../src/dom/web_animations_driver'; import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS, PlatformLocation} from "@angular/common"; import {DomSanitizationService, DomSanitizationServiceImpl} from "./security/dom_sanitization_service"; @@ -37,7 +37,6 @@ import {BrowserPlatformLocation} from "./browser/location/browser_platform_locat import {COMPILER_PROVIDERS, XHR} from "@angular/compiler"; import {CachedXHR} from "./xhr/xhr_cache"; import {XHRImpl} from "./xhr/xhr_impl"; -import {reflector} from '../core_private'; export const CACHED_TEMPLATE_PROVIDER: Array = [{provide: XHR, useClass: CachedXHR}]; diff --git a/modules/@angular/platform-browser/src/dom/dom_renderer.ts b/modules/@angular/platform-browser/src/dom/dom_renderer.ts index 0e23057e32..3fa9298f3b 100644 --- a/modules/@angular/platform-browser/src/dom/dom_renderer.ts +++ b/modules/@angular/platform-browser/src/dom/dom_renderer.ts @@ -7,7 +7,6 @@ import { RenderComponentType, ViewEncapsulation } from '@angular/core'; -import {RenderDebugInfo} from '../../core_private'; import { isPresent, isBlank, @@ -28,7 +27,8 @@ import { AnimationKeyframe, AnimationStyles, AnimationPlayer, - AnimationDriver + AnimationDriver, + RenderDebugInfo, } from '../../core_private'; import {EventManager} from './events/event_manager'; diff --git a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts index 36eed29b11..073bccd5b3 100644 --- a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts +++ b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts @@ -5,7 +5,6 @@ import { Injectable, ViewEncapsulation } from '@angular/core'; -import {RenderDebugInfo} from '../../../core_private'; import {ClientMessageBrokerFactory, FnArg, UiArguments} from '../shared/client_message_broker'; import {isPresent, isBlank} from '../../../src/facade/lang'; @@ -17,7 +16,7 @@ import {MessageBus} from '../shared/message_bus'; import {ObservableWrapper} from '../../../src/facade/async'; import {deserializeGenericEvent} from './event_deserializer'; -import {AnimationKeyframe, AnimationPlayer, AnimationStyles} from '../../../core_private'; +import {AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo} from '../../../core_private'; @Injectable() export class WebWorkerRootRenderer implements RootRenderer { diff --git a/modules/@angular/router/src/recognize.ts b/modules/@angular/router/src/recognize.ts index a9586280b6..5ca4437a89 100644 --- a/modules/@angular/router/src/recognize.ts +++ b/modules/@angular/router/src/recognize.ts @@ -12,8 +12,7 @@ import {RoutesMetadata, RouteMetadata} from './metadata/metadata'; import {Type, isBlank, isPresent, stringify} from './facade/lang'; import {ListWrapper, StringMapWrapper} from './facade/collection'; import {PromiseWrapper} from './facade/promise'; -import {BaseException, ComponentFactory} from '@angular/core'; -import {ComponentResolver} from '@angular/core'; +import {BaseException, ComponentFactory, ComponentResolver} from '@angular/core'; import {DEFAULT_OUTLET_NAME} from './constants'; import {reflector} from './core_private'; diff --git a/modules/@angular/router/src/router.ts b/modules/@angular/router/src/router.ts index a4984b5653..a8b5b82867 100644 --- a/modules/@angular/router/src/router.ts +++ b/modules/@angular/router/src/router.ts @@ -1,10 +1,8 @@ -import {OnInit, provide, ReflectiveInjector, ComponentResolver} from '@angular/core'; +import {BaseException, provide, ReflectiveInjector, ComponentResolver} from '@angular/core'; import {RouterOutlet} from './directives/router_outlet'; import {Type, isBlank, isPresent} from './facade/lang'; -import {ListWrapper} from './facade/collection'; +import {ListWrapper, StringMapWrapper} from './facade/collection'; import {EventEmitter, Observable, PromiseWrapper, ObservableWrapper} from './facade/async'; -import {StringMapWrapper} from './facade/collection'; -import {BaseException} from '@angular/core'; import {RouterUrlSerializer} from './router_url_serializer'; import {CanDeactivate} from './interfaces'; import {recognize} from './recognize'; diff --git a/modules/@angular/router/src/router_providers_common.ts b/modules/@angular/router/src/router_providers_common.ts index 410acde528..d9800686b3 100644 --- a/modules/@angular/router/src/router_providers_common.ts +++ b/modules/@angular/router/src/router_providers_common.ts @@ -1,10 +1,8 @@ -import {ComponentResolver} from '@angular/core'; +import {ApplicationRef, BaseException, ComponentResolver} from '@angular/core'; import {LocationStrategy, PathLocationStrategy, Location} from '@angular/common'; import {Router, RouterOutletMap} from './router'; import {RouteSegment} from './segments'; import {RouterUrlSerializer, DefaultRouterUrlSerializer} from './router_url_serializer'; -import {ApplicationRef} from '@angular/core'; -import {BaseException} from '@angular/core'; /** * The Platform agnostic ROUTER PROVIDERS diff --git a/tslint.json b/tslint.json index f60d014a2f..481bf43a40 100644 --- a/tslint.json +++ b/tslint.json @@ -1,5 +1,6 @@ { "rules": { + "duplicateModuleImport": true, "semicolon": true, "variable-name": false }