-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
build: Move to es2021, fix some typing problems #21391
Conversation
martinpitt
commented
Dec 6, 2024
•
edited
Loading
edited
- machine_core: Retry ws container removal bots#7185
This is still a bit on the new-ish side [1], and for type checking we'd need to update to es2023. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex
This makes String.replaceAll() available, which we use a lot.
These cannot be declared within JavaScript/Tyepscript, as their types depend on the playground manifest and our internal D-Bus server.
Don't mix boolean and number, that's too confusing (one instance of TS2365 "Operator '<=' cannot be applied to types 'boolean' and 'number'."). Declare it as an optional number (i.e. `null`able), and help the type checker with an assertion.
@@ -144,7 +144,7 @@ export function Router(callbacks) { | |||
} | |||
|
|||
unique_id += 1; | |||
const seed = (cockpit.transport.options["channel-seed"] || "undefined:") + unique_id + "!"; | |||
const seed = (cockpit.transport.options["channel-seed"] || "undefined:") + unique_id.toString() + "!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
This failure repeats, needs investigation. |
@@ -32,7 +32,7 @@ const pkgOptions = { | |||
nodePaths, | |||
outbase: './pkg', | |||
outdir: "./dist", | |||
target: ['es2020'], | |||
target: ['es2021'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be lib, we don't want to target es2021 in the end result of the transpilation 5f68dfe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want half of our code 2021 and half 2020. Let's stick to one standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright! Would have also liked a .eslintrc.json downgrade but we can do that later.
I debugged the failure. It's completely unrelated to the changes here, they just trigger 3x affected retries. Fixed in cockpit-project/bots#7185 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I guess this was all the trivial stuff? :)
@jelly not all of it, I spent an hour on this and thought "this is big enough for a CI run". I'm sure there's much more low-hanging fruit. |