Sai Darshan
Sai Darshan

Reputation: 387

EJS variable is working inside a <script> tag but vscode throws error

I have a ejs variable inside a script tag which is just working fine but vscode throws error saying "Expression expected" Here is the code

 <script type="text/javascript">
      var currentUser= <%- JSON.stringify(currentUser) %>
      console.log(currentUser);
    </script>

as we can see vscode is highligting the error

but it is working im able to see the currentUser object in my browser console console screenshot

Im not able to figure out what is causing this problem.Can please someone help me out with this?

Upvotes: 4

Views: 1762

Answers (1)

Shubham
Shubham

Reputation: 779

update this setting in vs-code

"html.validate.scripts": false

source link: https://github.com/microsoft/vscode/issues/51118

Upvotes: 6

Related Questions