File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ function adjustBlock(block) {
331
331
332
332
const lineInCode = message . line - leadingCommentLines ;
333
333
334
- if ( lineInCode < 1 ) {
334
+ if ( lineInCode < 1 || lineInCode >= block . rangeMap . length ) {
335
335
return null ;
336
336
}
337
337
Original file line number Diff line number Diff line change @@ -755,6 +755,18 @@ describe("processor", () => {
755
755
} ) ;
756
756
} ) ;
757
757
758
+ it ( "should ignore messages after the code block" , ( ) => {
759
+ const empty = [
760
+ "```javascript" ,
761
+ "```"
762
+ ] . join ( "\n" ) ;
763
+
764
+ processor . preprocess ( empty , "empty.md" ) ;
765
+ const message = { message : "Empty file" , ruleId : null , line : 2 } ;
766
+ const result = processor . postprocess ( [ [ message ] ] , "empty.md" ) ;
767
+
768
+ assert . deepStrictEqual ( result , [ ] ) ;
769
+ } ) ;
758
770
} ) ;
759
771
760
772
describe ( "supportsAutofix" , ( ) => {
You can’t perform that action at this time.
0 commit comments