-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possbile to eslint-disable a script(type=module)? #188
Comments
I think you should be able to do something like: <script type="application/javascript" type="module">
/* eslint-disable */
// Your code
/* eslint-enable */
</script> |
It doesn't work because the syntax inside the tag is invalid JavaScript code Before the comment |
Please refer to Linting templates |
I have read it. But there are a lot of template engines, not only PHP. And If the whole <!-- eslint-disable -->
<script type="module">
window.myGlobal.var = {{.MyData}}; // here is invalid JS syntax, but it's rendered by backend template engine correctly.
</script> Is it feasible? |
I think the bug here is that invalid JS between <script>
/* eslint-disable */
]
/* eslint-enable */
</script> The bug is reproducible with a regular What could work (if <!-- eslint-disable -->
<script>
]
</script>
<!-- eslint-enable --> |
Thank you for the suggestion, it has been implemented and released as part of v7.0.0. |
When working with backend MVC projects, sometimes the code could be:
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.The text was updated successfully, but these errors were encountered: