no-console rule should document how to enforce calls only via no-restricted-syntax
See original GitHub issueWhat rule do you want to change?
The no-console
rule.
Does this change cause the rule to produce more or fewer warnings?
Fewer warnings.
How will the change be implemented? (New option, new default behavior, etc.)?
I’m thinking it would be default behavior, but could also be configured.
Please provide some example code that this change will affect:
In our development and test environments we have this snippet to suss out warnings in our Javascript:
console.error = function (message) {
throw new Error(message);
};
What does the rule currently do for this code?
The rule currently reports Unexpected console statement
.
What will the rule do after it’s changed?
It will not report any errors for assignment to console.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:18 (16 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. Examples of incorrect code for this rule: /* eslint no-console: "error"...
Read more >What if ESLint's configuration worked like elm-review?
I was curious to see how the configuration for ESLint would look ... In elm-review , the whole configuration is just this list...
Read more >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 >eslint-config-openstack/.eslintrc at master - OpenDev
# Disallow assigning of the exception parameter in a catch block. # http://eslint.org/docs/rules/no-ex-assign.
Read more >List of available rules - ESLint - Pluggable JavaScript linter
These rules relate to possible syntax or logic errors in JavaScript code: for-direction. enforce “for” loop update clause moving the counter in the...
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
I don’t think it’s worth changing the rule for this use case. Instead, you can use a disable comment to ignore the rule in this location.
Here are two ways you can do this:
Of course, you could also just use the
no-console
rule to statically detect all of yourconsole.error
invocations and replace them with error throwing, as needed. 😄Editing the title of this issue to reflect the TSC decision.