So, what do you guys think, what is the best reformatting tool for JavaScript? The two ones I have experience with is clang-format and Prettier.
I think clang-format produces significantly more legible code. I formatted this web-page using Prettier, and this NodeJS script with clang-format.
Here is an example of how the code produced by clang-format is more legible than the code produced by Prettier.
Clang-format:
Prettier:
The advantage of Prettier over clang-format is that clang-format won't help you format your HTML or CSS.
I think clang-format produces significantly more legible code. I formatted this web-page using Prettier, and this NodeJS script with clang-format.
Here is an example of how the code produced by clang-format is more legible than the code produced by Prettier.
Clang-format:
Code:
var mnemonike = [
"mov", "fxch", "fabs", "fild", "f2xm1", "fprem", "fld1",
"fscale", "fldl2e", "fyl2x", "fldpi", "fstp", "fld", "fpatan",
"fsqrt", "fsincos", "fcos", "fsin", "fdivp", "fmulp", "fsubp",
"faddp", "finit", "fcomip", "jne", "jmp", "fldz", "jna",
"jnb", "fistp", "and", "or", "xor", "jz", "cmp"
];
var registri = [ "eax", "st0", "st1" ];
Code:
var mnemonike = [
"mov",
"fxch",
"fabs",
"fild",
"f2xm1",
"fprem",
"fld1",
"fscale",
"fldl2e",
"fyl2x",
"fldpi",
"fstp",
"fld",
"fpatan",
"fsqrt",
"fsincos",
"fcos",
"fsin",
"fdivp",
"fmulp",
"fsubp",
"faddp",
"finit",
"fcomip",
"jne",
"jmp",
"fldz",
"jna",
"jnb",
"fistp",
"and",
"or",
"xor",
"jz",
"cmp"
];
var registri = ["eax", "st0", "st1"];