stylelint-config-rational-order icon indicating copy to clipboard operation
stylelint-config-rational-order copied to clipboard

The plugin does not do a thing

Open soullivaneuh opened this issue 5 years ago • 4 comments

With this css:

h1 {
  position: absolute;
  display: block;
  float: right;
  color: black;
  background-color: blue;
  border: 1px black solid;
}

This configuration (basically copy/pasta).

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-rational-order"
  ],
  "plugins": [
    "stylelint-order",
    "stylelint-config-rational-order/plugin"
  ],
  "rules": {
    "order/properties-order": [],
    "plugin/rational-order": [true, {
      "border-in-box-model": false,
      "empty-line-between-groups": true,
    }]
  }
}

And the command:

stylelint --config config/.stylelintrc --fix fixtures/main.css

Strictly nothing happen.

soullivaneuh avatar Sep 06 '19 09:09 soullivaneuh

It looks like your CSS file has already been sorted according to the plugin settings. Try to reorder rules and run the command again to make sure the plugin works.

vdkrasny avatar Sep 12 '19 12:09 vdkrasny

same issue here :

I have this minimal config :

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-sass-guidelines",
    "stylelint-config-rational-order"
  ],
  "rules": {
    "selector-class-pattern": ["[a-z]",{
      "resolveNestedSelectors": true
    }],
    "max-nesting-depth": [2, {}]
  }
}

When i run stylelint, I get the following output :

image

When I then run stylelint --fix, I have no output from styleint (like when all the warnings have been fixed). But there is no change in the files. And then when I rerun stylelint, I get the previous errors again

rgranger avatar May 20 '20 14:05 rgranger

Weirdly, when i had this line to the config :

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-sass-guidelines",
    "stylelint-config-rational-order"
  ],
  "rules": {
    "order/properties-alphabetical-order":  [false], // <-- This line
    "selector-class-pattern": ["[a-z]",{
      "resolveNestedSelectors": true
    }],
    "max-nesting-depth": [2, {}]
  }
}

The stylelint --fix works as expected. But then I get warnings from order/properties-alphabetical-order whereas it should be disabled by the config... Weird.

rgranger avatar May 20 '20 15:05 rgranger

Ok, so after looking it up, it's not "[false]" to disable alphabetical-order, but "null".

So with this config :

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-sass-guidelines",
    "stylelint-config-rational-order"
  ],
  "rules": {
    "order/properties-alphabetical-order":  null,
    "selector-class-pattern": ["[a-z]",{
      "resolveNestedSelectors": true
    }],
    "max-nesting-depth": [2, {}]
  }
}

The --fix is working as expected. But I don't understand why I have to add this line manually. Shouldn't the plugin do it for me ?

rgranger avatar May 20 '20 15:05 rgranger