File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change 66
77const utils = require ( '../utils' )
88
9- /**
10- * Get all comments that need to be reported
11- * @param {(HTMLComment | HTMLBogusComment | Comment)[] } comments
12- * @param {Range[] } elementRanges
13- * @returns {(HTMLComment | HTMLBogusComment | Comment)[] }
14- */
15- function getReportComments ( comments , elementRanges ) {
16- return comments . filter (
17- ( comment ) => ! elementRanges . some ( ( range ) => utils . inRange ( range , comment ) )
18- )
19- }
20-
219module . exports = {
2210 meta : {
2311 type : 'problem' ,
@@ -65,9 +53,12 @@ module.exports = {
6553 const comments = element . comments . filter ( ( comment ) =>
6654 utils . inRange ( element , comment )
6755 )
68- const elementRanges = element . children . map ( ( child ) => child . range )
69- if ( disallowComments && comments . length > 0 ) {
70- for ( const comment of getReportComments ( comments , elementRanges ) ) {
56+ const reportComments = comments . filter (
57+ ( comment ) =>
58+ ! element . children . some ( ( child ) => utils . inRange ( child , comment ) )
59+ )
60+ if ( disallowComments ) {
61+ for ( const comment of reportComments ) {
7162 context . report ( {
7263 node : comment ,
7364 loc : comment . loc ,
You can’t perform that action at this time.
0 commit comments