diff --git a/.prettierrc b/.prettierrc index e23b0be753..eda2e6131b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,8 @@ "semi": false, "singleQuote": false, "trailingComma": "es5", + "arrowParens": "avoid", + "jsxBracketSameLine": false, "plugins": ["prettier-plugin-svelte"], - "svelteSortOrder" : "scripts-markup-styles" + "svelteSortOrder" : "options-scripts-markup-styles" } \ No newline at end of file diff --git a/package.json b/package.json index f98624812f..171f9510f3 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "prettier-plugin-svelte": "^2.2.0", "rimraf": "^3.0.2", "rollup-plugin-replace": "^2.2.0", - "svelte": "^3.30.0" + "svelte": "^3.37.0" }, "scripts": { "bootstrap": "lerna link && lerna bootstrap", diff --git a/packages/auth/src/db/index.js b/packages/auth/src/db/index.js index cca0a3ddba..f94fe4afea 100644 --- a/packages/auth/src/db/index.js +++ b/packages/auth/src/db/index.js @@ -1,9 +1,9 @@ let Pouch -module.exports.setDB = (pouch) => { +module.exports.setDB = pouch => { Pouch = pouch } -module.exports.getDB = (dbName) => { +module.exports.getDB = dbName => { return new Pouch(dbName) } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index de743a7764..105e038907 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -48,7 +48,7 @@ exports.getGroupParams = (id = "", otherProps = {}) => { * Generates a new global user ID. * @returns {string} The new user ID which the user doc can be stored under. */ -exports.generateGlobalUserID = (id) => { +exports.generateGlobalUserID = id => { return `${DocumentTypes.USER}${SEPARATOR}${id || newid()}` } @@ -70,7 +70,7 @@ exports.getGlobalUserParams = (globalId, otherProps = {}) => { * Generates a template ID. * @param ownerId The owner/user of the template, this could be global or a group level. */ -exports.generateTemplateID = (ownerId) => { +exports.generateTemplateID = ownerId => { return `${DocumentTypes.TEMPLATE}${SEPARATOR}${ownerId}${newid()}` } @@ -132,7 +132,7 @@ const determineScopedConfig = async function (db, { type, user, group }) { } ) ) - const configs = response.rows.map((row) => { + const configs = response.rows.map(row => { const config = row.doc // Config is specific to a user and a group diff --git a/packages/auth/src/hashing.js b/packages/auth/src/hashing.js index fe9b034c63..7f3af2855f 100644 --- a/packages/auth/src/hashing.js +++ b/packages/auth/src/hashing.js @@ -4,7 +4,7 @@ const { v4 } = require("uuid") const SALT_ROUNDS = env.SALT_ROUNDS || 10 -exports.hash = async (data) => { +exports.hash = async data => { const salt = await bcrypt.genSalt(SALT_ROUNDS) return bcrypt.hash(data, salt) } diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js index beb1c33cf1..10507410b1 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -22,7 +22,7 @@ function confirmAppId(possibleAppId) { * @param {object} ctx The main request body to look through. * @returns {string|undefined} If an appId was found it will be returned. */ -exports.getAppId = (ctx) => { +exports.getAppId = ctx => { const options = [ctx.headers["x-budibase-app-id"], ctx.params.appId] if (ctx.subdomains) { options.push(ctx.subdomains[1]) @@ -41,7 +41,7 @@ exports.getAppId = (ctx) => { } let appPath = ctx.request.headers.referrer || - ctx.path.split("/").filter((subPath) => subPath.startsWith(APP_PREFIX)) + ctx.path.split("/").filter(subPath => subPath.startsWith(APP_PREFIX)) if (!appId && appPath.length !== 0) { appId = confirmAppId(appPath[0]) } @@ -101,11 +101,11 @@ exports.clearCookie = (ctx, name) => { * @param {object} ctx The koa context object to be tested. * @return {boolean} returns true if the call is from the client lib (a built app rather than the builder). */ -exports.isClient = (ctx) => { +exports.isClient = ctx => { return ctx.headers["x-budibase-type"] === "client" } -exports.getGlobalUserByEmail = async (email) => { +exports.getGlobalUserByEmail = async email => { const db = getDB(StaticDatabases.GLOBAL.name) try { let users = ( @@ -114,7 +114,7 @@ exports.getGlobalUserByEmail = async (email) => { include_docs: true, }) ).rows - users = users.map((user) => user.doc) + users = users.map(user => user.doc) return users.length <= 1 ? users[0] : users } catch (err) { if (err != null && err.name === "not_found") { diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index a4bfd29c83..4bb592aa26 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -42,12 +42,14 @@ class="spectrum-ActionButton spectrum-ActionButton--size{size}" {disabled} on:longPress - on:click|preventDefault> + on:click|preventDefault +> {#if longPressable} {/if} @@ -56,7 +58,8 @@ class="spectrum-Icon spectrum-Icon--size{size}" focusable="false" aria-hidden="true" - aria-label={icon}> + aria-label={icon} + > {/if} diff --git a/packages/bbui/src/ActionGroup/ActionGroup.svelte b/packages/bbui/src/ActionGroup/ActionGroup.svelte index 514b473521..43d8cd8de5 100644 --- a/packages/bbui/src/ActionGroup/ActionGroup.svelte +++ b/packages/bbui/src/ActionGroup/ActionGroup.svelte @@ -8,7 +8,7 @@ // Attaches a spectrum-ActionGroup-item class to buttons inside the div function group(element) { const buttons = Array.from(element.getElementsByTagName("button")) - buttons.forEach((button) => { + buttons.forEach(button => { button.classList.add("spectrum-ActionGroup-item") }) } diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 776fc7f83e..a25cc1bbd5 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -47,7 +47,7 @@ export default function positionDropdown(element, { anchor, align }) { element.style[positionSide] = `${dimensions[positionSide]}px` element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px` - const resizeObserver = new ResizeObserver((entries) => { + const resizeObserver = new ResizeObserver(entries => { entries.forEach(() => { dimensions = getDimensions() element.style[positionSide] = `${dimensions[positionSide]}px` diff --git a/packages/bbui/src/Button/Button.svelte b/packages/bbui/src/Button/Button.svelte index 6e2b63adbd..da4d405f02 100644 --- a/packages/bbui/src/Button/Button.svelte +++ b/packages/bbui/src/Button/Button.svelte @@ -23,13 +23,15 @@ class:active class="spectrum-Button spectrum-Button--size{size.toUpperCase()}" {disabled} - on:click|preventDefault> + on:click|preventDefault +> {#if icon} {/if} diff --git a/packages/bbui/src/ButtonGroup/ButtonGroup.svelte b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte index 51055363a2..b845a770e1 100644 --- a/packages/bbui/src/ButtonGroup/ButtonGroup.svelte +++ b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte @@ -1,15 +1,19 @@ -