Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set stylelint to fix errors automatically?

Tags:

stylelint

stylelint *.css --fix not working as expect. Error reporting works well but a file is not fixed.

package.json

{
  "devDependencies": {
    "stylelint": "^11.1.1",
    "stylelint-config-recess-order": "^2.0.3"
  }
}

.stylelintrc.json

{
  "extends": "stylelint-config-recess-order"
}

style.css (ugly-order properties)

.test {
  height: 100%;
  margin: auto;
  width: 100%;
}

command

$ npx stylelint style.css --fix

output

style.css
 4:3  ✖  Expected "width" to come before "margin"   order/properties-order

Error reporting is fine.
I expect auto-fixing works for a file.

like image 730
takanopontaro Avatar asked Oct 25 '19 11:10

takanopontaro


Video Answer


1 Answers

Resolved. I removed node_modules and package-lock.json. After that I ran npm i. I'm not sure about the cause but works well now.

like image 131
takanopontaro Avatar answered Sep 16 '22 12:09

takanopontaro