Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Mar 5, 2018
1 parent 67e459f commit 61bb79e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/services/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/services/MarkerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/services/SearchStore.ts
Original file line number Diff line number Diff line change
@@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion src/services/models/Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
getOperationSummary,
isAbsolutePath,
JsonPointer,
stripTrailingSlash,
sortByRequired,
stripTrailingSlash,
} from '../../utils';
import { ContentItemModel, ExtendedOpenAPIOperation } from '../MenuBuilder';
import { OpenAPIParser } from '../OpenAPIParser';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 61bb79e

Please sign in to comment.