Skip to content

Commit

Permalink
fix: fix overzealous eslint-plugin-perfectionist object ordering
Browse files Browse the repository at this point in the history
closes #187

Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Nov 13, 2024
1 parent 81424e0 commit 63f1078
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions src/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,25 @@ export class Bench extends EventTarget {
if (task.result) {
return task.result.error
? {
'Task name': task.name,
// eslint-disable-next-line perfectionist/sort-objects
Error: task.result.error.message,
Samples: task.result.latency.samples.length,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Stack: task.result.error.stack!,
'Task name': task.name,
// eslint-disable-next-line perfectionist/sort-objects
Samples: task.result.latency.samples.length,
}
: (convert?.(task) ?? {
'Task name': task.name,
// eslint-disable-next-line perfectionist/sort-objects
'Latency average (ns)': `${mToNs(task.result.latency.mean).toFixed(2)} \xb1 ${task.result.latency.rme.toFixed(2)}%`,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
'Latency median (ns)': `${mToNs(task.result.latency.p50!).toFixed(2)}${Number.parseFloat(mToNs(task.result.latency.mad!).toFixed(2)) > 0 ? ` \xb1 ${mToNs(task.result.latency.mad!).toFixed(2)}` : ''}`,
Samples: task.result.latency.samples.length,
'Task name': task.name,
'Throughput average (ops/s)': `${task.result.throughput.mean.toFixed(0)} \xb1 ${task.result.throughput.rme.toFixed(2)}%`,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
'Throughput median (ops/s)': `${task.result.throughput.p50!.toFixed(0)}${Number.parseInt(task.result.throughput.mad!.toFixed(0), 10) > 0 ? ` \xb1 ${task.result.throughput.mad!.toFixed(0)}` : ''}`,
// eslint-disable-next-line perfectionist/sort-objects
Samples: task.result.latency.samples.length,
})
}
return null
Expand Down
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ export const runtimeVersion: string = (() => {
'OSS Release Version'
] as string
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
if (runtime === JSRuntime.v8) return (globalThis as any).version?.() as string
if (runtime === JSRuntime.v8) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
return (globalThis as any).version?.() as string
}
if (runtime === JSRuntime['quickjs-ng']) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
return (globalThis as any).navigator?.userAgent?.split?.('/')[1] as string
Expand Down

0 comments on commit 63f1078

Please sign in to comment.