Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbjordan committed Dec 7, 2023
1 parent 96ca403 commit 5eb5c2b
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ITwinSavedViewsClient implements SavedViewsClient {
public async getSingularSavedView(args: GetSingularSavedViewParams): Promise<SavedViewWithDataRepresentation> {
const response = await this.client.getSavedViewRepresentation({
savedViewId: args.savedViewId,
signal: args.signal
signal: args.signal,
});
return response.savedView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ function renderSavedView(onRenderSelectedView: ((selectedView: string) => void)
if (onRenderSelectedView) {
return () => onRenderSelectedView(savedViewId)
} else {
// alert("No view renderer defined");
console.log("No view renderer defined");
return () => {};
}

}

function isOverflowing(element: HTMLElement): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
import { IModelReadRpcInterface, ViewQueryParams, ViewStateProps } from '@itwin/core-common';
import { IModelReadRpcInterface, ViewQueryParams, ViewStateProps } from "@itwin/core-common";
import {
DrawingViewState, IModelConnection, SheetViewState, SpatialViewState, ViewState
} from '@itwin/core-frontend';
DrawingViewState, IModelConnection, SheetViewState, SpatialViewState, ViewState,
} from "@itwin/core-frontend";
import {
Extension, SavedViewWithDataRepresentation, ViewData, ViewDataItwin3d, ViewDataITwinDrawing,
ViewDataITwinSheet
} from '@itwin/saved-views-client';
ViewDataITwinSheet,
} from "@itwin/saved-views-client";

import { ViewTypes } from '../../../SavedViewTypes.js';
import { ViewTypes } from "../../../SavedViewTypes.js";
import {
isDrawingSavedView, isSheetSavedView, isSpatialSavedView
} from '../../clients/ISavedViewsClient.js';
isDrawingSavedView, isSheetSavedView, isSpatialSavedView,
} from "../../clients/ISavedViewsClient.js";
import {
SavedView as LegacySavedView, SavedView2d as LegacySavedView2d,
SavedViewBase as LegacySavedViewBase
} from '../SavedViewTypes.js';
SavedViewBase as LegacySavedViewBase,
} from "../SavedViewTypes.js";
import {
cleanLegacyViewModelSelectorPropsModels, savedViewITwin3dToLegacy3dSavedView,
savedViewItwinDrawingToLegacyDrawingView, savedViewItwinSheetToLegacySheetSavedView
} from './viewExtractorSavedViewToLegacySavedView.js';
savedViewItwinDrawingToLegacyDrawingView, savedViewItwinSheetToLegacySheetSavedView,
} from "./viewExtractorSavedViewToLegacySavedView.js";

/*
* Converts a Saved View into an iTwin.js-style ViewState
Expand Down Expand Up @@ -73,7 +73,7 @@ async function translateSavedViewToLegacySavedView(

const actual = savedViewITwin3dToLegacy3dSavedView(
savedView,
iModelViewData as SpatialViewState
iModelViewData as SpatialViewState,
);
legacySavedView = actual;
} else if (isSavedViewItwinDrawing(savedViewData)) {
Expand All @@ -83,7 +83,7 @@ async function translateSavedViewToLegacySavedView(
);
const actual = savedViewItwinDrawingToLegacyDrawingView(
savedView,
iModelViewData as DrawingViewState
iModelViewData as DrawingViewState,
);
legacySavedView = actual;
} else if (isSavedViewItwinSheet(savedViewData)) {
Expand All @@ -93,12 +93,12 @@ async function translateSavedViewToLegacySavedView(
);
const actual = savedViewItwinSheetToLegacySheetSavedView(
savedView,
iModelViewData as SheetViewState
iModelViewData as SheetViewState,
);
legacySavedView = actual;
} else {
throw new Error(
"Could not translate itwin-saved-views API response to a SavedViewBaseSetting"
"Could not translate itwin-saved-views API response to a SavedViewBaseSetting",
);
}

Expand Down Expand Up @@ -130,9 +130,9 @@ async function fetchIModelViewData(viewClassName: ViewTypes, iModelConnection: I
// }
const viewId = await getDefaultViewIdFromClassName(
iModelConnection,
viewClassName
viewClassName,
);
let seedViewState = await iModelConnection.views.load(viewId);
const seedViewState = await iModelConnection.views.load(viewId);
// this._seedViewStates.set(viewClassName, seedViewState);
return seedViewState;
}
Expand All @@ -141,7 +141,7 @@ async function fetchIModelViewData(viewClassName: ViewTypes, iModelConnection: I
// method shared some implementation with getDefaultViewId
async function getDefaultViewIdFromClassName(
iModelConnection: IModelConnection,
savedViewType: ViewTypes
savedViewType: ViewTypes,
) {
let viewFullName = undefined;
switch (savedViewType) {
Expand All @@ -157,7 +157,6 @@ async function getDefaultViewIdFromClassName(
default:
throw new Error("Unrecognized View Type");
}
// eslint-disable-next-line deprecation/deprecation
const viewId = await iModelConnection.views.queryDefaultViewId();
const params: ViewQueryParams = {};
params.from = viewFullName;
Expand All @@ -167,7 +166,7 @@ async function getDefaultViewIdFromClassName(
const viewProps =
await IModelReadRpcInterface.getClient().queryElementProps(
iModelConnection.getRpcProps(),
params
params,
);
if (viewProps.length === 0) {
// Return the first view we can find
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const isPoint = (val: unknown): val is [number, number, number] =>
val.every((num: unknown) => typeof num === "number");

const isTransformRow = (
value: unknown
value: unknown,
): value is [number, number, number, number] =>
Array.isArray(value) &&
value.length === 4 &&
Expand All @@ -33,7 +33,7 @@ const clipPrimitiveShapeMappings: ExtractionFunc<void, void>[] = [
extractBoolean("mask"),
extractBoolean("invisible"),
],
"shape"
"shape",
),
];

Expand All @@ -47,7 +47,7 @@ const clipPlaneMappings: ExtractionFunc<void, void>[] = [
const clipPrimitivePlaneMappings: ExtractionFunc<void, void>[] = [
extractObject(
[extractArray2d(clipPlaneMappings, "clips"), extractBoolean("invisible")],
"planes"
"planes",
),
];

Expand All @@ -64,7 +64,7 @@ const clipVectorMappings: ExtractionFunc<void, void>[] = [
},
],
"clip",
"clipVectors"
"clipVectors",
),
];

Expand All @@ -78,6 +78,7 @@ export const extractClipVectors = (input: object) => {
return undefined;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const output: any = {};
applyExtraction(viewDetails, output, clipVectorMappings);
return output.clipVectors;
Expand Down
Loading

0 comments on commit 5eb5c2b

Please sign in to comment.