vscode - ES7 Syntax validation

VisuLearn Visual studio code - Configure Latest Javascript,ES7,ES2016 or ECmaScript 2016 Syntax support,options with javascript.validate.enable,jshint.options,configJS.

Visual Studio Code support latest javascript

Visual studio code is a popular Development environment for javascript.

ES7 alias ES2016 is latest javascript feature,Every year, ECmascript community releases new features, and frameworks like react,angular and vuejs frameworks are using ES7 or ES6 via babel plugins.

Visual Studio code provides syntax and auto code enable for every language, and does not support latest Javascript by default. Theare are number of ways to configure latest feature

  • update visual stuio code to latest version
  • th-ird third party plugin
  • Configure settings

This blog post will take you to configure ES6/ES7 Syntax support.

updates latest visual studio code

Go to visual studio code site and download latest version of vscode and installs as per link. By default new javascript features works in latest versions, still some of the most recent features does not works, in that case use other approach as described below.

Enable ES7/ES2016 Syntax in VScode

create a jsconfig.json file in your project and the following entries in it.

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

This will enable the compilaton and syntax support of EcmaScript 2016 code

With this features, some of the features will not work or this approach not working,consider other approach

Configure settings.json - javascript.validate.enable

First you need to disable the inbuilt validation to avoid syntax valiation errors caused due to Latest javascript not defined.

settings.json
javascript.validate.enable=false

To disable validation in javascript projects, you have to do configure settings

javascript.implicitProjectConfig.checkJs": false

disable in typescript

configJS:false

In VSCODe, add the below properties

jshint.options: { "esversion": 6 or 7 }