Woocommerce-admin: stylelint is not running on commit

Created on 5 Jul 2019  路  6Comments  路  Source: woocommerce/woocommerce-admin

It doesn't look like some of the linters, specifically stylelint are getting ran on pre-commits.

Both Josh and I created new PRs that had some CSS issues in it, which caused the CI tests to fail. Our pre-commit hooks should catch that.

Build bug

All 6 comments

Hmmm I did update some linter dependencies this week, I wonder if that might be related.

I think (at least in my case) the pre-commit hook was actually formatting my passing CSS to a style that did not pass.

I had to commit with --no-verify to prevent the lint fixes.

@joshuatf Do you happen to remember what scss files you touched? I鈥檓 trying to run prettier on files to see if I can re-create, but no luck so far.

@psealock It was in mixins and breakpoints. If I recall correctly, it had mostly to do with the if/else line break formatting. Here's the PR where it occurred - https://github.com/woocommerce/woocommerce-admin/pull/2596/files

Steps to reproduce

  1. Using a prettier plugin for your editor, format client/stylesheets/abstracts/_mixins.scss.
  2. npm run lint and see it fail

We can update a few things, but the problem remains. Calypso simply skips prettier for sass files in https://github.com/Automattic/wp-calypso/pull/29697.

https://github.com/Automattic/wp-calypso/blob/master/bin/pre-commit-hook.js#L62-L78

That seems drastic, considering it only affects a few files. My opinion is to wait and suffer with the issue when editing files like the one above. When Prettier fixes its sass problems, we should update to wp-prettier (we are currently on calypso-prettier which is outdated):

https://github.com/Automattic/wp-prettier

This has been fixed

Was this page helpful?
0 / 5 - 0 ratings