Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/multi-ec30208de6
Browse files Browse the repository at this point in the history
  • Loading branch information
aneuwald-ctw authored Jul 23, 2024
2 parents d97e47a + c8eb4d6 commit f7da8e0
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 92 deletions.
4 changes: 2 additions & 2 deletions ci/lint-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ async function getAllWorkspacePackages(roots: string[]) {
const patterns: string[] = Array.isArray(workspaceInfo.workspaces)
? workspaceInfo.workspaces
: Array.isArray(workspaceInfo.workspaces?.packages)
? workspaceInfo.workspaces.packages
: [];
? workspaceInfo.workspaces.packages
: [];
for (const pattern of patterns) {
for (const packagePath of await promisify(glob)(pattern)) {
workspacePackages.push(path.resolve(process.cwd(), workspaceRoot, packagePath));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"license-checker": "25.0.1",
"prettier": "3.0.3",
"prettier": "3.3.2",
"rimraf": "5.0.5",
"semver": "7.5.4",
"storybook": "7.6.20",
Expand All @@ -132,7 +132,7 @@
"@foxglove/log": "workspace:*",
"@foxglove/studio": "workspace:*",
"@mui/material": "5.13.5",
"react-use": "17.4.0",
"react-use": "17.5.1",
"rehype-raw": "6.1.1",
"vm-browserify": "1.1.2"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/mcap-support/src/parseFlatbufferSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ function typeForField(schema: SchemaT, field: FieldT): MessageDefinitionField[]
const enums = schema.enums[field.type.index]?.values;
if (enums == undefined) {
throw new Error(
`Invalid schema, missing enum values for field type ${schema.enums[field.type.index]
?.name}`,
`Invalid schema, missing enum values for field type ${
schema.enums[field.type.index]?.name
}`,
);
}
for (const enumVal of enums) {
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@foxglove/message-definition": "0.3.1",
"@foxglove/message-path": "workspace:*",
"@foxglove/ros1": "3.0.0",
"@foxglove/rosbag": "0.4.0",
"@foxglove/rosbag": "0.4.1",
"@foxglove/rosbag2-web": "4.1.1",
"@foxglove/roslibjs": "0.0.3",
"@foxglove/rosmsg": "4.2.2",
Expand Down Expand Up @@ -151,7 +151,7 @@
"react-refresh-typescript": "2.0.9",
"react-resize-detector": "10.0.1",
"react-transition-group": "4.4.5",
"react-use": "17.4.0",
"react-use": "17.5.1",
"react-virtualized": "9.22.5",
"react-window": "1.8.9",
"readable-stream": "4.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ function getPublicState(
props.topics === prevState?.mockProps.topics
? prevState?.public.sortedTopics ?? []
: props.topics
? [...props.topics].sort((a, b) => a.name.localeCompare(b.name))
: [],
? [...props.topics].sort((a, b) => a.name.localeCompare(b.name))
: [],
datatypes: props.datatypes ?? NO_DATATYPES,
setSubscriptions:
(props.setSubscriptions === prevState?.mockProps.setSubscriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const jumpSeek = (
modifierKeys?.altKey === true
? ARROW_SEEK_BIG_MS
: modifierKeys?.shiftKey === true
? ARROW_SEEK_SMALL_MS
: ARROW_SEEK_DEFAULT_MS;
? ARROW_SEEK_SMALL_MS
: ARROW_SEEK_DEFAULT_MS;
return fromMillis(timeMs + deltaMs * directionSign);
};
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ function NodeEditorComponent(props: NodeEditorProps): JSX.Element {
state.visibilityFilter === "visible"
? showVisibleFilter
: state.visibilityFilter === "invisible"
? showInvisibleFilter
: undefined;
? showInvisibleFilter
: undefined;
const childNodes = filterMap(prepareSettingsNodes(children ?? {}), ([key, child]) => {
return !filterFn || filterFn(child) ? (
<NodeEditor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ export function NumberInput(
inputRef.current === document.activeElement
? value
: value != undefined
? _.round(value, precision)
: undefined;
? _.round(value, precision)
: undefined;

return (
<TextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ export default function TimeBasedChartTooltipContent(
typeof tooltip.value === "string"
? tooltip.value
: typeof tooltip.value === "bigint"
? tooltip.value.toString()
: JSON.stringify(tooltip.value);
? tooltip.value.toString()
: JSON.stringify(tooltip.value);

return (
<Stack className={classes.root} data-testid="TimeBasedChartTooltipContent">
Expand All @@ -166,8 +166,8 @@ export default function TimeBasedChartTooltipContent(
typeof tooltip.value === "string"
? tooltip.value
: typeof tooltip.value === "bigint"
? tooltip.value.toString()
: JSON.stringify(tooltip.value);
? tooltip.value.toString()
: JSON.stringify(tooltip.value);

return (
<Fragment key={idx}>
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-base/src/components/TopicList/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function ContextMenu(props: {
? t("copyMessagePath")
: t("copyMessagePaths")
: messagePaths.length === 1
? t("copyTopicName")
: t("copyTopicNames"),
? t("copyTopicName")
: t("copyTopicNames"),
onClick: () => {
onClose();
copyToClipboard(messagePaths.map((item) => item.path).join("\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export class TimestampDatasetsBuilderImpl {
items.length < min
? items.map((item) => item.index)
: dataset.showLine === true
? downsampleTimeseries(items, downsampleViewport, maxPoints)
: downsampleScatter(items, downsampleViewport);
? downsampleTimeseries(items, downsampleViewport, maxPoints)
: downsampleScatter(items, downsampleViewport);

// When a series is downsampled the points are disabled as a visual indicator that
// data is downsampled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ class LinePrimitiveRenderable extends THREE.Object3D {
const singleColor = this.#color
? stringToRgba(tempRgba, this.#color)
: this.#primitive.colors.length === 0
? this.#primitive.color
: undefined;
? this.#primitive.color
: undefined;

if (singleColor == undefined) {
assert(this.#geometry, "Line Group geometry must exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ export class RenderableModels extends RenderablePrimitive {
const overrideColor = this.userData.settings.color
? stringToRgba(tempRgba, this.userData.settings.color)
: primitive.override_color
? primitive.color
: undefined;
? primitive.color
: undefined;
if (overrideColor) {
if (!renderable.material) {
renderable.material = new THREE.MeshStandardMaterial({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export class RenderableTriangles extends RenderablePrimitive {
const singleColor = this.userData.settings.color
? stringToRgba(tempRgba, this.userData.settings.color)
: primitive.colors.length === 0
? primitive.color
: undefined;
? primitive.color
: undefined;

if (!singleColor && !geometry.attributes.color) {
geometry.createAttribute("color", Uint8Array, 4, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export class TransformTree {
return cycleDetected
? AddTransformResult.CYCLE_DETECTED
: updated
? AddTransformResult.UPDATED
: AddTransformResult.NOT_UPDATED;
? AddTransformResult.UPDATED
: AddTransformResult.NOT_UPDATED;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-base/src/panels/diagnostics/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export function getDisplayName(hardwareId: string, name: string): string {
? `${hardwareId}: ${name}`
: `${name}`
: hardwareId.length > 0
? `${hardwareId}`
: `(empty)`;
? `${hardwareId}`
: `(empty)`;
}

// ensures the diagnostic status message's name consists of both the hardware id and the name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ export default class FoxgloveWebSocketPlayer implements Player {
const rosDataTypes = isRos1
? CommonRosTypes.ros1
: ["foxy", "galactic"].includes(rosDistro)
? CommonRosTypes.ros2galactic
: CommonRosTypes.ros2humble;
? CommonRosTypes.ros2galactic
: CommonRosTypes.ros2humble;

const dataTypes: MessageDefinitionMap = new Map();
for (const dataType in rosDataTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ function activateExtension(
process.env.NODE_ENV === "production"
? "production"
: process.env.NODE_ENV === "test"
? "test"
: "development";
? "test"
: "development";

const ctx: ExtensionContext = {
mode: extensionMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ export default class LayoutManager implements ILayoutManager {
data == undefined
? localLayout.working
: isLayoutEqual(localLayout.baseline.data, data)
? undefined
: { data, savedAt: now };
? undefined
: { data, savedAt: now };

// Renames of shared layouts go directly to the server
if (name != undefined && layoutIsShared(localLayout)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ function migrateLegacyToNew3DConfig(legacyConfig: Partial<Legacy3DConfig>): Rend
legacyConfig.followMode === "follow-orientation"
? "follow-pose"
: legacyConfig.followMode === "follow"
? "follow-position"
: "follow-none",
? "follow-position"
: "follow-none",
cameraState: {
...DEFAULT_CAMERA_STATE,
...legacyConfig.cameraState,
Expand Down
7 changes: 4 additions & 3 deletions packages/studio-base/src/util/naturalSort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import natsort from "natsort";

const sortFn = natsort({ insensitive: true });

type StringOrNumberFields<T> = T extends Record<string, unknown>
? { [K in keyof T]: T[K] extends string | number ? K : never }[keyof T]
: never;
type StringOrNumberFields<T> =
T extends Record<string, unknown>
? { [K in keyof T]: T[K] extends string | number ? K : never }[keyof T]
: never;

function naturalSort(): typeof sortFn;
function naturalSort<T, K extends StringOrNumberFields<T>>(key: K): (a: T, b: T) => number;
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@foxglove/electron-socket": "2.1.1",
"@foxglove/log": "workspace:*",
"@foxglove/mcap-support": "workspace:*",
"@foxglove/rosbag": "0.4.0",
"@foxglove/rosbag": "0.4.1",
"@foxglove/rostime": "1.1.2",
"@foxglove/studio-base": "workspace:*",
"@foxglove/theme": "workspace:*",
Expand Down Expand Up @@ -46,7 +46,7 @@
"react": "18.2.0",
"react-dom": "18.3.1",
"react-refresh-typescript": "2.0.9",
"react-use": "17.4.0",
"react-use": "17.5.1",
"tinycolor2": "1.6.0",
"tss-react": "4.9.2",
"utif": "3.1.0",
Expand Down
60 changes: 29 additions & 31 deletions packages/studio/src/immutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,36 @@ export type IsTuple<Type> = Type extends readonly any[]
: Type
: never;

export type IsUnknown<Type> = IsAny<Type> extends true
? false
: unknown extends Type
? true
: false;
export type IsUnknown<Type> =
IsAny<Type> extends true ? false : unknown extends Type ? true : false;

// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
export type IsAny<Type> = 0 extends 1 & Type ? true : false;

export type Immutable<Type> = Type extends Exclude<Builtin, Error>
? Type
: Type extends Map<infer Keys, infer Values>
? ReadonlyMap<Immutable<Keys>, Immutable<Values>>
: Type extends ReadonlyMap<infer Keys, infer Values>
? ReadonlyMap<Immutable<Keys>, Immutable<Values>>
: Type extends WeakMap<infer Keys, infer Values>
? WeakMap<Immutable<Keys>, Immutable<Values>>
: Type extends Set<infer Values>
? ReadonlySet<Immutable<Values>>
: Type extends ReadonlySet<infer Values>
? ReadonlySet<Immutable<Values>>
: Type extends WeakSet<infer Values>
? WeakSet<Immutable<Values>>
: Type extends Promise<infer Value>
? Promise<Immutable<Value>>
: Type extends AnyArray<infer Values>
? Type extends IsTuple<Type>
? { readonly [Key in keyof Type]: Immutable<Type[Key]> }
: ReadonlyArray<Immutable<Values>>
: // eslint-disable-next-line @typescript-eslint/ban-types
Type extends {}
? { readonly [Key in keyof Type]: Immutable<Type[Key]> }
: IsUnknown<Type> extends true
? unknown
: Readonly<Type>;
export type Immutable<Type> =
Type extends Exclude<Builtin, Error>
? Type
: Type extends Map<infer Keys, infer Values>
? ReadonlyMap<Immutable<Keys>, Immutable<Values>>
: Type extends ReadonlyMap<infer Keys, infer Values>
? ReadonlyMap<Immutable<Keys>, Immutable<Values>>
: Type extends WeakMap<infer Keys, infer Values>
? WeakMap<Immutable<Keys>, Immutable<Values>>
: Type extends Set<infer Values>
? ReadonlySet<Immutable<Values>>
: Type extends ReadonlySet<infer Values>
? ReadonlySet<Immutable<Values>>
: Type extends WeakSet<infer Values>
? WeakSet<Immutable<Values>>
: Type extends Promise<infer Value>
? Promise<Immutable<Value>>
: Type extends AnyArray<infer Values>
? Type extends IsTuple<Type>
? { readonly [Key in keyof Type]: Immutable<Type[Key]> }
: ReadonlyArray<Immutable<Values>>
: // eslint-disable-next-line @typescript-eslint/ban-types
Type extends {}
? { readonly [Key in keyof Type]: Immutable<Type[Key]> }
: IsUnknown<Type> extends true
? unknown
: Readonly<Type>;
Loading

0 comments on commit f7da8e0

Please sign in to comment.