postcss-sorting
Advanced tools
Comparing version 3.1.0 to 4.0.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
This project adheres to [Semantic Versioning](https://semver.org/). | ||
## 4.0.0 | ||
* Breaking change: Dropped Node.js 4 support. Node.js 6.14.3 is the minimum supported version. | ||
* Could be a breaking change: Plugin won't sort inside some at-rule (mostly Sass specific directives). Read more about [ignored at-rules](https://github.com/hudochenkov/postcss-sorting#ignored-at-rules). | ||
* Added: `at-variables` keyword for `order`. | ||
## 3.1.0 | ||
@@ -6,0 +11,0 @@ * Added: `throw-validate-errors` option. |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const postcss = require('postcss'); | ||
@@ -4,0 +2,0 @@ const _ = require('lodash'); |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
module.exports = function calcAtRulePatternPriority(pattern, node) { | ||
@@ -4,0 +2,0 @@ // 0 — it pattern doesn't match |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
module.exports = function calcRulePatternPriority(pattern, node) { | ||
@@ -4,0 +2,0 @@ // 0 — it pattern doesn't match |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const _ = require('lodash'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const _ = require('lodash'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const _ = require('lodash'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
module.exports = { | ||
@@ -4,0 +2,0 @@ beforeNode, |
@@ -1,6 +0,5 @@ | ||
'use strict'; | ||
const isStandardSyntaxProperty = require('./isStandardSyntaxProperty'); | ||
const isCustomProperty = require('./isCustomProperty'); | ||
const isDollarVariable = require('./isDollarVariable'); | ||
const isAtVariable = require('./isAtVariable'); | ||
const calcAtRulePatternPriority = require('./calcAtRulePatternPriority'); | ||
@@ -17,2 +16,4 @@ const calcRulePatternPriority = require('./calcRulePatternPriority'); | ||
nodeType = 'dollar-variables'; | ||
} else if (isAtVariable(node.prop)) { | ||
nodeType = 'at-variables'; | ||
} else if (isStandardSyntaxProperty(node.prop)) { | ||
@@ -19,0 +20,0 @@ nodeType = 'declarations'; |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
module.exports = function getPropertiesOrderData(expectedOrder, propName) { | ||
return expectedOrder[propName]; | ||
}; |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
module.exports = function isCustomProperty(property) { | ||
return property.slice(0, 2) === '--'; | ||
}; |
@@ -1,5 +0,3 @@ | ||
'use strict'; | ||
module.exports = function isDollarVariable(property) { | ||
return property[0] === '$'; | ||
}; |
@@ -1,5 +0,10 @@ | ||
'use strict'; | ||
const atRuleExcludes = ['function', 'if', 'else', 'for', 'each', 'while']; | ||
module.exports = function isRuleWithNodes(node) { | ||
return (node.type === 'rule' || node.type === 'atrule') && node.nodes && node.nodes.length; | ||
return ( | ||
(node.type === 'rule' || node.type === 'atrule') && | ||
node.nodes && | ||
node.nodes.length && | ||
atRuleExcludes.indexOf(node.name) === -1 | ||
); | ||
}; |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
module.exports = function isStandardSyntaxProperty(property) { | ||
@@ -4,0 +2,0 @@ // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value)) |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const createExpectedOrder = require('../createExpectedOrder'); | ||
@@ -4,0 +2,0 @@ const isRuleWithNodes = require('../isRuleWithNodes'); |
@@ -12,2 +12,3 @@ # order | ||
- `dollar-variables` — Dollar variables (e. g., `$variable`) | ||
- `at-variables` — At-variables (e. g., `@variable`) | ||
- `declarations` — CSS declarations (e. g., `display: block`) | ||
@@ -14,0 +15,0 @@ - `rules` — Nested rules (e. g., `span {}` in `a { span {} }`) |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
module.exports = function processLastComments(node, index, processedNodes) { | ||
@@ -4,0 +2,0 @@ if (node.type === 'comment' && !node.hasOwnProperty('position')) { |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const getOrderData = require('./getOrderData'); | ||
@@ -4,0 +2,0 @@ const getComments = require('./getComments'); |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const postcss = require('postcss'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const postcss = require('postcss'); | ||
@@ -4,0 +2,0 @@ const _ = require('lodash'); |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const _ = require('lodash'); | ||
@@ -16,4 +14,3 @@ | ||
const validatedOrder = validateOrder(options.order); | ||
const isValid = validatedOrder.isValid; | ||
const message = validatedOrder.message; | ||
const { isValid, message } = validatedOrder; | ||
@@ -27,4 +24,3 @@ if (!isValid) { | ||
const validatedPropertiesOrder = validatePropertiesOrder(options['properties-order']); | ||
const isValid = validatedPropertiesOrder.isValid; | ||
const message = validatedPropertiesOrder.message; | ||
const { isValid, message } = validatedPropertiesOrder; | ||
@@ -43,4 +39,3 @@ if (!isValid) { | ||
); | ||
const isValid = validatedUnspecifiedPropertiesPosition.isValid; | ||
const message = validatedUnspecifiedPropertiesPosition.message; | ||
const { isValid, message } = validatedUnspecifiedPropertiesPosition; | ||
@@ -59,5 +54,3 @@ if (!isValid) { | ||
function reportInvalidOption(optionName, optionError) { | ||
optionError = optionError || 'Invalid value'; | ||
function reportInvalidOption(optionName, optionError = 'Invalid value') { | ||
return reportError(`${optionName}: ${optionError}`); | ||
@@ -83,3 +76,10 @@ } | ||
const keywords = ['custom-properties', 'dollar-variables', 'declarations', 'rules', 'at-rules']; | ||
const keywords = [ | ||
'custom-properties', | ||
'dollar-variables', | ||
'at-variables', | ||
'declarations', | ||
'rules', | ||
'at-rules', | ||
]; | ||
@@ -86,0 +86,0 @@ // Every item in the array must be a certain string or an object |
The MIT License (MIT) | ||
Copyright 2017 Aleks Hudochenkov <aleks@hudochenkov.com> | ||
Copyright 2015-present Aleks Hudochenkov <aleks@hudochenkov.com> | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
{ | ||
"name": "postcss-sorting", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "PostCSS plugin to keep rules and at-rules content in order.", | ||
@@ -25,17 +25,17 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=6.14.3" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.4", | ||
"postcss": "^6.0.13" | ||
"postcss": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "~4.10.0", | ||
"eslint-config-hudochenkov": "~2.0.0", | ||
"eslint-config-prettier": "~2.6.0", | ||
"eslint-plugin-prettier": "~2.3.1", | ||
"eslint": "~5.1.0", | ||
"eslint-config-hudochenkov": "~3.0.0", | ||
"eslint-config-prettier": "~2.9.0", | ||
"eslint-plugin-prettier": "~2.6.2", | ||
"husky": "^0.14.3", | ||
"jest": "^21.2.1", | ||
"lint-staged": "^4.3.0", | ||
"prettier": "~1.7.4" | ||
"jest": "^23.4.1", | ||
"lint-staged": "^7.2.0", | ||
"prettier": "~1.13.7" | ||
}, | ||
@@ -42,0 +42,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
# PostCSS Sorting [![Build Status][ci-img]][ci] [![npm version][npm-version-img]][npm] [![npm downloads last month][npm-downloads-img]][npm] [![Dependency status][dependencies-img]][dependencies-status] | ||
# PostCSS Sorting [![Build Status][ci-img]][ci] [![npm version][npm-version-img]][npm] [![npm downloads last month][npm-downloads-img]][npm] | ||
@@ -30,3 +30,3 @@ [PostCSS] plugin to keep rules and at-rules content in order. | ||
- [`unspecified-properties-position`](./lib/properties-order/unspecified-properties-position.md): Specify position for properties not specified in `properties-order`. | ||
- `throw-validate-errors`: Throw config validation errors instead of just showing and ignoring them. | ||
- `throw-validate-errors`: Throw config validation errors instead of just showing and ignoring them. Defaults to `false`. | ||
@@ -46,2 +46,6 @@ ## Handling comments | ||
## Ignored at-rules | ||
Some at-rules, like [control](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#control_directives__expressions) and [function](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#function_directives) directives in Sass, are ignored. It means rules won't touch content inside these at-rules, as doing so could change or break functionality. | ||
## Migration from `2.x` | ||
@@ -190,3 +194,3 @@ | ||
Other style sheet formatting tools are [Prettier], [perfectionist], [scssfmt]. | ||
I recommend [Prettier] for formatting style sheets. | ||
@@ -197,4 +201,2 @@ [ci-img]: https://travis-ci.org/hudochenkov/postcss-sorting.svg | ||
[npm-downloads-img]: https://img.shields.io/npm/dm/postcss-sorting.svg | ||
[dependencies-img]: https://img.shields.io/gemnasium/hudochenkov/postcss-sorting.svg | ||
[dependencies-status]: https://gemnasium.com/github.com/hudochenkov/postcss-sorting | ||
[npm]: https://www.npmjs.com/package/postcss-sorting | ||
@@ -212,6 +214,4 @@ | ||
[postcss-scss]: https://github.com/postcss/postcss-scss | ||
[perfectionist]: https://github.com/ben-eb/perfectionist | ||
[scssfmt]: https://github.com/morishitter/scssfmt | ||
[Prettier]: https://github.com/prettier/prettier | ||
[Prettier]: https://prettier.io/ | ||
[stylelint]: https://stylelint.io/ | ||
[stylelint-order]: https://github.com/hudochenkov/stylelint-order |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67230
30
758
+ Addedpicocolors@0.2.1(transitive)
+ Addedpostcss@7.0.39(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedpostcss@6.0.23(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedpostcss@^7.0.0