Skip to content

Commit c57cef4

Browse files
Merge pull request #2431 from angular/fix-lint
chore(lint): Fix lint errors + Run lint pre-commit and In Travis
2 parents 3665a56 + 1a57717 commit c57cef4

File tree

96 files changed

+1949
-1670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1949
-1670
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ branches:
1515

1616
install: yarn
1717

18-
script: yarn build && yarn test:all
18+
script: yarn build && yarn test:all && yarn lint

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
"build": "tsc tools/build.ts; node ./tools/build.js",
1717
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"
1818
},
19+
"husky": {
20+
"hooks": {
21+
"pre-commit": "npm run lint"
22+
}
23+
},
1924
"schematics": "./dist/packages-dist/collection.json",
2025
"builders": "./dist/packages-dist/builders.json",
2126
"keywords": [
@@ -49,6 +54,7 @@
4954
"firebase-tools": "^8.0.0",
5055
"fs-extra": "^8.0.1",
5156
"fuzzy": "^0.1.3",
57+
"husky": "^4.2.5",
5258
"inquirer": "^6.2.2",
5359
"inquirer-autocomplete-prompt": "^1.0.1",
5460
"rxfire": "^3.9.7",

sample/server.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { APP_BASE_HREF } from '@angular/common';
99
import { existsSync } from 'fs';
1010

1111
// Polyfill XMLHttpRequest and WS for Firebase
12-
global['XMLHttpRequest'] = require("xhr2");
13-
global['WebSocket'] = require("ws");
12+
/* tslint:disable:no-string-literal */
13+
global['XMLHttpRequest'] = require('xhr2');
14+
global['WebSocket'] = require('ws');
15+
/* tslint:enable:no-string-literal */
1416

1517
// The Express app is exported so that it can be used by serverless Functions.
1618
export function app() {

sample/src/app/app-routing.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule } from '@angular/router';
2+
import { RouterModule, Routes } from '@angular/router';
33

44

55
const routes: Routes = [];

sample/src/app/app.component.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TestBed, async } from '@angular/core/testing';
1+
import { async, TestBed } from '@angular/core/testing';
22
import { RouterTestingModule } from '@angular/router/testing';
33
import { AppComponent } from './app.component';
44

sample/src/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ApplicationRef } from '@angular/core';
1+
import { ApplicationRef, Component } from '@angular/core';
22
import { FirebaseApp } from '@angular/fire';
33

