CSS: New option «CSS Selector List on Same Line» and changed default behaviour#2022
Closed
yuchi wants to merge 3 commits intoprettier:masterfrom
Closed
CSS: New option «CSS Selector List on Same Line» and changed default behaviour#2022yuchi wants to merge 3 commits intoprettier:masterfrom
yuchi wants to merge 3 commits intoprettier:masterfrom
Conversation
Changes the behaviour for line breaking inside selector lists (those separated by ',') so that every selector is in its own line. Can be changed back to previous behaviour setting the option 'cssSelectorListSameLine' to 'true'. In the CLI is '--css-selector-list-same-line'. Fixes prettier#1962
Contributor
Author
|
.cc @evilebottnawi for their work on |
Contributor
|
Hey. I've been thinking about it some more and I believe that you are right. This should be the way we print CSS. If you remove the option, I'll merge it in! Thanks |
Contributor
Author
|
Thank you. This is the main stopper to adopt it in a lot of our projects. We'll report other minor issues over the time. Glad to help! |
Contributor
Author
|
@vjeux I didn’t update all failing snapshots but I can do that in another commit. Do you want me to do that and probably also rebase? |
Contributor
|
Snapshots should be updated. https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md |
Contributor
Author
|
Thanks @SimenB, updated them. Should I rebase to master also? |
Contributor
Author
|
@vjeux Totally missed «If you remove the option, I'll merge it in!» |
Contributor
Author
|
Close in favor of #2047 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following #1962 this PR changes the behaviour of the CSS Printer so that every selector in a selector list will be printed in its own line. A new option enables the previous behaviour.
This new behaviour is the one followed by
( 1, 2: CSS Lint doesn’t have formatting linting rules. )
Example
Given this input:
New output:
Previous behaviour (can be enabled with option):
New option
To revert back to the previous behaviour we created the
cssSelectorListSameLineoption, which defaults tofalse.From the CLI can be used as
--css-selector-list-same-line.The name of the option comes from the Style lint rule:
selector-list-comma-newline-after.