-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
Add autofix to function-max-empty-lines #3645
Add autofix to function-max-empty-lines #3645
Conversation
@@ -53,6 +53,17 @@ const rule = function(max) { | |||
index -= 1; | |||
} | |||
|
|||
if (context.fix) { | |||
decl.value = ( |
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.
If value contains a comment, you must use decl.raws.value.raw
.
decl.toString().substring(0, index) + | ||
decl.toString().substring(match.endIndex) | ||
) | ||
.split(":")[1] |
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.
You can use declarationValueIndex.js
to take the starting position.
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 the following test case?
a { transform: /*c*/translate(\n\n\n1,1); }
Thank you for this PR. |
* add test to auto fix two places * use declarationValueIndex * add tests containing comments
Hi, thank you for reviewing my PR :) I have addressed the comments you left, let me know if there is something that should be improved! |
@Bilie Thank you for the great work :) |
@Bilie LGTM! Thank you. |
Closes #3613
No, it's self explanatory