Search code examples
javascriptvisual-studio-codeformattingprettier

VS Code Javascript Formatting is acting strange


I am using VS Code and the prettier extension. However, This is how it formats my javascript:

showModal.forEach(node => {
  node.addEventListener(
    'click',
    () => {
      modalClose(findHidden, 'remove');
    },
    false
  );
});

I would prefer if it would format it like this:

showModal.forEach(node => {
  node.addEventListener('click', () => {
      modalClose(findHidden, 'remove');
    },
    false
  );
});

Is this normal behavior for Prettier or should I use different settings? Thank you


Solution

  • The reason why the code is formatted this way in VS Code is because I had the word wrap length at 60. I increased it to 80 and the problem was resolved.