Skip to content

Commit 6ba8d51

Browse files
committed
Fix eslint errors
1 parent e1a4cd7 commit 6ba8d51

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ jobs:
2828
env:
2929
SARIF_ESLINT_IGNORE_SUPPRESSED: "true"
3030
run: npx eslint src/**/*
31-
--config .eslint.config.mjs
31+
--config eslint.config.mjs
3232
--format @microsoft/eslint-formatter-sarif
3333
--output-file eslint-results.sarif
3434
continue-on-error: true
3535

3636
- name: Upload analysis results to GitHub
37-
uses: github/codeql-action/upload-sarif@v3
37+
uses: github/codeql-action/upload-sarif@v4
3838
with:
3939
sarif_file: eslint-results.sarif
4040
wait-for-processing: true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default [
1111
{ plugins: {
1212
'@stylistic/js': stylisticJs
1313
}, rules: {
14-
'@stylistic/js/indent': ['error', 4],
14+
'@stylistic/js/indent': ['error', 4, { "SwitchCase": 1 }],
1515
'@typescript-eslint/no-wrapper-object-types': 'off'
1616
}
1717
},

src/messaging/Message.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Interrupt = WARDuino.Interrupt;
1111
import State = WARDuino.State;
1212
import Value = WASM.Value;
1313
import Type = WASM.Type;
14+
import Float = WASM.Float;
1415

1516
// An acknowledgement returned by the debugger
1617
export interface Ack {
@@ -177,9 +178,7 @@ export namespace Message {
177178
switch (arg.type) {
178179
case WASM.Float.f32:
179180
case WASM.Float.f64:
180-
const buff = Buffer.alloc(arg.type === Float.f32 ? 4 : 8);
181-
ieee754.write(buff, <number>arg.value, 0, true, arg.type === Float.f32 ? 23 : 52, buff.length); // TODO write BigInt without loss of precision (don't use ieee754.write)
182-
payload += buff.toString('hex');
181+
payload += ieeefloat(<Value<Float>>arg)
183182
break;
184183
case WASM.Integer.i32:
185184
case WASM.Integer.i64:
@@ -226,3 +225,9 @@ export namespace Message {
226225
}
227226
};
228227
}
228+
229+
function ieeefloat(arg: Value<Float>): String {
230+
const buff = Buffer.alloc(arg.type === Float.f32 ? 4 : 8);
231+
ieee754.write(buff, <number>arg.value, 0, true, arg.type === Float.f32 ? 23 : 52, buff.length); // TODO write BigInt without loss of precision (don't use ieee754.write)
232+
return buff.toString('hex');
233+
}

src/messaging/Parsers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function breakpointHitParser(text: string): Breakpoint {
5959
throw new Error('Could not messaging BREAKPOINT address in ack.');
6060
}
6161

62+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6263
function stacking(objects: {value: any, type: any}[]): WASM.Value<Type>[] {
6364
const stacked: WASM.Value<Type>[] = [];
6465
for (const object of objects) {

src/sourcemap/Wasm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export namespace WASM {
3232
value: T extends Float ? number : bigint;
3333
}
3434

35-
export interface Nothing extends Value<Type> {}
35+
export type Nothing = Value<Type>
3636

3737
export const nothing: Nothing = {
3838
type: Special.nothing, value: 0

0 commit comments

Comments
 (0)