oclif/cli-ux

Specify column order in table

Closed this issue · 5 comments

AFAICT there's no way to specify the order of columns in tables. Am I missing something here?

jdx commented

it's specified by the order of the keys

jdx commented

in node they are, which is why this works. Also in the post you linked it states that ES2015 made this the defined behavior as well.

Node implements the spec for various versions of JavaScript, but it makes no guarantees beyond those specs. Therefore any other behavior falls outside the realm of the spec and is purely incidental; it could be changed at any time and without any warning.

The SO link above notes that ES2015 adds support for Map which behaves similarly to Object but maintains an ordering on the keys: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Objects_and_maps_compared. The ES2015 spec does in fact define the ordering for Object keys here: https://www.ecma-international.org/ecma-262/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys. But the library is still difficult to use in this configuration because

jdx commented

Look, I'm not going to engage in a theoretical debate. The behavior works perfectly as is and node isn't going to change this behavior so there is literally nothing to worry about.

If you can show me a code sample of something actually not working correctly then I'll revisit but there is no point in arguing about the spec. That is the case for node 8+ (at least) and those are the only versions oclif supports anyways.

Conventional or not, this is ergonomic and a clean way to design this functionality. I get that you don't agree, but this is the design we've settled on. If you use a linter that conflicts, just add an exclusion, or remove such a silly setting.