Skip to content

Commit

Permalink
fix: undefined place in vFile message causes TypeError (#521)
Browse files Browse the repository at this point in the history
Many remark-lint errors do not set a place variable in the vFile
message. This code should accept undefined for this field.

fixes #520

Co-authored-by: JounQin <admin@1stg.me>
  • Loading branch information
EthanShoeDev and JounQin committed Jan 14, 2024
1 parent 4623359 commit 1a81c44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .changeset/new-brooms-visit.md
@@ -0,0 +1,10 @@
---
"eslint-plugin-mdx": patch
---

fix: `undefined` `place` in vFile message causes TypeError

Many `remark-lint` errors do not set a place variable in the vFile
message. This code should accept `undefined` for this field.

fixes #520
2 changes: 1 addition & 1 deletion packages/eslint-plugin-mdx/src/rules/remark.ts
Expand Up @@ -100,7 +100,7 @@ export const remark: Rule.RuleModule = {
// related to https://github.com/eslint/eslint/issues/14198
message: JSON.stringify(message),
loc:
/* istanbul ignore next */ 'start' in place
/* istanbul ignore next */ place && 'start' in place
? {
...point,
start: { ...place.start, column: place.start.column - 1 },
Expand Down

0 comments on commit 1a81c44

Please sign in to comment.