44
@Component({

sample/src/app/app.module.ts

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BrowserModule, BrowserTransferStateModule } from '@angular/platform-browser';
2-
import { NgModule, isDevMode } from '@angular/core';
2+
import { isDevMode, NgModule } from '@angular/core';
33

44
import { AppRoutingModule } from './app-routing.module';
55
import { AppComponent } from './app.component';
@@ -9,7 +9,12 @@ import { environment } from '../environments/environment';
99
import { AngularFireModule } from '@angular/fire';
1010
import { AngularFireStorageModule } from '@angular/fire/storage';
1111

12-
import { AngularFireAnalyticsModule, UserTrackingService, ScreenTrackingService, DEBUG_MODE as ANALYTICS_DEBUG_MODE } from '@angular/fire/analytics';
12+
import {
13+
AngularFireAnalyticsModule,
14+
DEBUG_MODE as ANALYTICS_DEBUG_MODE,
15+
ScreenTrackingService,
16+
UserTrackingService
17+
} from '@angular/fire/analytics';
1318

1419
import { FirestoreComponent } from './firestore/firestore.component';
1520

@@ -28,7 +33,7 @@ import { RemoteConfigComponent } from './remote-config/remote-config.component';
2833
const shouldUseEmulator = () => false;
2934

3035
@NgModule({
31-
declarations: [ AppComponent, StorageComponent, FirestoreComponent, DatabaseComponent, RemoteConfigComponent ],
36+
declarations: [AppComponent, StorageComponent, FirestoreComponent, DatabaseComponent, RemoteConfigComponent],
3237
imports: [
3338
BrowserModule.withServerTransition({ appId: 'serverApp' }),
3439
BrowserTransferStateModule,
@@ -50,12 +55,19 @@ const shouldUseEmulator = () => false;
5055
UserTrackingService,
5156
ScreenTrackingService,
5257
PerformanceMonitoringService,
53-
{ provide: ANALYTICS_DEBUG_MODE, useFactory: () => isDevMode() },
54-
{ provide: DATABASE_URL, useFactory: () => shouldUseEmulator() ? `http://localhost:9000?ns=${environment.firebase.projectId}` : undefined },
55-
{ provide: FIRESTORE_SETTINGS, useFactory: () => shouldUseEmulator() ? { host: 'localhost:8080', ssl: false } : {} },
56-
{ provide: FUNCTIONS_ORIGIN, useFactory: () => shouldUseEmulator() ? 'http://localhost:9999' : undefined },
58+
{
59+
provide: ANALYTICS_DEBUG_MODE,
60+
useFactory: () => isDevMode()
61+
},
62+
{
63+
provide: DATABASE_URL,
64+
useFactory: () => shouldUseEmulator() ? `http://localhost:9000?ns=${environment.firebase.projectId}` : undefined
65+
},
66+
{ provide: FIRESTORE_SETTINGS, useFactory: () => shouldUseEmulator() ? { host: 'localhost:8080', ssl: false } : {} },
67+
{ provide: FUNCTIONS_ORIGIN, useFactory: () => shouldUseEmulator() ? 'http://localhost:9999' : undefined },
5768
{ provide: REMOTE_CONFIG_SETTINGS, useFactory: () => isDevMode() ? { minimumFetchIntervalMillis: 10_000 } : {} }
5869
],
59-
bootstrap: [ AppComponent ]
70+
bootstrap: [AppComponent]
6071
})
61-
export class AppModule { }
72+
export class AppModule {
73+
}

sample/src/app/database/database.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22
import { AngularFireDatabase } from '@angular/fire/database';
33
import { Observable } from 'rxjs';
4-
import { TransferState, makeStateKey } from '@angular/platform-browser';
4+
import { makeStateKey, TransferState } from '@angular/platform-browser';
55
import { startWith, tap } from 'rxjs/operators';
66
import { trace } from '@angular/fire/performance';
77

sample/src/app/firestore/firestore.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, OnInit } from '@angular/core';
22
import { AngularFirestore } from '@angular/fire/firestore';
33
import { Observable } from 'rxjs';
4-
import { tap, startWith } from 'rxjs/operators';
5-
import { TransferState, makeStateKey } from '@angular/platform-browser';
4+
import { startWith, tap } from 'rxjs/operators';
5+
import { makeStateKey, TransferState } from '@angular/platform-browser';
66
import { trace } from '@angular/fire/performance';
77

