Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How many warnings should your JavaScript app have?

How many warnings should your JavaScript app have?

JavaScript warnings are these messages being displayed in yellow or red in your JavaScript console or terminal. They make no sense at all in general but they are a good indication of the health of your app. The points below will give you a general idea of how many warnings you should expect in your app:

  • 0 warnings: the app is not working at all

  • 5 warnings: app is probably starting but crashing soon after - try to find why it crashes. You'd think you could read the warnings to learn why it doesn't work, but that's not what warnings are for.

  • 50 warnings: That's the soft spot - most likely everything's running smoothly

  • 200+ warnings: It might be an indication of a problem, but it could just be that a package developer decided to print pages of warnings for something they thought was very important. Everything still works the same, and the developer has moved on to more important stuff so get used to see these warnings all the time.

  • 20,000+ warnings: you need to do something. The app still works fine of course, but the amount of warnings being printed is starting to slow everything down. This is usually when it makes sense to throw away the whole app and start a new one (╯°□°)╯︵ ┻━┻ New apps have less warnings and are more fun to work on anyway.

An example of a well working app. All tests are passing with flying colours.

@frague59

This comment has been minimized.

Copy link

@frague59 frague59 commented Apr 1, 2020

I think we should have random colors on warnings, then the console should be more æstetic.

@MatthewCash

This comment has been minimized.

Copy link

@MatthewCash MatthewCash commented Apr 1, 2020

Easy trick to make your app much more stable, just clear the console after a few seconds. No more errors or warnings, all problems solved.

@frague59

This comment has been minimized.

Copy link

@frague59 frague59 commented Apr 2, 2020

👍

@subpardaemon

This comment has been minimized.

Copy link

@subpardaemon subpardaemon commented Apr 2, 2020

warning: this is not a warning. it's an error.
warning: planetary constellation unstable, please reboot gravity.
warning: i don't know who you are but i'm going to find you and kill you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.