Skip to content
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

Specify allowed console methods in no-console rule #4412

Closed
mminer opened this issue Nov 13, 2015 · 6 comments
Closed

Specify allowed console methods in no-console rule #4412

mminer opened this issue Nov 13, 2015 · 6 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@mminer
Copy link

mminer commented Nov 13, 2015

In some codebases I use console.info for permanent messages and console.log for occasional debugging. It would be helpful if ESLint's no-console rule could be configured to warn about instances of console.log (which shouldn't be committed) while ignoring console.info.

Something like this:

"no-console": [2, { "allowedMethods": ["assert", "info"] }]

I'm unsure how many developers differentiate between console methods in this manner, but I suspect I'm not the only one. If this rule option is deemed a good candidate, I'd be happy to work on it.

@eslintbot
Copy link

Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Nov 13, 2015
@ilyavolodin
Copy link
Member

Duplicate of #2621 This has been brought up before, and since the rule is called no-console it would be strange to allow use of console as an option. Somebody already created a custom rule that does what you are looking for: https://github.com/joeybaker/eslint-plugin-no-console-log
Closing, as I think what you are asking for is outside of the scope of the rule. Feel free to reopen if you disagree.

@mminer
Copy link
Author

mminer commented Nov 13, 2015

Being outside the scope of the rule is a fair assessment, though I still think there's a place for more fine-grained control over console given that some of its methods are typically used for debugging, others for routine logging. The custom rule you linked to looks like it'll do the job though; thanks for pointing it out.

(also, apologies for the duplicate issue, I searched through past ones but missed #2621)

@allenmanning
Copy link

+1

2 similar comments
@hugofqueiros
Copy link

+1

@Mouvedia
Copy link

Mouvedia commented Feb 3, 2016

+1

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

6 participants