Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
5.15, 6.5.0
-
None
Description
The qmlformat tool removes the curly brackets and adds a semi-colon at the end of function calls.
- The first one is a serious safety issue, is documented as why if/else statements should always have curly brackets.
- The second one is subjective but i don't remember the last time that any mainstream javascript formatter added semi-colons instead of removing them.
Original function:
function getSafe(fn, defaultVal) { try { return fn() } catch (e) { if (typeof defaultVal === "undefined") { defaultVal = null } return defaultVal } }
Formatted function
function getSafe(fn, defaultVal) { try { return fn(); } catch (e) { if (typeof defaultVal === "undefined") defaultVal = null; return defaultVal; } }
the curly brackets from the if were removed, and a semicolon was added at the end of each expression.