stylelint: Autofix not working

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

The auto fix is not working

Which rule, if any, is this issue related to?

all rules

What CSS is needed to reproduce this issue?

any SCSS

What stylelint configuration is needed to reproduce this issue?

{
  "extends": "stylelint-config-standard",
  "rules": {
    "at-rule-empty-line-before": null
  }
}

Which version of stylelint are you using?

8.1.1

How are you running stylelint: CLI, PostCSS plugin, Node API?

stylelint "**/*.scss" --syntax scss --fix

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

SCSS.

What did you expect to happen?

Autofixing to work

What actually happened (e.g. what warnings or errors you are getting)?

No Autofixing

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Tip : you can use npx 😃 (if you have npm > 5.2, you have npx)

npx stylelint "**/*.scss" --fix

Autofixing is available for a limited amount of rules. What rules exactly aren’t autofixed?

Additionally, can you confirm that you are definitely running version 8.1.1 and that you don’t have an older version installed globally e.g. npm -g uninstall stylelint.

Problem found & fixed 😃 I uninstalled the global version and now things work. for future researchers: the command to use local should be similar to

./node_modules/stylelint/bin/stylelint.js "**/*.scss" --fix

Tip : you can use npx 😃 (if you have npm > 5.2, you have npx) npx stylelint “**/*.scss” --fix

Trying npx stylelint "foo/*.css" --fix Doesn’t work. Windows 8.1, VS Code. NPM installed locally. image

I uninstalled the global version and now things work.

Good stuff! I’m glad you got it working. The local/global install stuff does pop-up occasionally and I just remembered it.

NPM should move the executable to a .bin folder for you, and so the following should suffice to run the local package:

./node_modules/.bin/stylelint "**/*.scss" --fix