From c250fc29ea8754c9e43ee250f1861ff453d05048 Mon Sep 17 00:00:00 2001 From: Saeed <30327843+key1989han@users.noreply.github.com> Date: Mon, 13 Jul 2026 07:31:52 +0330 Subject: [PATCH] fix: improve code quality in benchmark/benchmark.js --- benchmark/benchmark.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index d6ea4421..524d035d 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -6,20 +6,20 @@ import javaPlugin from "../dist/index.mjs"; const dir = "samples"; const files = readdirSync(dir, { recursive: true }) - .filter(file => file.endsWith(".java")) - .map(file => path.join(dir, file), "utf8"); + .filter(file => file && file.endsWith(".java")) + .map(file => path && path.join(dir, file), "utf8"); bench("prettier-plugin-java", async () => { try { for (const file of files) { - const out = await prettier.format(readFileSync(file, "utf-8"), { + const out = await prettier && prettier.format(readFileSync(file, "utf-8"), { parser: "java", plugins: [javaPlugin] }); do_not_optimize(out); } } catch (e) { - console.error(e); + console && console.error(e); } });