From 0071a8b513f2d8d3a863911208542b2039e184af Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 10 Sep 2019 14:14:10 +0200 Subject: [PATCH] build: run custom tslint rules on new packages Apparently we didn't run the custom tslint rules for the new packages that have been merged (`youtube-player` and `google-maps`). This is because we have a whitelist of packages we want to run these custom lint rules against. It should be actually the other way around where we only specify the folders we _don't_ want to lint against. That way, new folders are automatically linted and we need to explicitly exclude them if we don't want to run for those. --- src/google-maps/google-map/google-map.ts | 11 ++++++ src/google-maps/map-marker/map-marker.ts | 13 ++++++- .../testing/fake-google-map-utils.ts | 8 ++++ src/youtube-player/fake-youtube-player.ts | 8 ++++ src/youtube-player/index.ts | 8 ++++ src/youtube-player/public-api.ts | 8 ++++ src/youtube-player/tsconfig-build.json | 9 +++-- src/youtube-player/typings.d.ts | 1 + src/youtube-player/youtube-module.ts | 8 ++++ src/youtube-player/youtube-player.ts | 37 ++++++++++++------- tslint.json | 6 +-- 11 files changed, 96 insertions(+), 21 deletions(-) create mode 100644 src/youtube-player/typings.d.ts diff --git a/src/google-maps/google-map/google-map.ts b/src/google-maps/google-map/google-map.ts index 6c3021434248..049c98d7f929 100644 --- a/src/google-maps/google-map/google-map.ts +++ b/src/google-maps/google-map/google-map.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + import { AfterContentInit, ChangeDetectionStrategy, @@ -11,6 +19,7 @@ import { OnInit, Output, QueryList, + ViewEncapsulation, } from '@angular/core'; import {BehaviorSubject, combineLatest, Observable, Subject} from 'rxjs'; import {map, shareReplay, take, takeUntil} from 'rxjs/operators'; @@ -47,9 +56,11 @@ export const DEFAULT_WIDTH = '500px'; * @see https://developers.google.com/maps/documentation/javascript/reference/ */ @Component({ + moduleId: module.id, selector: 'google-map', changeDetection: ChangeDetectionStrategy.OnPush, template: '
', + encapsulation: ViewEncapsulation.None, }) export class GoogleMap implements OnChanges, OnInit, AfterContentInit, OnDestroy { @Input() height = DEFAULT_HEIGHT; diff --git a/src/google-maps/map-marker/map-marker.ts b/src/google-maps/map-marker/map-marker.ts index 6117481e9caf..cbf69381c4c8 100644 --- a/src/google-maps/map-marker/map-marker.ts +++ b/src/google-maps/map-marker/map-marker.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + import { ChangeDetectionStrategy, Component, @@ -5,7 +13,8 @@ import { Input, OnDestroy, OnInit, - Output + Output, + ViewEncapsulation } from '@angular/core'; import {BehaviorSubject, combineLatest, Observable, ReplaySubject, Subject} from 'rxjs'; import {map, takeUntil} from 'rxjs/operators'; @@ -23,9 +32,11 @@ export const DEFAULT_MARKER_OPTIONS = { * @see developers.google.com/maps/documentation/javascript/reference/marker */ @Component({ + moduleId: module.id, selector: 'map-marker', template: '', changeDetection: ChangeDetectionStrategy.OnPush, + encapsulation: ViewEncapsulation.None, }) export class MapMarker implements OnInit, OnDestroy { @Input() diff --git a/src/google-maps/testing/fake-google-map-utils.ts b/src/google-maps/testing/fake-google-map-utils.ts index 6d09a5fe3239..f0747e883b29 100644 --- a/src/google-maps/testing/fake-google-map-utils.ts +++ b/src/google-maps/testing/fake-google-map-utils.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + import {UpdatedGoogleMap} from '../google-map/index'; /** Window interface for testing */ diff --git a/src/youtube-player/fake-youtube-player.ts b/src/youtube-player/fake-youtube-player.ts index 6c32f2c97e13..e5fc238b1e50 100644 --- a/src/youtube-player/fake-youtube-player.ts +++ b/src/youtube-player/fake-youtube-player.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + // A re-creation of YT.PlayerState since enum values cannot be bound to the window // object. const playerState = { diff --git a/src/youtube-player/index.ts b/src/youtube-player/index.ts index 7e1a213e3ea5..676ca90f1ffa 100644 --- a/src/youtube-player/index.ts +++ b/src/youtube-player/index.ts @@ -1 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + export * from './public-api'; diff --git a/src/youtube-player/public-api.ts b/src/youtube-player/public-api.ts index fa30b28c2dbc..08134842450f 100644 --- a/src/youtube-player/public-api.ts +++ b/src/youtube-player/public-api.ts @@ -1,2 +1,10 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + export * from './youtube-module'; export {YouTubePlayer} from './youtube-player'; diff --git a/src/youtube-player/tsconfig-build.json b/src/youtube-player/tsconfig-build.json index 18cf0ec575e7..df2408a71a8b 100644 --- a/src/youtube-player/tsconfig-build.json +++ b/src/youtube-player/tsconfig-build.json @@ -1,6 +1,6 @@ -// TypeScript config file that is used to compile the Material package through Gulp. As the -// long term goal is to switch to Bazel, and we already want to run tests with Bazel, we need to -// ensure the TypeScript build options are the same for Gulp and Bazel. We achieve this by +// TypeScript config file that is used to compile the "youtube-player" package through Gulp. As +// the long term goal is to switch to Bazel, and we already want to run tests with Bazel, we need +// to ensure the TypeScript build options are the same for Gulp and Bazel. We achieve this by // extending the generic Bazel build tsconfig which will be used for each entry-point. { "extends": "../bazel-tsconfig-build.json", @@ -15,7 +15,8 @@ "types": ["youtube"] }, "files": [ - "public-api.ts" + "public-api.ts", + "typings.d.ts" ], "angularCompilerOptions": { "annotateForClosureCompiler": true, diff --git a/src/youtube-player/typings.d.ts b/src/youtube-player/typings.d.ts new file mode 100644 index 000000000000..ce4ae9b66cf0 --- /dev/null +++ b/src/youtube-player/typings.d.ts @@ -0,0 +1 @@ +declare var module: {id: string}; diff --git a/src/youtube-player/youtube-module.ts b/src/youtube-player/youtube-module.ts index 8d72d982f1e3..b1e4f597a495 100644 --- a/src/youtube-player/youtube-module.ts +++ b/src/youtube-player/youtube-module.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; diff --git a/src/youtube-player/youtube-player.ts b/src/youtube-player/youtube-player.ts index 08ba716290a7..911f5f2e53d2 100644 --- a/src/youtube-player/youtube-player.ts +++ b/src/youtube-player/youtube-player.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + import { AfterViewInit, ChangeDetectionStrategy, @@ -7,37 +15,38 @@ import { Input, NgZone, OnDestroy, + OnInit, Output, ViewChild, - OnInit, + ViewEncapsulation, } from '@angular/core'; import { combineLatest, - of as observableOf, - Observable, ConnectableObservable, - pipe, - MonoTypeOperatorFunction, merge, + MonoTypeOperatorFunction, + Observable, + of as observableOf, OperatorFunction, + pipe, Subject, } from 'rxjs'; import { combineLatest as combineLatestOp, + distinctUntilChanged, + filter, + first, + flatMap, map, + publish, scan, - withLatestFrom, - flatMap, - filter, + skipWhile, startWith, - publish, - first, - distinctUntilChanged, - takeUntil, take, - skipWhile, + takeUntil, + withLatestFrom, } from 'rxjs/operators'; declare global { @@ -66,8 +75,10 @@ type UninitializedPlayer = Pick', }) diff --git a/tslint.json b/tslint.json index b4d870fcd3aa..00a656549e0d 100644 --- a/tslint.json +++ b/tslint.json @@ -126,15 +126,15 @@ "!host": "\\[class\\]" }, "NgModule": "^(?!\\s*$).+" - }, "src/+(material|cdk|material-experimental|cdk-experimental)/**/!(*.spec).ts"], + }, "src/!(a11y-demo|e2e-app|material-examples|universal-app|dev-app)/**/!(*.spec).ts"], "require-license-banner": [ true, - "src/+(material|cdk|material-experimental|cdk-experimental|dev-app)/**/!(*.spec).ts" + "src/!(a11y-demo|e2e-app|material-examples|universal-app)/**/!(*.spec).ts" ], "missing-rollup-globals": [ true, "./tools/package-tools/rollup-globals.ts", - "src/+(material|cdk|material-examples|material-experimental|cdk-experimental)/!(schematics)**/*.ts" + "src/!(a11y-demo|e2e-app|material-examples|universal-app|dev-app)/!(schematics)**/*.ts" ], "file-name-casing": [true, { // Exclude custom lint rule files since they have to always be camel-cased and end