I configured Eslint on an Angular project to check the code during commits.
I made an error on purpouse to test if my configuration works: I set the rule "no-console":"error"
and I left a console.log()
inside the code.
When committing ESLint gives me this error:
...
✖ eslint --fix:
C:\project\src\app\app.component.ts
12:5 error Unexpected console statement no-console
✖ 1 problem (1 error, 0 warnings)
husky - pre-commit hook exited with code 1 (error)
My doubt is about the fact that I see 2 lines signed with ✖.
They refer to the same error (console.log) or one of them refers to an ESLint configuration problem?
Thank for you help,
CodePudding user response:
In Your example ESLint is saying that there is exactly one problem in file C:\project\src\app\app.component.ts
- 12:5 error Unexpected console statement no-console
About the ✖ eslint --fix:
- ESLint is just suggesting to run the command to automatically fix the files.
However, fix
command only takes care of formatting, oyu would have to manually remove the console.log()
call.