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 7.0.1 to 8.0.0

lib/isAllowedToProcess.js

8

lib/getComments.js

@@ -26,3 +26,3 @@ module.exports = {

const newComments = [previousNode].concat(comments);
const newComments = [previousNode, ...comments];

@@ -47,3 +47,3 @@ return beforeNode(newComments, previousNode.prev(), node, previousNode.initialIndex);

return afterNode(comments.concat(nextNode), nextNode.next(), node, nextNode.initialIndex);
return afterNode([...comments, nextNode], nextNode.next(), node, nextNode.initialIndex);
}

@@ -75,3 +75,3 @@

const newComments = [commentData].concat(comments);
const newComments = [commentData, ...comments];

@@ -106,3 +106,3 @@ return beforeDeclaration(newComments, previousNode.prev(), nodeData, commentData.initialIndex);

return afterDeclaration(
comments.concat(commentData),
[...comments, commentData],
nextNode.next(),

@@ -109,0 +109,0 @@ nodeData,

module.exports = function getContainingNode(node) {
// For styled-components declarations are children of Root node
if (
node.type !== 'rule' &&
node.type !== 'atrule' &&
node.parent.document &&
node.parent.document.nodes &&
node.parent.document.nodes.some((item) => item.type === 'root')
) {
// For styled-components: declarations are children of Root node
if (node.type !== 'rule' && node.type !== 'atrule' && node.parent.type === 'root') {
return node.parent;

@@ -11,0 +5,0 @@ }

@@ -6,3 +6,3 @@ module.exports = function processLastComments(node, index, processedNodes) {

return processedNodes.concat(node);
return [...processedNodes, node];
}

@@ -9,0 +9,0 @@

@@ -21,3 +21,3 @@ const getOrderData = require('./getOrderData');

return processedNodes.concat(commentsBefore, node, commentsAfter);
return [...processedNodes, ...commentsBefore, node, ...commentsAfter];
};
const createExpectedOrder = require('./createExpectedOrder');
const isRuleWithNodes = require('../isRuleWithNodes');
const isAllowedToProcess = require('../isAllowedToProcess');
const processLastComments = require('./processLastComments');

@@ -8,3 +8,3 @@ const processMostNodes = require('./processMostNodes');

module.exports = function sortNode(node, optsOrder) {
if (!isRuleWithNodes(node)) {
if (!isAllowedToProcess(node)) {
return;

@@ -11,0 +11,0 @@ }

@@ -5,3 +5,3 @@ let createExpectedPropertiesOrder = require('./createExpectedPropertiesOrder');

let isCustomProperty = require('../isCustomProperty');
let isRuleWithNodes = require('../isRuleWithNodes');
let isAllowedToProcess = require('../isAllowedToProcess');
let isStandardSyntaxProperty = require('../isStandardSyntaxProperty');

@@ -13,3 +13,3 @@ let sortDeclarations = require('./sortDeclarations');

module.exports = function sortNodeProperties(node, { order, unspecifiedPropertiesPosition }) {
if (!isRuleWithNodes(node)) {
if (!isAllowedToProcess(node)) {
return;

@@ -58,3 +58,3 @@ }

declarations = declarations.concat(commentsBefore, propData, commentsAfter);
declarations = [...declarations, ...commentsBefore, propData, ...commentsAfter];
}

@@ -61,0 +61,0 @@ });

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

@@ -26,28 +26,25 @@ "keywords": [

"peerDependencies": {
"postcss": "^8.3.9"
"postcss": "^8.4.20"
},
"devDependencies": {
"@stylelint/postcss-css-in-js": "^0.37.2",
"eslint": "^7.27.0",
"eslint-config-hudochenkov": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-unicorn": "^21.0.0",
"husky": "^7.0.2",
"jest": "^27.2.5",
"jest-watch-typeahead": "^1.0.0",
"lint-staged": "^11.2.3",
"postcss": "^8.3.9",
"postcss-html": "^0.36.0",
"postcss-syntax": "^0.36.2",
"prettier": "^2.4.1",
"eslint": "^8.31.0",
"eslint-config-hudochenkov": "^9.0.0",
"eslint-config-prettier": "^8.6.0",
"husky": "^8.0.3",
"jest": "^29.3.1",
"jest-watch-typeahead": "^2.2.1",
"lint-staged": "^13.1.0",
"postcss": "^8.4.20",
"postcss-html": "^1.5.0",
"postcss-styled-syntax": "^0.1.0",
"prettier": "^2.8.1",
"prettier-config-hudochenkov": "^0.3.0"
},
"scripts": {
"test": "npm run lint && jest",
"jest": "jest",
"test-full": "npm run lint && jest",
"test": "jest",
"watch": "jest --watch",
"coverage": "jest --coverage",
"fix": "npm run lint -- --fix && prettier --write *.js 'lib/**/*.js'",
"lint": "eslint *.js 'lib/**/*.js' --max-warnings=0",
"lint": "eslint *.js 'lib/**/*.js' --max-warnings=0 && prettier --check *.js 'lib/**/*.js'",
"prepare": "husky install"

@@ -54,0 +51,0 @@ },

@@ -15,3 +15,3 @@ # PostCSS Sorting

* Groups properties, custom properties, dollar variables, nested rules, nested at-rules.
* Supports CSS, SCSS (using [postcss-scss]), CSS-in-JS (with [@stylelint/postcss-css-in-js]), HTML (with [postcss-html]), and most likely any other syntax added by other PostCSS plugins.
* Supports CSS, SCSS (using [postcss-scss]), CSS-in-JS (with [postcss-styled-syntax]), HTML (with [postcss-html]), and most likely any other syntax added by other PostCSS plugins.

@@ -91,3 +91,3 @@ ## Installation

module.exports = {
plugins: [
plugins: {
'postcss-sorting': {

@@ -106,3 +106,3 @@ order: [

},
],
},
};

@@ -173,5 +173,5 @@ ```

[postcss-html]: https://github.com/gucong3000/postcss-html
[@stylelint/postcss-css-in-js]: https://github.com/stylelint/postcss-css-in-js
[postcss-styled-syntax]: https://github.com/hudochenkov/postcss-styled-syntax
[Prettier]: https://prettier.io/
[stylelint]: https://stylelint.io/
[stylelint-order]: https://github.com/hudochenkov/stylelint-order
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