New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stylelint-config-clean-order

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint-config-clean-order

Order your styles with stylelint-order.

  • 7.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
84K
increased by6.23%
Maintainers
0
Weekly downloads
 
Created
Source
Logo

stylelint-config-clean-order

npm test

Order your styles with stylelint-order.

BeforeAfter   
beforeafter

Usage

Install stylelint and this package to your project:

npm install stylelint stylelint-config-clean-order --save-dev

Configure your stylelint configuration file (.stylelintrc.json) to extend this package:

[!TIP] You don't need to install stylelint-order nor add stylelint-order to "plugins" since this package already does that for you.

{
  "extends": ["stylelint-config-clean-order"]
}

Severity Options

Default severity level is warning but you can use error variant to change severity level to error.

{
  "extends": ["stylelint-config-clean-order/error"]
}

Customization

You can import raw property groups to add or override rule options. Please refer to stylelint-order plugin documentation.

For example, you can override 'properties-order' rule to not have empty lines between groups:

const { propertyGroups } = require('stylelint-config-clean-order')

const propertiesOrder = propertyGroups.map((properties) => ({
  noEmptyLineBetween: true,
  emptyLineBefore: 'never', // Don't add empty lines between order groups.
  properties
}))

module.exports = {
  extends: ['stylelint-config-clean-order'],
  rules: {
    'order/properties-order': [
      propertiesOrder,
      {
        severity: 'warning',
        unspecified: 'bottomAlphabetical',
      }
    ]
  }
}

Extra empty lines for formatting

In addition to stylelint-order plugin, this package also overrides two rules (declaration-empty-line-before and at-rule-empty-line-before) to improve the final formatted result by adding extra empty lines between declarations. stylelint-config-clean-order does not override a rule other than these two.

If you want these rules to put into effect, make sure config packages after stylelint-config-clean-order do not override them.

About orders

I try to hand-pick style orders in the most logical way to improve process of CSS refactoring; for example font-size before line-height, display before align-items. If you think order of a rule doesn't make sense, please open an issue so we can discuss. Thanks!

License

MIT

Keywords

FAQs

Package last updated on 07 Jan 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc