Skip to content

Commit

Permalink
build: run custom tslint rules on new packages (#17033)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 0d7e038)
  • Loading branch information
devversion authored and jelbourn committed Sep 24, 2019
1 parent 61edae8 commit d1ac6b0
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 21 deletions.
11 changes: 11 additions & 0 deletions src/google-maps/google-map/google-map.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';
Expand Down Expand Up @@ -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: '<div class="map-container"></div><ng-content></ng-content>',
encapsulation: ViewEncapsulation.None,
})
export class GoogleMap implements OnChanges, OnInit, AfterContentInit, OnDestroy {
@Input() height = DEFAULT_HEIGHT;
Expand Down
13 changes: 12 additions & 1 deletion src/google-maps/map-marker/map-marker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
/**
* @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,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output
Output,
ViewEncapsulation
} from '@angular/core';
import {BehaviorSubject, combineLatest, Observable, ReplaySubject, Subject} from 'rxjs';
import {map, takeUntil} from 'rxjs/operators';
Expand All @@ -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: '<ng-content></ng-content>',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class MapMarker implements OnInit, OnDestroy {
@Input()
Expand Down
8 changes: 8 additions & 0 deletions src/google-maps/testing/fake-google-map-utils.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
8 changes: 8 additions & 0 deletions src/youtube-player/fake-youtube-player.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
8 changes: 8 additions & 0 deletions src/youtube-player/index.ts
Original file line number Diff line number Diff line change
@@ -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';
8 changes: 8 additions & 0 deletions src/youtube-player/public-api.ts
Original file line number Diff line number Diff line change
@@ -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';
9 changes: 5 additions & 4 deletions src/youtube-player/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -15,7 +15,8 @@
"types": ["youtube"]
},
"files": [
"public-api.ts"
"public-api.ts",
"typings.d.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
Expand Down
1 change: 1 addition & 0 deletions src/youtube-player/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare var module: {id: string};
8 changes: 8 additions & 0 deletions src/youtube-player/youtube-module.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
37 changes: 24 additions & 13 deletions src/youtube-player/youtube-player.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -66,8 +75,10 @@ type UninitializedPlayer = Pick<Player, 'videoId' | 'destroy' | 'addEventListene
* @see https://developers.google.com/youtube/iframe_api_reference
*/
@Component({
moduleId: module.id,
selector: 'youtube-player',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
// This div is *replaced* by the YouTube player embed.
template: '<div #youtube_container></div>',
})
Expand Down
6 changes: 3 additions & 3 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1ac6b0

Please sign in to comment.