Visual Studio Code support the latest javascript
Visual studio code is a popular development environment for JavaScript.
ES7 alias ES2016 is the latest JavaScript feature, Every year, the 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 the latest JavaScript by default. There are a number of ways to configure the latest feature
- update visual studio code to the latest version
- 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 vscode-installation. By default new JavaScript features works in the latest versions, still, some of the most recent features do not work, in that case, use another 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 compilation and syntax support of EcmaScript 2016 code
With these 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 validation errors caused due to Latest JavaScript not being defined.
settings.json
javascript.validate.enable=false
To disable validation in JavaScript projects, you have to do configure the settings
javascript.implicitProjectConfig.checkJs": false
disable in typescript
configJS:false
In VSCODe, add the below properties.
jshint.options: { "esversion": 6 or 7 }