Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0560fe5

Browse files
committedMar 5, 2025··
Fix type error
1 parent 1e35d2a commit 0560fe5

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed
 

‎lib/index.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,21 @@ function parseStyle(state, value) {
637637
try {
638638
return styleToJs(value, {reactCompat: true})
639639
} catch (error) {
640-
if (!state.ignoreInvalidStyle) {
641-
const cause = /** @type {Error} */ (error)
642-
const message = new VFileMessage('Cannot parse `style` attribute', {
643-
ancestors: state.ancestors,
644-
cause,
645-
ruleId: 'style',
646-
source: 'hast-util-to-jsx-runtime'
647-
})
648-
message.file = state.filePath || undefined
649-
message.url = docs + '#cannot-parse-style-attribute'
650-
651-
throw message
640+
if (state.ignoreInvalidStyle) {
641+
return {}
652642
}
643+
644+
const cause = /** @type {Error} */ (error)
645+
const message = new VFileMessage('Cannot parse `style` attribute', {
646+
ancestors: state.ancestors,
647+
cause,
648+
ruleId: 'style',
649+
source: 'hast-util-to-jsx-runtime'
650+
})
651+
message.file = state.filePath || undefined
652+
message.url = docs + '#cannot-parse-style-attribute'
653+
654+
throw message
653655
}
654656
}
655657

0 commit comments

Comments
 (0)
Please sign in to comment.