diff --git a/.eslintrc.json b/.eslintrc.json
index a0111a63221..79f7e567129 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -59,7 +59,8 @@
],
"import/no-relative-packages": "error",
"import/export": "error",
- "import/no-duplicates": "error"
+ "import/no-duplicates": "error",
+ "import/newline-after-import": "error"
},
"globals": {
"GeolocationPositionError": true
diff --git a/packages/backend-core/src/auth/auth.ts b/packages/backend-core/src/auth/auth.ts
index 0100a2d0e23..e31bc81eed1 100644
--- a/packages/backend-core/src/auth/auth.ts
+++ b/packages/backend-core/src/auth/auth.ts
@@ -1,5 +1,6 @@
const _passport = require("koa-passport")
const LocalStrategy = require("passport-local").Strategy
+
import { getGlobalDB } from "../context"
import { Cookie } from "../constants"
import { getSessionsForUser, invalidateSessions } from "../security/sessions"
@@ -26,6 +27,7 @@ import { clearCookie, getCookie } from "../utils"
import { ssoSaveUserNoOp } from "../middleware/passport/sso/sso"
const refresh = require("passport-oauth2-refresh")
+
export {
auditLog,
authError,
diff --git a/packages/backend-core/src/constants/db.ts b/packages/backend-core/src/constants/db.ts
index bb944556af5..ac00483021f 100644
--- a/packages/backend-core/src/constants/db.ts
+++ b/packages/backend-core/src/constants/db.ts
@@ -1,4 +1,5 @@
import { prefixed, DocumentType } from "@budibase/types"
+
export {
SEPARATOR,
UNICODE_MAX,
diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts
index d7a4b8224ac..906a95e1db3 100644
--- a/packages/backend-core/src/db/utils.ts
+++ b/packages/backend-core/src/db/utils.ts
@@ -6,6 +6,7 @@ import { AppState, DeletedApp, getAppMetadata } from "../cache/appMetadata"
import { isDevApp, isDevAppID, getProdAppID } from "../docIds/conversions"
import { App, Database } from "@budibase/types"
import { getStartEndKeyURL } from "../docIds"
+
export * from "../docIds"
/**
diff --git a/packages/backend-core/src/docIds/conversions.ts b/packages/backend-core/src/docIds/conversions.ts
index b168b74e161..ec43d013894 100644
--- a/packages/backend-core/src/docIds/conversions.ts
+++ b/packages/backend-core/src/docIds/conversions.ts
@@ -1,5 +1,6 @@
import { APP_DEV_PREFIX, APP_PREFIX } from "../constants"
import { App } from "@budibase/types"
+
const NO_APP_ERROR = "No app provided"
export function isDevAppID(appId?: string) {
diff --git a/packages/backend-core/src/events/processors/posthog/index.ts b/packages/backend-core/src/events/processors/posthog/index.ts
index dceb10d2cd4..5a2b1afc9f3 100644
--- a/packages/backend-core/src/events/processors/posthog/index.ts
+++ b/packages/backend-core/src/events/processors/posthog/index.ts
@@ -1,2 +1,3 @@
import PosthogProcessor from "./PosthogProcessor"
+
export default PosthogProcessor
diff --git a/packages/backend-core/src/events/processors/posthog/tests/PosthogProcessor.spec.ts b/packages/backend-core/src/events/processors/posthog/tests/PosthogProcessor.spec.ts
index 0722fc32935..d9a5504073a 100644
--- a/packages/backend-core/src/events/processors/posthog/tests/PosthogProcessor.spec.ts
+++ b/packages/backend-core/src/events/processors/posthog/tests/PosthogProcessor.spec.ts
@@ -1,7 +1,9 @@
import { testEnv } from "../../../../../tests/extra"
import PosthogProcessor from "../PosthogProcessor"
import { Event, IdentityType, Hosting } from "@budibase/types"
+
const tk = require("timekeeper")
+
import * as cache from "../../../../cache/generic"
import { CacheKey } from "../../../../cache/generic"
import * as context from "../../../../context"
diff --git a/packages/backend-core/src/features/index.ts b/packages/backend-core/src/features/index.ts
index 8f5c903e051..ad517082de8 100644
--- a/packages/backend-core/src/features/index.ts
+++ b/packages/backend-core/src/features/index.ts
@@ -1,5 +1,6 @@
import env from "../environment"
import * as context from "../context"
+
export * from "./installation"
/**
diff --git a/packages/backend-core/src/index.ts b/packages/backend-core/src/index.ts
index 2cfd5179414..d04f48e5fcd 100644
--- a/packages/backend-core/src/index.ts
+++ b/packages/backend-core/src/index.ts
@@ -38,6 +38,7 @@ export * as docIds from "./docIds"
// circular dependencies
import * as context from "./context"
import * as _tenancy from "./tenancy"
+
export const tenancy = {
..._tenancy,
...context,
diff --git a/packages/backend-core/src/logging/correlation/correlation.ts b/packages/backend-core/src/logging/correlation/correlation.ts
index b5b47df9c66..0498bd43d5f 100644
--- a/packages/backend-core/src/logging/correlation/correlation.ts
+++ b/packages/backend-core/src/logging/correlation/correlation.ts
@@ -1,4 +1,5 @@
import { Header } from "../../constants"
+
const correlator = require("correlation-id")
export const setHeader = (headers: any) => {
diff --git a/packages/backend-core/src/logging/correlation/middleware.ts b/packages/backend-core/src/logging/correlation/middleware.ts
index f77714a5aea..45baee1fb13 100644
--- a/packages/backend-core/src/logging/correlation/middleware.ts
+++ b/packages/backend-core/src/logging/correlation/middleware.ts
@@ -1,5 +1,6 @@
import { Header } from "../../constants"
import { v4 as uuid } from "uuid"
+
const correlator = require("correlation-id")
const correlation = (ctx: any, next: any) => {
diff --git a/packages/backend-core/src/logging/pino/middleware.ts b/packages/backend-core/src/logging/pino/middleware.ts
index 569420c5f23..df18a35eb1f 100644
--- a/packages/backend-core/src/logging/pino/middleware.ts
+++ b/packages/backend-core/src/logging/pino/middleware.ts
@@ -1,9 +1,12 @@
import env from "../../environment"
import { logger } from "./logger"
import { IncomingMessage } from "http"
+
const pino = require("koa-pino-logger")
+
import { Options } from "pino-http"
import { Ctx } from "@budibase/types"
+
const correlator = require("correlation-id")
export function pinoSettings(): Options {
diff --git a/packages/backend-core/src/middleware/index.ts b/packages/backend-core/src/middleware/index.ts
index 980bf06b00e..e1eb7f1d261 100644
--- a/packages/backend-core/src/middleware/index.ts
+++ b/packages/backend-core/src/middleware/index.ts
@@ -2,6 +2,7 @@ export * as local from "./passport/local"
export * as google from "./passport/sso/google"
export * as oidc from "./passport/sso/oidc"
import * as datasourceGoogle from "./passport/datasource/google"
+
export const datasource = {
google: datasourceGoogle,
}
diff --git a/packages/backend-core/src/middleware/passport/sso/google.ts b/packages/backend-core/src/middleware/passport/sso/google.ts
index ad7593e63dc..2a08ad76659 100644
--- a/packages/backend-core/src/middleware/passport/sso/google.ts
+++ b/packages/backend-core/src/middleware/passport/sso/google.ts
@@ -8,6 +8,7 @@ import {
SaveSSOUserFunction,
GoogleInnerConfig,
} from "@budibase/types"
+
const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy
export function buildVerifyFn(saveUserFn: SaveSSOUserFunction) {
diff --git a/packages/backend-core/src/middleware/passport/sso/tests/google.spec.ts b/packages/backend-core/src/middleware/passport/sso/tests/google.spec.ts
index d0689a1f0a5..9bf855b3c54 100644
--- a/packages/backend-core/src/middleware/passport/sso/tests/google.spec.ts
+++ b/packages/backend-core/src/middleware/passport/sso/tests/google.spec.ts
@@ -6,6 +6,7 @@ const mockStrategy = require("passport-google-oauth").OAuth2Strategy
jest.mock("../sso")
import * as _sso from "../sso"
+
const sso = jest.mocked(_sso)
const mockSaveUserFn = jest.fn()
diff --git a/packages/backend-core/src/middleware/passport/sso/tests/sso.spec.ts b/packages/backend-core/src/middleware/passport/sso/tests/sso.spec.ts
index c3ddf220e67..d3486a5b148 100644
--- a/packages/backend-core/src/middleware/passport/sso/tests/sso.spec.ts
+++ b/packages/backend-core/src/middleware/passport/sso/tests/sso.spec.ts
@@ -11,6 +11,7 @@ const mockSaveUser = jest.fn()
jest.mock("../../../../users")
import * as _users from "../../../../users"
+
const users = jest.mocked(_users)
const getErrorMessage = () => {
diff --git a/packages/backend-core/src/middleware/tests/builder.spec.ts b/packages/backend-core/src/middleware/tests/builder.spec.ts
index d350eff4f67..0514dc13f0a 100644
--- a/packages/backend-core/src/middleware/tests/builder.spec.ts
+++ b/packages/backend-core/src/middleware/tests/builder.spec.ts
@@ -5,6 +5,7 @@ import { structures } from "../../../tests"
import { ContextUser, ServiceType } from "@budibase/types"
import { doInAppContext } from "../../context"
import env from "../../environment"
+
env._set("SERVICE_TYPE", ServiceType.APPS)
const appId = "app_aaa"
diff --git a/packages/backend-core/src/objectStore/objectStore.ts b/packages/backend-core/src/objectStore/objectStore.ts
index 76d2dd66890..cdaf19fa559 100644
--- a/packages/backend-core/src/objectStore/objectStore.ts
+++ b/packages/backend-core/src/objectStore/objectStore.ts
@@ -1,4 +1,5 @@
const sanitize = require("sanitize-s3-objectkey")
+
import AWS from "aws-sdk"
import stream, { Readable } from "stream"
import fetch from "node-fetch"
diff --git a/packages/backend-core/src/security/sessions.ts b/packages/backend-core/src/security/sessions.ts
index 5a535c0c46c..a86a829b178 100644
--- a/packages/backend-core/src/security/sessions.ts
+++ b/packages/backend-core/src/security/sessions.ts
@@ -1,6 +1,7 @@
const redis = require("../redis/init")
const { v4: uuidv4 } = require("uuid")
const { logWarn } = require("../logging")
+
import env from "../environment"
import {
Session,
diff --git a/packages/backend-core/src/utils/hashing.ts b/packages/backend-core/src/utils/hashing.ts
index aba11f38e6f..54d7de4aba0 100644
--- a/packages/backend-core/src/utils/hashing.ts
+++ b/packages/backend-core/src/utils/hashing.ts
@@ -1,4 +1,5 @@
import env from "../environment"
+
export * from "../docIds/newid"
const bcrypt = env.JS_BCRYPT ? require("bcryptjs") : require("bcrypt")
diff --git a/packages/backend-core/src/utils/utils.ts b/packages/backend-core/src/utils/utils.ts
index 1c1ca8473b0..b10d9ebdc0d 100644
--- a/packages/backend-core/src/utils/utils.ts
+++ b/packages/backend-core/src/utils/utils.ts
@@ -11,6 +11,7 @@ import {
TenantResolutionStrategy,
} from "@budibase/types"
import type { SetOption } from "cookies"
+
const jwt = require("jsonwebtoken")
const APP_PREFIX = DocumentType.APP + SEPARATOR
diff --git a/packages/backend-core/tests/core/utilities/mocks/alerts.ts b/packages/backend-core/tests/core/utilities/mocks/alerts.ts
index 90c9759c92f..0b26e98363a 100644
--- a/packages/backend-core/tests/core/utilities/mocks/alerts.ts
+++ b/packages/backend-core/tests/core/utilities/mocks/alerts.ts
@@ -1,3 +1,4 @@
jest.mock("../../../../src/logging/alerts")
import * as _alerts from "../../../../src/logging/alerts"
+
export const alerts = jest.mocked(_alerts)
diff --git a/packages/backend-core/tests/core/utilities/mocks/index.ts b/packages/backend-core/tests/core/utilities/mocks/index.ts
index 9a72b38ef50..8705e563cb1 100644
--- a/packages/backend-core/tests/core/utilities/mocks/index.ts
+++ b/packages/backend-core/tests/core/utilities/mocks/index.ts
@@ -1,5 +1,6 @@
jest.mock("../../../../src/accounts")
import * as _accounts from "../../../../src/accounts"
+
export const accounts = jest.mocked(_accounts)
export * as date from "./date"
diff --git a/packages/backend-core/tests/core/utilities/structures/generator.ts b/packages/backend-core/tests/core/utilities/structures/generator.ts
index ed4dac82550..64eb5ecc97a 100644
--- a/packages/backend-core/tests/core/utilities/structures/generator.ts
+++ b/packages/backend-core/tests/core/utilities/structures/generator.ts
@@ -1,2 +1,3 @@
import Chance from "./Chance"
+
export const generator = new Chance()
diff --git a/packages/backend-core/tests/jestSetup.ts b/packages/backend-core/tests/jestSetup.ts
index 42a24ce7336..e5d144290b6 100644
--- a/packages/backend-core/tests/jestSetup.ts
+++ b/packages/backend-core/tests/jestSetup.ts
@@ -9,6 +9,7 @@ mocks.fetch.enable()
// mock all dates to 2020-01-01T00:00:00.000Z
// use tk.reset() to use real dates in individual tests
import tk from "timekeeper"
+
tk.freeze(mocks.date.MOCK_DATE)
if (!process.env.DEBUG) {
diff --git a/packages/bbui/src/ActionGroup/ActionGroup.svelte b/packages/bbui/src/ActionGroup/ActionGroup.svelte
index 43d8cd8de52..978e920c42c 100644
--- a/packages/bbui/src/ActionGroup/ActionGroup.svelte
+++ b/packages/bbui/src/ActionGroup/ActionGroup.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte b/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte
index 8b13135b33f..d4ecda246dc 100644
--- a/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte
+++ b/packages/bbui/src/OptionSelectDnD/OptionSelectDnD.svelte
@@ -4,6 +4,7 @@
import Icon from "../Icon/Icon.svelte"
import Popover from "../Popover/Popover.svelte"
import { onMount } from "svelte"
+
const flipDurationMs = 150
export let constraints
diff --git a/packages/bbui/src/SideNavigation/Item.svelte b/packages/bbui/src/SideNavigation/Item.svelte
index dab88b05bc4..40d0af0d6e1 100644
--- a/packages/bbui/src/SideNavigation/Item.svelte
+++ b/packages/bbui/src/SideNavigation/Item.svelte
@@ -1,7 +1,9 @@
diff --git a/packages/bbui/src/Table/ArrayRenderer.svelte b/packages/bbui/src/Table/ArrayRenderer.svelte
index 637454dbca4..303397054ae 100644
--- a/packages/bbui/src/Table/ArrayRenderer.svelte
+++ b/packages/bbui/src/Table/ArrayRenderer.svelte
@@ -1,6 +1,7 @@
diff --git a/packages/builder/src/components/common/renderers/DateTimeRenderer.svelte b/packages/builder/src/components/common/renderers/DateTimeRenderer.svelte
index 8bf9499b98b..c0fb251dc01 100644
--- a/packages/builder/src/components/common/renderers/DateTimeRenderer.svelte
+++ b/packages/builder/src/components/common/renderers/DateTimeRenderer.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ContinueIf.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ContinueIf.svelte
index f284e24645e..91b70e0c457 100644
--- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ContinueIf.svelte
+++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ContinueIf.svelte
@@ -2,6 +2,7 @@
import { Select, Body } from "@budibase/bbui"
import { onMount } from "svelte"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
+
export let parameters
export let bindings
diff --git a/packages/builder/src/components/design/settings/controls/FlatButtonGroup/index.js b/packages/builder/src/components/design/settings/controls/FlatButtonGroup/index.js
index 5221ae4ef4e..a1903695f42 100644
--- a/packages/builder/src/components/design/settings/controls/FlatButtonGroup/index.js
+++ b/packages/builder/src/components/design/settings/controls/FlatButtonGroup/index.js
@@ -1,2 +1,3 @@
import FlatButtonGroup from "./FlatButtonGroup.svelte"
+
export default FlatButtonGroup
diff --git a/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte b/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte
index 3d74e3f6b6b..f8a14a6dd14 100644
--- a/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte
+++ b/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte
@@ -1,6 +1,7 @@
diff --git a/packages/builder/src/pages/builder/app/[application]/data/table/[tableId]/relationship/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/table/[tableId]/relationship/index.svelte
index f0baf88ffe8..cecec0ab532 100644
--- a/packages/builder/src/pages/builder/app/[application]/data/table/[tableId]/relationship/index.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/data/table/[tableId]/relationship/index.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte
index e73e6d78414..169dfa79349 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte
@@ -1,6 +1,7 @@
diff --git a/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/DatasourceTemplateRow.svelte b/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/DatasourceTemplateRow.svelte
index dac0aaed6ed..0db89cfe74e 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/DatasourceTemplateRow.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/DatasourceTemplateRow.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/pages/builder/app/[application]/settings/automation-history/_components/StatusRenderer.svelte b/packages/builder/src/pages/builder/app/[application]/settings/automation-history/_components/StatusRenderer.svelte
index fd289163b4a..7dd42ad6a6b 100644
--- a/packages/builder/src/pages/builder/app/[application]/settings/automation-history/_components/StatusRenderer.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/settings/automation-history/_components/StatusRenderer.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/pages/builder/portal/account/auditLogs/_components/TimeRenderer.svelte b/packages/builder/src/pages/builder/portal/account/auditLogs/_components/TimeRenderer.svelte
index b6c0262b478..e1867092c0b 100644
--- a/packages/builder/src/pages/builder/portal/account/auditLogs/_components/TimeRenderer.svelte
+++ b/packages/builder/src/pages/builder/portal/account/auditLogs/_components/TimeRenderer.svelte
@@ -1,6 +1,7 @@
diff --git a/packages/builder/src/pages/builder/portal/index.svelte b/packages/builder/src/pages/builder/portal/index.svelte
index 5426d52faea..8651ae5e08c 100644
--- a/packages/builder/src/pages/builder/portal/index.svelte
+++ b/packages/builder/src/pages/builder/portal/index.svelte
@@ -1,4 +1,5 @@
diff --git a/packages/builder/src/pages/builder/portal/settings/index.svelte b/packages/builder/src/pages/builder/portal/settings/index.svelte
index 842fe01be8e..09ead3e4108 100644
--- a/packages/builder/src/pages/builder/portal/settings/index.svelte
+++ b/packages/builder/src/pages/builder/portal/settings/index.svelte
@@ -1,4 +1,5 @@
diff --git a/packages/builder/src/pages/builder/portal/users/groups/_components/UsersTableRenderer.svelte b/packages/builder/src/pages/builder/portal/users/groups/_components/UsersTableRenderer.svelte
index 2adc0c82ae3..c701f582a2b 100644
--- a/packages/builder/src/pages/builder/portal/users/groups/_components/UsersTableRenderer.svelte
+++ b/packages/builder/src/pages/builder/portal/users/groups/_components/UsersTableRenderer.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/pages/builder/portal/users/index.svelte b/packages/builder/src/pages/builder/portal/users/index.svelte
index 4dbb81f7c6c..b876b2866c7 100644
--- a/packages/builder/src/pages/builder/portal/users/index.svelte
+++ b/packages/builder/src/pages/builder/portal/users/index.svelte
@@ -1,4 +1,5 @@
diff --git a/packages/builder/src/pages/builder/portal/users/users/_components/RolesTagsTableRenderer.svelte b/packages/builder/src/pages/builder/portal/users/users/_components/RolesTagsTableRenderer.svelte
index 7e63045edd6..402344dedd3 100644
--- a/packages/builder/src/pages/builder/portal/users/users/_components/RolesTagsTableRenderer.svelte
+++ b/packages/builder/src/pages/builder/portal/users/users/_components/RolesTagsTableRenderer.svelte
@@ -1,5 +1,6 @@