New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no-console warns on assignment #14793
Comments
Hi @sachinraja, thanks for the issue!
This was already discussed in #7806, and it was eventually decided that this behavior shouldn't be changed. If you want to disallow only method calls, you can use the
You're right, this sounds misleading. I'm marking this issue as an accepted documentation change. |
This comment has been minimized.
This comment has been minimized.
* master: Chore: Add rel/abs path tests in `no-restricted-{imports/modules}` rules (eslint#14910) Upgrade: Debug 4.0.1 > 4.3.2 (eslint#14892) Chore: add assertions on reporting location in `semi` (eslint#14899) Fix: no-useless-computed-key edge cases with class fields (refs eslint#14857) (eslint#14903) Upgrade: `js-yaml` to v4 (eslint#14890) Fix: prefer-destructuring PrivateIdentifier false positive (refs eslint#14857) (eslint#14897) Fix: dot-notation false positive with private identifier (refs eslint#14857) (eslint#14898) Sponsors: Sync README with website Sponsors: Sync README with website Docs: improve rule details for `no-console` (fixes eslint#14793) (eslint#14901) Update: check class fields in no-extra-parens (refs eslint#14857) (eslint#14906) Docs: add class fields in no-multi-assign documentation (refs eslint#14857) (eslint#14907) Docs: add class fields in func-names documentation (refs eslint#14857) (eslint#14908) Upgrade: `eslint-visitor-keys` to v3 (eslint#14902) Upgrade: `markdownlint` dev dependencies (eslint#14883) Upgrade: @humanwhocodes/config-array to 0.6 (eslint#14891) Chore: Specify Node 14.x for Verify Files CI job (eslint#14896)
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?@typescript-eslint/parser
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
npx eslint .
What did you expect to happen?
The
no-console
rule should detect that this is an assignment and not a call. In the rule details it says "This rule disallows calls to methods of the console object."What actually happened? Please copy-paste the actual, raw output from ESLint.
warning Unexpected console statement no-console
Steps to reproduce this issue:
no-console: 'warn'
to yourrules
.console.log = null
Are you willing to submit a pull request to fix this bug?
yes
The text was updated successfully, but these errors were encountered: