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

Comments stripped from empty functions #31

Closed
acdha opened this issue Jan 10, 2017 · 4 comments
Closed

Comments stripped from empty functions #31

acdha opened this issue Jan 10, 2017 · 4 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@acdha
Copy link
Contributor

acdha commented Jan 10, 2017

This is definitely an edge case but it might surprise people with placeholders, etc. if they aren't carefully reviewing changes:

function foo() {
	//foobar
}

becomes:

function foo() {}

Adding any sort of real work to that code will cause the comment to be retained:

function foo() {
	//foobar
        1;
}
function foo() {
  //foobar
  1;
}
@jlongster
Copy link
Member

Good call, I think that's called a "dangling" comment and we might just not be outputting those.

@deoxxa
Copy link

deoxxa commented Jan 10, 2017

I do this every now and then in empty catch handlers, like this:

doTheThing().then(something).then(somethingElse).then((res) => {
  console.log(res);
}).catch((err) => {
  /* do nothing - no way to recover from this error */
})

It makes no operational difference to the program, but it serves as documentation that the error has been considered and ignored on purpose.

@vramana vramana added the type:bug Issues identifying ugly output, or a defect in the program label Jan 11, 2017
@n1k0
Copy link

n1k0 commented Jan 15, 2017

This comes especially annoying when iterating over some implementation and using the format-on-save feature of some editor's plugin - which turns being totally unusable in these circumstances :)

@jlongster
Copy link
Member

Moved to #275

@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. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

5 participants