Fix lint and prettier

This commit is contained in:
David Corbitt
2023-07-18 11:11:20 -07:00
parent 374d0237ee
commit 999a4c08fa
4 changed files with 14 additions and 9 deletions

View File

@@ -19,6 +19,7 @@ export const ScenariosHeader = ({
return (
<GridItem
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ref={ref as any}
display="flex"
alignItems="flex-end"

View File

@@ -9,7 +9,7 @@ export function escapeQuotes(str: string) {
// Escape regex special characters
export function escapeRegExp(str: string) {
return str.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
return str.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
}
export function fillTemplate(template: string, variables: VariableMap): string {

View File

@@ -80,7 +80,9 @@ export const runOneEval = async (
const stringifiedMessage = message.content ?? JSON.stringify(message.function_call);
const matchRegex = escapeRegExp(fillTemplate(escapeQuotes(evaluation.value), scenario.variableValues as VariableMap));
const matchRegex = escapeRegExp(
fillTemplate(escapeQuotes(evaluation.value), scenario.variableValues as VariableMap),
);
switch (evaluation.evalType) {
case "CONTAINS":

View File

@@ -68,20 +68,22 @@ export const useElementDimensions = (): [RefObject<HTMLElement>, Dimensions | un
useEffect(() => {
if (ref.current) {
const observer = new ResizeObserver(entries => {
entries.forEach(entry => {
const observer = new ResizeObserver((entries) => {
entries.forEach((entry) => {
setDimensions(entry.contentRect);
});
});
observer.observe(ref.current);
const observedRef = ref.current;
observer.observe(observedRef);
// Cleanup the observer on component unmount
return () => {
if (ref.current) {
observer.unobserve(ref.current);
}
if (observedRef) {
observer.unobserve(observedRef);
}
};
}
}, []);