-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
New: Codeframe (JSCS) formatter (fixes #5860) #7437
Conversation
LGTM |
@vitorbal, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nzakas, @platinumazure and @gyandeeps to be potential reviewers. |
|
||
if (sourceCode) { | ||
result.push( | ||
codeFrame(sourceCode, message.line, message.column, { highlightCode: false }) |
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.
disabled code highlighting as the performance impact was way too high.
const summary = []; | ||
|
||
if (errors > 0) { | ||
summary.push(`${errors} code style ${pluralize("error", errors)}`); |
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.
This is so great! Looking forward to using this :) Don't have time to do a full review right now (will try to get back to this soon), but my preference would be for this to just be error
and warning
instead of code style error
and code style warning
, since not all reported errors/warnings are style related.
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.
Thanks!! That's a good point, I can change it to say only 2 errors found.
, 1 error and 2 warnings found.
, etc instead.
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.
@kaicataldo removed the code style
part of the sentence, as discussed!
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.
This looks way cool!
Just two questions:
- What does the output look like if this is piped into an output file?
- Can this be adapted to support end locations (although perhaps only when the end location is on the same line)?
Any particular reason why it needs to have an end location? I don't think JSCS's formatter did that either. |
Nope! I just figured since we were already making enhancements, I thought On Oct 27, 2016 9:56 PM, "Kai Cataldo" notifications@github.com wrote:
|
🎉 nice job @vitorbal! |
@hzoo Thanks! babel-code-frame worked great :) |
@platinumazure sorry I couldn't get to your questions before. Here's how it looks like when the output is piped to a file:
The color escape codes are not there, which is nice! Regarding end locations, that's a good idea, but babel-code-frame doesn't support such feature. It might be an interesting enhancement in the future though, since we're planning to update a bunch of rules to report a location range (I think @mysticatea is the one working on that, AFAIR). |
What is the purpose of this pull request? (put an "X" next to item)
[x] Add something to the core
What changes did you make? (Give an overview)
Implements the
codeframe
formatter, which closely resembles the default JSCS formatter. Here are some screenshots of how it looks like under different circumstances:When only errors are reported:
When errors and warnings are reported:
When only warnings are reported:
When a parsing error is reported:
When an error that has no line/column is reported:
Is there anything you'd like reviewers to focus on?
Core
" or a "New
" change? I was not sure :(line:column
format to the end of the filepath so editors can open the file directly on the line/column of the error.