1
+ var getProperty = require ( './util' ) . getProperty
1
2
function formatSelectors ( rule , indentation , stylelint ) {
2
3
var tmp = [ ]
3
4
var isSingleLine = false
@@ -24,7 +25,7 @@ function formatSelectors (rule, indentation, stylelint) {
24
25
var separator = selectorListCommaSpaceBefore ( stylelint , isSingleLine , indentation )
25
26
+ selectorListCommaNewlineBefore ( stylelint , isSingleLine , indentation )
26
27
+ ','
27
- if ( stylelint [ 'selector-list-comma-space-after' ] ) {
28
+ if ( getProperty ( stylelint , 'selector-list-comma-space-after' ) ) {
28
29
separator += selectorListCommaSpaceAfter ( stylelint , isSingleLine )
29
30
} else {
30
31
separator += selectorListCommaNewlineAfter ( stylelint , isSingleLine )
@@ -43,7 +44,7 @@ function formatSelectors (rule, indentation, stylelint) {
43
44
}
44
45
45
46
function selectorCombinatorSpaceBefore ( stylelint , selector ) {
46
- switch ( stylelint [ 'selector-combinator-space-before' ] ) {
47
+ switch ( getProperty ( stylelint , 'selector-combinator-space-before' ) ) {
47
48
case 'never' :
48
49
return selector . replace ( / \s + (? = [ + ~ > ] ) / g, "" )
49
50
default :
@@ -52,7 +53,7 @@ function selectorCombinatorSpaceBefore (stylelint, selector) {
52
53
}
53
54
54
55
function selectorCombinatorSpaceAfter ( stylelint , selector ) {
55
- switch ( stylelint [ 'selector-combinator-space-after' ] ) {
56
+ switch ( getProperty ( stylelint , 'selector-combinator-space-after' ) ) {
56
57
case 'never' :
57
58
return selector . replace ( / ( [ + ~ > ] ) \s * / g, "$1" )
58
59
default :
@@ -61,7 +62,7 @@ function selectorCombinatorSpaceAfter (stylelint, selector) {
61
62
}
62
63
63
64
function selectorListCommaNewlineBefore ( stylelint , isSingleLine , indentation ) {
64
- switch ( stylelint [ 'selector-list-comma-newline-before' ] ) {
65
+ switch ( getProperty ( stylelint , 'selector-list-comma-newline-before' ) ) {
65
66
case 'always' :
66
67
return '\n' + indentation
67
68
case 'always-multi-line' :
@@ -75,7 +76,7 @@ function selectorListCommaNewlineBefore (stylelint, isSingleLine, indentation) {
75
76
}
76
77
77
78
function selectorListCommaNewlineAfter ( stylelint , isSingleLine ) {
78
- switch ( stylelint [ 'selector-list-comma-newline-after' ] ) {
79
+ switch ( getProperty ( stylelint , 'selector-list-comma-newline-after' ) ) {
79
80
case 'always-multi-line' :
80
81
if ( isSingleLine ) {
81
82
return '\n'
@@ -89,7 +90,7 @@ function selectorListCommaNewlineAfter (stylelint, isSingleLine) {
89
90
}
90
91
91
92
function selectorListCommaSpaceBefore ( stylelint , isSingleLine , indentation ) {
92
- switch ( stylelint [ 'selector-list-comma-space-before' ] ) {
93
+ switch ( getProperty ( stylelint , 'selector-list-comma-space-before' ) ) {
93
94
case 'always' :
94
95
return ' '
95
96
case 'always-single-line' :
@@ -108,7 +109,7 @@ function selectorListCommaSpaceBefore (stylelint, isSingleLine, indentation) {
108
109
}
109
110
110
111
function selectorListCommaSpaceAfter ( stylelint , isSingleLine ) {
111
- switch ( stylelint [ 'selector-list-comma-space-after' ] ) {
112
+ switch ( getProperty ( stylelint , 'selector-list-comma-space-after' ) ) {
112
113
case 'never' :
113
114
return ''
114
115
case 'always-single-line' :
0 commit comments