Merge pull request #12920 from Budibase/consoleloglintrule

adding lint rule for console.log
This commit is contained in:
Martin McKeaveney 2024-01-31 17:03:23 +02:00 committed by GitHub
commit 2bf1befd3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 25 additions and 16 deletions

View File

@ -45,6 +45,16 @@
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"local-rules/no-budibase-imports": "error" "local-rules/no-budibase-imports": "error"
} }
},
{
"files": [
"packages/builder/**/*",
"packages/client/**/*",
"packages/frontend-core/**/*"
],
"rules": {
"no-console": ["error", { "allow": ["warn", "error", "debug"] } ]
}
} }
], ],
"rules": { "rules": {

View File

@ -364,7 +364,6 @@ const getContextBindings = (asset, componentId) => {
* Generates a set of bindings for a given component context * Generates a set of bindings for a given component context
*/ */
const generateComponentContextBindings = (asset, componentContext) => { const generateComponentContextBindings = (asset, componentContext) => {
console.log("Hello ")
const { component, definition, contexts } = componentContext const { component, definition, contexts } = componentContext
if (!component || !definition || !contexts?.length) { if (!component || !definition || !contexts?.length) {
return [] return []

View File

@ -21,7 +21,7 @@ export const createBuilderWebsocket = appId => {
}) })
}) })
socket.on("connect_error", err => { socket.on("connect_error", err => {
console.log("Failed to connect to builder websocket:", err.message) console.error("Failed to connect to builder websocket:", err.message)
}) })
socket.on("disconnect", () => { socket.on("disconnect", () => {
userStore.actions.reset() userStore.actions.reset()

View File

@ -312,7 +312,7 @@ export const insertBinding = (view, from, to, text, mode) => {
} else if (mode.name == "handlebars") { } else if (mode.name == "handlebars") {
parsedInsert = hbInsert(view.state.doc?.toString(), from, to, text) parsedInsert = hbInsert(view.state.doc?.toString(), from, to, text)
} else { } else {
console.log("Unsupported") console.warn("Unsupported")
return return
} }

View File

@ -67,7 +67,7 @@
})) }))
navigateStep(target) navigateStep(target)
} else { } else {
console.log("Could not retrieve step") console.warn("Could not retrieve step")
} }
} else { } else {
if (typeof tourStep.onComplete === "function") { if (typeof tourStep.onComplete === "function") {

View File

@ -3,11 +3,11 @@ import { get } from "svelte/store"
const registerNode = async (node, tourStepKey) => { const registerNode = async (node, tourStepKey) => {
if (!node) { if (!node) {
console.log("Tour Handler - an anchor node is required") console.warn("Tour Handler - an anchor node is required")
} }
if (!get(store).tourKey) { if (!get(store).tourKey) {
console.log("Tour Handler - No active tour ", tourStepKey, node) console.error("Tour Handler - No active tour ", tourStepKey, node)
return return
} }

View File

@ -45,7 +45,7 @@ const endUserOnboarding = async ({ skipped = false } = {}) => {
onboarding: false, onboarding: false,
})) }))
} catch (e) { } catch (e) {
console.log("Onboarding failed", e) console.error("Onboarding failed", e)
return false return false
} }
return true return true

View File

@ -52,7 +52,7 @@ export const syncURLToState = options => {
let cachedPage = get(routify.page) let cachedPage = get(routify.page)
let previousParamsHash = null let previousParamsHash = null
let debug = false let debug = false
const log = (...params) => debug && console.log(`[${urlParam}]`, ...params) const log = (...params) => debug && console.debug(`[${urlParam}]`, ...params)
// Navigate to a certain URL // Navigate to a certain URL
const gotoUrl = (url, params) => { const gotoUrl = (url, params) => {

View File

@ -107,7 +107,7 @@
return return
} }
if (!prodAppId) { if (!prodAppId) {
console.log("Application id required") console.error("Application id required")
return return
} }
await usersFetch.update({ await usersFetch.update({

View File

@ -66,7 +66,7 @@
try { try {
await store.actions.screens.updateSetting(get(selectedScreen), key, value) await store.actions.screens.updateSetting(get(selectedScreen), key, value)
} catch (error) { } catch (error) {
console.log(error) console.error(error)
notifications.error("Error saving screen settings") notifications.error("Error saving screen settings")
} }
} }

View File

@ -71,7 +71,7 @@
$goto(`./${screenId}`) $goto(`./${screenId}`)
store.actions.screens.select(screenId) store.actions.screens.select(screenId)
} catch (error) { } catch (error) {
console.log(error) console.error(error)
notifications.error("Error creating screens") notifications.error("Error creating screens")
} }
} }

View File

@ -31,7 +31,7 @@
async function login() { async function login() {
form.validate() form.validate()
if (Object.keys(errors).length > 0) { if (Object.keys(errors).length > 0) {
console.log("errors", errors) console.error("errors", errors)
return return
} }
try { try {

View File

@ -307,7 +307,7 @@
// Reset view // Reset view
resetView() resetView()
} catch (e) { } catch (e) {
console.log("There was a problem with the map", e) console.error("There was a problem with the map", e)
} }
} }

View File

@ -61,7 +61,7 @@
resolve({ initialised: true }) resolve({ initialised: true })
}) })
.catch(err => { .catch(err => {
console.log("There was a problem scanning the image", err) console.error("There was a problem scanning the image", err)
resolve({ initialised: false }) resolve({ initialised: false })
}) })
}) })

View File

@ -14,7 +14,7 @@ const createOrgStore = () => {
const settingsConfigDoc = await API.getTenantConfig(tenantId) const settingsConfigDoc = await API.getTenantConfig(tenantId)
set({ logoUrl: settingsConfigDoc.config.logoUrl }) set({ logoUrl: settingsConfigDoc.config.logoUrl })
} catch (e) { } catch (e) {
console.log("Could not init org ", e) console.error("Could not init org ", e)
} }
} }

View File

@ -29,7 +29,7 @@ export const createGridWebsocket = context => {
connectToDatasource(get(datasource)) connectToDatasource(get(datasource))
}) })
socket.on("connect_error", err => { socket.on("connect_error", err => {
console.log("Failed to connect to grid websocket:", err.message) console.error("Failed to connect to grid websocket:", err.message)
}) })
// User events // User events