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 { OpenAPISpec } from '../types';
|
||||||
import { loadAndBundleSpec } from '../utils/loadAndBundleSpec';
|
import { loadAndBundleSpec } from '../utils/loadAndBundleSpec';
|
||||||
|
import { MarkerService } from './MarkerService';
|
||||||
import { MenuStore } from './MenuStore';
|
import { MenuStore } from './MenuStore';
|
||||||
import { SpecStore } from './models';
|
import { SpecStore } from './models';
|
||||||
import { RedocNormalizedOptions, RedocRawOptions } from './RedocNormalizedOptions';
|
import { RedocNormalizedOptions, RedocRawOptions } from './RedocNormalizedOptions';
|
||||||
import { ScrollService } from './ScrollService';
|
import { ScrollService } from './ScrollService';
|
||||||
import { SearchStore } from './SearchStore';
|
import { SearchStore } from './SearchStore';
|
||||||
import { MarkerService } from './MarkerService';
|
|
||||||
|
|
||||||
interface StoreData {
|
interface StoreData {
|
||||||
menu: {
|
menu: {
|
||||||
|
@ -80,11 +80,15 @@ export class AppStore {
|
||||||
const elements: Element[] = [];
|
const elements: Element[] = [];
|
||||||
for (let i = start; i < end; i++) {
|
for (let i = start; i < end; i++) {
|
||||||
let elem = this.menu.getElementAt(i);
|
let elem = this.menu.getElementAt(i);
|
||||||
if (!elem) continue;
|
if (!elem) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (this.menu.flatItems[i].type === 'section') {
|
if (this.menu.flatItems[i].type === 'section') {
|
||||||
elem = elem.parentElement!.parentElement;
|
elem = elem.parentElement!.parentElement;
|
||||||
}
|
}
|
||||||
if (elem) elements.push(elem);
|
if (elem) {
|
||||||
|
elements.push(elem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.marker.addOnly(elements);
|
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)) {
|
if (!this.map.has(el)) {
|
||||||
this.map.set(el, new Mark(el as HTMLElement));
|
this.map.set(el, new Mark(el as HTMLElement));
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,9 @@ export class MarkerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
mark(term?: string) {
|
mark(term?: string) {
|
||||||
if (!term && !this.prevTerm) return;
|
if (!term && !this.prevTerm) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.map.forEach(val => {
|
this.map.forEach(val => {
|
||||||
val.unmark();
|
val.unmark();
|
||||||
val.mark(term || this.prevTerm);
|
val.mark(term || this.prevTerm);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
|
import { IMenuItem } from './MenuStore';
|
||||||
import { OperationModel } from './models';
|
import { OperationModel } from './models';
|
||||||
import worker from './SearchWorker.worker';
|
import worker from './SearchWorker.worker';
|
||||||
import { IMenuItem } from './MenuStore';
|
|
||||||
|
|
||||||
export class SearchStore {
|
export class SearchStore {
|
||||||
searchWorker = new worker();
|
searchWorker = new worker();
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
indexItems(groups: Array<IMenuItem | OperationModel>) {
|
indexItems(groups: Array<IMenuItem | OperationModel>) {
|
||||||
groups.forEach(group => {
|
groups.forEach(group => {
|
||||||
if (group.type !== 'group') {
|
if (group.type !== 'group') {
|
||||||
|
|
|
@ -12,8 +12,8 @@ import {
|
||||||
getOperationSummary,
|
getOperationSummary,
|
||||||
isAbsolutePath,
|
isAbsolutePath,
|
||||||
JsonPointer,
|
JsonPointer,
|
||||||
stripTrailingSlash,
|
|
||||||
sortByRequired,
|
sortByRequired,
|
||||||
|
stripTrailingSlash,
|
||||||
} from '../../utils';
|
} from '../../utils';
|
||||||
import { ContentItemModel, ExtendedOpenAPIOperation } from '../MenuBuilder';
|
import { ContentItemModel, ExtendedOpenAPIOperation } from '../MenuBuilder';
|
||||||
import { OpenAPIParser } from '../OpenAPIParser';
|
import { OpenAPIParser } from '../OpenAPIParser';
|
||||||
|
|
|
@ -162,7 +162,7 @@ export function humanizeConstraints(schema: OpenAPISchema): string[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortByRequired(
|
export function sortByRequired(
|
||||||
fields: { required: boolean; name: string }[],
|
fields: Array<{ required: boolean; name: string }>,
|
||||||
order: string[] = [],
|
order: string[] = [],
|
||||||
) {
|
) {
|
||||||
fields.sort((a, b) => {
|
fields.sort((a, b) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user