Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-sorting

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-sorting - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

lib/shorthandData.js

3

CHANGELOG.md

@@ -5,2 +5,5 @@ # Change Log

## 5.0.1
* Fixed: `properties-order: "alphabetical"` now puts shorthands before their longhand forms even if that isn't alphabetical to avoid broken CSS. E. g. `border-color` will be before `border-bottom-color`.
## 5.0.0

@@ -7,0 +10,0 @@ * Dropped Node.js 6 support. Node.js 8.7.0 or greater is now required.

2

lib/properties-order/README.md

@@ -5,3 +5,3 @@ # properties-order

This rule ignore prefixes to determine properties order. E. g. `-moz-transform` is treated as `transform`. But prefixed properties *will always* precede the unprefixed version (e. g. `-moz-transform` will be always before `transform`).
This rule ignore prefixes to determine properties order. E. g. `-moz-transform` is treated as `transform`. Shorthand properties *will always* precede their longhand forms (e.g. `border-style` will always be before `border-bottom-style`). Prefixed properties *will always* precede the unprefixed version (e. g. `-moz-transform` will be always before `transform`).

@@ -8,0 +8,0 @@ Recommended to use this rule only on source files, rather autoprefixed files. Some “non-standard” prefixes could be treated wrong. E. g. different flexbox implementations; `-ms-flex-align: center; align-items: center;` with alphabetical order will be sorted as `align-items: center; -ms-flex-align: center;` because alphabetically `flex-align` is after `align-item`.

const postcss = require('postcss');
const _ = require('lodash');
const shorthandData = require('./shorthandData');

@@ -68,3 +69,17 @@ module.exports = {

function isShorthand(a, b) {
const longhands = shorthandData[a] || [];
return longhands.includes(b);
}
function sortDeclarationsAlphabetically(a, b) {
if (isShorthand(a.unprefixedName, b.unprefixedName)) {
return -1;
}
if (isShorthand(b.unprefixedName, a.unprefixedName)) {
return 1;
}
if (a.unprefixedName === b.unprefixedName) {

@@ -71,0 +86,0 @@ if (a.node.type === 'decl' && b.node.type === 'decl') {

{
"name": "postcss-sorting",
"version": "5.0.0",
"version": "5.0.1",
"description": "PostCSS plugin to keep rules and at-rules content in order.",

@@ -29,17 +29,17 @@ "keywords": [

"dependencies": {
"lodash": "^4.17.11",
"postcss": "^7.0.14"
"lodash": "^4.17.14",
"postcss": "^7.0.17"
},
"devDependencies": {
"eslint": "~5.16.0",
"eslint-config-hudochenkov": "~3.0.0",
"eslint-config-prettier": "~4.1.0",
"husky": "^1.3.1",
"jest": "^24.7.1",
"jest-watch-typeahead": "^0.3.0",
"lint-staged": "^8.1.5",
"eslint": "^6.0.1",
"eslint-config-hudochenkov": "^3.0.1",
"eslint-config-prettier": "^6.0.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"jest-watch-typeahead": "^0.3.1",
"lint-staged": "^9.2.0",
"postcss-html": "^0.36.0",
"postcss-jsx": "^0.36.0",
"postcss-jsx": "^0.36.1",
"postcss-syntax": "^0.36.2",
"prettier": "~1.17.0"
"prettier": "^1.18.2"
},

@@ -46,0 +46,0 @@ "scripts": {

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