chore: fix lint issues

This commit is contained in:
Roman Hotsiy 2018-03-05 17:58:19 +02:00
parent 67e459f0c7
commit 61bb79e8b0
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
5 changed files with 14 additions and 10 deletions

View File

@ -2,12 +2,12 @@ import { observe } from 'mobx';
import { OpenAPISpec } from '../types';
import { loadAndBundleSpec } from '../utils/loadAndBundleSpec';
import { MarkerService } from './MarkerService';
import { MenuStore } from './MenuStore';
import { SpecStore } from './models';
import { RedocNormalizedOptions, RedocRawOptions } from './RedocNormalizedOptions';
import { ScrollService } from './ScrollService';
import { SearchStore } from './SearchStore';
import { MarkerService } from './MarkerService';
interface StoreData {
menu: {
@ -80,11 +80,15 @@ export class AppStore {
const elements: Element[] = [];
for (let i = start; i < end; i++) {
let elem = this.menu.getElementAt(i);
if (!elem) continue;
if (!elem) {
continue;
}
if (this.menu.flatItems[i].type === 'section') {
elem = elem.parentElement!.parentElement;
}
if (elem) elements.push(elem);
if (elem) {
elements.push(elem);
}
}
this.marker.addOnly(elements);

View File

@ -21,7 +21,7 @@ export class MarkerService {
}
});
for (let el of elements) {
for (const el of elements) {
if (!this.map.has(el)) {
this.map.set(el, new Mark(el as HTMLElement));
}
@ -34,7 +34,9 @@ export class MarkerService {
}
mark(term?: string) {
if (!term && !this.prevTerm) return;
if (!term && !this.prevTerm) {
return;
}
this.map.forEach(val => {
val.unmark();
val.mark(term || this.prevTerm);

View File

@ -1,12 +1,10 @@
import { IMenuItem } from './MenuStore';
import { OperationModel } from './models';
import worker from './SearchWorker.worker';
import { IMenuItem } from './MenuStore';
export class SearchStore {
searchWorker = new worker();
constructor() {}
indexItems(groups: Array<IMenuItem | OperationModel>) {
groups.forEach(group => {
if (group.type !== 'group') {

View File

@ -12,8 +12,8 @@ import {
getOperationSummary,
isAbsolutePath,
JsonPointer,
stripTrailingSlash,
sortByRequired,
stripTrailingSlash,
} from '../../utils';
import { ContentItemModel, ExtendedOpenAPIOperation } from '../MenuBuilder';
import { OpenAPIParser } from '../OpenAPIParser';

View File

@ -162,7 +162,7 @@ export function humanizeConstraints(schema: OpenAPISchema): string[] {
}
export function sortByRequired(
fields: { required: boolean; name: string }[],
fields: Array<{ required: boolean; name: string }>,
order: string[] = [],
) {
fields.sort((a, b) => {