question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disallow console log in ESLint

See original GitHub issue

🐛 Bug Report

As a followup to https://github.com/HospitalRun/hospitalrun-frontend/issues/2286 I thought it might be desirable to not allow any log messages in the application using an ESlint rule https://eslint.org/docs/rules/no-console

Proposed changes

  • Remove any console call from the application
  • Add a rule in the ESLint config that would make the linter fail if there is a console call in the application

Is there any good reason why console logs should be kept in the application?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Fibiicommented, Aug 19, 2020

@tobireuen, i don’t think exceptions are handled on the higher level, a good way to handle that is by either informing the user with an alert or a notification with whatever error that is, or use some kind of a logger

for now you can override no-console rule for that line, unless specified otherwise by the maintainers

1reaction
jackcmeyercommented, Aug 18, 2020

Seems reasonable to me.

Is there any good reason why console logs should be kept in the application?

If there is, we can allow console.log on a per file/line basis.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-console - ESLint - Pluggable JavaScript Linter
This rule disallows calls or assignments to methods of the console object. ... eslint no-console: "error" */ console.log("Log a debug level message.
Read more >
How to disable "unexpected console statement" in Node.js ...
If you install eslint under your local project, you should have a directory /node_modules/eslint/conf/ and ...
Read more >
How to disable an ESLint rule - Flavio Copes
You can disable one or more specific ESLint rules for a whole file by adding on a few lines: /* eslint-disable no-debugger, no-console...
Read more >
How to allow console.log() in .eslint? #747 - airbnb/javascript
How to allow console.log() in .eslint? I tried "rules": { "comma-dangle": 0, "no-console": 2 } but don't work.
Read more >
How to disable ESLint for some lines, files or folders
For demo purposes imagine you have a file with a couple of console.log() statements that ESLint doesn't like. To temporarily turn off ESLint, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found