mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 10:04:08 +03:00
chore: fix lint issues
This commit is contained in:
parent
67e459f0c7
commit
61bb79e8b0
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -12,8 +12,8 @@ import {
|
|||
getOperationSummary,
|
||||
isAbsolutePath,
|
||||
JsonPointer,
|
||||
stripTrailingSlash,
|
||||
sortByRequired,
|
||||
stripTrailingSlash,
|
||||
} from '../../utils';
|
||||
import { ContentItemModel, ExtendedOpenAPIOperation } from '../MenuBuilder';
|
||||
import { OpenAPIParser } from '../OpenAPIParser';
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user