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: Add class options for lines-around-comment
(fixes #8564)
#8565
Conversation
LGTM |
@Mardak, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mathieumg, @scriptdaemon and @alberto to be potential reviewers. |
LGTM |
lines-around-comment
(fixes #8564)lines-around-comment
(fixes #8564)
LGTM |
lines-around-comment
(fixes #8564)lines-around-comment
(fixes #8564)
This PR should no longer be a breaking rule change as indicated by the old tag. |
LGTM |
docs/rules/lines-around-comment.md
Outdated
@@ -172,6 +172,55 @@ function foo(){ | |||
} | |||
``` | |||
|
|||
### allowClassStart | |||
|
|||
Examples of **correct** code for this rule with the `{ "beforeLineComment": true, "allowClassStart": true }` option: |
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.
Can you add a few incorrect code examples too. For example, { "beforeLineComment": true, "allowClassStart": false }
, or { "beforeLineComment": false, "allowClassStart": 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.
Added incorrect examples with allowClassStart: false
. It's not as relevant for incorrect examples with allowClassStart: true
as it's making the check less strict.
LGTM |
Do the labels/tags on this approved PR need to be adjusted? |
This has now been accepted. Apologies for the delay! |
docs/rules/lines-around-comment.md
Outdated
|
||
class foo { | ||
// what a great and wonderful day | ||
day() {"great"} |
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.
Can we all these examples say day() {}
or day() { return great; }
instead? It's a bit confusing as it currently stands.
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.
Switched them all to day() {}
(and rebased)
LGTM |
LGTM. Thank for contributing to ESLint! |
Just FYI, the release note doesn't seem to list this PR in the Enhancements section. |
This was my fault. I missed that the commit message said |
Relevant comment: #8633 (comment) |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[x] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Fix #8564.
What changes did you make? (Give an overview)
Moved the "ClassBody" check from "Block" to "Object"AddedallowClassStart
andallowClassEnd
options, updated tests, and added docs.Is there anything you'd like reviewers to focus on?
Should this be marked breaking?