ActivityPub-federated video streaming platform using P2P directly in your web browser
Add typescript (and angular2) linter
Chocobozzz44124980c55d
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.tsindex 1648b88702..68c9ba0090 100644--- a/client/angular/app/app.component.ts+++ b/client/angular/app/app.component.ts@@ -53,8 +53,11 @@ export class AppComponent {private _authService: AuthService,private _router: Router) {- if (localStorage.getItem('access_token')) this.isLoggedIn = true;- else this.isLoggedIn = false;+ if (localStorage.getItem('access_token')) {+ this.isLoggedIn = true;+ } else {+ this.isLoggedIn = false;+ }this._authService.loginChanged$.subscribe(status => {@@ -87,7 +90,7 @@ export class AppComponent {}},error => alert(error)- )+ );}quitFriends() {@@ -96,6 +99,6 @@ export class AppComponent {alert('Quit friends!');},error => alert(error)- )+ );}}diff --git a/client/angular/friends/services/friends.service.ts b/client/angular/friends/services/friends.service.tsindex a34ef0d6fb..4eb1fc67b1 100644--- a/client/angular/friends/services/friends.service.ts+++ b/client/angular/friends/services/friends.service.ts@@ -1,6 +1,6 @@-import {Injectable} from 'angular2/core';-import {Http, Response, Headers, RequestOptions} from 'angular2/http';-import {Observable} from 'rxjs/Rx';+import { Injectable } from 'angular2/core';+import { Http, Response } from 'angular2/http';+import { Observable } from 'rxjs/Rx';@Injectable()export class FriendsService {diff --git a/client/angular/users/services/auth.service.ts b/client/angular/users/services/auth.service.tsindex a512c3d9cd..80886346ca 100644--- a/client/angular/users/services/auth.service.ts+++ b/client/angular/users/services/auth.service.ts@@ -2,19 +2,18 @@ import { Injectable } from 'angular2/core';import { Http, Response, Headers, URLSearchParams } from 'angular2/http';import { Observable, Subject } from 'rxjs/Rx';-import { Token } from '../models/token';import { AuthStatus } from '../models/authStatus';@Injectable()export class AuthService {+ loginChanged$ = this._loginChanged.asObservable();+private _loginChanged = new Subject<AuthStatus>();private _baseLoginUrl = '/api/v1/users/token';private _clientId = '56f055587305d40b21904240';private _clientSecret = 'megustalabanana';- loginChanged$ = this._loginChanged.asObservable();-constructor (private http: Http) {}login(username: string, password: string) {@@ -32,7 +31,7 @@ export class AuthService {let options = {headers: headers- }+ };return this.http.post(this._baseLoginUrl, body.toString(), options).map(res => res.json())diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.tsindex 0004cfa20f..7ae11db226 100644--- a/client/angular/videos/components/add/videos-add.component.ts+++ b/client/angular/videos/components/add/videos-add.component.ts@@ -1,8 +1,5 @@-import { Component, ElementRef, Inject, OnInit } from 'angular2/core';+import { Component, ElementRef, OnInit } from 'angular2/core';import { Router } from 'angular2/router';-import { NgForm } from 'angular2/common';--import { Video } from '../../models/video';// TODO: import it with systemjsdeclare var jQuery:any;diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.tsindex eb23ed1ff6..ae58f4d7e8 100644--- a/client/angular/videos/components/list/videos-list.component.ts+++ b/client/angular/videos/components/list/videos-list.component.ts@@ -33,7 +33,7 @@ export class VideosListComponent implements OnInit {if (this.search !== null) {observable = this._videosService.searchVideos(this.search);} else {- observable = this._videosService.getVideos()+ observable = this._videosService.getVideos();}observable.subscribe(@@ -46,7 +46,7 @@ export class VideosListComponent implements OnInit {this._videosService.removeVideo(id).subscribe(status => this.getVideos(),error => alert(error)- )+ );}}diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.tsindex 1a17e2b1ae..28786ebb9c 100644--- a/client/angular/videos/components/watch/videos-watch.component.ts+++ b/client/angular/videos/components/watch/videos-watch.component.ts@@ -47,8 +47,8 @@ export class VideosWatchComponent implements OnInit, CanDeactivate {alert('Cannot append the file.');console.error(err);}- })- })+ });+ });}routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) : any {diff --git a/client/package.json b/client/package.jsonindex 31c92f8cc2..5fd5beca46 100644--- a/client/package.json+++ b/client/package.json@@ -16,7 +16,8 @@"tsc": "tsc","tsc:w": "tsc -w","typings": "typings",- "postinstall": "typings install"+ "postinstall": "typings install",+ "test": "tslint -c ./tslint.json angular/**/*.ts angular/**/**/*.ts"},"license": "ISC","dependencies": {@@ -34,6 +35,8 @@"zone.js": "0.5.15"},"devDependencies": {+ "codelyzer": "0.0.12",+ "tslint": "^3.7.1","typescript": "^1.8.2","typings": "^0.6.8"}diff --git a/client/tslint.json b/client/tslint.jsonnew file mode 100644index 0000000000..6a40b5b118--- /dev/null+++ b/client/tslint.json@@ -0,0 +1,46 @@+{+ "rulesDirectory": ["./node_modules/codelyzer/dist/src"],+ "rules": {+ "class-name": true,+ "curly": false,+ "eofline": true,+ "indent": ["spaces"],+ "max-line-length": [true, 140],+ "member-ordering": [true,+ "public-before-private",+ "static-before-instance",+ "variables-before-functions"+ ],+ "no-arg": true,+ "no-construct": true,+ "no-duplicate-key": true,+ "no-duplicate-variable": true,+ "no-empty": true,+ "no-eval": true,+ "no-trailing-whitespace": true,+ "no-unused-expression": true,+ "no-unused-variable": true,+ "no-unreachable": true,+ "no-use-before-declare": true,+ "one-line": [true,+ "check-open-brace",+ "check-catch",+ "check-else",+ "check-whitespace"+ ],+ "quotemark": [true, "single"],+ "semicolon": true,+ "trailing-comma": true,+ "triple-equals": true,+ "variable-name": false,++ "component-selector-name": [true, "kebab-case"],+ "component-selector-type": [true, "element"],+ "host-parameter-decorator": true,+ "input-parameter-decorator": true,+ "output-parameter-decorator": true,+ "attribute-parameter-decorator": true,+ "input-property-directive": true,+ "output-property-directive": true+ }+}diff --git a/package.json b/package.jsonindex 42e79aae20..076cf6fdba 100644--- a/package.json+++ b/package.json@@ -34,7 +34,7 @@"dev": "npm run build && NODE_ENV=test concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"","livereload": "livereload ./client","start": "node server",- "test": "standard && mocha server/tests",+ "test": "cd client && npm test && cd .. && standard && mocha server/tests","postinstall": "cd client && npm install"},"dependencies": {