-
Notifications
You must be signed in to change notification settings - Fork 1.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
Bring back space_after_anon_function #474
Bring back space_after_anon_function #474
Conversation
Interesting. The only reason we have |
Yes, as @rossipedia and @roman01la I just want the space between I gave it some though before and came up with these alternatives for the API:
Options 2 and 3 have the downside that if in the future So I ended up going with option 3 because it seemed the least disruptive. What I'd like is actually option 1 and to also keep |
I went ahead and cleaned up the spaces in master. Thanks for pointing them out. There is a long standing tension between added formatting options and keeping the tool from degenerating into a completely configurable but untestable hell. In #221, we've discussed "The beautifier basic formatter, not a general-purpose custom formatter." It looks like what you really want add the In fact, option 4 (option 1 but keep |
Thanks, I'll follow that discussion. I pushed some changes to bring Just FYI, I use Sublime Text 3 with these options 😃: {
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true
} |
|
@evocateur you're right, sorry. |
@gabrielmaldi Any news on the Python implementation? I appreciate your responsiveness to the feedback here. |
I mistakenly thought I had asked for some help because I had never written a line of Python before. Anyway, I dived into it and it was pretty simple since all I had to do was copy the whole structure of an existing option. I also added the new option to the CLI and docs. Just shoot any feedback 😃 |
Hey, just a friendly reminder that if you guys want me to work further on this PR just go ahead and tell me what you think I should do/change 😄 |
@@ -266,6 +271,7 @@ | |||
opt.space_in_paren = (options.space_in_paren === undefined) ? false : options.space_in_paren; | |||
opt.space_in_empty_paren = (options.space_in_empty_paren === undefined) ? false : options.space_in_empty_paren; | |||
opt.jslint_happy = (options.jslint_happy === undefined) ? false : options.jslint_happy; | |||
opt.space_after_anon_function = (options.space_after_anon_function === undefined) ? false : options.space_after_anon_function; |
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.
Instead, I'd suggest adding this at line 279:
// force opt.space_after_anon_function to true if opt.jslint_happy
if(opt.jslint_happy) {
opt.space_after_anon_function = true;
}
Then below you can check for just opt.space_after_anon_function
instead of two different options.
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.
Most likely I misunderstood, but we need this line here; otherwise space_after_anon_function
won't be set to the desired value.
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.
The change you made looks like what I intended. 😄
Sorry for the delay. Thanks again for you following through on this change, and for doing the python work as well. It looks really good. A few minor changes (and mirror them in python) and we can merge this. |
ce54ae7
to
aff7dc6
Compare
|
||
# force opts.space_after_anon_function to true if opts.jslint_happy | ||
if self.opts.jslint_happy: | ||
self.opts.space_after_anon_function = True |
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.
I can't get this to work; it's what's making tests fail. Help? 😄
Thanks for your feedback! I went ahead and made the changes you suggested. If I missed anything just tell me. I'm having trouble getting to force |
Ah, you found a bug in the python code. I've just pushed a fix. Rebase your changes on top of master and squash to one commit. Tests should then pass. |
aff7dc6
to
0a30fc7
Compare
0a30fc7
to
f5e7dce
Compare
My first thought was that it was probably just what you fixed in c67a9e7. But I couldn't be sure because of my little knowledge of Python 😄 |
Bring back space_after_anon_function
This PR adds the option
jslint_happy_align_switch_case
which allows to opt out of switch-case alignment when usingjslint_happy
.With
jslint_happy_align_switch_case = true
(the default):With
jslint_happy_align_switch_case = false
:Most changes in this PR are trimmed trailing whitespace, use ?w=1 to focus on the real changes.
#15, #213, #372
ToDo: