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

Add autofix to function-max-empty-lines #3645

Merged
merged 5 commits into from
Sep 20, 2018

Conversation

Bilie
Copy link
Member

@Bilie Bilie commented Sep 8, 2018

Which issue, if any, is this issue related to?

Closes #3613

Is there anything in the PR that needs further explanation?

No, it's self explanatory

@@ -53,6 +53,17 @@ const rule = function(max) {
index -= 1;
}

if (context.fix) {
decl.value = (
Copy link
Member

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]
Copy link
Member

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.

Copy link
Member

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); }

@ota-meshi
Copy link
Member

Thank you for this PR.
I wrote some change requests in comments.

* add test to auto fix two places
* use declarationValueIndex
* add tests containing comments
@Bilie
Copy link
Member Author

Bilie commented Sep 10, 2018

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!

@ota-meshi
Copy link
Member

@Bilie Thank you for the great work :)
I have a few more request.

@ota-meshi
Copy link
Member

@Bilie LGTM! Thank you.

@ntwb ntwb merged commit a7aad08 into stylelint:master Sep 20, 2018
@ntwb
Copy link
Member

ntwb commented Sep 20, 2018

Changelog: b202c59

Added: function-max-empty-lines autofix (#3645).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants