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.

Rule no-console ignores `window.console`

See original GitHub issue

https://github.com/eslint/eslint/blob/master/lib%2Frules%2Fno-console.js

         "MemberExpression": function(node) {

            if (node.object.name === "console") {
                context.report(node, "Unexpected console statement.");
            }

        }

How about adding this support? The fact is that some of my partners prefer to write window.console.log. Or, I have to add a rule for myself? Btw, I find no-alert is simillar: Btw, I just found no-alert seems to be nicer: https://github.com/eslint/eslint/blob/master/lib%2Frules%2Fno-alert.js

Cheers

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Feb 4, 2016

We should probably allow configuration of the global object so you can specify window or something else.

0reactions
kaicataldocommented, Sep 27, 2016

I’m closing this issues since it has been open since January and does not have anyone from the team or the community willing to step forward and own the work to complete to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable "unexpected console statement" in Node.js ...
Create a .eslintrc.js in the directory of your file, and put the following contents in it: module.exports = { rules: { 'no-console': 'off',...
Read more >
no-console - ESLint - Pluggable JavaScript Linter
This rule disallows calls or assignments to methods of the console object. Examples of incorrect code for this rule: /* eslint no-console: "error"...
Read more >
Unexpected console statement. eslint(no-console) error in ...
i am not able to debug my lightning web component javaScript code. am using console.log / window.alert() statements. but it's showing ...
Read more >
Console API — Rich 12.6.0 documentation
The console will auto-detect a number of properties required when rendering. ... dimensions of the terminal (which may change if you resize the...
Read more >
Conditional Logging to the JavaScript Console
The linter will still complain if I leave 'console' method calls in my code without explicitly allowing them with 'eslint-disable no-console' ...
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