no-console doesn't work to disable all console statements without an empty "allow" parameter on it.
See original GitHub issueESlint version: 7.6.0
Expected to work as follows:
no-console: "error"
Actually works only when done as follows:
"no-console": [ "error", { "allow": [""] // ¯\_(ツ)_/¯ } ],
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to quickly and conveniently disable all console.log ...
Redefine the console.log function in your script. console.log = function() {}. That's it, no more messages to console. EDIT: Expanding on Cide's idea....
Read more >no-console - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Global Flags - Rclone
Global Flags. This describes the global flags available to every rclone command split into two groups, non backend and backend flags.
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >Windows PowerShell Cheat Sheet
(The pure PS console does not allow shrinking of width). ... Any cmdlet parameter (aka flag) can be truncated to the extent that...
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 FreeTop 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
Top GitHub Comments
@DanBoSlice thanks for the details!
The rule itself seems to be working fine: Online Demo
The behavior you’re seeing is due to how overriding rules’ configuration works.
In your example, one of the configurations you’re extending from,
plugin:@angular-eslint/ng-cli-compat
, enablesno-console
rule and configures it to allow.log
and other methods here.If you reconfigure the rule in your main config file (derived config) by specifying only severity, ESLint will keep the options from the extended configuration (base config). This behavior is explained in Extending Configuration Files:
So, in your example,
"no-console": "error"
has no effect as it overrides just severity but not the options. You can double-check the resulting configuration for a file with the –print-config CLI option.The solution is to specify options in the main config.
"no-console": ["error", {"allow": [""]}]
or just"no-console": ["error", {}]
should do the work. That would entirely override the configuration forno-console
from the extended config.Thank you, now I understand the mistake, thanks for your time