From 6bb0a40087b06b2c1890c1828f7416160260397a Mon Sep 17 00:00:00 2001 From: Oleg Pimenov Date: Fri, 5 Oct 2018 05:26:29 +0300 Subject: [PATCH] chore: tslint fixes --- src/cdk/a11y/a11y-module.ts | 11 +- .../aria-describer/aria-describer.spec.ts | 8 +- .../a11y/focus-monitor/focus-monitor.spec.ts | 9 +- src/cdk/bidi/directionality.spec.ts | 2 +- src/cdk/coercion/array.spec.ts | 2 +- src/cdk/coercion/boolean-property.spec.ts | 2 +- src/cdk/coercion/css-pixel-value.spec.ts | 2 +- src/cdk/coercion/number-property.spec.ts | 5 +- src/cdk/collections/array-data-source.ts | 1 + src/cdk/collections/collection-viewer.ts | 1 + src/cdk/collections/selection.spec.ts | 2 + .../unique-selection-dispatcher.spec.ts | 2 +- src/cdk/layout/breakpoints-observer.ts | 6 +- src/cdk/layout/layout-module.ts | 2 +- src/cdk/portal/portal.spec.ts | 12 +- src/cdk/scrolling/scroll-dispatcher.ts | 14 +- src/cdk/scrolling/scrollable.ts | 6 +- src/cdk/scrolling/scrolling-module.ts | 6 +- src/cdk/scrolling/viewport-ruler.spec.ts | 8 +- src/cdk/testing/dispatch-events.ts | 1 + src/cdk/testing/event-objects.ts | 103 ++++---- src/cdk/testing/mock-ng-zone.ts | 30 +-- .../tree/control/nested-tree-control.spec.ts | 234 +++++++++--------- .../core/common-behaviors/common-module.ts | 1 + src/lib/core/common-behaviors/disabled.ts | 1 + src/lib/core/common-behaviors/error-state.ts | 4 +- src/lib/core/option/option.ts | 1 + .../services/measure-scrollbar.service.ts | 1 + src/lib/divider/divider.spec.ts | 8 +- src/lib/layout/layout.component.ts | 2 +- src/lib/layout/sidebar.component.ts | 2 +- src/lib/navbar/navbar.component.ts | 2 +- src/mosaic-examples/mosaic-module.ts | 2 +- tools/gulp/tasks/changelog.ts | 9 +- tools/gulp/tasks/example-module.ts | 29 ++- tools/gulp/tasks/payload.ts | 48 ++-- tools/gulp/tasks/validate-licenses.ts | 2 +- tools/packages/build-bundles.ts | 3 +- tools/packages/metadata-reexport.ts | 3 +- tools/packages/rollup-remove-licenses.ts | 2 + 40 files changed, 312 insertions(+), 277 deletions(-) diff --git a/src/cdk/a11y/a11y-module.ts b/src/cdk/a11y/a11y-module.ts index 3ebae4e4c..797e0329d 100644 --- a/src/cdk/a11y/a11y-module.ts +++ b/src/cdk/a11y/a11y-module.ts @@ -1,8 +1,9 @@ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {CdkMonitorFocus, FOCUS_MONITOR_PROVIDER} from './focus-monitor/focus-monitor'; -import {PlatformModule} from '@ptsecurity/cdk/platform'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { PlatformModule } from '@ptsecurity/cdk/platform'; + +import { CdkMonitorFocus, FOCUS_MONITOR_PROVIDER } from './focus-monitor/focus-monitor'; @NgModule({ @@ -10,7 +11,7 @@ import {PlatformModule} from '@ptsecurity/cdk/platform'; declarations: [CdkMonitorFocus], exports: [CdkMonitorFocus], providers: [ - FOCUS_MONITOR_PROVIDER, + FOCUS_MONITOR_PROVIDER ] }) export class A11yModule {} diff --git a/src/cdk/a11y/aria-describer/aria-describer.spec.ts b/src/cdk/a11y/aria-describer/aria-describer.spec.ts index 60d1a6da6..dd86a16d2 100644 --- a/src/cdk/a11y/aria-describer/aria-describer.spec.ts +++ b/src/cdk/a11y/aria-describer/aria-describer.spec.ts @@ -1,9 +1,9 @@ -import {Component, ElementRef, ViewChild} from '@angular/core'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; +import { Component, ElementRef, ViewChild } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import {A11yModule, CDK_DESCRIBEDBY_HOST_ATTRIBUTE} from '../index'; +import { A11yModule, CDK_DESCRIBEDBY_HOST_ATTRIBUTE } from '../index'; -import {AriaDescriber, MESSAGES_CONTAINER_ID} from './aria-describer'; +import { AriaDescriber, MESSAGES_CONTAINER_ID } from './aria-describer'; describe('AriaDescriber', () => { diff --git a/src/cdk/a11y/focus-monitor/focus-monitor.spec.ts b/src/cdk/a11y/focus-monitor/focus-monitor.spec.ts index a3b6ae17b..921f3dce8 100644 --- a/src/cdk/a11y/focus-monitor/focus-monitor.spec.ts +++ b/src/cdk/a11y/focus-monitor/focus-monitor.spec.ts @@ -14,7 +14,8 @@ import { A11yModule } from '../index'; import { FocusMonitor, FocusOrigin, TOUCH_BUFFER_MS } from './focus-monitor'; -/* tslint:disable:no-magic-numbers */ +// tslint:disable:no-magic-numbers +// tslint:disable no-unbound-method describe('FocusMonitor', () => { let fixture: ComponentFixture; let buttonElement: HTMLElement; @@ -226,7 +227,7 @@ describe('cdkMonitorFocus', () => { ButtonWithFocusClasses, ComplexComponentWithMonitorElementFocus, ComplexComponentWithMonitorSubtreeFocus, - ComplexComponentWithMonitorSubtreeFocusAndMonitorElementFocus, + ComplexComponentWithMonitorSubtreeFocusAndMonitorElementFocus ] }).compileComponents(); }); @@ -474,8 +475,8 @@ class PlainButton { ` }) class ButtonWithFocusClasses { - focusChanged(_origin: FocusOrigin) { - } + // tslint:disable-next-line + focusChanged(_origin: FocusOrigin) {} } diff --git a/src/cdk/bidi/directionality.spec.ts b/src/cdk/bidi/directionality.spec.ts index bd654b490..2f57251f8 100644 --- a/src/cdk/bidi/directionality.spec.ts +++ b/src/cdk/bidi/directionality.spec.ts @@ -14,7 +14,7 @@ describe('Directionality', () => { TestBed.configureTestingModule({ imports: [BidiModule], declarations: [ElementWithDir, InjectsDirectionality], - providers: [{ provide: DIR_DOCUMENT, useFactory: () => fakeDocument }], + providers: [{ provide: DIR_DOCUMENT, useFactory: () => fakeDocument }] }).compileComponents(); })); diff --git a/src/cdk/coercion/array.spec.ts b/src/cdk/coercion/array.spec.ts index 28eeeac8e..453f4eda3 100644 --- a/src/cdk/coercion/array.spec.ts +++ b/src/cdk/coercion/array.spec.ts @@ -1,4 +1,4 @@ -import {coerceArray} from './array'; +import { coerceArray } from './array'; describe('coerceArray', () => { diff --git a/src/cdk/coercion/boolean-property.spec.ts b/src/cdk/coercion/boolean-property.spec.ts index 26ddf7c70..64b3fa606 100644 --- a/src/cdk/coercion/boolean-property.spec.ts +++ b/src/cdk/coercion/boolean-property.spec.ts @@ -1,4 +1,4 @@ -import {coerceBooleanProperty} from './boolean-property'; +import { coerceBooleanProperty } from './boolean-property'; describe('coerceBooleanProperty', () => { diff --git a/src/cdk/coercion/css-pixel-value.spec.ts b/src/cdk/coercion/css-pixel-value.spec.ts index 2d4c3e37a..2b2c17f63 100644 --- a/src/cdk/coercion/css-pixel-value.spec.ts +++ b/src/cdk/coercion/css-pixel-value.spec.ts @@ -1,4 +1,4 @@ -import {coerceCssPixelValue} from './css-pixel-value'; +import { coerceCssPixelValue } from './css-pixel-value'; describe('coerceCssPixelValue', () => { diff --git a/src/cdk/coercion/number-property.spec.ts b/src/cdk/coercion/number-property.spec.ts index 31639266f..51c44977c 100644 --- a/src/cdk/coercion/number-property.spec.ts +++ b/src/cdk/coercion/number-property.spec.ts @@ -1,6 +1,7 @@ -import {coerceNumberProperty} from './number-property'; -//tslint:disable +import { coerceNumberProperty } from './number-property'; + +//tslint:disable describe('coerceNumberProperty', () => { it('should coerce undefined to 0 or default', () => { diff --git a/src/cdk/collections/array-data-source.ts b/src/cdk/collections/array-data-source.ts index 30a3f9daf..5a3bc7d44 100644 --- a/src/cdk/collections/array-data-source.ts +++ b/src/cdk/collections/array-data-source.ts @@ -13,5 +13,6 @@ export class ArrayDataSource extends DataSource { return this._data instanceof Observable ? this._data : observableOf(this._data); } + // tslint:disable-next-line disconnect() {} } diff --git a/src/cdk/collections/collection-viewer.ts b/src/cdk/collections/collection-viewer.ts index ef38ff2fd..664339f66 100644 --- a/src/cdk/collections/collection-viewer.ts +++ b/src/cdk/collections/collection-viewer.ts @@ -2,6 +2,7 @@ import { Observable } from 'rxjs'; /** Represents a range of numbers with a specified start and end. */ +// tslint:disable-next-line export type ListRange = { start: number, end: number }; diff --git a/src/cdk/collections/selection.spec.ts b/src/cdk/collections/selection.spec.ts index eba536ea8..69e296f50 100644 --- a/src/cdk/collections/selection.spec.ts +++ b/src/cdk/collections/selection.spec.ts @@ -1,6 +1,8 @@ import { getMultipleValuesInSingleSelectionError, SelectionModel } from './selection'; +// tslint:disable:no-magic-numbers +// tslint:disable no-unbound-method describe('SelectionModel', () => { describe('single selection', () => { let model: SelectionModel; diff --git a/src/cdk/collections/unique-selection-dispatcher.spec.ts b/src/cdk/collections/unique-selection-dispatcher.spec.ts index 83020350c..e45bd2dd9 100644 --- a/src/cdk/collections/unique-selection-dispatcher.spec.ts +++ b/src/cdk/collections/unique-selection-dispatcher.spec.ts @@ -1,4 +1,4 @@ -import {UniqueSelectionDispatcher} from './unique-selection-dispatcher'; +import { UniqueSelectionDispatcher } from './unique-selection-dispatcher'; describe('Unique selection dispatcher', () => { diff --git a/src/cdk/layout/breakpoints-observer.ts b/src/cdk/layout/breakpoints-observer.ts index 2046521f5..dcdb0efbd 100644 --- a/src/cdk/layout/breakpoints-observer.ts +++ b/src/cdk/layout/breakpoints-observer.ts @@ -1,7 +1,7 @@ import { Injectable, NgZone, OnDestroy } from '@angular/core'; import { coerceArray } from '@ptsecurity/cdk/coercion'; -import {asapScheduler, combineLatest, fromEventPattern, Observable, Subject} from 'rxjs'; -import {debounceTime, map, startWith, takeUntil} from 'rxjs/operators'; +import { asapScheduler, combineLatest, fromEventPattern, Observable, Subject } from 'rxjs'; +import { debounceTime, map, startWith, takeUntil } from 'rxjs/operators'; import { MediaMatcher } from './media-matcher'; @@ -76,7 +76,7 @@ export class BreakpointObserver implements OnDestroy { map((breakpointStates: InternalBreakpointState[]) => { const response: IBreakpointState = { matches: false, - breakpoints: {}, + breakpoints: {} }; breakpointStates.forEach((state: InternalBreakpointState) => { diff --git a/src/cdk/layout/layout-module.ts b/src/cdk/layout/layout-module.ts index bf012f128..19755eda3 100644 --- a/src/cdk/layout/layout-module.ts +++ b/src/cdk/layout/layout-module.ts @@ -1,5 +1,5 @@ -import {NgModule} from '@angular/core'; +import { NgModule } from '@angular/core'; @NgModule() diff --git a/src/cdk/portal/portal.spec.ts b/src/cdk/portal/portal.spec.ts index b2608a68c..24e336e54 100644 --- a/src/cdk/portal/portal.spec.ts +++ b/src/cdk/portal/portal.spec.ts @@ -1,4 +1,4 @@ -import {CommonModule} from '@angular/common'; +import { CommonModule } from '@angular/common'; import { NgModule, Component, @@ -13,11 +13,11 @@ import { TemplateRef, ComponentRef } from '@angular/core'; -import {inject, ComponentFixture, TestBed} from '@angular/core/testing'; +import { inject, ComponentFixture, TestBed } from '@angular/core/testing'; -import {DomPortalOutlet} from './dom-portal-outlet'; -import {Portal, ComponentPortal, TemplatePortal} from './portal'; -import {CdkPortal, CdkPortalOutlet, PortalModule} from './portal-directives'; +import { DomPortalOutlet } from './dom-portal-outlet'; +import { Portal, ComponentPortal, TemplatePortal } from './portal'; +import { CdkPortal, CdkPortalOutlet, PortalModule } from './portal-directives'; describe('Portals', () => { @@ -533,7 +533,7 @@ class PortalTestApp { @ViewChild(CdkPortalOutlet) portalOutlet: CdkPortalOutlet; @ViewChild('templateRef', { read: TemplateRef }) templateRef: TemplateRef; - selectedPortal: Portal|undefined; + selectedPortal: Portal | undefined; fruit: string = 'Banana'; fruits = ['Apple', 'Pineapple', 'Durian']; attachedSpy = jasmine.createSpy('attached spy'); diff --git a/src/cdk/scrolling/scroll-dispatcher.ts b/src/cdk/scrolling/scroll-dispatcher.ts index 8aeeb8510..99fae04d1 100644 --- a/src/cdk/scrolling/scroll-dispatcher.ts +++ b/src/cdk/scrolling/scroll-dispatcher.ts @@ -4,11 +4,11 @@ import { NgZone, OnDestroy } from '@angular/core'; -import {Platform} from '@ptsecurity/cdk/platform'; -import {fromEvent, of as observableOf, Subject, Subscription, Observable} from 'rxjs'; -import {auditTime, filter} from 'rxjs/operators'; +import { Platform } from '@ptsecurity/cdk/platform'; +import { fromEvent, of as observableOf, Subject, Subscription, Observable } from 'rxjs'; +import { auditTime, filter } from 'rxjs/operators'; -import {CdkScrollable} from './scrollable'; +import { CdkScrollable } from './scrollable'; /** Time in ms to throttle the scrolling events by default. */ @@ -31,7 +31,7 @@ export class ScrollDispatcher implements OnDestroy { _globalSubscription: Subscription | null = null; /** Subject for notifying that a registered scrollable reference element has been scrolled. */ - private _scrolled = new Subject(); + private _scrolled = new Subject(); /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */ private _scrolledCount = 0; @@ -73,7 +73,7 @@ export class ScrollDispatcher implements OnDestroy { * If you need to update any data bindings as a result of a scroll event, you have * to run the callback using `NgZone.run`. */ - scrolled(auditTimeInMs: number = DEFAULT_SCROLL_TIME): Observable { + scrolled(auditTimeInMs: number = DEFAULT_SCROLL_TIME): Observable { return this._platform.isBrowser ? Observable.create((observer) => { if (!this._globalSubscription) { this._addGlobalListener(); @@ -110,7 +110,7 @@ export class ScrollDispatcher implements OnDestroy { * @param elementRef Element whose ancestors to listen for. * @param auditTimeInMs Time to throttle the scroll events. */ - ancestorScrolled(elementRef: ElementRef, auditTimeInMs?: number): Observable { + ancestorScrolled(elementRef: ElementRef, auditTimeInMs?: number): Observable { const ancestors = this.getAncestorScrollContainers(elementRef); return this.scrolled(auditTimeInMs).pipe(filter((target: any) => { diff --git a/src/cdk/scrolling/scrollable.ts b/src/cdk/scrolling/scrollable.ts index 98d2c612e..60f9810db 100644 --- a/src/cdk/scrolling/scrollable.ts +++ b/src/cdk/scrolling/scrollable.ts @@ -1,7 +1,7 @@ -import {Directive, ElementRef, OnInit, OnDestroy, NgZone} from '@angular/core'; -import {Observable, Subject} from 'rxjs'; +import { Directive, ElementRef, OnInit, OnDestroy, NgZone } from '@angular/core'; +import { Observable, Subject } from 'rxjs'; -import {ScrollDispatcher} from './scroll-dispatcher'; +import { ScrollDispatcher } from './scroll-dispatcher'; /** diff --git a/src/cdk/scrolling/scrolling-module.ts b/src/cdk/scrolling/scrolling-module.ts index 0a89916a2..423978f3c 100644 --- a/src/cdk/scrolling/scrolling-module.ts +++ b/src/cdk/scrolling/scrolling-module.ts @@ -1,7 +1,7 @@ -import {NgModule} from '@angular/core'; -import {PlatformModule} from '@ptsecurity/cdk/platform'; +import { NgModule } from '@angular/core'; +import { PlatformModule } from '@ptsecurity/cdk/platform'; -import {CdkScrollable} from './scrollable'; +import { CdkScrollable } from './scrollable'; @NgModule({ diff --git a/src/cdk/scrolling/viewport-ruler.spec.ts b/src/cdk/scrolling/viewport-ruler.spec.ts index 878a276d9..6dcc5786f 100644 --- a/src/cdk/scrolling/viewport-ruler.spec.ts +++ b/src/cdk/scrolling/viewport-ruler.spec.ts @@ -1,8 +1,8 @@ -import {TestBed, inject, fakeAsync, tick} from '@angular/core/testing'; -import {dispatchFakeEvent} from '@ptsecurity/cdk/testing'; +import { TestBed, inject, fakeAsync, tick } from '@angular/core/testing'; +import { dispatchFakeEvent } from '@ptsecurity/cdk/testing'; -import {ScrollDispatchModule} from './public-api'; -import {ViewportRuler} from './viewport-ruler'; +import { ScrollDispatchModule } from './public-api'; +import { ViewportRuler } from './viewport-ruler'; // For all tests, we assume the browser window is 1024x786 (outerWidth x outerHeight). diff --git a/src/cdk/testing/dispatch-events.ts b/src/cdk/testing/dispatch-events.ts index 34e47c86f..ebecde019 100644 --- a/src/cdk/testing/dispatch-events.ts +++ b/src/cdk/testing/dispatch-events.ts @@ -25,6 +25,7 @@ export function dispatchKeyboardEvent(node: Node, type: string, keyCode: number, } /** Shorthand to dispatch a mouse event on the specified coordinates. */ +// tslint:disable-next-line export function dispatchMouseEvent(node: Node, type: string, x = 0, y = 0, event = createMouseEvent(type, x, y)): MouseEvent { return dispatchEvent(node, event) as MouseEvent; diff --git a/src/cdk/testing/event-objects.ts b/src/cdk/testing/event-objects.ts index ee4c8e7a7..108ebe67f 100644 --- a/src/cdk/testing/event-objects.ts +++ b/src/cdk/testing/event-objects.ts @@ -1,76 +1,79 @@ - /** Creates a browser MouseEvent with the specified options. */ +// tslint:disable-next-line export function createMouseEvent(type: string, x = 0, y = 0) { - const event = document.createEvent('MouseEvent'); + const event = document.createEvent('MouseEvent'); - event.initMouseEvent(type, - false, /* canBubble */ - false, /* cancelable */ - window, /* view */ - 0, /* detail */ - x, /* screenX */ - y, /* screenY */ - x, /* clientX */ - y, /* clientY */ - false, /* ctrlKey */ - false, /* altKey */ - false, /* shiftKey */ - false, /* metaKey */ - 0, /* button */ - null /* relatedTarget */); + event.initMouseEvent(type, + false, /* canBubble */ + false, /* cancelable */ + window, /* view */ + 0, /* detail */ + x, /* screenX */ + y, /* screenY */ + x, /* clientX */ + y, /* clientY */ + false, /* ctrlKey */ + false, /* altKey */ + false, /* shiftKey */ + false, /* metaKey */ + 0, /* button */ + null /* relatedTarget */); - return event; + return event; } /** Creates a browser TouchEvent with the specified pointer coordinates. */ +// tslint:disable-next-line export function createTouchEvent(type: string, pageX = 0, pageY = 0) { - // In favor of creating events that work for most of the browsers, the event is created - // as a basic UI Event. The necessary details for the event will be set manually. - const event = document.createEvent('UIEvent'); - const touchDetails = {pageX, pageY}; + // In favor of creating events that work for most of the browsers, the event is created + // as a basic UI Event. The necessary details for the event will be set manually. + const event = document.createEvent('UIEvent'); + const touchDetails = {pageX, pageY}; - event.initUIEvent(type, true, true, window, 0); + event.initUIEvent(type, true, true, window, 0); - // Most of the browsers don't have a "initTouchEvent" method that can be used to define - // the touch details. - Object.defineProperties(event, { - touches: {value: [touchDetails]} - }); + // Most of the browsers don't have a "initTouchEvent" method that can be used to define + // the touch details. + Object.defineProperties(event, { + touches: {value: [touchDetails]} + }); - return event; + return event; } /** Dispatches a keydown event from an element. */ +// tslint:disable-next-line export function createKeyboardEvent(type: string, keyCode: number, target?: Element, key?: string) { - let event = document.createEvent('KeyboardEvent') as any; - // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`. - let initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event); - let originalPreventDefault = event.preventDefault; + const event = document.createEvent('KeyboardEvent') as any; + // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`. + const initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event); + const originalPreventDefault = event.preventDefault; - initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode); + initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode); - // Webkit Browsers don't set the keyCode when calling the init function. - // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735 - Object.defineProperties(event, { - keyCode: { get: () => keyCode }, - key: { get: () => key }, - target: { get: () => target } - }); + // Webkit Browsers don't set the keyCode when calling the init function. + // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735 + Object.defineProperties(event, { + keyCode: {get: () => keyCode}, + key: {get: () => key}, + target: {get: () => target} + }); - // IE won't set `defaultPrevented` on synthetic events so we need to do it manually. - event.preventDefault = function() { - Object.defineProperty(event, 'defaultPrevented', { get: () => true }); + // IE won't set `defaultPrevented` on synthetic events so we need to do it manually. + event.preventDefault = function() { + Object.defineProperty(event, 'defaultPrevented', {get: () => true}); - return originalPreventDefault.apply(this, arguments); - }; + return originalPreventDefault.apply(this, arguments); + }; - return event; + return event; } /** Creates a fake event object with any desired event type. */ +// tslint:disable-next-line export function createFakeEvent(type: string, canBubble = false, cancelable = true) { - const event = document.createEvent('Event'); - event.initEvent(type, canBubble, cancelable); + const event = document.createEvent('Event'); + event.initEvent(type, canBubble, cancelable); - return event; + return event; } diff --git a/src/cdk/testing/mock-ng-zone.ts b/src/cdk/testing/mock-ng-zone.ts index 01f53fb5f..3d519f731 100644 --- a/src/cdk/testing/mock-ng-zone.ts +++ b/src/cdk/testing/mock-ng-zone.ts @@ -1,4 +1,4 @@ -import {EventEmitter, Injectable, NgZone} from '@angular/core'; +import { EventEmitter, Injectable, NgZone } from '@angular/core'; /** @@ -10,21 +10,23 @@ import {EventEmitter, Injectable, NgZone} from '@angular/core'; */ @Injectable() export class MockNgZone extends NgZone { - onStable: EventEmitter = new EventEmitter(false); + onStable: EventEmitter = new EventEmitter(false); - constructor() { - super({enableLongStackTrace: false}); - } + constructor() { + super({enableLongStackTrace: false}); + } - run(fn: () => void): any { - return fn(); - } + run(fn: () => void): any { + // tslint:disable-next-line + return fn(); + } - runOutsideAngular(fn: () => void): any { - return fn(); - } + runOutsideAngular(fn: () => void): any { + // tslint:disable-next-line + return fn(); + } - simulateZoneExit(): void { - this.onStable.emit(null); - } + simulateZoneExit(): void { + this.onStable.emit(null); + } } diff --git a/src/cdk/tree/control/nested-tree-control.spec.ts b/src/cdk/tree/control/nested-tree-control.spec.ts index 3159f39d3..6fba0323f 100644 --- a/src/cdk/tree/control/nested-tree-control.spec.ts +++ b/src/cdk/tree/control/nested-tree-control.spec.ts @@ -1,130 +1,136 @@ -import {of as observableOf} from 'rxjs'; -import {NestedTreeControl} from './nested-tree-control'; +import {of as observableOf } from 'rxjs'; +import { NestedTreeControl } from './nested-tree-control'; -describe('CdkNestedTreeControl', () => { - let treeControl: NestedTreeControl; - let getChildren = (node: TestData) => observableOf(node.children); - - beforeEach(() => { - treeControl = new NestedTreeControl(getChildren); - }); - - describe('base tree control actions', () => { - it('should be able to expand and collapse dataNodes', () => { - const nodes = generateData(10, 4); - const node = nodes[1]; - const sixthNode = nodes[5]; - treeControl.dataNodes = nodes; - - treeControl.expand(node); - - - expect(treeControl.isExpanded(node)).toBeTruthy('Expect second node to be expanded'); - expect(treeControl.expansionModel.selected) - .toContain(node, 'Expect second node in expansionModel'); - expect(treeControl.expansionModel.selected.length) - .toBe(1, 'Expect only second node in expansionModel'); - - treeControl.toggle(sixthNode); - - expect(treeControl.isExpanded(node)).toBeTruthy('Expect second node to stay expanded'); - expect(treeControl.expansionModel.selected) - .toContain(sixthNode, 'Expect sixth node in expansionModel'); - expect(treeControl.expansionModel.selected) - .toContain(node, 'Expect second node in expansionModel'); - expect(treeControl.expansionModel.selected.length) - .toBe(2, 'Expect two dataNodes in expansionModel'); - - treeControl.collapse(node); - - expect(treeControl.isExpanded(node)).toBeFalsy('Expect second node to be collapsed'); - expect(treeControl.expansionModel.selected.length) - .toBe(1, 'Expect one node in expansionModel'); - expect(treeControl.isExpanded(sixthNode)).toBeTruthy('Expect sixth node to stay expanded'); - expect(treeControl.expansionModel.selected) - .toContain(sixthNode, 'Expect sixth node in expansionModel'); - }); - - it('should toggle descendants correctly', () => { - const numNodes = 10; - const numChildren = 4; - const numGrandChildren = 2; - const nodes = generateData(numNodes, numChildren, numGrandChildren); - treeControl.dataNodes = nodes; - - treeControl.expandDescendants(nodes[1]); - const expandedNodesNum = 1 + numChildren + numChildren * numGrandChildren; - expect(treeControl.expansionModel.selected.length) - .toBe(expandedNodesNum, `Expect expanded ${expandedNodesNum} nodes`); - - expect(treeControl.isExpanded(nodes[1])).toBeTruthy('Expect second node to be expanded'); - for (let i = 0; i < numChildren; i++) { +/* tslint:disable:no-magic-numbers */ +describe('CdkNestedTreeControl', () => { + let treeControl: NestedTreeControl; + const getChildren = (node: TestData) => observableOf(node.children); - expect(treeControl.isExpanded(nodes[1].children[i])) - .toBeTruthy(`Expect second node's children to be expanded`); - for (let j = 0; j < numGrandChildren; j++) { - expect(treeControl.isExpanded(nodes[1].children[i].children[j])) - .toBeTruthy(`Expect second node grand children to be expanded`); - } - } + beforeEach(() => { + treeControl = new NestedTreeControl(getChildren); }); - it('should be able to expand/collapse all the dataNodes', () => { - const numNodes = 10; - const numChildren = 4; - const numGrandChildren = 2; - const nodes = generateData(numNodes, numChildren, numGrandChildren); - treeControl.dataNodes = nodes; - - treeControl.expandDescendants(nodes[1]); - - treeControl.collapseAll(); - - expect(treeControl.expansionModel.selected.length).toBe(0, `Expect no expanded nodes`); - - treeControl.expandAll(); - - const totalNumber = numNodes + numNodes * numChildren - + numNodes * numChildren * numGrandChildren; - expect(treeControl.expansionModel.selected.length) - .toBe(totalNumber, `Expect ${totalNumber} expanded nodes`); + describe('base tree control actions', () => { + it('should be able to expand and collapse dataNodes', () => { + const nodes = generateData(10, 4); + const node = nodes[1]; + const sixthNode = nodes[5]; + treeControl.dataNodes = nodes; + + treeControl.expand(node); + + + expect(treeControl.isExpanded(node)).toBeTruthy('Expect second node to be expanded'); + expect(treeControl.expansionModel.selected) + .toContain(node, 'Expect second node in expansionModel'); + expect(treeControl.expansionModel.selected.length) + .toBe(1, 'Expect only second node in expansionModel'); + + treeControl.toggle(sixthNode); + + expect(treeControl.isExpanded(node)).toBeTruthy('Expect second node to stay expanded'); + expect(treeControl.expansionModel.selected) + .toContain(sixthNode, 'Expect sixth node in expansionModel'); + expect(treeControl.expansionModel.selected) + .toContain(node, 'Expect second node in expansionModel'); + expect(treeControl.expansionModel.selected.length) + .toBe(2, 'Expect two dataNodes in expansionModel'); + + treeControl.collapse(node); + + expect(treeControl.isExpanded(node)).toBeFalsy('Expect second node to be collapsed'); + expect(treeControl.expansionModel.selected.length) + .toBe(1, 'Expect one node in expansionModel'); + expect(treeControl.isExpanded(sixthNode)).toBeTruthy('Expect sixth node to stay expanded'); + expect(treeControl.expansionModel.selected) + .toContain(sixthNode, 'Expect sixth node in expansionModel'); + }); + + it('should toggle descendants correctly', () => { + const numNodes = 10; + const numChildren = 4; + const numGrandChildren = 2; + const nodes = generateData(numNodes, numChildren, numGrandChildren); + treeControl.dataNodes = nodes; + + treeControl.expandDescendants(nodes[1]); + + // tslint:disable-next-line + const expandedNodesNum = 1 + numChildren + numChildren * numGrandChildren; + expect(treeControl.expansionModel.selected.length) + .toBe(expandedNodesNum, `Expect expanded ${expandedNodesNum} nodes`); + + expect(treeControl.isExpanded(nodes[1])).toBeTruthy('Expect second node to be expanded'); + + for (let i = 0; i < numChildren; i++) { + + expect(treeControl.isExpanded(nodes[1].children[i])) + .toBeTruthy(`Expect second node's children to be expanded`); + for (let j = 0; j < numGrandChildren; j++) { + expect(treeControl.isExpanded(nodes[1].children[i].children[j])) + .toBeTruthy(`Expect second node grand children to be expanded`); + } + } + }); + + it('should be able to expand/collapse all the dataNodes', () => { + const numNodes = 10; + const numChildren = 4; + const numGrandChildren = 2; + const nodes = generateData(numNodes, numChildren, numGrandChildren); + treeControl.dataNodes = nodes; + + treeControl.expandDescendants(nodes[1]); + + treeControl.collapseAll(); + + expect(treeControl.expansionModel.selected.length).toBe(0, `Expect no expanded nodes`); + + treeControl.expandAll(); + + const totalNumber = numNodes + numNodes * numChildren + + numNodes * numChildren * numGrandChildren; + expect(treeControl.expansionModel.selected.length) + .toBe(totalNumber, `Expect ${totalNumber} expanded nodes`); + }); }); - }); }); export class TestData { - a: string; - b: string; - c: string; - level: number; - children: TestData[]; - - constructor(a: string, b: string, c: string, level: number = 1, children: TestData[] = []) { - this.a = a; - this.b = b; - this.c = c; - this.level = level; - this.children = children; - } + a: string; + b: string; + c: string; + level: number; + children: TestData[]; + + constructor(a: string, b: string, c: string, level: number = 1, children: TestData[] = []) { + this.a = a; + this.b = b; + this.c = c; + this.level = level; + this.children = children; + } } function generateData(dataLength: number, childLength: number, grandChildLength: number = 0) : TestData[] { - let data = []; - let nextIndex = 0; - for (let i = 0; i < dataLength; i++) { - let children = []; - for (let j = 0; j < childLength; j++) { - let grandChildren = []; - for (let k = 0; k < grandChildLength; k++) { - grandChildren.push(new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 3)); - } - children.push( - new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 2, grandChildren)); + const data = []; + let nextIndex = 0; + + for (let i = 0; i < dataLength; i++) { + const children = []; + for (let j = 0; j < childLength; j++) { + const grandChildren = []; + for (let k = 0; k < grandChildLength; k++) { + grandChildren.push(new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 3)); + } + children.push( + new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 2, grandChildren)); + } + data.push(new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 1, children)); } - data.push(new TestData(`a_${nextIndex}`, `b_${nextIndex}`, `c_${nextIndex++}`, 1, children)); - } - return data; + + return data; } diff --git a/src/lib/core/common-behaviors/common-module.ts b/src/lib/core/common-behaviors/common-module.ts index b67ae532e..f265b6268 100644 --- a/src/lib/core/common-behaviors/common-module.ts +++ b/src/lib/core/common-behaviors/common-module.ts @@ -47,6 +47,7 @@ export class McCommonModule { // Whether the code is running in tests. private _isTestEnv() { + // tslint:disable-next-line return this._window && (this._window['__karma__'] || this._window['jasmine']); } diff --git a/src/lib/core/common-behaviors/disabled.ts b/src/lib/core/common-behaviors/disabled.ts index 007441ead..c025f93a6 100644 --- a/src/lib/core/common-behaviors/disabled.ts +++ b/src/lib/core/common-behaviors/disabled.ts @@ -24,6 +24,7 @@ export function mixinDisabled>(base: T): CanDisableCto } constructor(...args: any[]) { + // tslint:disable-next-line super(...args); } }; diff --git a/src/lib/core/common-behaviors/error-state.ts b/src/lib/core/common-behaviors/error-state.ts index 41f8630a7..1cd73b04a 100644 --- a/src/lib/core/common-behaviors/error-state.ts +++ b/src/lib/core/common-behaviors/error-state.ts @@ -8,11 +8,13 @@ import { Constructor } from './constructor'; /** @docs-private */ export interface CanUpdateErrorState { - updateErrorState(); readonly stateChanges: Subject; + errorState: boolean; errorStateMatcher: ErrorStateMatcher; + + updateErrorState(); } /** @docs-private */ diff --git a/src/lib/core/option/option.ts b/src/lib/core/option/option.ts index 7ba64ce48..fc4dabdc5 100644 --- a/src/lib/core/option/option.ts +++ b/src/lib/core/option/option.ts @@ -206,6 +206,7 @@ export class McOption implements AfterViewChecked, OnDestroy { /** Ensures the option is selected when activated from the keyboard. */ _handleKeydown(event: KeyboardEvent): void { + // tslint:disable-next-line if (event.keyCode === ENTER || event.keyCode === SPACE) { this._selectViaInteraction(); diff --git a/src/lib/core/services/measure-scrollbar.service.ts b/src/lib/core/services/measure-scrollbar.service.ts index b63c63e14..cc8f97a0d 100644 --- a/src/lib/core/services/measure-scrollbar.service.ts +++ b/src/lib/core/services/measure-scrollbar.service.ts @@ -34,6 +34,7 @@ export class McMeasureScrollbarService { initScrollBarWidth() { const scrollDiv = this.document.createElement('div'); + // tslint:disable-next-line for (const scrollProp in this.scrollbarMeasure) { if (this.scrollbarMeasure.hasOwnProperty(scrollProp)) { scrollDiv.style[scrollProp] = this.scrollbarMeasure[scrollProp]; diff --git a/src/lib/divider/divider.spec.ts b/src/lib/divider/divider.spec.ts index e0bcbc403..4cedd68da 100644 --- a/src/lib/divider/divider.spec.ts +++ b/src/lib/divider/divider.spec.ts @@ -1,6 +1,6 @@ -import {Component} from '@angular/core'; -import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import {By} from '@angular/platform-browser'; +import { Component } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; import { McDividerModule } from './divider.module'; @@ -14,7 +14,7 @@ describe('McDivider', () => { imports: [McDividerModule], declarations: [ McDividerTestComponent - ], + ] }); TestBed.compileComponents(); diff --git a/src/lib/layout/layout.component.ts b/src/lib/layout/layout.component.ts index df3c53f2d..2c1ddddcf 100644 --- a/src/lib/layout/layout.component.ts +++ b/src/lib/layout/layout.component.ts @@ -1,4 +1,4 @@ -import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; +import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core'; @Component({ diff --git a/src/lib/layout/sidebar.component.ts b/src/lib/layout/sidebar.component.ts index 02bc77006..d92af3685 100644 --- a/src/lib/layout/sidebar.component.ts +++ b/src/lib/layout/sidebar.component.ts @@ -3,7 +3,6 @@ import { Component, EventEmitter, Host, - HostBinding, Input, OnInit, Optional, @@ -51,6 +50,7 @@ export class McSidebarComponent implements OnInit { return this.collapsed; } + // tslint:disable-next-line @Output() mcCollapsedChange = new EventEmitter(); private collapsed = false; diff --git a/src/lib/navbar/navbar.component.ts b/src/lib/navbar/navbar.component.ts index 434b66b9c..6f80258a4 100644 --- a/src/lib/navbar/navbar.component.ts +++ b/src/lib/navbar/navbar.component.ts @@ -19,7 +19,7 @@ import { import { FocusMonitor, FocusOrigin } from '@ptsecurity/cdk/a11y'; import { SPACE } from '@ptsecurity/cdk/keycodes'; import { Platform } from '@ptsecurity/cdk/platform'; -import {CanDisable, CanDisableCtor, mixinDisabled} from '@ptsecurity/mosaic/core'; +import { CanDisable, CanDisableCtor, mixinDisabled } from '@ptsecurity/mosaic/core'; const COLLAPSED_CLASS: string = 'mc-navbar-collapsed-title'; diff --git a/src/mosaic-examples/mosaic-module.ts b/src/mosaic-examples/mosaic-module.ts index 41da9b117..35d41e3fa 100644 --- a/src/mosaic-examples/mosaic-module.ts +++ b/src/mosaic-examples/mosaic-module.ts @@ -1,4 +1,4 @@ -import {NgModule} from '@angular/core'; +import { NgModule} from '@angular/core'; import { McButtonModule diff --git a/tools/gulp/tasks/changelog.ts b/tools/gulp/tasks/changelog.ts index 8362b7a89..545351f65 100644 --- a/tools/gulp/tasks/changelog.ts +++ b/tools/gulp/tasks/changelog.ts @@ -5,6 +5,8 @@ import { join } from 'path'; import { buildConfig } from '../../packages'; +/* tslint:disable:no-var-requires */ +/* tslint:disable:no-magic-numbers */ // This imports lack of type definitions. const gulpChangelog = require('gulp-conventional-changelog'); const gitSemverTags = require('git-semver-tags'); @@ -71,13 +73,14 @@ const writerOpts = { /** Task that generates a new changelog section from the latest tag to HEAD. */ task('changelog', async () => { - //TODO: Show the instructions for the changelog generation. + // TODO: Show the instructions for the changelog generation. showChangelogInstructions(); // Cancel the generation when the latest tag is the same as the version from the "package.json". if (await getLatestSemverTag() === buildConfig.projectVersion) { - console.error(chalk.default.red('Warning: Changelog won\'t change because the "package.json" version is ' + - 'equal to the latest Git tag.\n')); + // tslint:disable-next-line + console.error(chalk.default.red(`Warning: Changelog won\'t change because the "package.json" + version is equal to the latest Git tag.\n`)); return; } diff --git a/tools/gulp/tasks/example-module.ts b/tools/gulp/tasks/example-module.ts index 5d45318df..15b9034f8 100644 --- a/tools/gulp/tasks/example-module.ts +++ b/tools/gulp/tasks/example-module.ts @@ -2,13 +2,13 @@ import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; -import {sync as glob} from 'glob'; -import {task} from 'gulp'; +import { sync as glob } from 'glob'; +import { task } from 'gulp'; -import {buildConfig} from '../../packages'; +import { buildConfig } from '../../packages'; -const {packagesDir} = buildConfig; +const { packagesDir } = buildConfig; interface IExampleMetadata { component: string; @@ -20,16 +20,16 @@ interface IExampleMetadata { selectorName: string[]; } -interface ParsedMetadata { +interface IParsedMetadata { primary: boolean; component: string; title: string; templateUrl: string; } -interface ParsedMetadataResults { - primaryComponent: ParsedMetadata; - secondaryComponents: ParsedMetadata[]; +interface IParsedMetadataResults { + primaryComponent: IParsedMetadata; + secondaryComponents: IParsedMetadata[]; } /** Path to find the examples */ @@ -59,7 +59,7 @@ function buildImportsTemplate(metadata: IExampleMetadata): string { function buildExamplesTemplate(metadata: IExampleMetadata): string { const fields = [ `title: '${metadata.title.trim()}'`, - `component: ${metadata.component}`, + `component: ${metadata.component}` ]; // if no additional files or selectors were provided, @@ -72,6 +72,7 @@ function buildExamplesTemplate(metadata: IExampleMetadata): string { fields.push(`selectorName: '${metadata.selectorName.join(', ')}'`); } + // tslint:disable-next-line const data = '\n' + fields.map((field) => ' ' + field).join(',\n'); return `'${metadata.id}': {${data} @@ -100,7 +101,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {CommonModule} from '@angular/common'; import {ExampleMosaicModule} from './mosaic-module'; -${extractedMetadata.map(r => buildImportsTemplate(r)).join('').trim()} +${extractedMetadata.map(buildImportsTemplate).join('').trim()} export interface LiveExample { title: string; @@ -110,11 +111,11 @@ export interface LiveExample { } export const EXAMPLE_COMPONENTS: {[key: string]: LiveExample} = { - ${extractedMetadata.map((r) => buildExamplesTemplate(r)).join('').trim()} + ${extractedMetadata.map(buildExamplesTemplate).join('').trim()} }; export const EXAMPLE_LIST = [ - ${extractedMetadata.map((r) => buildListTemplate(r)).join('').trim()} + ${extractedMetadata.map(buildListTemplate).join('').trim()} ]; @NgModule({ @@ -136,7 +137,9 @@ export class ExampleModule { } * this function will convert to dash case. */ function convertToDashCase(name: string): string { + // tslint:disable-next-line name = name.replace(/[A-Z]/g, ' $&'); + // tslint:disable-next-line name = name.toLowerCase().trim(); return name.split(' ').join('-'); @@ -145,7 +148,7 @@ function convertToDashCase(name: string): string { /** * Parse the AST of a file and get metadata about it */ -function parseExampleMetadata(fileName: string, sourceContent: string): ParsedMetadataResults { +function parseExampleMetadata(fileName: string, sourceContent: string): IParsedMetadataResults { const sourceFile = ts.createSourceFile( fileName, sourceContent, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS); diff --git a/tools/gulp/tasks/payload.ts b/tools/gulp/tasks/payload.ts index c1af7cd8b..aa3ff11e3 100644 --- a/tools/gulp/tasks/payload.ts +++ b/tools/gulp/tasks/payload.ts @@ -1,9 +1,9 @@ -import {statSync} from 'fs'; -import {sync as glob} from 'glob'; -import {task} from 'gulp'; -import {join} from 'path'; +import { statSync } from 'fs'; +import { sync as glob } from 'glob'; +import { task } from 'gulp'; +import { join } from 'path'; -import {buildConfig} from '../../packages'; +import { buildConfig } from '../../packages'; /** Path to the directory where all bundles are living. */ @@ -15,33 +15,33 @@ const bundlesDir = join(buildConfig.outputDir, 'bundles'); /** Task which runs test against the size of mosaic. */ task('payload', ['mosaic:clean-build'], async () => { - const results = { - timestamp: Date.now(), - // mosaic bundles - mosaic_umd: getBundleSize('mosaic.umd.js'), - mosaic_umd_minified_uglify: getBundleSize('mosaic.umd.min.js'), - mosaic_fesm_2015: getBundleSize('mosaic.js') + getBundleSize('mosaic/!(*.es5).js'), - mosaic_fesm_2014: getBundleSize('mosaic.es5.js') + getBundleSize('mosaic/*.es5.js'), - // CDK bundles - cdk_umd: getBundleSize('cdk*.umd.js'), - cdk_umd_minified_uglify: getBundleSize('cdk*.umd.min.js'), - cdk_fesm_2015: getBundleSize('cdk.js') + getBundleSize('cdk/!(*.es5).js'), - cdk_fesm_2014: getBundleSize('cdk.es5.js') + getBundleSize('cdk/*.es5.js') - }; - - // Print the results to the console, so we can read it from the CI. - console.log('Payload Results:', JSON.stringify(results, null, 2)); + const results = { + timestamp: Date.now(), + // mosaic bundles + mosaic_umd: getBundleSize('mosaic.umd.js'), + mosaic_umd_minified_uglify: getBundleSize('mosaic.umd.min.js'), + mosaic_fesm_2015: getBundleSize('mosaic.js') + getBundleSize('mosaic/!(*.es5).js'), + mosaic_fesm_2014: getBundleSize('mosaic.es5.js') + getBundleSize('mosaic/*.es5.js'), + // CDK bundles + cdk_umd: getBundleSize('cdk*.umd.js'), + cdk_umd_minified_uglify: getBundleSize('cdk*.umd.min.js'), + cdk_fesm_2015: getBundleSize('cdk.js') + getBundleSize('cdk/!(*.es5).js'), + cdk_fesm_2014: getBundleSize('cdk.es5.js') + getBundleSize('cdk/*.es5.js') + }; + + // Print the results to the console, so we can read it from the CI. + console.log('Payload Results:', JSON.stringify(results, null, 2)); }); /** Returns the size of the given library bundle. */ function getBundleSize(bundleName: string) { - return glob(bundleName, {cwd: bundlesDir}) - .reduce((sum, fileName) => sum + getFilesize(join(bundlesDir, fileName)), 0); + return glob(bundleName, {cwd: bundlesDir}) + .reduce((sum, fileName) => sum + getFilesize(join(bundlesDir, fileName)), 0); } /** Returns the size of a file in kilobytes. */ function getFilesize(filePath: string) { - return statSync(filePath).size / 1000; + return statSync(filePath).size / 1000; } /* tslint:enable:no-magic-numbers */ diff --git a/tools/gulp/tasks/validate-licenses.ts b/tools/gulp/tasks/validate-licenses.ts index c1fc96caf..8e2ebfdd5 100644 --- a/tools/gulp/tasks/validate-licenses.ts +++ b/tools/gulp/tasks/validate-licenses.ts @@ -83,7 +83,7 @@ const enum ReturnCode { INVALID_LIC = 2 } -export default function validateLicense(): Promise { +export function validateLicense(): Promise { return new Promise((resolve) => { checker.init({start: path.join(__dirname, '../../../')}, (err: Error, json: any) => { diff --git a/tools/packages/build-bundles.ts b/tools/packages/build-bundles.ts index 9d3006a34..8066501c5 100644 --- a/tools/packages/build-bundles.ts +++ b/tools/packages/build-bundles.ts @@ -1,4 +1,4 @@ -import {dirname, join} from 'path'; +import { dirname, join } from 'path'; import { rollupGlobals } from './rollup-globals'; @@ -189,6 +189,7 @@ export class PackageBundler { join(dirname(bundleOutputDir), this.buildPackage.name, `${p}.es5.js`); return map; + // tslint:disable-next-line }, {} as {[key: string]: string}); } } diff --git a/tools/packages/metadata-reexport.ts b/tools/packages/metadata-reexport.ts index b8a3cf9b0..53b6ca533 100644 --- a/tools/packages/metadata-reexport.ts +++ b/tools/packages/metadata-reexport.ts @@ -6,13 +6,14 @@ import { join } from 'path'; /* tslint:disable-next-line:no-reserved-keywords */ export function createMetadataReexportFile(destDir: string, from: string | string[], entryPointName: string, importAsName: string) { + // tslint:disable-next-line from = Array.isArray(from) ? from : [from]; const metadataJsonContent = JSON.stringify({ __symbolic: 'module', version: 3, metadata: {}, - exports: from.map(f => ({from: f})), + exports: from.map((f) => ({from: f})), flatModuleIndexRedirect: true, importAs: importAsName /* tslint:disable-next-line:no-magic-numbers */ diff --git a/tools/packages/rollup-remove-licenses.ts b/tools/packages/rollup-remove-licenses.ts index 5ed290ad7..9ed85d3e3 100644 --- a/tools/packages/rollup-remove-licenses.ts +++ b/tools/packages/rollup-remove-licenses.ts @@ -1,3 +1,4 @@ +// tslint:disable-next-line import MagicString from 'magic-string'; import { buildConfig } from './build-config'; @@ -15,6 +16,7 @@ export const rollupRemoveLicensesPlugin = { const newContent = new MagicString(code); // Walks through every occurrence of a license comment and overwrites it with an empty string. + // tslint:disable-next-line for (let pos = -1; (pos = code.indexOf(licenseBanner, pos + 1)) !== -1; null) { newContent.overwrite(pos, pos + licenseBanner.length, ''); }