4 ms·
But the linked formatter doesn't seem to have an option for no semicolons so I wouldn't call it better in that regard. EDIT: Looks like they may be open to it
by kasbah 10y ago
But the linked formatter doesn't seem to have an option for no semicolons so I wouldn't call it better in that regard.
EDIT: Looks like they may be open to it though. https://github.com/jlongster/prettier/issues/12 https://github.com/jlongster/prettier/issues/12
- russellbeattie 10y agoSemicolons are not optional in JavaScript: ASI (http://www.ecma-international.org/ecma-262/6.0/#sec-automatic-semicolon-insertion http://www.ecma-international.org/ecma-262/6.0/#sec-automati...) is an error correction scheme for novice programmers. The spec's parsing rules calls out the statements following where a semicolon should be "offending tokens". There is no leeway here for style or preference.
- kasbah 10y agoThe thing is, they made the "error correction scheme" work so well that they are no longer required. Give it a go sometime; you might like it.