-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Fix: lines-between-class-members
(fixes #9665)
#9680
Conversation
9de78e2
to
8d81306
Compare
`lines-between-class-memebers` if a comment occurs between class members
8d81306
to
af7a7f3
Compare
lines-between-class-memebers
(fixes #9665)
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.
Thank you for the contribution!
Direction looks good to me, but I have some concerns. Could you add some tests?
class A {
foo() {} // a comment
bar() {}
}
class A {
foo() {}
/* a */ /* b */
bar() {}
}
class A {
foo() {}
/* a */ bar() {}
}
And could you sign our CLA?
@mysticatea Thank you for your review. I added those test cases, which failed. I'm debugging my code now. |
I see. a blank line was wrongly expected before class Foo{
foo(){}
/* foo*/
bar(){}
} An easy fix is to also check lines after the comment |
Hm, #9680 (comment) shows "not signed yet", but @ilyavolodin do you have idea? |
@mysticatea Sorry, I did strange things.
|
@sakabar Thank you for the information! Looks like a bug of @jsf-clabot. |
Sorry, I can't imagine code when there are several comments. I implemented this code in my way. |
@@ -55,7 +55,30 @@ module.exports = { | |||
* @returns {boolean} True if there is at least a line between the tokens | |||
*/ | |||
function isPaddingBetweenTokens(first, second) { |
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 function seems a little complicated for me, could you add a comment to say what was happening, thanks!
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.
@aladdin-add Sure, I'll add comments.
@mysticatea All checks have passed. I'll add more comments because my code is complicated. |
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.
LGTM. thanks!!
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.
LGTM, thank you!
@aladdin-add @mysticatea |
@sakabar not a necessary, we will squash the commits when merging. 😄 |
lines-between-class-memebers
(fixes #9665)lines-between-class-members
(fixes #9665)
@aladdin-add Sure! |
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.
This LGTM so far. Are there any invalid tests that could/should be added, though? It would be especially good to capture any new (or clarified) autofix behavior in some new tests.
@platinumazure I think additional invalid tests are unnecessary because this PR is a bug fix of false positive. |
thanks for contributing! @sakabar |
@mysticatea @aladdin-add Thank you for your reviewing! |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
I fixed the bug of issue #9665
Is there anything you'd like reviewers to focus on?