stylelint: Deprecate declaration-block-properties-order in favour of more specific community plugins
Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?
I want to test my Sass (scss) without having the properties being in a set order.
Which rule, if any, is this issue related to?
declaration-block-properties-order
What stylelint configuration is needed to reproduce this issue?
{
"rules": {
"declaration-block-properties-order": [
{
order: "flexible",
properties: [
"position",
"top",
"right",
"bottom",
"left"
]
},
{
order: "flexible",
properties: [
"flex",
"flex-direction",
"flex-order",
"flex-pack",
"flex-align"
]
},
{
order: "flexible",
properties: [
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left"
]
},
{
order: "flexible",
properties: [
"font",
"font-family",
"font-size",
"font-style",
"font-weight"
]
},
{
order: "flexible",
properties: [
"background",
"background-color",
"background-image",
"background-repeat",
"background-attachment",
"background-position",
"background-position-x",
"background-position-y",
"background-clip",
"background-origin",
"background-size",
]
},
{
order: "flexible",
properties: [
"transition",
"transition-delay",
"transition-timing-function",
"transition-duration",
"transition-property",
]
},
{
order: "flexible",
properties: [
"animation",
"animation-name",
"animation-duration",
"animation-fill-mode",
"animation-play-state",
"animation-timing-function",
"animation-delay",
"animation-iteration-count",
"animation-direction"
]
}
]
}
}
Which version of stylelint are you using?
“gulp-stylelint”: “3.4.0”,
Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?
Nope
What did you expect to happen?
Code to flag, but with the order in each properties: […] above (not in the listed order).
What actually happened (e.g. what warnings or errors you are getting)?
Flags loads of errors, because the code is not written in the order of each block above.
In an ideal world, I want the code to check through and validate the code. However I can’t expect all my development team to remember the order.
E.G. must use background before transition but only after the flex code. As an example I don’t mind where the flex and positioning are placed however when someone codes positioning. I want it to go:
Pass linting:
position: absolute;
top: 0;
right: 0;
bottom:
left: 0;
Flag in NPM:
right: 0;
top: 0;
bottom:
position: absolute;
left: 0;
Many thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (21 by maintainers)
Commits related to this issue
- Deprecate declaration-block-properties-order Closes #2010 — committed to stylelint/stylelint by jeddy3 8 years ago
- Deprecate declaration-block-properties-order Closes #2010 — committed to sergesemashko/stylelint by jeddy3 8 years ago
I’ve released stylelint-order
0.2.0.property-groups-structuretodeclaration-block-property-groups-structuredeclaration-block-properties-specified-orderruleDo you thinks it’s ready for a public announcement?
Lets:
declaration-block-properties-orderwith a simple message within the changelog.This will give people plenty of time to migrate to
stylelint-order(and hopefully contribute any additional functionality they want to see) before we removedeclaration-block-properties-orderinstylelint@8.0.0Once these three things are done, I think an announcement via a tweet would be nice 😃
@davidtheclark thank you! There is a good replacement — stylelint-order, because I’ve merged code from plugins above into new plugin 😃
You suggest also to check order in property-groups-structure? Which means code for
declaration-block-properties-specified-orderalso will be inproperty-groups-structure?It’s an interesting idea. I can create
stylelint-orderplugin pack with these rules:declaration-block-orderproperty-groups-structuredeclaration-block-properties-specified-orderdeclaration-block-properties-alphabetical-orderI would like to make these plugins, since it’s kinda my thing to make order plugins for stylelint and PostCSS 😃
I think this illustrates how the rule is trying to do too much.
I agree with @jeddy3’s suggestion that we need to get serious about drawing some boundaries. I think the current should be altogether cut, and replaced with specific rules with clear boundaries. @jeddy3’s example could be broken down further into two distinct rules:
declaration-block-properties-alphabetical-orderdeclaration-block-properties-specified-orderI was thinking these rules could live within stylelint core — but then we run into compatibility problems. I do think this makes the most sense delegated to external plugins. People should simply pick the plugin that fits their idiosyncratic desire.
This leads me to think we should just cut the rule from stylelint altogether.
Can you please provide some more (minimal) examples of what you want to happen? e.g. “with the following config
..., the following CSS...would produce the following...warnings”.Originally, I thought you were asking for an option that would allow for the flexible ordering of groups, but with a strict ordering within each group e.g.
With such a config, both the following are valid:
As the order of each group is flexible, whereas the properties within each group aren’t.
Whereas, the following two examples would return one warning each, but on different lines:
And:
As the strict order within the “flex group” is being violated.
Is this what you’re asking for?. If not, I think some examples would help us better understand what you’re requesting.
Once we understand the request we can better judge whether it is inside or outside the scope of this rule.