ejs-grammar
ejs-grammar copied to clipboard
EJS tags within <script> tags in a .ejs file appear as errors.
Steps to reproduce:
<script>
const test = <%= thisVariableWasPassedToTheEjsFile %>
</script>
Expected result:
The EJS tags within <script>
tags appear with red squiggly lines underneath them. The code still works, so it's not a huge problem, but I do find the lines a tad annoying.
Confirmed: EJS tags inside Javascript code trigger an JS error ("Expression expected"). This seems to me to be a fundamental bug.
Hi, I experience it too, any news about this?
Im having the same issue also with style tags and in attributes
I Have a Error with this:
In this point nt%>">" with Error "at-rule or selector expectedcss(css-ruleorselectorexpected)" Thanks for you work. so usefull.
Confirmed. This is driving me bonkers.
Hey all,
This looks like an error with the linter. The syntax highlighter does not throw any errors. The only error you would get from this (and may be the case as well, would the color would not be colored correctly)
I know this doesn't help, but maybe look into the different linters you have installed. One of them is probably throwing the error.
On Wed, Sep 15, 2021, 8:29 PM Greg-J @.***> wrote:
Confirmed. This is driving me bonkers.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Digitalbrainstem/ejs-grammar/issues/78#issuecomment-920483315, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMHQ7AR6JCCWNDMT4CIIZLUCE27VANCNFSM42O4OUZQ .
I'm having the same issue, and I disabled the only Linter i had installed and the error persisted.
const campground = <%-JSON.stringify(campground)%>;
The main reason why I'm trying to find a working EJS extension is to be able to both
- write and work in EJS files without getting linting errors because of EJS tags
- still get language support for the surrounding languages
Without that, working with EJS in VS Code is a nightmare :(
Hey all, This looks like an error with the linter. The syntax highlighter does not throw any errors. The only error you would get from this (and may be the case as well, would the color would not be colored correctly) I know this doesn't help, but maybe look into the different linters you have installed. One of them is probably throwing the error. … On Wed, Sep 15, 2021, 8:29 PM Greg-J @.***> wrote: Confirmed. This is driving me bonkers. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#78 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMHQ7AR6JCCWNDMT4CIIZLUCE27VANCNFSM42O4OUZQ .
Are you saying you've got a working set-up? Which linters do you use? And how do I disable which ever internal linter is throwing these errors?
Has there been any update on this issue?
Nothin'.
The only solution seems to be to disable validation of JS within script tags: "html.validate.scripts": false
However, this is not ideal, because actual errors are no longer detected within script tags.
has anyone found a good solution to this yet?
fyi, incase it helps anyone, my current approach to prevent the issue is
<%- "<script> const existingData = "+JSON.stringify(existingData)+"; </script>"; %>
it wont be a solution for every situation, and its less than ideal. but better then the false flag error highlighting
I found another way to do it (thank you chatGPT). in the ejs file i enter this:
and later on to use it:
I do not have any error flags now :). Worked for me, and maybe will help someone.