3 ms·
That’s gotta be a really unpopular opinion since I’ve never seen anyone write “[ 1, 2, 3 ]” instead of “[1, 2, 3]” in the last 10 years or so. If anything I’m
by NavinF 5y ago
That’s gotta be a really unpopular opinion since I’ve never seen anyone write “[ 1, 2, 3 ]” instead of “[1, 2, 3]” in the last 10 years or so.
If anything I’m seeing the opposite trend with a few devs writing “[1,2,3]” so that large constant literals don’t overflow the line.
- LegionMammal978 5y agoI've recently been working with an old C++ codebase that formats every function call like this: Foo<Bar,Baz> value = some.method (1, 2, 3 + 4) ; // or with no parameters: value = some.method() ; I've never seen it anywhere else, and it took me a good week to get used to it.
- goblin89 5y agoYou might not have been writing JavaScript. For objects, spacing properties from curly brackets is pretty much the norm, Prettier does that by default. For lists I see it rarer but I personally use it instinctively for consistency with objects, especially with things like useState destructuring and ([ complex, ...splatting, ...combinations ]) into function calls (which admittedly becomes uncomfortably terse).
- goblin89 5y agoAnd here’re some fresh examples with lists just encountered in the wild: https://developer.matomo.org/guides/tracking-javascript-guide https://developer.matomo.org/guides/tracking-javascript-guid...
- mech422 5y agoFWIW, I do "[ 1,2,3 ]". So we exist, perhaps you just haven't bumped into us :-)