Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: re-enable typecheck for stories. #1591

Merged
merged 13 commits into from
Jul 7, 2023
398 changes: 10 additions & 388 deletions typescript/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion typescript/packages/group-tree/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/"]
"include": ["src/"],
"exclude": ["src/test", "./**/*.test.tsx", "./**/*.stories.tsx", "./**/*.stories.jsx", "./storybook"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import {
} from "./components/Map";
import { WellsLayer, MapLayer } from "./layers";
import InfoCard from "./components/InfoCard";
import { ExtendedLayerProps, LayerPickInfo } from "./layers/utils/layerTools";
import {
ExtendedLayerProps,
LayerPickInfo,
PropertyDataType,
} from "./layers/utils/layerTools";
import { WellsPickInfo } from "./layers/wells/wellsLayer";
import { FeatureCollection } from "geojson";
import { Feature } from "geojson";
import { ViewFooter } from "./components/ViewFooter";
import { styled } from "@mui/material/styles";
import Switch from "@mui/material/Switch";
Expand Down Expand Up @@ -169,7 +173,7 @@ const tooltipImpFunc: TooltipCallback = (
outputString += processPropInfo(properties, true);
} else if (layerName === "WellsLayer") {
const wellsPickInfo = info as WellsPickInfo;
const wellsPickInfoObject = info.object as FeatureCollection;
const wellsPickInfoObject = info.object as Feature;
const wellProperties = wellsPickInfoObject.properties;
const name = (wellProperties as { name: string }).name;
outputString += `Well: ${name || ""}`;
Expand Down Expand Up @@ -274,12 +278,16 @@ const MultiViewAnnotationTemplate: ComponentStory<typeof SubsurfaceViewer> = (
) => (
<SubsurfaceViewer {...args}>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_1">
<ContinuousLegend min={-3071} max={41048} />
<ViewFooter>kH netmap</ViewFooter>
</View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_2">
<ContinuousLegend min={2725} max={3396} />
<ViewFooter>Hugin</ViewFooter>
Expand Down Expand Up @@ -409,10 +417,14 @@ const MouseEventStory = (args: { show3d: boolean }) => {

return (
<SubsurfaceViewer {...useProps}>
<View id="test">
{getReadout(event)}
<ViewFooter>Mouse event example</ViewFooter>
</View>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="test">
{getReadout(event)}
<ViewFooter>Mouse event example</ViewFooter>
</View>
}
</SubsurfaceViewer>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export default {
title: "SubsurfaceViewer / Box Selection Layer",
} as Meta;

export const boxSelection = ({ enableSelection }) => {
export const boxSelection = ({
enableSelection,
}: {
enableSelection: boolean;
}) => {
const deckProps = React.useMemo(
() => ({
...DECK_PROPS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,26 @@ const MatrixStory = () => {
views={views}
bounds={bounds}
>
<View id="view_1"></View>
<View id="view_2"></View>
<View id="view_3"></View>
<View id="view_4"></View>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_1"></View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_2"></View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_3"></View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_4"></View>
}
</SubsurfaceViewer>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,8 @@ const MapLayerColorSelectorTemplate: ComponentStory<typeof SubsurfaceViewer> = (
return (
<SubsurfaceViewer {...args} layers={updatedLayerData}>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_1">
<div style={{ marginTop: 50 }}>
<ColorLegend
Expand Down Expand Up @@ -1333,22 +1335,38 @@ const ContourLinesStory = (props: {
]}
views={views}
>
<View id="view_1">
<ViewFooter>Default - no contour lines</ViewFooter>
</View>
<View id="view_2">
<ViewFooter>
Contour lines enabled - default is Z value
</ViewFooter>
</View>
<View id="view_3">
<ViewFooter>Contour lines on property value</ViewFooter>
</View>
<View id="view_4">
<ViewFooter>
Contour lines on flat map - default is property value
</ViewFooter>
</View>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_1">
<ViewFooter>Default - no contour lines</ViewFooter>
</View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_2">
<ViewFooter>
Contour lines enabled - default is Z value
</ViewFooter>
</View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_3">
<ViewFooter>Contour lines on property value</ViewFooter>
</View>
}
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-expect-error */
<View id="view_4">
<ViewFooter>
Contour lines on flat map - default is property value
</ViewFooter>
</View>
}
</SubsurfaceViewer>
);
};
Expand Down
3 changes: 2 additions & 1 deletion typescript/packages/subsurface-viewer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/"]
"include": ["src/"],
"exclude": ["src/test", "./**/*.test.tsx", "./**/*.stories.tsx", "./**/*.stories.jsx", "./storybook"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ import React from "react";
import { Provider } from "react-redux";
import { createReduxStore } from "../redux/store";
import { testState } from "./testReduxState";
import { DecoratorFunction } from "@storybook/addons";
import { DecoratorFunction } from "@storybook/csf";

// A super-simple mock of a redux store
const testStore = createReduxStore(testState);

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
export const withReduxDecorator: DecoratorFunction<JSX.Element> = (Story) => (
<Provider store={testStore}>
<Story />
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<Story />
}
</Provider>
);
3 changes: 2 additions & 1 deletion typescript/packages/well-completions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/"]
"include": ["src/"],
"exclude": ["src/test", "./**/*.test.tsx", "./**/*.stories.tsx", "./**/*.stories.jsx"]
}
3 changes: 2 additions & 1 deletion typescript/packages/well-log-viewer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/"]
"include": ["src/"],
"exclude": ["src/demo", "./**/*.test.tsx", "./**/*.stories.tsx", "./**/*.stories.jsx"]
}
1 change: 0 additions & 1 deletion typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"exclude": [
"**/*.test.tsx",
"**/test/*.tsx",
"**/*.stories.tsx",
"**/*.stories.jsx",
"./cypress.config.ts",
"**/*.test.ts"
Expand Down