@@ -239,6 +239,8 @@ function linter( tree, file, options, clbk ) {
239
239
debug ( 'Popping section stack for combined section end+comment' ) ;
240
240
sectionStack . pop ( ) ;
241
241
}
242
+
243
+ // Do not fall through to other handlers once combined case is handled...
242
244
return ;
243
245
}
244
246
@@ -266,6 +268,8 @@ function linter( tree, file, options, clbk ) {
266
268
}
267
269
268
270
sectionStack . push ( data ) ;
271
+
272
+ // Don't fall through and misinterpret this node as an end tag...
269
273
return ;
270
274
}
271
275
@@ -279,6 +283,8 @@ function linter( tree, file, options, clbk ) {
279
283
msg = 'Orphaned section closing tag. Found </section> without a matching opening <section> tag. Remove this tag or add a corresponding opening tag.' ;
280
284
errCode = 'orphaned-section-end' ;
281
285
reportErr ( file , node , msg , errCode ) ;
286
+
287
+ // Since there is nothing to close, do not fall through to other end-handling logic...
282
288
return ;
283
289
}
284
290
@@ -323,6 +329,8 @@ function linter( tree, file, options, clbk ) {
323
329
msg = 'Missing proper empty line after closing section tag. There should be an empty line between </section> and the closing comment.' ;
324
330
errCode = 'missing-empty-line-after-section' ;
325
331
reportErr ( file , node , msg , errCode ) ;
332
+
333
+ // Fall through to still check following comment and then close section...
326
334
}
327
335
328
336
// Check if the following node is the expected comment:
@@ -355,7 +363,7 @@ function linter( tree, file, options, clbk ) {
355
363
reportErr ( file , node , msg , errCode ) ;
356
364
}
357
365
358
- // Pop the section stack:
366
+ // Fall-throughs above are intentional: regardless of errors, pop the section stack:
359
367
sectionStack . pop ( ) ;
360
368
}
361
369
}
0 commit comments