Skip to content

CSS: New option «CSS Selector List on Same Line» and changed default behaviour#2022

Closed
yuchi wants to merge 3 commits intoprettier:masterfrom
yuchi:dev-css-single-selector-per-line
Closed

CSS: New option «CSS Selector List on Same Line» and changed default behaviour#2022
yuchi wants to merge 3 commits intoprettier:masterfrom
yuchi:dev-css-single-selector-per-line

Conversation

@yuchi
Copy link
Copy Markdown
Contributor

@yuchi yuchi commented Jun 7, 2017

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:

.a,.b,.c {
  color: red;
}

New output:

.a,
.b,
.c {
  color: red;
}

Previous behaviour (can be enabled with option):

.a, .b, .c {
  color: red;
}

New option

To revert back to the previous behaviour we created the cssSelectorListSameLine option, which defaults to false.

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.

yuchi added 2 commits June 7, 2017 15:50
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
@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 7, 2017

.cc @evilebottnawi for their work on stylelint-plugin-prettier

@vjeux
Copy link
Copy Markdown
Contributor

vjeux commented Jun 8, 2017

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

@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 8, 2017

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!

@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 8, 2017

@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?

@SimenB
Copy link
Copy Markdown
Contributor

SimenB commented Jun 8, 2017

Snapshots should be updated. https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md

@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 8, 2017

Thanks @SimenB, updated them. Should I rebase to master also?

@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 8, 2017

@vjeux Totally missed «If you remove the option, I'll merge it in!»

@yuchi
Copy link
Copy Markdown
Contributor Author

yuchi commented Jun 8, 2017

Close in favor of #2047

@yuchi yuchi closed this Jun 8, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 20, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants