-
Notifications
You must be signed in to change notification settings - Fork 889
no-console
gives a false positive when there is a console
local
#3633
Comments
This is kind of a bug I guess, but I think that it is not advisable to use a variable named |
That's the whole point of it tho. I don't want people to use the global |
Whether you want people to use the global console or not, a variable named ‘console’ will still shadow the global unless you do something funky like unsetting the function. It’s a very specific use case and as such does not have a place in the main tslint ruleset, which is intended to be fairly specific and opinionated. That said, you could write your own custom rule to lint this use case. |
Yes, I have done that for other globals like Our use case is that we don't want people to use globals in a server-side rendering context, but global names like ESLint has a similar rule for what we need: https://eslint.org/docs/rules/no-restricted-globals |
I guess we finally got that rule #3824 |
Bug Report
5.8.0
2.5.3
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
ERROR: 2:3 no-console Calls to 'console.log' are not allowed.
Expected behavior
No error
The text was updated successfully, but these errors were encountered: