P10 How to resolve javascript warnings jshint esversion 6

P10 How to resolve javascript warnings jshint esversion 6

  

Hello OutSystems friends!

I am getting several warnings in javascript in p10 mobile (see below). Can anyone explain to me how to resolve these warnings?

I tried adding this at the top of each javascript file: 

/*jshint esversion: 6 */

Interestingly, this will clear the warnings in the editor, but it still shows as an red error in TrueChange and will not let me build.

Do I need to edit a .jshintrc file somewhere?

Any help would be greatly appreciated!

----Erik


Solution

Hi Erik,


I can relate with the reasons why you'd want to use ES6 features in the way you write JS. The platform currently doesn't allow you use some of the new features / syntax on Mobile Apps. That's by design. The reason for it is that we support Android versions starting on 4.4 and iOS versions starting on 8. On these systems some of the ES6 syntax is not supported and would result in a syntax error. The problem with having Syntax Errors in Mobile Apps is that they'd completely break the app. For that reason, the platform is rather strict in what it allows or doesn't allow publishing, and this strictness will happen regardless of the linter configuration.


As support for ES6 becomes more widespread we may revisit that behavior. Also as demand for ES6 constructs increases, we may consider other alternatives (eg: transparently using a transpiler). Unfortunately, for now, there's just no easy way to simply place ES6 constructs in the JS node.


I know this probably wasn't the answer you were looking forward to, but I hope you can understand the rationale behind it.


Cheers,

Miguel

Solution

Thanks Miguel! Your explanation makes perfect sense. Can you help me by making it clear exactly what version is currently supported?