Search code examples
webstorm

WebStorm Marking Files as Invalid when using Require


I' using the latest release version of webstorm (9.03) and most of my JavaScript files show up as invalid. I'm showing the code below.

enter image description here

    'use strict';

    function SpeakerDetailsController (speaker, CONFIG, $sce, $scope) {
      this.speaker = speaker;
      this.showSessions = CONFIG.showSessions === 'True';

        $scope.someSafeContent = $sce.trustAsHtml("<i>Hello</i> <b>World!</b>");

    }
    SpeakerDetailsController.$inject = ['speaker', 'CONFIG', '$sce', '$scope'];

    export default SpeakerDetailsController;

Solution

  • Please make sure to set JavaScript Language Version to 'ECMAScript 6' (or 'JSX Harmony') in Settings/Languages&Frameworks/JavaScript to get ES6 syntax correctly recognized.