@@ -46,7 +46,7 @@ function plugin(css, opts) {
4646 }
4747
4848 // Having this option before `properties-order`, because later one can add empty lines by `emptyLineBefore`
49- if ( opts [ 'clean-empty-lines' ] ) {
49+ if ( opts [ 'clean-empty-lines' ] === true ) {
5050 css . walk ( function ( node ) {
5151 if ( isRuleWithNodes ( node ) ) {
5252 // Remove empty lines before every node
@@ -64,7 +64,10 @@ function plugin(css, opts) {
6464 } ) ;
6565 }
6666
67- if ( opts . order ) {
67+ if (
68+ ! _ . isUndefined ( opts . order )
69+ && ! _ . isNull ( opts . order )
70+ ) {
6871 const expectedOrder = createExpectedOrder ( opts . order ) ;
6972
7073 css . walk ( function ( node ) {
@@ -96,10 +99,20 @@ function plugin(css, opts) {
9699 } ) ;
97100 }
98101
99- if ( opts [ 'properties-order' ] ) {
102+ if (
103+ ! _ . isUndefined ( opts [ 'properties-order' ] )
104+ && ! _ . isNull ( opts [ 'properties-order' ] )
105+ ) {
100106 const isAlphabetical = opts [ 'properties-order' ] === 'alphabetical' ;
101107 const expectedOrder = isAlphabetical ? null : createExpectedPropertiesOrder ( opts [ 'properties-order' ] ) ;
102- const unspecifiedPropertiesPosition = _ . get ( opts , [ 'unspecified-properties-position' ] , 'bottom' ) ;
108+ let unspecifiedPropertiesPosition = opts [ 'unspecified-properties-position' ] ;
109+
110+ if (
111+ _ . isUndefined ( unspecifiedPropertiesPosition )
112+ || _ . isNull ( unspecifiedPropertiesPosition )
113+ ) {
114+ unspecifiedPropertiesPosition = 'bottom' ;
115+ }
103116
104117 css . walk ( function ( node ) {
105118 // Process only rules and atrules with nodes
@@ -168,7 +181,10 @@ function plugin(css, opts) {
168181 } ) ;
169182 }
170183
171- if ( ! _ . isUndefined ( opts [ 'custom-property-empty-line-before' ] ) ) {
184+ if (
185+ ! _ . isUndefined ( opts [ 'custom-property-empty-line-before' ] )
186+ && ! _ . isNull ( opts [ 'custom-property-empty-line-before' ] )
187+ ) {
172188 let customPropertyEmptyLineBefore = opts [ 'custom-property-empty-line-before' ] ;
173189
174190 // Convert to common options format, e. g. `true` → `[true]`
@@ -259,7 +275,10 @@ function plugin(css, opts) {
259275 } ) ;
260276 }
261277
262- if ( ! _ . isUndefined ( opts [ 'dollar-variable-empty-line-before' ] ) ) {
278+ if (
279+ ! _ . isUndefined ( opts [ 'dollar-variable-empty-line-before' ] )
280+ && ! _ . isNull ( opts [ 'dollar-variable-empty-line-before' ] )
281+ ) {
263282 let dollarVariableEmptyLineBefore = opts [ 'dollar-variable-empty-line-before' ] ;
264283
265284 // Convert to common options format, e. g. `true` → `[true]`
@@ -350,7 +369,10 @@ function plugin(css, opts) {
350369 } ) ;
351370 }
352371
353- if ( ! _ . isUndefined ( opts [ 'declaration-empty-line-before' ] ) ) {
372+ if (
373+ ! _ . isUndefined ( opts [ 'declaration-empty-line-before' ] )
374+ && ! _ . isNull ( opts [ 'declaration-empty-line-before' ] )
375+ ) {
354376 let declarationEmptyLineBefore = opts [ 'declaration-empty-line-before' ] ;
355377
356378 // Convert to common options format, e. g. `true` → `[true]`
@@ -462,7 +484,10 @@ function plugin(css, opts) {
462484 } ) ;
463485 }
464486
465- if ( ! _ . isUndefined ( opts [ 'rule-nested-empty-line-before' ] ) ) {
487+ if (
488+ ! _ . isUndefined ( opts [ 'rule-nested-empty-line-before' ] )
489+ && ! _ . isNull ( opts [ 'rule-nested-empty-line-before' ] )
490+ ) {
466491 let ruleNestedEmptyLineBefore = opts [ 'rule-nested-empty-line-before' ] ;
467492
468493 // Convert to common options format, e. g. `true` → `[true]`
@@ -556,7 +581,10 @@ function plugin(css, opts) {
556581 } ) ;
557582 }
558583
559- if ( ! _ . isUndefined ( opts [ 'at-rule-nested-empty-line-before' ] ) ) {
584+ if (
585+ ! _ . isUndefined ( opts [ 'at-rule-nested-empty-line-before' ] )
586+ && ! _ . isNull ( opts [ 'at-rule-nested-empty-line-before' ] )
587+ ) {
560588 let atRuleNestedEmptyLineBefore = opts [ 'at-rule-nested-empty-line-before' ] ;
561589
562590 // Convert to common options format, e. g. `true` → `[true]`
@@ -711,7 +739,10 @@ function plugin(css, opts) {
711739 } ) ;
712740 }
713741
714- if ( ! _ . isUndefined ( opts [ 'comment-empty-line-before' ] ) ) {
742+ if (
743+ ! _ . isUndefined ( opts [ 'comment-empty-line-before' ] )
744+ && ! _ . isNull ( opts [ 'comment-empty-line-before' ] )
745+ ) {
715746 let commentEmptyLineBefore = opts [ 'comment-empty-line-before' ] ;
716747
717748 // Convert to common options format, e. g. `true` → `[true]`
0 commit comments