From 7a1638fceae6faed6a9e210197af10c50a8213d9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 19:41:10 +0000 Subject: [PATCH] refactor: wrap iifes properly This PR refactors all immediately-invoked function expressions (IIFEs) to ensure they are properly wrapped and terminated, preventing potential parsing ambiguities and relying on consistent semicolon insertion. - IIFEs should be wrapped: Previously, the code used unwrapped or inconsistently terminated IIFEs (e.g., `})()` and missing semicolons before them), which can lead to automatic semicolon insertion issues or unexpected global scope leakage. The patch adds an outer parenthesis around each function invocation (`}(...)`), standardizes the invocation syntax to `}());`, and ensures that `var Action;` and `var ResultType;` declarations are explicitly terminated with semicolons before the IIFE definitions. > This Autofix was generated by AI. Please review the change before merging. --- common/plugin_transpiler/build.mjs | 2 +- .../posthog-route-censor-plugin/dist.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/plugin_transpiler/build.mjs b/common/plugin_transpiler/build.mjs index c748c3bddc75..e664128c0609 100755 --- a/common/plugin_transpiler/build.mjs +++ b/common/plugin_transpiler/build.mjs @@ -10,4 +10,4 @@ import * as esbuild from 'esbuild' // eslint-disable-next-line no-console console.log('Build succeeded') } -})() +}()) diff --git a/plugin-server/src/cdp/legacy-plugins/_transformations/posthog-route-censor-plugin/dist.js b/plugin-server/src/cdp/legacy-plugins/_transformations/posthog-route-censor-plugin/dist.js index 732df4679928..db707a65786b 100644 --- a/plugin-server/src/cdp/legacy-plugins/_transformations/posthog-route-censor-plugin/dist.js +++ b/plugin-server/src/cdp/legacy-plugins/_transformations/posthog-route-censor-plugin/dist.js @@ -27,8 +27,8 @@ const checkIsValidHttpUrl = (str) => { /** * Actions represent the type of change to a location value. */ -var Action -;(function (Action) { +var Action; +(function (Action) { /** * A POP indicates a change to an arbitrary index in the history stack, such * as a back or forward navigation. It does not describe the direction of the @@ -50,7 +50,7 @@ var Action */ Action['Replace'] = 'REPLACE' -})(Action || (Action = {})) +}(Action || (Action = {}))); function invariant(value, message) { if (value === false || value === null || typeof value === 'undefined') { throw new Error(message) @@ -98,13 +98,13 @@ function parsePath(path) { return parsedPath } -var ResultType -;(function (ResultType) { +var ResultType; +(function (ResultType) { ResultType['data'] = 'data' ResultType['deferred'] = 'deferred' ResultType['redirect'] = 'redirect' ResultType['error'] = 'error' -})(ResultType || (ResultType = {})) +}(ResultType || (ResultType = {}))); /** * Matches the given routes to a location and returns the match data. *