@@ -90,9 +90,9 @@ export default {
90
90
const sensitivity = caseSensitive ? "sensitive" : "insensitive" ;
91
91
const isValidOrder = comparators [ direction ] [ sortName ] [ sensitivity ] ;
92
92
93
- const commentLineRanges = new Set ( ) ;
93
+ const commentLines = new Set ( ) ;
94
94
for ( const comment of context . sourceCode . comments ) {
95
- commentLineRanges . add (
95
+ commentLines . add (
96
96
`${ comment . loc . start . line } :${ comment . loc . end . line } ` ,
97
97
) ;
98
98
}
@@ -113,21 +113,15 @@ export default {
113
113
const prevLine = prevMember ?. loc . end . line ;
114
114
const thisLine = member . loc . start . line ;
115
115
116
- const membersAreJoinedByComment =
117
- commentLineRanges . has ( `${ prevLine } :${ thisLine } ` ) ||
118
- commentLineRanges . has (
119
- `${ prevLine + 1 } :${ thisLine } ` ,
120
- ) ||
121
- commentLineRanges . has (
122
- `${ prevLine } :${ thisLine - 1 } ` ,
123
- ) ||
124
- commentLineRanges . has (
125
- `${ prevLine + 1 } :${ thisLine - 1 } ` ,
126
- ) ;
116
+ const membersAreAdjacent =
117
+ thisLine - prevLine < 2 ||
118
+ commentLines . has ( `${ prevLine } :${ thisLine } ` ) ||
119
+ commentLines . has ( `${ prevLine + 1 } :${ thisLine } ` ) ||
120
+ commentLines . has ( `${ prevLine } :${ thisLine - 1 } ` ) ||
121
+ commentLines . has ( `${ prevLine + 1 } :${ thisLine - 1 } ` ) ;
127
122
128
123
if (
129
- ( thisLine - prevLine < 2 ||
130
- membersAreJoinedByComment ) &&
124
+ membersAreAdjacent &&
131
125
isValidOrder ( prevName , thisName ) === false
132
126
) {
133
127
context . report ( {
0 commit comments