Closed
Description
When working with backend MVC projects, sometimes the code could be:
<!-- I want to disable eslint-plugin-html for this script block -->
<script type="module">
window.myGlobal.var = {{.MyData}}; // here is invalid JS syntax, but it's rendered by backend template engine correctly.
</script>
<!-- eslint-plugin-html works well for this block, and it should be enabled -->
<script type="module">
console.log(window.myGlobal.var);
</script>
What we need here is to make eslint-plugin-html
skip a whole <script>
block because code inside it is not valid JS syntax.
When using eslint-plugin-html
, I can not find a proper way to disable the eslint for the script(type=module) block (I do not want ignore the whole file).
I know a trick that: <script><!-- /* eslint-disable */ --></script>
, but it doesn't work for script(type=module)
For traditional <script>
we can use <script><!-- /* eslint-disable */ --></script>
.
But for <script type=module>
, this trick doesn't work anymore because the module script doesn't accept <!--
HTML comment.
Metadata
Metadata
Assignees
Labels
No labels