Skip to content

Excessive line breaks for a short comparison expression #3621

@atomiks

Description

@atomiks

Prettier 1.9.2
Playground link

Input:

const palindrome = str => {
  const s = str.toLowerCase().replace(/[\W_]/g, '');
  return s === s.split('').reverse().join('');
};

Output:

const palindrome = str => {
  const s = str.toLowerCase().replace(/[\W_]/g, "");
  return (
    s ===
    s
      .split("")
      .reverse()
      .join("")
  );
};

Expected behavior:
The line breaks probably shouldn't occur in this case. It's excessive and doesn't look very nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:member chainslang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be taken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions