-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Chore: use precalculated counts in stylish formatter #8251
Conversation
@alberto, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mgol, @sindresorhus and @mysticatea to be potential reviewers. |
LGTM |
lib/formatters/stylish.js
Outdated
@@ -74,6 +74,8 @@ module.exports = function(results) { | |||
).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`; | |||
}); | |||
|
|||
total = errors + warnings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could total
be declared with const
instead of let
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, sure!
d31efd3
to
1dd6bfa
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. FWIW, the codeframe formatter could also be updated to use the precalculated counts: https://github.com/eslint/eslint/blob/master/lib/formatters/codeframe.js#L105-L109
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[X] Other, please explain:
What changes did you make? (Give an overview)
Use the precalculated error and warning count in stylish
Is there anything you'd like reviewers to focus on?
Is there a reason why we weren't doing this before?