Kagami Sascha Rosylight
Kagami Sascha Rosylight

Reputation: 1482

Enable ES6 in HTML file with Visual Studio Code

VS Code 0.8.0 warns I have to write jsconfig.json file to set ES6 option, but it seems it works only for JS files, not HTML ones. It doesn't suppress the error in HTML.

How can I suppress this error in HTML files?

jsconfig.json file:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    }
}

html file:

<html>
<head>
  <meta charset="utf-8">
  <title>Mocha Tests</title>
  <script>
    document.addEventListener("DOMContentLoaded", () => { // Error: This can only be used with ES6. Make sure to have a jsconfig.json-file which sets the target to ES6.
    })
  </script>
</head>
<body>
  <div id="mocha"></div>
</body>
</html>

Upvotes: 1

Views: 1275

Answers (1)

I don't know if you can suppress the error immediately, but it is a confirmed bug. Keep an eye on this bug report about the issue and update when it gets fixed: https://github.com/Microsoft/vscode/issues/559

Upvotes: 2

Related Questions