Stylelint Automatic Fixes

With Sage 9’s new stylelint checks, I’m wondering has anyone implemented any tools to automatically correct formatting issues?

With the upcoming update, you can do this with

yarn lint:styles -- --fix

Until then you can run the full command manually if you want:

stylelint 'resources/assets/styles/**/*.{css,sass,scss,sss,less}' --fix

or

node node_modules/.bin/stylelint 'resources/assets/styles/**/*.{css,sass,scss,sss,less}' --fix
4 Likes

The bottom option is not working for me. It displays the issues but does not fix them.

1 Like

I’m facing the same problem here. Running any of those commands won’t make the trick. I’m dealing with plenty of minor errors which not let me build the main.css file.

Any idea?

Thanks in advance!

Thanks, have you integrated this? I’m interested to see how you configured things.

I currently disabled the linting from webpack.config.js.

i get the same “error Command failed with exit code 2.” error

Any ideas on how to make the --fix work?

Thanks!

this is such a nice feature. I wish I had known earlier :smile:

but looking up and copypasting or typing in the command in to cli every time still sucks. maybe is it possible to add some hint to the stylelint error message displayed by browsersync which provides this $ yarn lint:styles -- --fix?

that would be very handy …

or is that a feature that can be implemented only in stylelint itself?