Change Javascript language version on per directory/file basis

I'm building a react-native app and I'm running into an issue where the completion (really the main reason why I use Webstorm over JustAnEditor™) is really messed up because I doesn't understand that the node_modules I'm using are written in Flow.

I can't just change the javascript language version for the whole project since my code is written in ES2015. Is there a way to change the JS language version on a per file/ per directory basis so that it works again?

Atm thats really annoying since those files are essentially external libraries and I have no control over the language version.

5 comments
Comment actions Permalink

No, it's not possible. Please vote for https://youtrack.jetbrains.com/issue/WEB-12666. For now I can only suggest setting language version to 'Flow' for the whole project - usual ES2015 syntax will be parsed correctly when using this version

0
Comment actions Permalink

Hmm okay I will do that. Actually I'm not using ES2015 but JSX but that should work to since flow is used with JSX isn't it? Anyway I will try that. 

--

Edit: Seems to work 

:)

1
Comment actions Permalink

Yes, JSX syntax is supported with language version==Flow

0
Comment actions Permalink

Something else you can do is to open the directory as a project and set it to be i.e es5

0

Please sign in to leave a comment.