hudochenkov / stylelint-order

A plugin pack of order related linting rules for Stylelint.
MIT License
914 stars 61 forks source link

Autofix not working #175

Open sethjwilliamson opened 1 year ago

sethjwilliamson commented 1 year ago

Hi, not sure if I've read documentation wrong, if I've set it up wrong, or there's an actual issue with the plugin. I've been trying to get autofix to work but it's only showing that errors are there. --fix does not fix the issues. I also want to note that the issues from the base stylelint autofixing is working.

Here is my .stylelintrc.json:

{
  "extends": [
    "stylelint-config-standard"
  ],
  "plugins": [
    "stylelint-order"
  ],
  "rules": {
    "property-no-vendor-prefix": null,
    "order/properties-alphabetical-order": true
  }
}

The command I run is stylelint "**/*.css" --fix

And the response is

src/App.css
 209:3  ✖  Expected box-sizing to come before width                     order/properties-alphabetical-order
 327:3  ✖  Expected grid-column to come before grid-row                 order/properties-alphabetical-order
 333:3  ✖  Expected grid-row to come before position                    order/properties-alphabetical-order
 334:3  ✖  Expected grid-column to come before grid-row                 order/properties-alphabetical-order
 335:3  ✖  Expected background-color to come before grid-column         order/properties-alphabetical-order
 ...

20 problems (20 errors, 0 warnings)
hudochenkov commented 1 year ago

What is the CSS that is not fixed?

omar-koala commented 1 year ago

Hi, I've been experiencing the same issue of the plugin autofixing not working and have discovered that the problem is caused by having a /* stylelint-disable */ directive present anywhere in the file (even if stylelint is later re-enabled), my solution for now was to move the conflicting block of code to a separate file and exclude that file from stylelint completely.

seyanaracore commented 11 months ago

change "extends" priority example: extends: ['stylelint-config-standard-scss', 'stylelint-config-clean-order'],

or:

const { getConfig } = require('stylelint-config-clean-order/src/config');

const cleanOrderRules = getConfig({ severity: 'error' }).rules;

and

rules: { ...cleanOrderRules, ...other-rules}