Skip to content
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

Force a blank line like refmt with /** */ comment #7

Closed
vramana opened this issue Jan 7, 2017 · 4 comments
Closed

Force a blank line like refmt with /** */ comment #7

vramana opened this issue Jan 7, 2017 · 4 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken

Comments

@vramana
Copy link

vramana commented Jan 7, 2017

I have observed that this made me document code more often.

@jlongster
Copy link
Member

Can you expand on this more? I don't remember exactly what this behavior is.

@vramana
Copy link
Author

vramana commented Jan 9, 2017

refmt would normally remove all the blank lines btween the let declarations. So,

let a = 2;

let b = 3;

will become

let a = 2;
let b = 3;

But if you use a comment /** */ between them i.e,

let a = 3;
/** My Comment */
let b = 4;

It inserts a new line above the comment.

let a = 3;

/** My Comment */
let b = 4;

@jlongster
Copy link
Member

Ah interesting. Today I landed rules for newlines, and it keeps the original newlines. Meaning if you had

let a = 2;
let b = 3;

that's what it would output. However if you had:

let a = 2;

let b = 3;

It would output that as well. Lastly, if you have multiple blank lines like:

let a = 2;



let b = 3;

It will collapse them into a single newline.

I don't think we can be as opinionated as refmt because there are so many existing JS coding styles. I tried coming up with automatic ways to insert newlines, but it's pretty difficult.

I like the idea that it encourages you to document in order to group things up. I'm open to talking more about this, so I'll leave this open. @vjeux what do you think?

@vjeux
Copy link
Contributor

vjeux commented Jan 9, 2017

I know about the refmt way of doing things but I still think that it's better to preserve lines inputted by the user. It seems super arbitrary to have to add a comment to make sure lines are displayed the way you want. Also, adding more comments is not a good thing in itself. I'd rather have comments on why things are done this way rather than commenting on how each line works.

@vramana vramana added the status:needs discussion Issues needing discussion and a decision to be made before action can be taken label Jan 11, 2017
@vramana vramana closed this as completed Feb 25, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken
Projects
None yet
Development

No branches or pull requests

3 participants