syavorsky/comment-parser

Dropping of carriage returns

brettz9 opened this issue · 6 comments

We had an issue reported at gajus/eslint-plugin-jsdoc#745 regarding carriage returns being dropped.

It appears that in the splitLines function, a splitis taking place which may consume the carriage return, but joins are not adding back what was found to be there.

Would it work and be enough to just drop the matching of \r? in the split regex (or make its consumption optional), letting consumers deal with stripping out any unwanted carriage returns?

Hi there... Do you think you may have some time to take a look at this?

Yes, this is in my TODO list. Unfortunately, I am blocked badly with work these days. Will try my best to cut some time for it

Was just bumping in case it fell off the radar. Please don't feel any pressure.

@brettz9 please check out the comment-parser@1.1.6-beta.0. Let me know if I got it right. It seems to be a safe change overall but I am going to add more tests

Fixed in 1.2.0. Carriage returns are split into separate token lineEnd and kept untouched until eventually merged back with stringify()

Great...this new approach was a good way to go, I think. Thanks!