Back to Prettier

18775

changelog_unreleased/javascript/18775.md

3.9.0560 B
Original Source

Prevent moving comments after arrow into parameters (#18775 by @fisker)

<!-- prettier-ignore -->
jsx
// Input
KEYPAD_NUMBERS.map(num => ( // Buttons 0-9
  <div />
));

const createIdFilter =
  (foo) => /** @param {string} id */ 
	(id) => id;

// Prettier stable
KEYPAD_NUMBERS.map(
  (
    num // Buttons 0-9
  ) => <div />
);

const createIdFilter = (foo /** @param {string} id */) => (id) => id;

// Prettier main
KEYPAD_NUMBERS.map((num) => (
  // Buttons 0-9
  <div />
));

const createIdFilter = (foo) => /** @param {string} id */ (id) => id;