postcss-sorting
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -5,2 +5,5 @@ # Change Log | ||
## 2.0.1 | ||
* Accept `null` for all options. | ||
## 2.0.0 | ||
@@ -28,3 +31,3 @@ This release completely incompatible with the previous API. There is a lot new options. Please read the documentation. | ||
* Empty lines don't delete anymore if only “order” options are enabled. | ||
* Droped support for Node <4. | ||
* Dropped support for Node <4. | ||
@@ -31,0 +34,0 @@ ### Removed |
51
index.js
@@ -49,3 +49,3 @@ 'use strict'; | ||
// Having this option before `properties-order`, because later one can add empty lines by `emptyLineBefore` | ||
if (opts['clean-empty-lines']) { | ||
if (opts['clean-empty-lines'] === true) { | ||
css.walk(function (node) { | ||
@@ -68,3 +68,6 @@ if (isRuleWithNodes(node)) { | ||
if (opts.order) { | ||
if ( | ||
!_.isUndefined(opts.order) | ||
&& !_.isNull(opts.order) | ||
) { | ||
const expectedOrder = createExpectedOrder(opts.order); | ||
@@ -101,7 +104,17 @@ | ||
if (opts['properties-order']) { | ||
if ( | ||
!_.isUndefined(opts['properties-order']) | ||
&& !_.isNull(opts['properties-order']) | ||
) { | ||
const isAlphabetical = opts['properties-order'] === 'alphabetical'; | ||
const expectedOrder = isAlphabetical ? null : createExpectedPropertiesOrder(opts['properties-order']); | ||
const unspecifiedPropertiesPosition = _.get(opts, ['unspecified-properties-position'], 'bottom'); | ||
let unspecifiedPropertiesPosition = opts['unspecified-properties-position']; | ||
if ( | ||
_.isUndefined(unspecifiedPropertiesPosition) | ||
|| _.isNull(unspecifiedPropertiesPosition) | ||
) { | ||
unspecifiedPropertiesPosition = 'bottom'; | ||
} | ||
css.walk(function (node) { | ||
@@ -174,3 +187,6 @@ // Process only rules and atrules with nodes | ||
if (!_.isUndefined(opts['custom-property-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['custom-property-empty-line-before']) | ||
&& !_.isNull(opts['custom-property-empty-line-before']) | ||
) { | ||
let customPropertyEmptyLineBefore = opts['custom-property-empty-line-before']; | ||
@@ -266,3 +282,6 @@ | ||
if (!_.isUndefined(opts['dollar-variable-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['dollar-variable-empty-line-before']) | ||
&& !_.isNull(opts['dollar-variable-empty-line-before']) | ||
) { | ||
let dollarVariableEmptyLineBefore = opts['dollar-variable-empty-line-before']; | ||
@@ -358,3 +377,6 @@ | ||
if (!_.isUndefined(opts['declaration-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['declaration-empty-line-before']) | ||
&& !_.isNull(opts['declaration-empty-line-before']) | ||
) { | ||
let declarationEmptyLineBefore = opts['declaration-empty-line-before']; | ||
@@ -471,3 +493,6 @@ | ||
if (!_.isUndefined(opts['rule-nested-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['rule-nested-empty-line-before']) | ||
&& !_.isNull(opts['rule-nested-empty-line-before']) | ||
) { | ||
let ruleNestedEmptyLineBefore = opts['rule-nested-empty-line-before']; | ||
@@ -566,3 +591,6 @@ | ||
if (!_.isUndefined(opts['at-rule-nested-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['at-rule-nested-empty-line-before']) | ||
&& !_.isNull(opts['at-rule-nested-empty-line-before']) | ||
) { | ||
let atRuleNestedEmptyLineBefore = opts['at-rule-nested-empty-line-before']; | ||
@@ -722,3 +750,6 @@ | ||
if (!_.isUndefined(opts['comment-empty-line-before'])) { | ||
if ( | ||
!_.isUndefined(opts['comment-empty-line-before']) | ||
&& !_.isNull(opts['comment-empty-line-before']) | ||
) { | ||
let commentEmptyLineBefore = opts['comment-empty-line-before']; | ||
@@ -725,0 +756,0 @@ |
@@ -6,3 +6,6 @@ 'use strict'; | ||
module.exports = function validateOptions(options) { | ||
if (_.isUndefined(options)) { | ||
if ( | ||
_.isUndefined(options) | ||
|| _.isNull(options) | ||
) { | ||
return false; | ||
@@ -17,2 +20,3 @@ } | ||
!_.isUndefined(options.order) | ||
&& !_.isNull(options.order) | ||
&& !validateOrder(options.order) | ||
@@ -25,2 +29,3 @@ ) { | ||
!_.isUndefined(options['properties-order']) | ||
&& !_.isNull(options['properties-order']) | ||
&& !validatePropertiesOrder(options['properties-order']) | ||
@@ -33,2 +38,3 @@ ) { | ||
!_.isUndefined(options['clean-empty-lines']) | ||
&& !_.isNull(options['clean-empty-lines']) | ||
&& !validateCleanEmptyLines(options['clean-empty-lines']) | ||
@@ -41,2 +47,3 @@ ) { | ||
!_.isUndefined(options['unspecified-properties-position']) | ||
&& !_.isNull(options['unspecified-properties-position']) | ||
&& !validateUnspecifiedPropertiesPosition(options['unspecified-properties-position']) | ||
@@ -49,2 +56,3 @@ ) { | ||
!_.isUndefined(options['custom-property-empty-line-before']) | ||
&& !_.isNull(options['custom-property-empty-line-before']) | ||
&& !validateCustomPropertyEmptyLineBefore(options['custom-property-empty-line-before']) | ||
@@ -57,2 +65,3 @@ ) { | ||
!_.isUndefined(options['dollar-variable-empty-line-before']) | ||
&& !_.isNull(options['dollar-variable-empty-line-before']) | ||
&& !validateDollarVariableEmptyLineBefore(options['dollar-variable-empty-line-before']) | ||
@@ -65,2 +74,3 @@ ) { | ||
!_.isUndefined(options['declaration-empty-line-before']) | ||
&& !_.isNull(options['declaration-empty-line-before']) | ||
&& !validateDeclarationEmptyLineBefore(options['declaration-empty-line-before']) | ||
@@ -73,2 +83,3 @@ ) { | ||
!_.isUndefined(options['rule-nested-empty-line-before']) | ||
&& !_.isNull(options['rule-nested-empty-line-before']) | ||
&& !validateRuleNestedEmptyLineBefore(options['rule-nested-empty-line-before']) | ||
@@ -81,2 +92,3 @@ ) { | ||
!_.isUndefined(options['at-rule-nested-empty-line-before']) | ||
&& !_.isNull(options['at-rule-nested-empty-line-before']) | ||
&& !validateAtRuleNestedEmptyLineBefore(options['at-rule-nested-empty-line-before']) | ||
@@ -89,2 +101,3 @@ ) { | ||
!_.isUndefined(options['comment-empty-line-before']) | ||
&& !_.isNull(options['comment-empty-line-before']) | ||
&& !validateCommentEmptyLineBefore(options['comment-empty-line-before']) | ||
@@ -91,0 +104,0 @@ ) { |
{ | ||
"name": "postcss-sorting", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "PostCSS plugin to keep rules and at-rules content in order.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
88362
1636
0