Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Plüddemann committed Jul 26, 2024
1 parent 4049c88 commit 708ea5e
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 309 deletions.
14 changes: 11 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"doc",
"public",
"screenshots",
"src/components/testing"
"src/components/testing",
"src/components/scenariotest"
]
},
"organizeImports": {
Expand All @@ -26,7 +27,10 @@
},
"noArrayIndexKey": {
"level": "off"
}
},
"noAssignInExpressions": "off",
"noImplicitAnyLet": "off",
"noPrototypeBuiltins": "off"
},
"a11y": {
"useButtonType": "off",
Expand All @@ -37,10 +41,14 @@
"noUselessElse": "off"
},
"complexity": {
"noForEach": "off"
"noForEach": "off",
"noBannedTypes": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
},
"security": {
"noDangerouslySetInnerHtml": "off"
}
}
},
Expand Down
43 changes: 13 additions & 30 deletions src/app/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,19 @@ const backendUrl = new URL(
* @returns {Promise<string[]>} A promise that resolves to an array of domain story IDs.
*/
export const readAllDomainStoryIds = async (): Promise<string[]> => {
try {
// Send a GET request to the backend's '/api/v2/domain-story/ids' endpoint.
// The 'cache' option is set to 'no-store' to prevent caching of the response.
const res = await fetch(`${backendUrl}/ids`, {
cache: "no-store",
});
try {
// Send a GET request to the backend's '/api/v2/domain-story/ids' endpoint.
// The 'cache' option is set to 'no-store' to prevent caching of the response.
const res = await fetch(`${backendUrl}/ids`, {
cache: "no-store",
});
// Send a GET request to the backend's '/api/v2/domain-story/ids' endpoint.
// The 'cache' option is set to 'no-store' to prevent caching of the response.
const res = await fetch(`${backendUrl}/ids`, {
next: { revalidate: 30 },
});

// If the response status is not OK, throw an error.
if (!res.ok) {
throw new Error(
`Failed to fetch domain story IDs: ${res.status} ${res.statusText}`,
);
}

// Parse the response as JSON and return it.
return await res.json();
} catch (error) {
// If an error occurs, log it to the console and rethrow it.
console.error("Error fetching domain story IDs:", error);
throw error;
}
} catch (error) {
// If an error occurs, log it to the console and rethrow it.
console.error("Error fetching domain story IDs:", error);
throw error;
// If the response status is not OK, throw an error.
if (!res.ok) {
throw new Error(
`Failed to fetch domain story IDs: ${res.status} ${res.statusText}`,
);
}

// Parse the response as JSON and return it.
return await res.json();
};
3 changes: 1 addition & 2 deletions src/components/ScenarioEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default function ScenarioEditor({
setShowLoadTestSpecifier: Dispatch<SetStateAction<boolean>>;
setShowResilienceTestSpecifier: Dispatch<SetStateAction<boolean>>;
}) {
const [selectedEdge, setSelectedEdge] = useState<Edge | null>(null);
const [selectedEdge, setSelectedEdge] = useState<Edge | null>(null);
const [selectedEdge] = useState<Edge | null>(null);

console.log(showMonitoringSpecifier);
return (
Expand Down
16 changes: 0 additions & 16 deletions src/components/ScenarioEditorTaskbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@ export default function ScenarioEditorTaskbar({
setShowResilienceTestSpecifier: Dispatch<SetStateAction<boolean>>;
setShowMonitoringSpecifier: Dispatch<SetStateAction<boolean>>;
}) {
return (
<>
<button
type="button"
onClick={() => setRqaExplorerShow((prevState) => !prevState)}
>
<div>
<EqualizerIcon />
</div>
</button>
<button
type="button"
onClick={() => setShowLoadTestSpecifier((prevState) => !prevState)}
>
<div className="icon-domain-story-loadtest" />
</button>
return (
<>
<button
Expand Down
9 changes: 0 additions & 9 deletions src/components/Taskbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ export default function Taskbar({
setShowResilienceTestSpecifier: Dispatch<SetStateAction<boolean>>;
setShowMonitoringSpecifier: Dispatch<SetStateAction<boolean>>;
}) {
return (
<div className="taskbar-container">
<button
type="button"
className="change-mode"
onClick={() => setScenarioMode((prevState) => !prevState)}
>
<div>{scenarioMode ? <CloudQueueIcon /> : <CloudOffIcon />}</div>
</button>
return (
<div className="taskbar-container">
<button
Expand Down
1 change: 0 additions & 1 deletion src/components/input/InputSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export function InputSelect<T>({
<option
// @ts-expect-error
value={optionValue ? option[optionValue] : (option as T)}
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
key={i}
>
{option[optionName] as ReactNode}
Expand Down
2 changes: 0 additions & 2 deletions src/components/input/InputSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ interface InputSliderProps {
label: string;
name: string;
value?: number | null;
// @ts-ignore noExplicitAny
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
onChange: (e: ChangeEvent<HTMLInputElement>, data: any) => void;
}

Expand Down
Loading

0 comments on commit 708ea5e

Please sign in to comment.