Skip to content

Commit cbf2203

Browse files
build: bump prettier to 3 and typescript to 5.6
The format target was broken on `packages/core/rollup.config.ts` because prettier 2 cannot parse the modern `with { type: "json" }` import attribute syntax. Bump prettier to ^3.8.3 (and prettier-plugin-organize- imports to ^4.3.0 for compatibility), and align the other rollup configs to `with` so the repo uses one syntax. The organize-imports plugin parses through the workspace's installed TypeScript, so bump TypeScript to ^5.6.3 too — 4.9.4 also rejects the `with` syntax. Drop the explicit `Promise<typeof import("tinybench")>` return type on WalltimeRunner.importTinybench(); TS 5.x's stricter type equality flags it as incompatible with the inferred type on vitest's NodeBenchmarkRunner base class. Reformat ~30 source files where prettier 3's new `trailingComma: "all"` default added trailing commas after multi-line arguments. Refs COD-2721 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9c525e9 commit cbf2203

40 files changed

Lines changed: 230 additions & 235 deletions

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
"jest": "^29.5.0",
3232
"jest-config": "^29.5.0",
3333
"lerna": "^6.6.1",
34-
"prettier": "^2.8.7",
35-
"prettier-plugin-organize-imports": "^3.2.2",
34+
"prettier": "^3.8.3",
35+
"prettier-plugin-organize-imports": "^4.3.0",
3636
"rollup": "^4.47.1",
3737
"rollup-plugin-dts": "^6.1.0",
3838
"rollup-plugin-esbuild": "^6.1.0",
3939
"ts-jest": "^29.1.0",
4040
"tslib": "^2.5.0",
4141
"turbo": "^2.5.6",
42-
"typescript": "4.9.4"
42+
"typescript": "^5.6.3"
4343
},
4444
"packageManager": "pnpm@10.12.4",
4545
"engines": {

packages/benchmark.js-plugin/benches/parsePr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function sendEvent(numberOfOperations: number): void {
1313

1414
function logMetrics(
1515
numberOfOperations: number,
16-
numberOfDeepOperations: number
16+
numberOfDeepOperations: number,
1717
): void {
1818
for (let i = 0; i < numberOfOperations; i++) {
1919
for (let i = 0; i < numberOfOperations; i++) {

packages/benchmark.js-plugin/benches/sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import parsePr from "./parsePr";
55
const LONG_BODY =
66
new Array(1_000)
77
.fill(
8-
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt, earum. Atque architecto vero veniam est tempora fugiat sint quo praesentium quia. Autem, veritatis omnis beatae iste delectus recusandae animi non."
8+
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt, earum. Atque architecto vero veniam est tempora fugiat sint quo praesentium quia. Autem, veritatis omnis beatae iste delectus recusandae animi non.",
99
)
1010
.join("\n") + "fixes #123";
1111

packages/benchmark.js-plugin/rollup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from "rollup";
22
import { declarationsPlugin, jsPlugins } from "../../rollup.options";
3-
import pkg from "./package.json" assert { type: "json" };
3+
import pkg from "./package.json" with { type: "json" };
44

55
const entrypoint = "src/index.ts";
66

packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ describe("buildSuiteAdd", () => {
1818
suite.add({ name: "test", fn: emptyBench });
1919
suite.forEach((bench: CodSpeedBenchmark) =>
2020
expect(bench.uri).toBe(
21-
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test"
22-
)
21+
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test",
22+
),
2323
);
2424
});
2525

@@ -28,8 +28,8 @@ describe("buildSuiteAdd", () => {
2828
suite.add(emptyBench, { name: "test" });
2929
suite.forEach((bench: CodSpeedBenchmark) =>
3030
expect(bench.uri).toBe(
31-
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test"
32-
)
31+
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test",
32+
),
3333
);
3434
});
3535

@@ -38,8 +38,8 @@ describe("buildSuiteAdd", () => {
3838
suite.add("test", { fn: emptyBench });
3939
suite.forEach((bench: CodSpeedBenchmark) =>
4040
expect(bench.uri).toBe(
41-
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test"
42-
)
41+
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test",
42+
),
4343
);
4444
});
4545

@@ -48,8 +48,8 @@ describe("buildSuiteAdd", () => {
4848
suite.add("test", emptyBench);
4949
suite.forEach((bench: CodSpeedBenchmark) =>
5050
expect(bench.uri).toBe(
51-
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test"
52-
)
51+
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::test",
52+
),
5353
);
5454
});
5555

@@ -59,8 +59,8 @@ describe("buildSuiteAdd", () => {
5959
suite.add("test", emptyBench);
6060
suite.forEach((bench: CodSpeedBenchmark) =>
6161
expect(bench.uri).toBe(
62-
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::suite::test"
63-
)
62+
"packages/benchmark.js-plugin/src/__tests__/buildSuiteAdd.test.ts::suite::test",
63+
),
6464
);
6565
});
6666

