-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix: newline-before-return: bug with comment (fixes: 5480) #5512
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
Conversation
|
By analyzing the blame information on this pull request, we identified @kaicataldo to be a potential reviewer |
|
Thanks for the pull request, @diki! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
ff07c57 to
b4f5d87
Compare
|
Thanks, @diki! Can you add some tests to this to make sure we don't inadvertently reintroduce this bug later? |
|
@btmills 👍 |
|
I'm not at my computer right now, but it looks like blocks that only contain comments aren't getting calculated correctly. Do you know what exactly is happening? I'd love to see a few more tests for other scenarios ( Would you mind writing the actual cause in the comment rather than just linking to the issue? Makes it easier for the next person :) Thanks for fixing this! |
|
I'd also love to see the inverse invalid cases tested as well, if possible :) |
|
https://github.com/eslint/eslint/blob/master/lib/rules/newline-before-return.js#L70 fail also fail fail fail if it is last fail :) pass Fixing |
|
Ah, got it - thanks for the thorough explanation! I've asked in the issue of this is intended behavior or a bug, so hopefully we can understand why that's the case. Great work here! |
|
Looks good to me, Thank you! |
Fix: newline-before-return: bug with comment (fixes: 5480)
|
👍 |
|
Thanks for doing this! |
I think problem occurs because sourceCode.getComments(node).leading miscalculates, this is a quick fix.