Skip to content

Prettier reverts to defaults (double quotes and semicolon removal) regardless of code preference #2119

@mplungjan

Description

@mplungjan

According to this comment on issue 1896

Prettier will now check for users preferred way of coding: semis, quotes (single or double), and adhere to these styles when tidying the code.
If detection fails, it'll default to no-semis and double-quotes.

How to convince it? Or at least have a setting to reverse the default which I personally hate

Code I want to format with two space indent

export function createNewItem() {
    const newItem = document.createElement('div');
    newItem.classList.add('new-div');

    const newHeading = document.createElement('h2');
    newHeading.classList.add('new-heading');

    const deleteButton = document.createElement('button');
    deleteButton.classList.add('delete-btn');
    deleteButton.innerText = 'Delete';

    const inputArea = document.createElement('input');
    inputArea.classList.add('textbox');
    inputArea.type = 'text';
    inputArea.placeholder = 'Enter here...';

    const main = document.querySelector('.main');
    const num = main.children.length;
    newHeading.innerText = `Task ${num}`;

    newItem.append(newHeading, deleteButton, inputArea);

    return newItem;
}

After prettifying - the indentation is fixed but the quotes and semis are "fixed" but not in the expected manner.
Please allow me to turn that off or change default

export function createNewItem() {
  const newItem = document.createElement("div")
  newItem.classList.add("new-div")

  const newHeading = document.createElement("h2")
  newHeading.classList.add("new-heading")

  const deleteButton = document.createElement("button")
  deleteButton.classList.add("delete-btn")
  deleteButton.innerText = "Delete"

  const inputArea = document.createElement("input")
  inputArea.classList.add("textbox")
  inputArea.type = "text"
  inputArea.placeholder = "Enter here..."

  const main = document.querySelector(".main")
  const num = main.children.length
  newHeading.innerText = `Task ${num}`

  newItem.append(newHeading, deleteButton, inputArea)

  return newItem
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions