gitify-app / gitify

GitHub notifications on your menu bar. Available on macOS, Windows & Linux.
https://gitify.io
MIT License
4.48k stars 257 forks source link

build(biome): enable noConsoleLog rule #1268

Closed setchy closed 3 months ago

setchy commented 3 months ago

Avoid future console.logs accidentally creeping in 🙈

setchy commented 3 months ago

The fact that you refactored a console log into its own function to not put the ignore on multiple places is a bit hilarious 😆

just making our friend @bmulholland happy 😄

https://github.com/gitify-app/gitify/pull/1268#discussion_r1644892762

bmulholland commented 3 months ago

Well, to be fair, I was thinking of going one step further: logger.ts:

function debugLog(msg) {
  // biome-ignore lint/suspicious/noConsoleLog: debug logging
  console.log(msg);
}

The point isn't to centralize the biome-ignore, but more to make the intent clear. Specifically: if I'm reading the code, and I see console.log, I think "this is a mistake, shouldn't be here." But if I'm reading code and see debugLog, I don't question it, and even consider it thoughtful and helpful.

Also, centralizing it means that we could in future e.g. change the debug log to a log file, which could be submitted with bug reporst.

My mental reference here is Rails' log levels: https://guides.rubyonrails.org/debugging_rails_applications.html#sending-messages