Skip to content

Commit ee3b593

Browse files
authored
fix: position could be null actually (#524)
1 parent 2da97b2 commit ee3b593

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.changeset/two-eagles-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-mdx": patch
3+
---
4+
5+
fix: `position` could be `null` actually - related to #520

packages/eslint-plugin-mdx/src/rules/remark.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const remark: Rule.RuleModule = {
7272
fatal,
7373
line,
7474
column,
75-
position: { start, end },
75+
position,
7676
} of messages) {
7777
// https://github.com/remarkjs/remark-lint/issues/65#issuecomment-220800231
7878
/* istanbul ignore next */
@@ -83,6 +83,8 @@ export const remark: Rule.RuleModule = {
8383
continue
8484
}
8585

86+
const { start, end } = position || /* istanbul ignore next */ {}
87+
8688
const message: RemarkLintMessage = {
8789
reason,
8890
source,
@@ -96,11 +98,11 @@ export const remark: Rule.RuleModule = {
9698
line,
9799
// ! eslint ast column is 0-indexed, but unified is 1-indexed
98100
column: column - 1,
99-
start: {
101+
start: start && {
100102
...start,
101103
column: start.column - 1,
102104
},
103-
end: {
105+
end: end && {
104106
...end,
105107
column: end.column - 1,
106108
},

0 commit comments

Comments
 (0)