Search code examples
javascriptnode.jsintellij-ideaecmascript-6webstorm

WebStorm : Different JS language versions in different scopes


This is an WebStorm related question: I have an WebStorm project where I use NodeJS (ES6) in the Backend and JSX in the frontend.

Is there a way to let WebStorm handle these two javascript-types different, based on location ?


Solution

  • This is currently possible from the EAP build of WebStorm 2017.3.

    On the new versions of the JetBrains IDES (iDea, WebStorm, and so on) you can configure different JavaScript language versions for different folders.

    For example, if you’re working on a JavaScript project that uses both ECMAScript 5.1 and newer ECMAScript version or JSX or Flow, you now have two options for how to configure it in WebStorm.

    To configure different JavaScript language versions for different folders, you need to go to Preferences | Languages, and Frameworks | JavaScript menu and click the on button next to the drop-down with the version, then select a folder and the language version used for its files:

    enter image description here

    The version specified on the main settings page will be applied by default for all other JavaScript files in the project.

    Ref. WebStorm blog#multiple-js-versions