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:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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
Seems reasonable to me.
If there is, we can allow console.log on a per file/line basis.