mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-21 20:20:32 +03:00
Fix linter/tsc errors
This commit is contained in:
parent
14074856b6
commit
1855d2bd38
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
|
||||
import { SpecManager, BaseComponent } from '../base';
|
||||
import { OptionsService, MenuService } from '../../services/index';
|
||||
import { OptionsService } from '../../services/index';
|
||||
|
||||
@Component({
|
||||
selector: 'api-info',
|
||||
|
|
|
@ -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 || '');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
'use strict';
|
||||
import { Input, HostBinding, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } 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/';
|
||||
import { Input, HostBinding, Component, OnChanges } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'loading-bar',
|
||||
|
@ -32,10 +28,9 @@ import { OptionsService, AppStateService } from '../../services/';
|
|||
background-color: #5f7fc3;
|
||||
transition: right 0.2s linear;
|
||||
}
|
||||
`],
|
||||
//changeDetection: ChangeDetectionStrategy.OnPush
|
||||
`]
|
||||
})
|
||||
export class LoadingBar {
|
||||
export class LoadingBar implements OnChanges {
|
||||
@Input() progress:number = 0;
|
||||
@HostBinding('style.display') display = 'block';
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
'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 { BaseComponent, SpecManager } from '../base';
|
||||
import { SchemaHelper } from '../../services/schema-helper.service';
|
||||
import { OptionsService, AppStateService } from '../../services/';
|
||||
import { OptionsService } from '../../services/';
|
||||
|
||||
@Component({
|
||||
selector: 'method',
|
||||
|
@ -20,8 +20,7 @@ export class Method extends BaseComponent implements OnInit {
|
|||
|
||||
method:any;
|
||||
|
||||
constructor(specMgr:SpecManager, private optionsService: OptionsService, private chDetector: ChangeDetectorRef,
|
||||
private appState: AppStateService, private el: ElementRef) {
|
||||
constructor(specMgr:SpecManager, private optionsService: OptionsService, private el: ElementRef) {
|
||||
super(specMgr);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,7 @@ export class MethodsList extends BaseComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
trackByPointer(idx, el) {
|
||||
return el.pointer;
|
||||
}
|
||||
|
||||
trackByTagName(idx, el) {
|
||||
trackByTagName(_, el) {
|
||||
return el.name;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
import { ElementRef,
|
||||
ComponentRef,
|
||||
ChangeDetectorRef,
|
||||
Input,
|
||||
Component,
|
||||
OnInit,
|
||||
ChangeDetectionStrategy,
|
||||
HostBinding
|
||||
} from '@angular/core';
|
||||
|
||||
|
@ -18,7 +16,6 @@ import * as detectScollParent from 'scrollparent';
|
|||
import { SpecManager } from '../../utils/spec-manager';
|
||||
import { OptionsService, Hash, AppStateService, SchemaHelper } from '../../services/index';
|
||||
import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for';
|
||||
import { CustomErrorHandler } from '../../utils/';
|
||||
|
||||
@Component({
|
||||
selector: 'redoc',
|
||||
|
|
|
@ -63,7 +63,7 @@ export class ResponsesList extends BaseComponent implements OnInit {
|
|||
this.responses = responses;
|
||||
}
|
||||
|
||||
trackByCode(idx, el) {
|
||||
trackByCode(_, el) {
|
||||
return el.code;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
import { Component, ChangeDetectionStrategy, OnInit, HostListener } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
|
||||
import { SpecManager, BaseComponent } from '../base';
|
||||
|
||||
import { ComponentParser } from '../../services/component-parser.service';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Component, ElementRef, ChangeDetectorRef, OnInit } from '@angular/core'
|
|||
//import { global } from '@angular/core/src/facade/lang';
|
||||
import { trigger, state, animate, transition, style } from '@angular/core';
|
||||
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 { MenuCategory } from '../../services/schema-helper.service';
|
||||
|
||||
|
@ -41,7 +41,7 @@ export class SideMenu extends BaseComponent implements OnInit {
|
|||
private firstChange = true;
|
||||
|
||||
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) {
|
||||
super(specMgr);
|
||||
this.$element = elementRef.nativeElement;
|
||||
|
|
|
@ -3,7 +3,6 @@ import './components/Redoc/redoc-initial-styles.css';
|
|||
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { Redoc } from './components/index';
|
||||
import { SpecManager } from './utils/spec-manager';
|
||||
import { BrowserDomAdapter as DOM } from './utils/browser-adapter';
|
||||
import { disableDebugTools } from '@angular/platform-browser';
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|||
|
||||
import { Redoc, SecurityDefinitions, Method, REDOC_DIRECTIVES } from './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 { LazyTasksService } from './shared/components/LazyFor/lazy-for';
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { Injector } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class AppStateService {
|
||||
samplesLanguage = new Subject<string>();
|
||||
error = new BehaviorSubject<any>(null);
|
||||
loading = new Subject<boolean>();
|
||||
initialized = new BehaviorSubject<any>(false);
|
||||
|
||||
startLoading() {
|
||||
this.loading.next(true);
|
||||
|
@ -18,7 +18,4 @@ export class AppStateService {
|
|||
stopLoading() {
|
||||
this.loading.next(false);
|
||||
}
|
||||
|
||||
constructor(private injector: Injector, private zone: NgZone) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ export class ComponentParser {
|
|||
}
|
||||
|
||||
createComponentByHtml(htmlTag: string, injector:Injector):ComponentRef<any>| null {
|
||||
let {componentType, options} = this._parseHtml(htmlTag);
|
||||
let { componentType } = this._parseHtml(htmlTag);
|
||||
if (!componentType) return null;
|
||||
|
||||
let factory = this.resolver.resolveComponentFactory(componentType);
|
||||
|
|
|
@ -52,7 +52,7 @@ export class OptionsService {
|
|||
//camelCasify
|
||||
.map(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))
|
||||
|
|
|
@ -64,7 +64,7 @@ const injectors = {
|
|||
},
|
||||
discriminator: {
|
||||
check: (propertySchema) => propertySchema.discriminator || propertySchema['x-extendedDiscriminator'],
|
||||
inject: (injectTo, propertySchema = injectTo, pointer) => {
|
||||
inject: (injectTo, propertySchema = injectTo) => {
|
||||
injectTo.discriminator = propertySchema.discriminator;
|
||||
injectTo['x-extendedDiscriminator'] = propertySchema['x-extendedDiscriminator'];
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ const injectors = {
|
|||
},
|
||||
file: {
|
||||
check: propertySchema => (propertySchema.type === 'file'),
|
||||
inject: (injectTo, propertySchema = injectTo, propPointer, hostPointer) => {
|
||||
inject: (injectTo, propertySchema = injectTo, _, hostPointer) => {
|
||||
injectTo.isFile = true;
|
||||
let parentPtr;
|
||||
if (propertySchema.in === 'formData') {
|
||||
|
@ -230,7 +230,7 @@ export class SchemaHelper {
|
|||
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 propPointer = propertySchema._pointer ||
|
||||
JsonPointer.join(pointer, ['properties', propName]);
|
||||
|
|
|
@ -20,7 +20,7 @@ interface Schema {
|
|||
@Injectable()
|
||||
export class SchemaNormalizer {
|
||||
_dereferencer:SchemaDereferencer;
|
||||
constructor(private _schema:any) {
|
||||
constructor(_schema:any) {
|
||||
this._dereferencer = new SchemaDereferencer(_schema, this);
|
||||
}
|
||||
normalize(schema, ptr, opts:any ={}) {
|
||||
|
|
|
@ -19,7 +19,7 @@ export class ScrollService {
|
|||
private _cancel:any;
|
||||
private _savedPosition:number;
|
||||
private _stickElement: HTMLElement;
|
||||
constructor(private optionsService:OptionsService) {
|
||||
constructor(optionsService:OptionsService) {
|
||||
this.scrollYOffset = () => optionsService.options.scrollYOffset();
|
||||
this.$scrollParent = optionsService.options.$scrollParent || window;
|
||||
this.scroll = new EventEmitter();
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Output,
|
||||
Input,
|
||||
OnInit,
|
||||
ViewContainerRef,
|
||||
|
|
|
@ -6,8 +6,7 @@ import {
|
|||
TemplateRef,
|
||||
ChangeDetectorRef,
|
||||
ViewContainerRef,
|
||||
Injectable,
|
||||
NgZone
|
||||
Injectable
|
||||
} from '@angular/core';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
|
@ -36,7 +35,7 @@ export class LazyTasksService {
|
|||
|
||||
public loadProgress = new BehaviorSubject<number>(0);
|
||||
public allSync = false;
|
||||
constructor(public optionsService: OptionsService, private zone: NgZone) {
|
||||
constructor(public optionsService: OptionsService) {
|
||||
}
|
||||
|
||||
get empty() {
|
||||
|
@ -117,8 +116,8 @@ export class LazyTasksService {
|
|||
|
||||
@Injectable()
|
||||
export class LazyTasksServiceSync extends LazyTasksService {
|
||||
constructor(optionsService: OptionsService, zone: NgZone) {
|
||||
super(optionsService, zone);
|
||||
constructor(optionsService: OptionsService) {
|
||||
super(optionsService);
|
||||
this.allSync = true;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +131,6 @@ export class LazyFor {
|
|||
|
||||
prevIdx = null;
|
||||
|
||||
private _viewRef;
|
||||
constructor(
|
||||
public _template: TemplateRef<LazyForRow>,
|
||||
public cdr: ChangeDetectorRef,
|
||||
|
@ -152,7 +150,7 @@ export class LazyFor {
|
|||
if (sync) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
return new Promise<void>(resolve => {
|
||||
requestAnimationFrame(() => {
|
||||
this.scroll.saveScroll();
|
||||
|
||||
|
|
|
@ -19,11 +19,6 @@ const md = new Remarkable({
|
|||
}
|
||||
});
|
||||
|
||||
interface HeadersHandler {
|
||||
open: Function;
|
||||
close: Function;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class MdRenderer {
|
||||
public firstLevelHeadings: string[] = [];
|
||||
|
|
Loading…
Reference in New Issue
Block a user