eslint / markdown

Lint JavaScript code blocks in Markdown documents
MIT License
391 stars 60 forks source link

fix: Account for BOM in the processor #282

Closed mdjermanovic closed 6 days ago

mdjermanovic commented 1 week ago

The processor doesn't account for BOM, which would be passed in by ESLint if the file has it.

This causes incorrect adjustments of locations and fix ranges.

Repro: https://github.com/mdjermanovic/eslint-markdown-bom

In the above repro, space-in-parens rule fixes ( a) to ( ) instead of (a).

This PR updates preprocess() to remove BOM from the text it operates on.