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 block-closing-brace-newline-before #3442

Merged
merged 5 commits into from Aug 3, 2018
Merged

Add autofix to block-closing-brace-newline-before #3442

merged 5 commits into from Aug 3, 2018

Conversation

ota-meshi
Copy link
Member

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

e.g. "Closes #000" or "None, as it's a documentation fix."

block-closing-brace-newline-before in #2829

Is there anything in the PR that needs further explanation?

e.g. "No, it's self explanatory."

ex.

  • option: always***

    code:

    a { color: pink; }

    fixed:

    a { color: pink;
     }
  • option: never***

    code:

    a {
    color: pink;
    }

    fixed:

    a {
    color: pink;}

@jeddy3 jeddy3 changed the title Add autofix to block-closing-brace-newline-before Add autofix to block-closing-brace-newline-before Jul 21, 2018
Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ota-meshi Thanks for starting this.

I've added a question about the three new tests.

message: messages.rejectedBeforeMultiLine,
line: 3,
column: 8
},
{
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 explain these tests, please?

I'd expected a { color: pink;;;\ntop: 0; ;;} and a { color: pink;;;\ntop: 0;; ;} to be accepted as neither has a newline before the closing brace.

a { color: pink;;;\ntop: 0; ; ; } does, but the spacing between the semicolons is transformed to a { color: pink;;;\ntop: 0;;;}.

I understand these are edge-cases, and if these artifacts are due to an unavoidable implementation detail then I'm happy to stick with them... I'd just like to understand them :)

Copy link
Member Author

@ota-meshi ota-meshi Jul 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"never-multi-line" option does not allow whitespace before closing brace.
It can be understood also from the test case of "a { color: pink;\ntop: 0; }".

Also, when I tried, "a { color: pink;;;\ntop: 0; ;;}" and "a { color: pink;;;\ntop: 0;; ;}" is not allowed with this option.

If used the --fix option, no error is reported, so all errors need to be resolved,
"a { color: pink;;;\ntop: 0; ; ; }" is transformed to "a { color: pink;;;\ntop: 0;;;}".

@jeddy3 jeddy3 merged commit ee00e63 into stylelint:master Aug 3, 2018
@jeddy3
Copy link
Member

jeddy3 commented Aug 3, 2018

  • Added: block-closing-brace-newline-before autofix (#3442).

@ota-meshi ota-meshi deleted the dev/fixable--block-closing-brace-newline-before branch August 3, 2018 22:13
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

3 participants