How to add support within {% javascript %} tag in .liquid files
Currently, the plugin is working fine in .liquid files if my jS code is within the normal <script> tag but I want to add support if I use the recommended way from Shopify to add JS codes, within the {% javascript %} some JS code {% endjavascript %} tag
Any solution?
I have the following in my eslint.config.mjs file:
{
files: ["**/*.liquid"],
plugins: { html },
settings: {
"html/html-extensions": [".liquid"],
},
},
export default [ { files: ["**/*.liquid"], plugins: { html: require('eslint-plugin-html'), }, settings: { "html/html-extensions": [".liquid"], "html/javascript-tag-names": ["javascript"], // {% javascript %} define tags }, rules: { // İhtiyaca göre kurallar ekleyebilirsiniz }, }, ];
and update npx eslint **/*.liquid
Thanks for your reply.
That didn't work but for the moment I'm wrapping my code with a // <script> comment and that seems to work, but the biggest advantage for me would be to enable Intellisense. Not sure how to archive that.
Please don't follow @hakan4773 advices, as it is LLM generated bulshit.
Unfortunately at this time the plugin does not support templates. See the README for a dirty workaround.
Please excuse me if I misdirected you.
@BenoitZugmeyer Thanks for the reply. Well Eslint is working within those tags fine using the // <script> workaround like this in case someone else needs it.
{% javascript %}
// <script>
some Js code
// </script>
{% endjavascript %}
but my next step would be to have vsCode Intellisense there also. I will see if i can get a solution for it.