2

I am passing a twig object to javascript via script tags in a .html.twig file, and VS Code complains that "Property assignment expected. js [17, 38]". Is it possible to turn this off completely for .html.twig-files or perhaps turn off checking altogether? I am using ESLint extension in any case.

    <script>
    ...
    window.PROPS = {{ props|json_encode|raw }};
    ...
    </script>

Problems that are really not problems and that I wish to get rid of.

(edit) Just to clarify, ESLint is not responsible for these problem-messages. I can turn off the ESLint extension (and reload the window); the messages remain.

4
  • If you want to turn it off altogether, you can disable the ESLint extension Commented Nov 26, 2019 at 18:01
  • Edited my question: ESLint is not the culprit. Commented Nov 26, 2019 at 18:08
  • Are you using prettier or something like that? Commented Nov 26, 2019 at 18:17
  • @leofalmeida No, and to be safe I just disabled all my VS Code extensions and reloaded the window. Commented Nov 26, 2019 at 18:26

2 Answers 2

10

There is another setting in VS Code for Javascript inside script tags:

in settings.json, set

"html.validate.scripts": false
Sign up to request clarification or add additional context in comments.

1 Comment

Additional note: in case you have a .htmlhintrc file in your work directory, "html.validate.scripts": false in settings.json is ignored if property "jshint": true is present in .htmlhintrc
3

You can turn off JavaScript validation off through the javascript.validate.enable setting in VS Code settings.

enter image description here

5 Comments

Edited my question: ESLint is not the culprit.
Unbelievably, the problem messages are still there. I just found another setting that was the issue. Thanks for your help, @Shahzad B
@Sheepwall what was the setting?
@Olli This was a long time ago, but it might be the accepted answer
@Sheepwall I see thanks! in my case it was a the svelte plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.