From 9ecf13fcea3d1f2f8d5091ee8eab2754d94b4cbf Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Mon, 25 May 2026 00:47:02 +0000 Subject: [PATCH] [Refactor] Use .find() in error-handler Replace `.filter(...)[0]` with `.find(...)` in `cleanStackFrameFilePath` for improved readability and to leverage short-circuiting. --- packages/cli-kit/src/public/node/error-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli-kit/src/public/node/error-handler.ts b/packages/cli-kit/src/public/node/error-handler.ts index 5735d2b823a..d639c9d3d33 100644 --- a/packages/cli-kit/src/public/node/error-handler.ts +++ b/packages/cli-kit/src/public/node/error-handler.ts @@ -192,7 +192,7 @@ export function cleanStackFrameFilePath({ ? currentFilePath : path.joinPath(projectRoot, currentFilePath) - const matchingPluginPath = pluginLocations.filter(({pluginPath}) => fullLocation.startsWith(pluginPath))[0] + const matchingPluginPath = pluginLocations.find(({pluginPath}) => fullLocation.startsWith(pluginPath)) if (matchingPluginPath !== undefined) { // the plugin name (e.g. @shopify/cli-kit), plus the relative path of the error line from within the plugin's code (e.g. dist/something.js )