88
@Component({

sample/src/app/storage/storage.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import { startWith, tap } from 'rxjs/operators';
55
import { makeStateKey, TransferState } from '@angular/platform-browser';
66
import { trace } from '@angular/fire/performance';
77

8-
const TRANSPARENT_PNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
8+
const TRANSPARENT_PNG
9+
= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
910

1011
@Component({
1112
selector: 'app-storage',
1213
template: `
1314
<p>
1415
Storage!
15-
<img [src]="downloadUrl$ | async" width="64" height="64" />
16+
<img [src]="downloadUrl$ | async" width="64" height="64"/>
1617
</p>
1718
`,
1819
styles: []
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export const environment = {
22
production: true,
33
firebase: {
4-
apiKey: "AIzaSyA7CNE9aHbcSEbt9y03QReJ-Xr0nwKg7Yg",
5-
authDomain: "aftest-94085.firebaseapp.com",
6-
databaseURL: "https://aftest-94085.firebaseio.com",
7-
projectId: "aftest-94085",
8-
storageBucket: "aftest-94085.appspot.com",
9-
messagingSenderId: "480362569154",
10-
appId: "1:480362569154:web:2fe6f75104cdfb82f50a5b",
11-
measurementId: "G-CBRYER9PJR"
4+
apiKey: 'AIzaSyA7CNE9aHbcSEbt9y03QReJ-Xr0nwKg7Yg',
5+
authDomain: 'aftest-94085.firebaseapp.com',
6+
databaseURL: 'https://aftest-94085.firebaseio.com',
7+
projectId: 'aftest-94085',
8+
storageBucket: 'aftest-94085.appspot.com',
9+
messagingSenderId: '480362569154',
10+
appId: '1:480362569154:web:2fe6f75104cdfb82f50a5b',
11+
measurementId: 'G-CBRYER9PJR'
1212
}
1313
};

sample/src/environments/environment.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
export const environment = {
66
production: false,
77
firebase: {
8-
apiKey: "AIzaSyA7CNE9aHbcSEbt9y03QReJ-Xr0nwKg7Yg",
9-
authDomain: "aftest-94085.firebaseapp.com",
10-
databaseURL: "https://aftest-94085.firebaseio.com",
11-
projectId: "aftest-94085",
12-
storageBucket: "aftest-94085.appspot.com",
13-
messagingSenderId: "480362569154",
14-
appId: "1:480362569154:web:2fe6f75104cdfb82f50a5b",
15-
measurementId: "G-CBRYER9PJR"
8+
apiKey: 'AIzaSyA7CNE9aHbcSEbt9y03QReJ-Xr0nwKg7Yg',
9+
authDomain: 'aftest-94085.firebaseapp.com',
10+
databaseURL: 'https://aftest-94085.firebaseio.com',
11+
projectId: 'aftest-94085',
12+
storageBucket: 'aftest-94085.appspot.com',
13+
messagingSenderId: '480362569154',
14+
appId: '1:480362569154:web:2fe6f75104cdfb82f50a5b',
15+
measurementId: 'G-CBRYER9PJR'
1616
}
1717
};
1818

@@ -23,4 +23,4 @@ export const environment = {
2323
* This import should be commented out in production mode because it will have a negative impact
2424
* on performance if an error is thrown.
2525
*/
26-
import 'zone.js/dist/zone-error'; // Included with Angular CLI.
26+
import 'zone.js/dist/zone-error'; // Included with Angular CLI.

sample/src/polyfills.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/***************************************************************************************************
5656
* Zone JS is required by default for Angular itself.
5757
*/
58-
import 'zone.js/dist/zone'; // Included with Angular CLI.
58+
import 'zone.js/dist/zone'; // Included with Angular CLI.
5959

6060

6161
/***************************************************************************************************

sample/src/test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
import 'zone.js/dist/zone-testing';
44
import { getTestBed } from '@angular/core/testing';
5-
import {
6-
BrowserDynamicTestingModule,
7-
platformBrowserDynamicTesting
8-
} from '@angular/platform-browser-dynamic/testing';
5+
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
96

107
declare const require: {
118
context(path: string, deep?: boolean, filter?: RegExp): {

src/analytics/analytics.module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule, Optional } from '@angular/core';
2-
import { UserTrackingService, ScreenTrackingService } from './analytics.service';
2+
import { ScreenTrackingService, UserTrackingService } from './analytics.service';
33
import { AngularFireAnalytics } from './analytics';
44

55
@NgModule({
@@ -12,6 +12,7 @@ export class AngularFireAnalyticsModule {
1212
@Optional() userTracking: UserTrackingService
1313
) {
1414
// calling anything on analytics will eagerly load the SDK
15+
// tslint:disable-next-line:no-unused-expression
1516
analytics.app;
1617
}
1718
}

0 commit comments

Comments
 (0)