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

Turn off prettier for SASS, use stylelint instead #29697

Merged
merged 6 commits into from
Jan 2, 2019

Conversation

blowery
Copy link
Contributor

@blowery blowery commented Dec 21, 2018

Prettier has a bunch of bugs with SASS formatting that can break our styles. However, our style linting solution, stylelint has a --fix option much like eslint. Let's try that instead...

The first commit swaps prettier for eslint for sass files.
The second commit updates our stylelint rules to match our guidelines and fix some mistaken rule violations.

The last commit runs --fix over all our sass files.

This should have no visible impact.

@matticbot
Copy link
Contributor

@blowery blowery requested review from a team, jsnajdr and sirreal and removed request for jsnajdr December 21, 2018 01:36
@blowery blowery self-assigned this Dec 21, 2018
@blowery blowery added Framework [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs e2e Testing labels Dec 21, 2018
Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

A visual scan of a sample of the changes looks pretty good. I left a question about line breaks and @else

@if $size == $and-larger {
$approved-value: 2;
@media ( min-width: $breakpoint + 1 ) {
@content;
}
} @else {
}
@else {
Copy link
Member

Choose a reason for hiding this comment

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

These breaks before an else aren't aligned with our typical style. Can that be improved so the else is on the same line as braces?

Copy link
Member

@jsnajdr jsnajdr Jan 2, 2019

Choose a reason for hiding this comment

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

Nice spotting @sirreal 😉 Turns out this can be indeed improved by configuring the block-closing-brace-newline-after rule. The @if and @else SCSS statements are actually an example in the docs.

I updated the Stylelint config in 4a4a8be and updated the file formatting in 3fa79b6

blowery and others added 6 commits January 2, 2019 11:03
We have been using prettier recently to format SCSS files. Unfortunately, prettier has a number of outstanding bugs with comments and formatting that can easily break code.

This patch turns off prettier for sass files and uses stylelint instead. This has the added bonus of enforcing (or at least reporting) our stylelint rules, something that has been sorely missing until now.
@jsnajdr jsnajdr force-pushed the update/turn-off-prettier-for-sass branch from e63bcef to 005f385 Compare January 2, 2019 10:11
@jsnajdr
Copy link
Member

jsnajdr commented Jan 2, 2019

I rebased this PR onto the latest master, resolved conflicts that were introduced over the holidays, and patched the npm run reformat-files script to exclude SCSS files, too. Let's see how the tests fare on the updated PR. I'm ready to approve if they pass.

Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Looks good, both code-wise and also after some calypso.live clicking-around.

@jsnajdr jsnajdr merged commit 0233ccd into master Jan 2, 2019
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 2, 2019
@jsnajdr jsnajdr deleted the update/turn-off-prettier-for-sass branch January 2, 2019 15:02
blowery added a commit that referenced this pull request Jan 3, 2019
…sh-2019

* origin/master:
  Disable select when only one domain exiists (#29873)
  Tiled galleries: Disable captions (#29776)
  Prevent scrolling up when opening a dialog (#29832)
  Gutenberg: Move Shortlinks to production (#29883)
  Gutenlypso: add convert to blocks dialog (#29790)
  Gutenberg: Move Related Posts to production blocks (#29650)
  Analytics: fix ad-tracking issue on signup for non-gdpr countries (#29741)
  Update mobile phone validation module (used for 2fa) (#29740)
  Gutenlypso: make sure titles load on second edit (#29877)
  Site Picker: Change wording of /page and /block-editor to match /post (#29859)
  Gutenberg: update copy link in page list to be editor aware
  Gutenberg: use core approach of initialEdits over overridePost
  Gutenberg: when duplicating a post, override post content
  Gutenberg: update duplicate url when Gutenlypso is enabled
  Refactor: Replace use of key-mirror with inline code (#29857)
  Fixes wrong selected domain name (#29824)
  Turn off prettier for SASS, use stylelint instead (#29697)
  Gutenberg: Add copy button to Shortlinks (#29556)
  add a section name to the body class (#29563)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants