Edward de Jong / Beads Project
02/07/2019, 7:28 PMIvan Reese
Ivan Reese
Ivan Reese
Prettier enforces a consistent code style (i.e. code formatting that won't affect the AST) across your entire codebase because it disregards the original styling by parsing it away and re-printing the parsed AST with its own rules [...]
Ivan Reese
gman
02/08/2019, 6:27 AMconst arrayOfRects = [
{ x: 0, y: 0, width: 100, },
{ x: 123, y: 45, width: 10, },
{ x: -45, y: -410, width: -123, },
];
vs
const arrayOfRects = [
{
x: 0,
y: 0,
width: 100,
},
{
x: 123,
y: 45,
width: 10,
},
{
x: -45,
y: -410,
width: -123,
},
];
vs
const arrayOfRects = [
{ x: 0, y: 0, width: 100, },
{ x: 123, y: 45, width: 10, },
{ x: -45, y: -410, width: -123, },
];
I prefer the last one depending on the situation. There are plenty of places where turning the data into something more like a table makes it much much easier to find errors and see exceptions but auto formaters normal destroy such formatting.
In the same way I'd expect issues with VPLs in that people want to arrange their nodes the way that works best for them, not on some auto-layed out way. Consider 6 nodes that could be stacked vertically, horizontally, 3x2, 2x3 or just manually placed wherever. Now two or more people move the nodes and you've got a conflict that needs resolving.
Maybe not a good example. I'm just trying to point out that just like an code AST generally removes all formatting info which is often an issue, VPLs probably also have similar types of metadata that will end up causing similar issues.duncanawoods
02/08/2019, 10:38 AMcode AST generally removes all formatting infoI'm not sure how true this is in the real world. The AST libraries I have written for myself and those I have used (e.g. Roslyn) retain text-span information so you can navigate to/from the source code, display warnings on the right characters, perform refactorings etc.
Edward de Jong / Beads Project
02/09/2019, 8:10 AM