Skip to content

Commit

Permalink
[QOLDEV-614] fix lint errors
Browse files Browse the repository at this point in the history
- Use camelCase variable names
- Fix function parameter definitions
  • Loading branch information
ThrawnCA committed Nov 17, 2023
1 parent a39b70a commit 4f16763
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/helpers/FormioLoader/FormioLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ const defaultInitFormioAction = () => {
);
};

const initFormio = ({cdn = null}) => {
const initFormio = (cdn = null) => {
// Init form
Formio.icons = "fontawesome";
if (cdn) {
Formio.cdn.setOverrideUrl('grid', cdn);
Formio.cdn.setOverrideUrl("grid", cdn);
}
if (premium) Formio.use(premium);

Expand Down
27 changes: 15 additions & 12 deletions src/helpers/FormioScript/FormioScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,55 @@ export const createScripts = (scripts, i, mainResolve) => {
}
};

export const getDefaultCdn = ({subdomain = "static", version = defaultVersion}) => {
return `https://${subdomain}.qgov.net.au/formio-qld/${version}`
}
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")
Expand Down
8 changes: 3 additions & 5 deletions src/helpers/FormioScript/index.dev.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { initScript, getDefaultCdn, getDefaultScripts } from ".";

let base_url = getDefaultCdn(subdomain="dev-static")
const scripts = getDefaultScripts({
base_url: base_url,
});
const baseUrl = getDefaultCdn("dev-static");
const scripts = getDefaultScripts(baseUrl);

export const init = () => initScript(scripts, base_url);
export const init = () => initScript(scripts, baseUrl);
2 changes: 1 addition & 1 deletion src/helpers/FormioScript/index.gitbridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
18 changes: 9 additions & 9 deletions src/helpers/FormioScript/index.prod.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import { initScript, getDefaultCdn } from ".";

let base_url = getDefaultCdn()
const 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);
8 changes: 3 additions & 5 deletions src/helpers/FormioScript/index.staging.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { initScript, getDefaultCdn, getDefaultScripts } from ".";

let base_url = getDefaultCdn(subdomain="beta-static")
const scripts = getDefaultScripts({
base_url: base_url,
});
const baseUrl = getDefaultCdn("beta-static");
const scripts = getDefaultScripts(baseUrl);

export const init = () => initScript(scripts, base_url);
export const init = () => initScript(scripts, baseUrl);
8 changes: 3 additions & 5 deletions src/helpers/FormioScript/index.testing.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { initScript, getDefaultCdn, getDefaultScripts } from ".";

let base_url = getDefaultCdn(subdomain="test-static")
const scripts = getDefaultScripts({
base_url: base_url,
});
const baseUrl = getDefaultCdn("test-static");
const scripts = getDefaultScripts(baseUrl);

export const init = () => initScript(scripts, base_url);
export const init = () => initScript(scripts, baseUrl);

0 comments on commit 4f16763

Please sign in to comment.