Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
stylelint-order
Advanced tools
The stylelint-order npm package is a plugin for stylelint that provides order related linting rules for CSS properties within declaration blocks. It helps in enforcing a consistent order for CSS properties, which can make code easier to read and maintain.
Specifying the order of content within declaration blocks
This feature allows you to define the order in which different types of content within a declaration block should appear. For example, you can specify that custom properties should be declared before any other declarations.
{
"plugins": [
"stylelint-order"
],
"rules": {
"order/order": [
"custom-properties",
"declarations"
],
"order/properties-order": [
"position",
"top",
"right",
"bottom",
"left"
]
}
}
Specifying the order of properties within declaration blocks
This feature allows you to define a specific order for CSS properties within a declaration block. You can list the properties in the order you want them to be linted. This can be a custom order or alphabetical order.
{
"plugins": [
"stylelint-order"
],
"rules": {
"order/properties-order": [
"position",
"z-index",
"top",
"right",
"bottom",
"left"
],
"order/properties-alphabetical-order": {}
}
}
Grouping and separating properties
This feature allows you to group related properties together and enforce an empty line before the group or between groups. This can improve readability and organization of CSS rules.
{
"plugins": [
"stylelint-order"
],
"rules": {
"order/properties-order": [
[
"position",
"z-index"
],
{
"emptyLineBefore": "always",
"properties": [
"color",
"font-size",
"font-weight"
]
}
]
}
}
CSScomb is a coding style formatter for CSS. Similar to stylelint-order, it can sort CSS properties in a specific order. However, CSScomb is not a plugin for stylelint and has its own configuration and usage patterns.
postcss-sorting is a PostCSS plugin that sorts CSS properties according to specified order. It is similar to stylelint-order in functionality but is used within the PostCSS ecosystem, which is a tool for transforming CSS with JavaScript plugins.
sass-lint is a tool to help you enforce consistent conventions and avoid errors in your stylesheets. It is similar to stylelint-order in that it can enforce property order, but it is specifically designed for linting Sass files, not standard CSS.
A plugin pack of order related linting rules for stylelint.
npm install stylelint-order
Add stylelint-order
to your stylelint config plugins array, then add rules you need to the rules list. All rules from stylelint-order need to be namespaced with order
.
Like so:
// .stylelintrc
{
"plugins": [
"stylelint-order"
],
"rules": {
// ...
"order/order": [
"custom-properties",
"declarations"
],
"order/properties-alphabetical-order": true
// ...
}
}
order
: Specify the order of content within declaration blocks.properties-order
: Specify the order of properties within declaration blocks.properties-alphabetical-order
: Specify the alphabetical order of properties within declaration blocks.properties-order
and properties-alphabetical-order
code and readme are based on declaration-block-properties-order
rule which was a stylelint's core rule prior stylelint 8.0.0.
0.4.4
order
.FAQs
A collection of order related linting rules for Stylelint.
The npm package stylelint-order receives a total of 1,224,520 weekly downloads. As such, stylelint-order popularity was classified as popular.
We found that stylelint-order demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.