From b2379d94ac247e1d3b0f6762497e93ec90b100c8 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 17 Nov 2023 11:34:46 +1000 Subject: [PATCH] [QOLDEV-614] fix lint errors - Use camelCase variable names - Fix function parameter definitions --- src/helpers/FormioLoader/FormioLoader.js | 2 +- src/helpers/FormioScript/FormioScript.js | 20 ++++++++++---------- src/helpers/FormioScript/index.dev.js | 8 +++----- src/helpers/FormioScript/index.gitbridge.js | 2 +- src/helpers/FormioScript/index.prod.js | 18 +++++++++--------- src/helpers/FormioScript/index.staging.js | 8 +++----- src/helpers/FormioScript/index.testing.js | 8 +++----- 7 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/helpers/FormioLoader/FormioLoader.js b/src/helpers/FormioLoader/FormioLoader.js index 5ed63d8a..8438b7aa 100644 --- a/src/helpers/FormioLoader/FormioLoader.js +++ b/src/helpers/FormioLoader/FormioLoader.js @@ -165,7 +165,7 @@ const defaultInitFormioAction = () => { ); }; -const initFormio = ({cdn = null}) => { +const initFormio = (cdn = null) => { // Init form Formio.icons = "fontawesome"; if (cdn) { diff --git a/src/helpers/FormioScript/FormioScript.js b/src/helpers/FormioScript/FormioScript.js index 89cea6a9..b349da56 100644 --- a/src/helpers/FormioScript/FormioScript.js +++ b/src/helpers/FormioScript/FormioScript.js @@ -31,52 +31,52 @@ export const createScripts = (scripts, i, mainResolve) => { } }; -export const getDefaultCdn = ({subdomain = "static", version = defaultVersion}) => { +export const getDefaultCdn = (subdomain = "static", version = defaultVersion) => { return `https://${subdomain}.qgov.net.au/formio-qld/${version}` } -export const getDefaultScripts = ({ base_url }) => { +export const getDefaultScripts = (baseUrl) => { return [ { type: "script", - src: `${base_url}/formio.full.js`, + src: `${baseUrl}/formio.full.js`, async: false, }, { type: "script", - src: `${base_url}/premium.min.js`, + src: `${baseUrl}/premium.min.js`, async: false, }, { type: "script", - src: `${base_url}/formio-qld.js`, + src: `${baseUrl}/formio-qld.js`, async: false, }, // note: formio-loader should always load last { type: "script", - src: `${base_url}/formio-loader.js`, + src: `${baseUrl}/formio-loader.js`, async: false, }, { type: "link", - href: `${base_url}/formio.full.min.css`, + href: `${baseUrl}/formio.full.min.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/premium.css`, + href: `${baseUrl}/premium.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/formio-qld.min.css`, + href: `${baseUrl}/formio-qld.min.css`, rel: "stylesheet", }, ]; }; -export const initScript = ({scripts, cdn = null}) => +export const initScript = (scripts, cdn = null) => new Promise((resolve) => { if (window.formioScriptLoaded) { if (typeof FormioLoader !== "undefined") diff --git a/src/helpers/FormioScript/index.dev.js b/src/helpers/FormioScript/index.dev.js index c5a21b94..1a5e30ce 100644 --- a/src/helpers/FormioScript/index.dev.js +++ b/src/helpers/FormioScript/index.dev.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="dev-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +let baseUrl = getDefaultCdn("dev-static") +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.gitbridge.js b/src/helpers/FormioScript/index.gitbridge.js index 9b70591b..7d7ebc4a 100644 --- a/src/helpers/FormioScript/index.gitbridge.js +++ b/src/helpers/FormioScript/index.gitbridge.js @@ -2,6 +2,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; const version = window.formIOGitBridgeID || "248740"; -const scripts = getDefaultScripts(base_url = `/__data/assets/git_bridge/0025/${version}`); +const scripts = getDefaultScripts(`/__data/assets/git_bridge/0025/${version}`); export const init = () => initScript(scripts, getDefaultCdn()); diff --git a/src/helpers/FormioScript/index.prod.js b/src/helpers/FormioScript/index.prod.js index a5f9be56..2de0b799 100644 --- a/src/helpers/FormioScript/index.prod.js +++ b/src/helpers/FormioScript/index.prod.js @@ -1,44 +1,44 @@ import { initScript, getDefaultCdn } from "."; -let base_url = getDefaultCdn() +let baseUrl = getDefaultCdn() const scripts = [ { type: "script", - src: `${base_url}/formio.full.min.js`, + src: `${baseUrl}/formio.full.min.js`, async: false, }, { type: "script", - src: `${base_url}/premium.min.js`, + src: `${baseUrl}/premium.min.js`, async: false, }, { type: "script", - src: `${base_url}/formio-qld.min.js`, + src: `${baseUrl}/formio-qld.min.js`, async: false, }, // note: formio-loader should always load last { type: "script", - src: `${base_url}/formio-loader.min.js`, + src: `${baseUrl}/formio-loader.min.js`, async: false, }, { type: "link", - href: `${base_url}/formio.full.min.css`, + href: `${baseUrl}/formio.full.min.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/premium.css`, + href: `${baseUrl}/premium.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/formio-qld.min.css`, + href: `${baseUrl}/formio-qld.min.css`, rel: "stylesheet", }, ]; -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.staging.js b/src/helpers/FormioScript/index.staging.js index 76182400..95f94ab1 100644 --- a/src/helpers/FormioScript/index.staging.js +++ b/src/helpers/FormioScript/index.staging.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="beta-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +let baseUrl = getDefaultCdn("beta-static") +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.testing.js b/src/helpers/FormioScript/index.testing.js index 9f9537ca..9ae778ea 100644 --- a/src/helpers/FormioScript/index.testing.js +++ b/src/helpers/FormioScript/index.testing.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="test-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +let baseUrl = getDefaultCdn("test-static") +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl);