Skip to content

Some CSS/SCSS feedback #2213

Closed
Closed

Description

@ahmedelgabri

I ran prettier on our SCSS files to see if we can use it also for .scss files next to .js files & I noticed a couple of things:

  • Selectors are flattened
-  &:before,
-  &:after {
+  &:before, &:after {
- @media all and (-webkit-min-device-pixel-ratio : 1.5),
- all and (-o-min-device-pixel-ratio: 3/2),
- all and (min--moz-device-pixel-ratio: 1.5),
- all and (min-device-pixel-ratio: 1.5) {
+ @media all and (-webkit-min-device-pixel-ratio: 1.5), all and (-o-min-device-pixel-ratio: 3/2), all and (min--moz-device-pixel-ratio: 1.5), all and (min-device-pixel-ratio: 1.5) {
  • Some values are formatted in a kind of weird way, I assume Prettier is trying to limit the line to 80 characters so that's why this is happening. But for S/CSS maybe the limit can be disabled or changed to something like 120?

Some examples:

- border-left: 1px solid mix($warningBackgroundColor, $warningBorderColor, 50%);
+ border-left: 1px
+  solid
+  mix($warningBackgroundColor, $warningBorderColor, 50%);
- $fontFamily: "Lato", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
+ $fontFamily: "Lato",
+  -apple-system,
+  "Helvetica Neue",
+  Helvetica,
+  Arial,
+  sans-serif;
  • Some problems with inline comments
- background-position: center bottom; // center the image using background position
+ background-position: center
+   bottom; // center the image using background position
- span.label { // 1
+ span.label {
+  // 1

Activity

  1. yuchi commented on Jun 21, 2017

    @yuchi
    Contributor

    A small note: your first point (flattened selectors lists) has been already addressed in #2047 and merged but not released yet (happened the day after the 1.4.4 release).
    @vjeux when is the ETA for this?

  2. vjeux commented on Jun 21, 2017

    @vjeux
    Contributor
    1. was fixed by CSS: Every selector is now printed in its own line #2047, I just fixed 2) with Allow long media rules to break #2219.

    For 3) and 4), I'm going to look into using fill() for those, it's indeed weird when it breaks for everyone of them.

    1. is intended, we don't want the comment to go past 80 columns so we break.

    2. is intended as well. The underlying comment algorithm has a limited number of ways we can encode them and we cannot support comments attached to {. This is a bit unfortunate but it's usually easy to fix by putting the comment on the line above.

    @yuchi, I'm back from vacation and had to spend time rewriting the README in order to defuse drama around eslint. Hopefully by the end of the week/early next week.

  3. yuchi commented on Jun 21, 2017

    @yuchi
    Contributor

    Thanks for the feedback on the release. Can we help on some of these? Any pointers? (Also related to wording on readme if a non-native english speaker can help)

  4. vjeux commented on Jun 21, 2017

    @vjeux
    Contributor

    @yuchi I'm not actively looking for help but if you come up with better wording on the README or send a fix for an issue labelled as "bug", it'll be appreciated :)

  5. added a commit that references this issue on Jun 21, 2017
    035e118
  6. vjeux commented on Jun 21, 2017

    @vjeux
    Contributor

    Actually, #2224 also fixes the first issue you have with comments :)

  7. added
    lang:css/scss/less
    on Jun 21, 2017
  8. added a commit that references this issue on Jun 21, 2017
    08060e7
  9. ahmedelgabri commented on Jun 22, 2017

    @ahmedelgabri
    ContributorAuthor

    Thanks @vjeux!

    One small question :)

    1. is intended, we don't want the comment to go past 80 columns so we break.

    makes sense, but what can prevent us from passing --print-width to CSS too?

  10. vjeux commented on Jun 22, 2017

    @vjeux
    Contributor

    --print-width is already working for css. I just used 80 as an example.

  11. ahmedelgabri commented on Jun 22, 2017

    @ahmedelgabri
    ContributorAuthor

    --print-width is already working for css. I just used 80 as an example.

    I didn't know that, thanks!

  12. added
    locked-due-to-inactivity
    on Jul 7, 2018
  13. locked as resolved and limited conversation to collaborators on Jul 7, 2018
  14. added theissue type on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:css/scss/lesslocked-due-to-inactivity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions