Error ESlint (no-console)

Good night what happens is that I have this error:

line 11, col 7, Error - Unexpected console statement. (No-console)

My solution was as follows:

sArray.forEach((char) => {
    if (/[aeiou]/.test(char) === true) {
      // should be printed "char"

As we can see, I only put a comment inside the “yes” instead of a “console”, however, I am not very happy with that. I researched on the Internet and saw that ESlint blocks it, since it is a bad practice to use the “console” when it goes to production, I was investigating how I can print the result and there is a “Windows” object but it needs an “html”, so what discarded The funny thing is that I was looking at the repository and several of my colleagues are using the “console”, so I don’t know how they made the pipe work for them.

could someone please help me

“I am waiting for the merge to accept me but I know that they will tell me that this solution does not work”


I understand your confusion regarding this rule, eslint is pretty clear to disallow the use of the console log in most cases, however, some trainees have found workarounds for this issue, such as printing the output in a file and then printing the content of the file. In order to keep it simple, I suggest you to take eslint advice and use a global /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ at the start of the file instead of disabling each instance of console log in the code. I’m starting to consider disabling this rule in the linter since many trainees have the same issue.