BenoitZugmeyer / eslint-plugin-html

An ESLint plugin to extract and lint scripts from HTML files.
ISC License
430 stars 51 forks source link

Fix space eating issue #1

Closed greggman closed 9 years ago

greggman commented 9 years ago

The issue is if there's a less than symbol in the script it comes through the ontext callback separated before and after. So for example

 if (a < b) { doit(); }

gets split into if (a (space after a) and < b) { doit(); } A line in the ontext handler scripts trailing whitespec so when finally reassembled it comes out with

 if (a< b) { doit(); }

Which no longer lints correctly with certain rules on.

I think the solution is to strip the only the last string in each script tag

BenoitZugmeyer commented 9 years ago

Thanks for your work, sorry for the delay. I will have time this week-end to write some unit tests and look at your code.

BenoitZugmeyer commented 9 years ago

OK so I cherry-picked the first revision of your pull request, as the version bumping didn't merge with the last changes I did on package.json.

Thank you again for your work!