Condition return editor parsing error - return outside of function

OH 5.1

Is it expected that the editor for a JS condition script will complain about a parsing error with a ‘return’ outside of a function? As far as I can tell the syntax for the condition is okay. Is there any issue with it?

I do have the ‘Wrap Script Conditions in Self-Executing Function’ turned on.

image

I think there is a PR to fix the syntax checking for this. If you can save and the code will run correctly, you can ignore this and wait for the next patch release for 5.1 where this should be corrected.

2 Likes