Skip to content

Commit

Permalink
removed unnecessary console logs (#159)
Browse files Browse the repository at this point in the history
* removed unnecessary console logs

* format fix

* updated version in package.json
  • Loading branch information
abrulic1 authored Oct 31, 2024
1 parent 66d252e commit a9cfeec
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 48 deletions.
6 changes: 5 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
"recommended": true,
"suspicious": {
"recommended": true,
"noExplicitAny": "off"
"noExplicitAny": "off",
"noConsole": {
"level": "error",
"options": { "allow": ["assert", "error", "info", "warn"] }
}
},
"style": {
"recommended": true
Expand Down
85 changes: 47 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "remix-development-tools",
"description": "Remix development tools - a set of tools for developing/debugging Remix.run apps",
"author": "Alem Tuzlak",
"version": "4.7.3",
"version": "4.7.4",
"license": "MIT",
"keywords": [
"remix",
Expand Down Expand Up @@ -99,7 +99,7 @@
"vite": ">=5.0.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@biomejs/biome": "^1.9.4",
"@remix-run/dev": "^2.9.1",
"@remix-run/node": "^2.9.1",
"@remix-run/react": "^2.9.1",
Expand Down
2 changes: 2 additions & 0 deletions scripts/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ const files = glob.sync("**/*.svg", {
cwd: inputDir,
})
if (files.length === 0) {
// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log(`No SVG files found in ${inputDirRelative}`)
process.exit(0)
}
// The relative paths are just for cleaner logs
// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log(`Generating sprite for ${inputDirRelative}`)

generateSvgSprite({
Expand Down
2 changes: 2 additions & 0 deletions scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import chalk from "chalk"
import prompt from "prompt"
// Helper method used to verify the run
const verifyRun = async () => {
// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log("About to execute the command")

const { sure } = await prompt.get([
{ name: "sure", description: "Are you sure? (y/n)", type: "string", required: true },
])

if (sure !== "y") {
// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log(chalk.bold.red("Command aborted!\n"))
process.exit(1)
}
Expand Down
1 change: 0 additions & 1 deletion src/client/components/jsonRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const JsonRenderer = ({ data }: JsonRendererProps) => {
value
.then((res) => {
if (!ref.current) return
console.log(res)
setJson((json: any) => ({
...json,
[key]: res,
Expand Down
10 changes: 5 additions & 5 deletions src/client/hooks/useDevServerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const updateRouteInfo = (
const { data, type } = event
const { id, ...rest } = data
// Get existing route
const existingRouteInfo = !includeServerInfo ? routes?.[id] : routes?.[id] ?? server?.routes?.[id]
const existingRouteInfo = !includeServerInfo ? routes?.[id] : (routes?.[id] ?? server?.routes?.[id])
let newRouteData = [...(existingRouteInfo?.[type === "loader" ? "loaders" : "actions"] || []), rest]
// Makes sure there are no more than 20 entries per loader/action
newRouteData = cutArrayToLastN(newRouteData, 20)
Expand All @@ -40,10 +40,10 @@ const updateRouteInfo = (
highestExecutionTime: max,
averageExecutionTime: Number(Number(total / newRouteData.length).toFixed(2)),
loaderTriggerCount: type === "loader" ? loaderTriggerCount + 1 : loaderTriggerCount,
loaders: type === "loader" ? newRouteData : existingRouteInfo?.loaders ?? [],
actions: type === "action" ? newRouteData : existingRouteInfo?.actions ?? [],
lastLoader: type === "loader" ? rest : existingRouteInfo?.lastLoader ?? {},
lastAction: type === "action" ? rest : existingRouteInfo?.lastAction ?? {},
loaders: type === "loader" ? newRouteData : (existingRouteInfo?.loaders ?? []),
actions: type === "action" ? newRouteData : (existingRouteInfo?.actions ?? []),
lastLoader: type === "loader" ? rest : (existingRouteInfo?.lastLoader ?? {}),
lastAction: type === "action" ? rest : (existingRouteInfo?.lastAction ?? {}),
actionTriggerCount: type === "action" ? actionTriggerCount + 1 : actionTriggerCount,
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const log = (message: string) => {
if (config.silent) {
return
}
// eslint-disable-next-line no-console

// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log(message)
}

Expand Down
1 change: 1 addition & 0 deletions src/vite/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const remixDevTools: (args?: RemixViteConfig) => Plugin[] = (args) => {
async configResolved(resolvedViteConfig) {
if (!args?.suppressDeprecationWarning && resolvedViteConfig.appType === "custom") {
// Log a warning message
// biome-ignore lint/suspicious/noConsole: disable noConsole rule for this line
console.log(
`\n\n⚠️ ${chalk.yellowBright("remix-development-tools")} are going to be deprecated and will be renamed to ${chalk.greenBright("react-router-devtools ")} when React Router v7 is released ⚠️`,
`\n⚠️ Set suppressDeprecationWarning to true in your ${chalk.greenBright("vite.config.ts")} file to silence this warning ⚠️`
Expand Down

0 comments on commit a9cfeec

Please sign in to comment.