constverum / stylelint-config-rational-order

Stylelint config that sorts related property declarations by grouping together in the rational order :vertical_traffic_light:
Apache License 2.0
449 stars 53 forks source link

The plugin does not do a thing #22

Open soullivaneuh opened 5 years ago

soullivaneuh commented 5 years ago

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.

vdkrasny commented 5 years ago

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.

rgranger commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 ?