Closed emmabukacek closed 6 years ago
Thank you for the PR, sorry about the slow response!
The change itself is a good start, but could you make the PR for the v2 branch instead? You'll get quite a lot of conflicts, sorry about that.
To answer your questions:
This breaks the default behavior of the formatting in favor of the old format.
That's fine
Leaving in the 'pretty' reporter seems like a good idea in case some editor parsers updated their code to match. If not, I can strip all that out and we can just revert the commit.
That's also fine, but if you could make --pretty
somehow set the reporter
option instead of being it's own config inside of stylint, that would be nice π If it's unlcear what I mean, don't hesitate to ask.
If it needs to go into a separate file altogether, I can do that.
Yes please, ties into ^
Let me know there's a more acceptable place to store the pretty flag.
I kinda answered above, was that understandable?
Again, sorry about the late response
@SimenB Hey, no problem! Thanks for the response! I'm sorry I'm also late, :grimacing: I'll get on this as soon as I can. So I need to:
reporter
option instead of overloading the default behavior.:smile:
Profit after those 2 things, yeah!
Hey @SimenB , so in the heart of async communication, I figured I'd let you know where I'm at and what I'm thinking.
So far, I've rebased my branch onto v2
(rendering most of my code bunk :laughing: ) and started undergoing the process to add the reporter into a separate file.
In the spirit of solving these issues:
This is the approach I'm taking in this PR:
src/
called formatters/
.default.js
formatter
as an option instead of reporter
.
In the next PR (to make reviews manageable, but can be put into one), I would:
reporter.js
to formatters/???.js
This is making some bigger architectural decisions, so feel free to shut me down, but I figured this was a little more comprehensive than what I originally introduced. Adding the formatters
aligns with ESLint (which seems to be a common theme), helps add organization, and makes future formatters, i.e. json
, a bit easier to bolt on.
Thoughts?
Not so async, woo!
This is the approach I'm taking in this PR:
All of those points SGTM.
In the next PR (to make reviews manageable, but can be put into one), I would:
2 PRs also SGTM π
Thoughts?
You're awesome, thanks for stepping up!
Sorry about v2 killing a lot of your code, that's what I was sorta afraid of...
@emmabukacek ProTipβ’οΈ run eslint . --fix
from the root of the project, and it should cover up at least some of your CoffeeScript habits π₯
I might add it as a precommit hook, but that might be a bit too much...
Hey @SimenB , I'm just about done with this, but I'm at a bit of an impasse. Based on the tickets I've read, it appears that we want four ways to load in formatters:
default
stylint-json-reporter
my/really/cool/formatter.js
Now this is fine and dandy if it comes from the .stylintrc
file and with a few tweaks, all of these should work. However, how do we want to handle CLI arguments? Passing in a configuration isn't really realistic (JSON in the CLI sounds gross), but I think we could reasonably handle the first three if we're smart about it. I was thinking about having this syntax:
stylint path/to/file --formatter=default
stylint path/to/file --formatter=stylint-json-reporter
--third-party-formatter=
, but that seems verbose.stylint path/to/file --formatter=path/to/formatter.js
/
(my current code does that as well), but that means that you would have to write a root file as ./formatter.js
instead of just formatter.js
.--local-formatter=formatter.js
Anyway, just some thoughts. Let me know if you agree or have any ideas; I'm close to the finish line on this (I think, anyway :laughing: ) and I want to make sure I do it right.
Thanks!
I would use --formatter
, no need for specific commands.
Could attempt native, 3rd party, then a specific path.
π
but that means that you would have to write a root file as ./formatter.js instead of just formatter.js
And that's ok. Some npm modules have dot in their name so formatter.js
can still be a third party formatter module. Presence of /
is obvious we deal with a path. There is an exception though , scoped modules @scope/project-name
.
@wojciechczerniak Yeah, that's a good point with the scoping. I'll try to throw together a solid series of tests to make sure we have our bases covered. Thanks for confirming for me!
Okay, I think this is ready for an actual review! @SimenB @wojciechczerniak Happy to make any changes.
Once we're done here, I've got a few more PRs:
https://github.com/SimenB/stylint/pull/424 - formatterOptions
-> formatter
https://github.com/SimenB/stylint/pull/425 - A little clean-up
Obviously the latter is biased, but it looked like the repo was going towards spaces and I wanted to knock out that TODO
. No hard feelings if it's not needed. π
I'll review this later today, I swear!
@SimenB Ugh, sorry to make you review the code twice, heh. I meant for this to be split from https://github.com/SimenB/stylint/pull/424 so it was easier to review, but somewhere along the lines, they were combined. :woman_facepalming: Closing this out.
Issues
Changes
reporter
config key toformatter
formatter
take a native formatter name, a third-party module, or path.pretty
package.json
coverage includeAdditional
formatter
argument now works so that you can pass in:pretty
ordefault
./local_repo/linter_formatters/...
Code Coverage