Skip to content

Commit cf30050

Browse files
Merge branch 'main' into guoda-ui-component-types-2
2 parents 1191ad3 + 326b01e commit cf30050

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1173
-817
lines changed

.changeset/pretty-buses-accept.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudoperators/juno-app-supernova": patch
3+
---
4+
5+
Transfer supernova to TypeScript

apps/supernova/eslint.config.mjs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,33 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import junoConfigs from "@cloudoperators/juno-config/eslint/juno.mjs"
6+
import junoConfigs from "@cloudoperators/juno-config/eslint/juno-typescript.mjs"
77

88
export default [
99
...junoConfigs,
1010
{
11-
files: ["**/*.js", "**/*.mjs", "**/*.jsx"],
12-
languageOptions: { sourceType: "module" },
11+
files: ["**/*.ts", "**/*.tsx"],
12+
languageOptions: {
13+
parserOptions: {
14+
project: ["./tsconfig.json"], // Ensure this points to your tsconfig.json
15+
},
16+
},
17+
// TODO: We need to make all of this checks on again, step by step
1318
rules: {
14-
// disable for now, till we switch to TypeScript
19+
"@typescript-eslint/no-unsafe-assignment": "off",
20+
"@typescript-eslint/no-unsafe-call": "off",
21+
"@typescript-eslint/no-unsafe-argument": "off",
22+
"@typescript-eslint/no-unsafe-return": "off",
23+
"@typescript-eslint/no-unsafe-member-access": "off",
24+
"@typescript-eslint/no-floating-promises": "off",
25+
"no-unused-vars": "off",
26+
"@typescript-eslint/restrict-plus-operands": "off",
27+
"react/no-unescaped-entities": "off",
28+
"@typescript-eslint/await-thenable": "off",
1529
"react/prop-types": "off",
30+
"prefer-const": "off",
31+
"react/jsx-no-comment-textnodes": "off",
1632
},
17-
},
18-
{
19-
ignores: ["setupTests.js"],
33+
ignores: ["vitest.config.ts", "vite.config.ts", "tailwind.config.ts"],
2034
},
2135
]

apps/supernova/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"dev": "vite",
4040
"build": "vite build",
4141
"build:static": "vite build --mode static",
42+
"typecheck": "tsc --project tsconfig.json --noEmit",
4243
"serve": "vite preview",
4344
"lint": "eslint",
4445
"clean": "rm -rf build && rm -rf node_modules && rm -rf .turbo",
File renamed without changes.

apps/supernova/src/App.jsx renamed to apps/supernova/src/App.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function App(props = {}) {
3636
w-full
3737
`
3838

39-
const fallbackRender = ({ error }) => {
39+
const fallbackRender = ({ error }: any) => {
4040
return (
4141
<div className="w-1/2">
4242
<CodeBlock className={preErrorClasses} copy={false}>
@@ -51,6 +51,7 @@ function App(props = {}) {
5151
<MessagesProvider>
5252
<CustomAppShell>
5353
<QueryClientProvider client={queryClient}>
54+
{/* @ts-expect-error TS(2322) FIXME: Type '{ props: {}; }' is not assignable to type 'I... Remove this comment to see the full error message */}
5455
<AppContent props={props} />
5556
</QueryClientProvider>
5657
</CustomAppShell>
@@ -59,15 +60,15 @@ function App(props = {}) {
5960
)
6061
}
6162

62-
const AppWithOldUrlStructure = (props) => {
63+
const AppWithOldUrlStructure = (props: any) => {
6364
// syncs navigation relevant states with the url for deep links
6465
// gets the state from the URL in the beginning
6566
// sets the URL from state information
6667
useUrlState()
6768
return <App {...props} />
6869
}
6970

70-
const AppWithNewUrlStructure = (props) => {
71+
const AppWithNewUrlStructure = (props: any) => {
7172
/**
7273
* [TODO]
7374
* move the URL state changes closer to the origins of the change
@@ -77,8 +78,9 @@ const AppWithNewUrlStructure = (props) => {
7778
return <App {...props} />
7879
}
7980

80-
const StyledApp = (props) => {
81+
const StyledApp = (props: any) => {
8182
return (
83+
// @ts-ignore
8284
<AppShellProvider theme={`${props.theme ? props.theme : "theme-dark"}`}>
8385
{/* load appstyles inside the shadow dom */}
8486
<style>{styles.toString()}</style>
File renamed without changes.

apps/supernova/src/api/alerts.js renamed to apps/supernova/src/api/alerts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55

66
import { sortAlerts, countAlerts } from "../lib/utils"
7-
let compareAlertString
7+
let compareAlertString: any
88

9-
export const fetchAlerts = async (endpoint) => {
9+
export const fetchAlerts = async (endpoint: any) => {
1010
try {
1111
const response = await fetch(`${endpoint}/alerts`)
1212

@@ -26,7 +26,7 @@ export const fetchAlerts = async (endpoint) => {
2626

2727
// copy additional filter options to labels for easier filter selection
2828
// because the alert object is nested this makes it a lot easier to filter, since we only use what is present in alert.labels
29-
alerts.forEach((alert) => {
29+
alerts.forEach((alert: any) => {
3030
if (alert.labels) {
3131
alert.labels.status = alert.status?.state
3232
}

apps/supernova/src/api/silences.js renamed to apps/supernova/src/api/silences.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
export const fetchSilences = async (endpoint) => {
6+
export const fetchSilences = async (endpoint: any) => {
77
try {
88
const response = await fetch(`${endpoint}/silences`)
99

@@ -29,7 +29,7 @@ export const fetchSilences = async (endpoint) => {
2929
}
3030
}
3131

32-
export const deleteSilences = async (variables) => {
32+
export const deleteSilences = async (variables: any) => {
3333
try {
3434
const response = await fetch(`${variables.endpoint}/silence/${variables.id}`, {
3535
method: "DELETE",
@@ -51,7 +51,7 @@ export const deleteSilences = async (variables) => {
5151
}
5252
}
5353

54-
export const createSilences = async (variables) => {
54+
export const createSilences = async (variables: any) => {
5555
try {
5656
const response = await fetch(`${variables.endpoint}/silences`, {
5757
method: "POST",

0 commit comments

Comments
 (0)