@@ -46,7 +46,7 @@ function plugin(css, opts) {
46
46
}
47
47
48
48
// 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 ) {
50
50
css . walk ( function ( node ) {
51
51
if ( isRuleWithNodes ( node ) ) {
52
52
// Remove empty lines before every node
@@ -64,7 +64,10 @@ function plugin(css, opts) {
64
64
} ) ;
65
65
}
66
66
67
- if ( opts . order ) {
67
+ if (
68
+ ! _ . isUndefined ( opts . order )
69
+ && ! _ . isNull ( opts . order )
70
+ ) {
68
71
const expectedOrder = createExpectedOrder ( opts . order ) ;
69
72
70
73
css . walk ( function ( node ) {
@@ -96,10 +99,20 @@ function plugin(css, opts) {
96
99
} ) ;
97
100
}
98
101
99
- if ( opts [ 'properties-order' ] ) {
102
+ if (
103
+ ! _ . isUndefined ( opts [ 'properties-order' ] )
104
+ && ! _ . isNull ( opts [ 'properties-order' ] )
105
+ ) {
100
106
const isAlphabetical = opts [ 'properties-order' ] === 'alphabetical' ;
101
107
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
+ }
103
116
104
117
css . walk ( function ( node ) {
105
118
// Process only rules and atrules with nodes
@@ -168,7 +181,10 @@ function plugin(css, opts) {
168
181
} ) ;
169
182
}
170
183
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
+ ) {
172
188
let customPropertyEmptyLineBefore = opts [ 'custom-property-empty-line-before' ] ;
173
189
174
190
// Convert to common options format, e. g. `true` → `[true]`
@@ -259,7 +275,10 @@ function plugin(css, opts) {
259
275
} ) ;
260
276
}
261
277
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
+ ) {
263
282
let dollarVariableEmptyLineBefore = opts [ 'dollar-variable-empty-line-before' ] ;
264
283
265
284
// Convert to common options format, e. g. `true` → `[true]`
@@ -350,7 +369,10 @@ function plugin(css, opts) {
350
369
} ) ;
351
370
}
352
371
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
+ ) {
354
376
let declarationEmptyLineBefore = opts [ 'declaration-empty-line-before' ] ;
355
377
356
378
// Convert to common options format, e. g. `true` → `[true]`
@@ -462,7 +484,10 @@ function plugin(css, opts) {
462
484
} ) ;
463
485
}
464
486
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
+ ) {
466
491
let ruleNestedEmptyLineBefore = opts [ 'rule-nested-empty-line-before' ] ;
467
492
468
493
// Convert to common options format, e. g. `true` → `[true]`
@@ -556,7 +581,10 @@ function plugin(css, opts) {
556
581
} ) ;
557
582
}
558
583
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
+ ) {
560
588
let atRuleNestedEmptyLineBefore = opts [ 'at-rule-nested-empty-line-before' ] ;
561
589
562
590
// Convert to common options format, e. g. `true` → `[true]`
@@ -711,7 +739,10 @@ function plugin(css, opts) {
711
739
} ) ;
712
740
}
713
741
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
+ ) {
715
746
let commentEmptyLineBefore = opts [ 'comment-empty-line-before' ] ;
716
747
717
748
// Convert to common options format, e. g. `true` → `[true]`
0 commit comments