BenoitZugmeyer / eslint-plugin-html

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

Support for <![CDATA[ ]]> in <script> #20

Closed mnoorenberghe closed 8 years ago

mnoorenberghe commented 8 years ago

This plugin will gladly look at .xhtml files but fails when encountering a CDATA section in a <script> tag:

<script><![CDATA[
var foo = "bar";
]]></script>

The workaround is to change our XHTML files to add // comments before the CDATA opening and closing but since we actually use an XML/XHTML parser, this is added noise.

Ideally the plugin would use an XML parser to handle this for .xhtml files or automatically treat it like there are // before the opening and closing.

BenoitZugmeyer commented 8 years ago

Good point. I just pushed something to address this issue. Please let me know if it's fine for your usage, or if you would have done something different. I'll publish a release afterward.

BenoitZugmeyer commented 8 years ago

@mnoorenberghe do you have some time to try this out? else I'll just release it as is.

BenoitZugmeyer commented 8 years ago

Released.

mnoorenberghe commented 8 years ago

Apologies for the delay. It's working great 👍