@@ -52,7 +52,7 @@ module.exports = {
52
52
let countNewLinesAfterContent = 0 ;
53
53
54
54
if ( child . type === 'Literal' ) {
55
- if ( child . value . match ( / ^ \s * $ / ) ) {
55
+ if ( / ^ \s * $ / . test ( child . raw ) ) {
56
56
return ;
57
57
}
58
58
@@ -80,8 +80,8 @@ module.exports = {
80
80
}
81
81
} ) ;
82
82
83
- Object . keys ( childrenGroupedByLine ) . forEach ( line => {
84
- line = parseInt ( line , 10 ) ;
83
+ Object . keys ( childrenGroupedByLine ) . forEach ( _line => {
84
+ const line = parseInt ( _line , 10 ) ;
85
85
const firstIndex = 0 ;
86
86
const lastIndex = childrenGroupedByLine [ line ] . length - 1 ;
87
87
@@ -107,14 +107,14 @@ module.exports = {
107
107
}
108
108
109
109
function spaceBetweenPrev ( ) {
110
- return ( prevChild . type === 'Literal' && prevChild . raw . match ( / $ / ) ) ||
111
- ( child . type === 'Literal' && child . raw . match ( / ^ / ) ) ||
110
+ return ( prevChild . type === 'Literal' && / $ / . test ( prevChild . raw ) ) ||
111
+ ( child . type === 'Literal' && / ^ / . test ( child . raw ) ) ||
112
112
sourceCode . isSpaceBetweenTokens ( prevChild , child ) ;
113
113
}
114
114
115
115
function spaceBetweenNext ( ) {
116
- return ( nextChild . type === 'Literal' && nextChild . raw . match ( / ^ / ) ) ||
117
- ( child . type === 'Literal' && child . raw . match ( / $ / ) ) ||
116
+ return ( nextChild . type === 'Literal' && / ^ / . test ( nextChild . raw ) ) ||
117
+ ( child . type === 'Literal' && / $ / . test ( child . raw ) ) ||
118
118
sourceCode . isSpaceBetweenTokens ( child , nextChild ) ;
119
119
}
120
120
@@ -125,8 +125,8 @@ module.exports = {
125
125
const source = sourceCode . getText ( child ) ;
126
126
const leadingSpace = ! ! ( prevChild && spaceBetweenPrev ( ) ) ;
127
127
const trailingSpace = ! ! ( nextChild && spaceBetweenNext ( ) ) ;
128
- const leadingNewLine = ! ! ( prevChild ) ;
129
- const trailingNewLine = ! ! ( nextChild ) ;
128
+ const leadingNewLine = ! ! prevChild ;
129
+ const trailingNewLine = ! ! nextChild ;
130
130
131
131
const key = nodeKey ( child ) ;
132
132
0 commit comments