Fix linter/tsc errors

This commit is contained in:
Roman Hotsiy 2016-12-02 11:59:29 +02:00
parent 14074856b6
commit 1855d2bd38
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
20 changed files with 28 additions and 54 deletions

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { SpecManager, BaseComponent } from '../base'; import { SpecManager, BaseComponent } from '../base';
import { OptionsService, MenuService } from '../../services/index'; import { OptionsService } from '../../services/index';
@Component({ @Component({
selector: 'api-info', selector: 'api-info',

View File

@ -120,7 +120,7 @@ export class JsonSchema extends BaseComponent implements OnInit {
} }
} }
trackByName(index: number, item: any): number { trackByName(_: number, item: any): number {
return item.name + (item._pointer || ''); return item.name + (item._pointer || '');
} }

View File

@ -1,9 +1,5 @@
'use strict'; 'use strict';
import { Input, HostBinding, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; import { Input, HostBinding, Component, OnChanges } from '@angular/core';
import JsonPointer from '../../utils/JsonPointer';
import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/schema-helper.service';
import { OptionsService, AppStateService } from '../../services/';
@Component({ @Component({
selector: 'loading-bar', selector: 'loading-bar',
@ -32,10 +28,9 @@ import { OptionsService, AppStateService } from '../../services/';
background-color: #5f7fc3; background-color: #5f7fc3;
transition: right 0.2s linear; transition: right 0.2s linear;
} }
`], `]
//changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class LoadingBar { export class LoadingBar implements OnChanges {
@Input() progress:number = 0; @Input() progress:number = 0;
@HostBinding('style.display') display = 'block'; @HostBinding('style.display') display = 'block';

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef } from '@angular/core';
import JsonPointer from '../../utils/JsonPointer'; import JsonPointer from '../../utils/JsonPointer';
import { BaseComponent, SpecManager } from '../base'; import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/schema-helper.service'; import { SchemaHelper } from '../../services/schema-helper.service';
import { OptionsService, AppStateService } from '../../services/'; import { OptionsService } from '../../services/';
@Component({ @Component({
selector: 'method', selector: 'method',
@ -20,8 +20,7 @@ export class Method extends BaseComponent implements OnInit {
method:any; method:any;
constructor(specMgr:SpecManager, private optionsService: OptionsService, private chDetector: ChangeDetectorRef, constructor(specMgr:SpecManager, private optionsService: OptionsService, private el: ElementRef) {
private appState: AppStateService, private el: ElementRef) {
super(specMgr); super(specMgr);
} }

View File

@ -30,11 +30,7 @@ export class MethodsList extends BaseComponent implements OnInit {
}); });
} }
trackByPointer(idx, el) { trackByTagName(_, el) {
return el.pointer;
}
trackByTagName(idx, el) {
return el.name; return el.name;
} }

View File

@ -1,12 +1,10 @@
'use strict'; 'use strict';
import { ElementRef, import { ElementRef,
ComponentRef,
ChangeDetectorRef, ChangeDetectorRef,
Input, Input,
Component, Component,
OnInit, OnInit,
ChangeDetectionStrategy,
HostBinding HostBinding
} from '@angular/core'; } from '@angular/core';
@ -18,7 +16,6 @@ import * as detectScollParent from 'scrollparent';
import { SpecManager } from '../../utils/spec-manager'; import { SpecManager } from '../../utils/spec-manager';
import { OptionsService, Hash, AppStateService, SchemaHelper } from '../../services/index'; import { OptionsService, Hash, AppStateService, SchemaHelper } from '../../services/index';
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for'; import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';
import { CustomErrorHandler } from '../../utils/';
@Component({ @Component({
selector: 'redoc', selector: 'redoc',

View File

@ -63,7 +63,7 @@ export class ResponsesList extends BaseComponent implements OnInit {
this.responses = responses; this.responses = responses;
} }
trackByCode(idx, el) { trackByCode(_, el) {
return el.code; return el.code;
} }

View File

@ -1,5 +1,5 @@
'use strict'; 'use strict';
import { Component, ChangeDetectionStrategy, OnInit, HostListener } from '@angular/core'; import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { SpecManager, BaseComponent } from '../base'; import { SpecManager, BaseComponent } from '../base';
import { ComponentParser } from '../../services/component-parser.service'; import { ComponentParser } from '../../services/component-parser.service';

View File

@ -5,7 +5,7 @@ import { Component, ElementRef, ChangeDetectorRef, OnInit } from '@angular/core'
//import { global } from '@angular/core/src/facade/lang'; //import { global } from '@angular/core/src/facade/lang';
import { trigger, state, animate, transition, style } from '@angular/core'; import { trigger, state, animate, transition, style } from '@angular/core';
import { BaseComponent, SpecManager } from '../base'; import { BaseComponent, SpecManager } from '../base';
import { ScrollService, Hash, MenuService, OptionsService } from '../../services/index'; import { ScrollService, MenuService, OptionsService } from '../../services/index';
import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter'; import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter';
import { MenuCategory } from '../../services/schema-helper.service'; import { MenuCategory } from '../../services/schema-helper.service';
@ -41,7 +41,7 @@ export class SideMenu extends BaseComponent implements OnInit {
private firstChange = true; private firstChange = true;
constructor(specMgr:SpecManager, elementRef:ElementRef, constructor(specMgr:SpecManager, elementRef:ElementRef,
private scrollService:ScrollService, private menuService:MenuService, private hash:Hash, private scrollService:ScrollService, private menuService:MenuService,
optionsService:OptionsService, private detectorRef:ChangeDetectorRef) { optionsService:OptionsService, private detectorRef:ChangeDetectorRef) {
super(specMgr); super(specMgr);
this.$element = elementRef.nativeElement; this.$element = elementRef.nativeElement;

View File

@ -3,7 +3,6 @@ import './components/Redoc/redoc-initial-styles.css';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
import { Redoc } from './components/index'; import { Redoc } from './components/index';
import { SpecManager } from './utils/spec-manager';
import { BrowserDomAdapter as DOM } from './utils/browser-adapter'; import { BrowserDomAdapter as DOM } from './utils/browser-adapter';
import { disableDebugTools } from '@angular/platform-browser'; import { disableDebugTools } from '@angular/platform-browser';

View File

@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
import { Redoc, SecurityDefinitions, Method, REDOC_DIRECTIVES } from './components/index'; import { Redoc, SecurityDefinitions, Method, REDOC_DIRECTIVES } from './components/index';
import { REDOC_COMMON_DIRECTIVES, DynamicNg2Wrapper } from './shared/components/index'; import { REDOC_COMMON_DIRECTIVES, DynamicNg2Wrapper } from './shared/components/index';
import { REDOC_PIPES, KeysPipe } from './utils/pipes'; import { REDOC_PIPES } from './utils/pipes';
import { CustomErrorHandler } from './utils/' import { CustomErrorHandler } from './utils/'
import { LazyTasksService } from './shared/components/LazyFor/lazy-for'; import { LazyTasksService } from './shared/components/LazyFor/lazy-for';

View File

@ -1,15 +1,15 @@
'use strict'; 'use strict';
import { Injectable, NgZone } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Injector } from '@angular/core';
@Injectable() @Injectable()
export class AppStateService { export class AppStateService {
samplesLanguage = new Subject<string>(); samplesLanguage = new Subject<string>();
error = new BehaviorSubject<any>(null); error = new BehaviorSubject<any>(null);
loading = new Subject<boolean>(); loading = new Subject<boolean>();
initialized = new BehaviorSubject<any>(false);
startLoading() { startLoading() {
this.loading.next(true); this.loading.next(true);
@ -18,7 +18,4 @@ export class AppStateService {
stopLoading() { stopLoading() {
this.loading.next(false); this.loading.next(false);
} }
constructor(private injector: Injector, private zone: NgZone) {
}
} }

View File

@ -64,7 +64,7 @@ export class ComponentParser {
} }
createComponentByHtml(htmlTag: string, injector:Injector):ComponentRef<any>| null { createComponentByHtml(htmlTag: string, injector:Injector):ComponentRef<any>| null {
let {componentType, options} = this._parseHtml(htmlTag); let { componentType } = this._parseHtml(htmlTag);
if (!componentType) return null; if (!componentType) return null;
let factory = this.resolver.resolveComponentFactory(componentType); let factory = this.resolver.resolveComponentFactory(componentType);

View File

@ -52,7 +52,7 @@ export class OptionsService {
//camelCasify //camelCasify
.map(k => ({ .map(k => ({
attrName: k, attrName: k,
name: k.replace(/-(.)/g, (m, $1) => $1.toUpperCase()) name: k.replace(/-(.)/g, (_, $1) => $1.toUpperCase())
}) })
) )
.filter(option => OPTION_NAMES.has(option.name)) .filter(option => OPTION_NAMES.has(option.name))

View File

@ -64,7 +64,7 @@ const injectors = {
}, },
discriminator: { discriminator: {
check: (propertySchema) => propertySchema.discriminator || propertySchema['x-extendedDiscriminator'], check: (propertySchema) => propertySchema.discriminator || propertySchema['x-extendedDiscriminator'],
inject: (injectTo, propertySchema = injectTo, pointer) => { inject: (injectTo, propertySchema = injectTo) => {
injectTo.discriminator = propertySchema.discriminator; injectTo.discriminator = propertySchema.discriminator;
injectTo['x-extendedDiscriminator'] = propertySchema['x-extendedDiscriminator']; injectTo['x-extendedDiscriminator'] = propertySchema['x-extendedDiscriminator'];
} }
@ -182,7 +182,7 @@ const injectors = {
}, },
file: { file: {
check: propertySchema => (propertySchema.type === 'file'), check: propertySchema => (propertySchema.type === 'file'),
inject: (injectTo, propertySchema = injectTo, propPointer, hostPointer) => { inject: (injectTo, propertySchema = injectTo, _, hostPointer) => {
injectTo.isFile = true; injectTo.isFile = true;
let parentPtr; let parentPtr;
if (propertySchema.in === 'formData') { if (propertySchema.in === 'formData') {
@ -230,7 +230,7 @@ export class SchemaHelper {
schema.required.forEach(prop => requiredMap[prop] = true); schema.required.forEach(prop => requiredMap[prop] = true);
} }
let props = schema.properties && Object.keys(schema.properties).map((propName, idx) => { let props = schema.properties && Object.keys(schema.properties).map(propName => {
let propertySchema = Object.assign({}, schema.properties[propName]); let propertySchema = Object.assign({}, schema.properties[propName]);
let propPointer = propertySchema._pointer || let propPointer = propertySchema._pointer ||
JsonPointer.join(pointer, ['properties', propName]); JsonPointer.join(pointer, ['properties', propName]);

View File

@ -20,7 +20,7 @@ interface Schema {
@Injectable() @Injectable()
export class SchemaNormalizer { export class SchemaNormalizer {
_dereferencer:SchemaDereferencer; _dereferencer:SchemaDereferencer;
constructor(private _schema:any) { constructor(_schema:any) {
this._dereferencer = new SchemaDereferencer(_schema, this); this._dereferencer = new SchemaDereferencer(_schema, this);
} }
normalize(schema, ptr, opts:any ={}) { normalize(schema, ptr, opts:any ={}) {

View File

@ -19,7 +19,7 @@ export class ScrollService {
private _cancel:any; private _cancel:any;
private _savedPosition:number; private _savedPosition:number;
private _stickElement: HTMLElement; private _stickElement: HTMLElement;
constructor(private optionsService:OptionsService) { constructor(optionsService:OptionsService) {
this.scrollYOffset = () => optionsService.options.scrollYOffset(); this.scrollYOffset = () => optionsService.options.scrollYOffset();
this.$scrollParent = optionsService.options.$scrollParent || window; this.$scrollParent = optionsService.options.$scrollParent || window;
this.scroll = new EventEmitter(); this.scroll = new EventEmitter();

View File

@ -2,8 +2,6 @@
import { import {
Component, Component,
EventEmitter,
Output,
Input, Input,
OnInit, OnInit,
ViewContainerRef, ViewContainerRef,

View File

@ -6,8 +6,7 @@ import {
TemplateRef, TemplateRef,
ChangeDetectorRef, ChangeDetectorRef,
ViewContainerRef, ViewContainerRef,
Injectable, Injectable
NgZone
} from '@angular/core'; } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@ -36,7 +35,7 @@ export class LazyTasksService {
public loadProgress = new BehaviorSubject<number>(0); public loadProgress = new BehaviorSubject<number>(0);
public allSync = false; public allSync = false;
constructor(public optionsService: OptionsService, private zone: NgZone) { constructor(public optionsService: OptionsService) {
} }
get empty() { get empty() {
@ -117,8 +116,8 @@ export class LazyTasksService {
@Injectable() @Injectable()
export class LazyTasksServiceSync extends LazyTasksService { export class LazyTasksServiceSync extends LazyTasksService {
constructor(optionsService: OptionsService, zone: NgZone) { constructor(optionsService: OptionsService) {
super(optionsService, zone); super(optionsService);
this.allSync = true; this.allSync = true;
} }
} }
@ -132,7 +131,6 @@ export class LazyFor {
prevIdx = null; prevIdx = null;
private _viewRef;
constructor( constructor(
public _template: TemplateRef<LazyForRow>, public _template: TemplateRef<LazyForRow>,
public cdr: ChangeDetectorRef, public cdr: ChangeDetectorRef,
@ -152,7 +150,7 @@ export class LazyFor {
if (sync) { if (sync) {
return Promise.resolve(); return Promise.resolve();
} }
return new Promise<void>((resolve, reject) => { return new Promise<void>(resolve => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
this.scroll.saveScroll(); this.scroll.saveScroll();

View File

@ -19,11 +19,6 @@ const md = new Remarkable({
} }
}); });
interface HeadersHandler {
open: Function;
close: Function;
}
@Injectable() @Injectable()
export class MdRenderer { export class MdRenderer {
public firstLevelHeadings: string[] = []; public firstLevelHeadings: string[] = [];