packages/benchmark.js-plugin/src/index.ts

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ declare const __VERSION__: string;
1818

1919
tryIntrospect();
2020

21-
interface WithCodSpeedBenchmark
22-
extends Omit<
23-
Benchmark,
24-
"run" | "abort" | "clone" | "compare" | "emit" | "off" | "on" | "reset"
25-
> {
21+
interface WithCodSpeedBenchmark extends Omit<
22+
Benchmark,
23+
"run" | "abort" | "clone" | "compare" | "emit" | "off" | "on" | "reset"
24+
> {
2625
abort(): WithCodSpeedBenchmark;
2726
clone(options: Benchmark.Options): WithCodSpeedBenchmark;
2827
compare(benchmark: Benchmark): number;
2928
off(
3029
type?: string,
31-
listener?: CallableFunction
30+
listener?: CallableFunction,
3231
): Benchmark | Promise<Benchmark>;
3332
off(types: string[]): WithCodSpeedBenchmark;
3433
on(type?: string, listener?: CallableFunction): WithCodSpeedBenchmark;
@@ -38,31 +37,30 @@ interface WithCodSpeedBenchmark
3837
run(options?: Benchmark.Options): Benchmark | Promise<Benchmark>;
3938
}
4039

41-
export interface WithCodSpeedSuite
42-
extends Omit<
43-
Benchmark.Suite,
44-
| "run"
45-
| "abort"
46-
| "clone"
47-
| "compare"
48-
| "emit"
49-
| "off"
50-
| "on"
51-
| "reset"
52-
| "add"
53-
| "filter"
54-
| "each"
55-
| "forEach"
56-
> {
40+
export interface WithCodSpeedSuite extends Omit<
41+
Benchmark.Suite,
42+
| "run"
43+
| "abort"
44+
| "clone"
45+
| "compare"
46+
| "emit"
47+
| "off"
48+
| "on"
49+
| "reset"
50+
| "add"
51+
| "filter"
52+
| "each"
53+
| "forEach"
54+
> {
5755
abort(): WithCodSpeedSuite;
5856
add(
5957
name: string,
6058
fn: CallableFunction | string,
61-
options?: Benchmark.Options
59+
options?: Benchmark.Options,
6260
): WithCodSpeedSuite;
6361
add(
6462
fn: CallableFunction | string,
65-
options?: Benchmark.Options
63+
options?: Benchmark.Options,
6664
): WithCodSpeedSuite;
6765
add(name: string, options?: Benchmark.Options): WithCodSpeedSuite;
6866
add(options: Benchmark.Options): WithCodSpeedSuite;
@@ -94,7 +92,7 @@ function withCodSpeedBenchmark(bench: Benchmark): WithCodSpeedBenchmark {
9492
const rawRun = bench.run;
9593
bench.run = (options?: Benchmark.Options) => {
9694
console.warn(
97-
`[CodSpeed] bench detected but no instrumentation found, falling back to benchmark.js`
95+
`[CodSpeed] bench detected but no instrumentation found, falling back to benchmark.js`,
9896
);
9997
return rawRun.bind(bench)(options);
10098
};
@@ -124,7 +122,7 @@ function withCodSpeedSuite(suite: Benchmark.Suite): WithCodSpeedSuite {
124122
const rawRun = suite.run;
125123
suite.run = (options?: Benchmark.Options) => {
126124
console.warn(
127-
`[CodSpeed] ${suite.length} benches detected but no instrumentation found, falling back to benchmark.js`
125+
`[CodSpeed] ${suite.length} benches detected but no instrumentation found, falling back to benchmark.js`,
128126
);
129127
return rawRun.bind(suite)(options);
130128
};
@@ -135,7 +133,7 @@ function withCodSpeedSuite(suite: Benchmark.Suite): WithCodSpeedSuite {
135133
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-ts-comment
136134
// @ts-ignore
137135
suite.run = async function (
138-
options?: Benchmark.Options
136+
options?: Benchmark.Options,
139137
): Promise<Benchmark.Suite> {
140138
const suiteName = suite.name;
141139
const benches = this as unknown as BenchmarkWithOptions[];
@@ -231,7 +229,7 @@ async function runBenchmarks({
231229
* Dynamically setup the CodSpeed instruments.
232230
*/
233231
export async function setupInstruments(
234-
body: SetupInstrumentsRequestBody
232+
body: SetupInstrumentsRequestBody,
235233
): Promise<SetupInstrumentsResponse> {
236234
if (!InstrumentHooks.isInstrumented()) {
237235
console.warn("[CodSpeed] No instrumentation found, using default mongoUrl");

0 commit comments

Comments
 (0)