Questions tagged [prettier]

Prettier is an opinionated code formatter for JavaScript, CSS, HTML, Markdown, and other languages. If possible, please use Prettier's Playground to illustrate your question (use the "Copy link" and "Copy markdown" buttons at the bottom right corner of the Playground).

Prettier is an opinionated code formatter.

You can use it to format JavaScript (including JSX, Flow, TypeScript, JSON), CSS (including Less, SCSS, CSS-in-JS), HTML (including Angular and Vue), GraphQL, Markdown, and YAML.

Try it out here: Prettier Playground.

1619 questions
0
votes
1 answer

How to stop PhpStorm from stripping single quotes from variable names

I am integrating with a third party that wants a variable '$email' sent to them, with the single quotes and all. However, when I save my code, it becomes this: $email. I need PhpStorm or Prettier to stop stripping single quotes. I know I've seen a…
StevenBoyce
  • 421
  • 5
  • 12
0
votes
2 answers

VsCode is creating a new line when i use template literan inside of getElememdById? How can i fix it?

Vscode is creating a new line when I use template literal inside of getElememdById? How can I fix it? it should be like this: document.getElementById(`current--${activePlayer}`).textContent = currentScore; but document.getElementById( …
0
votes
1 answer

Configure parserOptions or parser package for ESLint and Airbnb typescript setup

In my Gatsby (React) project I am using typescript. I need to setup ESLint and have to use eslint-config-airbnb-typescript I am also using Prettier: prettier (comes with Gatsby), and I installed the following packages: npm install…
0
votes
1 answer

VSC extension Prettier doesn't format on save

I know there's a lot of duplicate questions, but generally the fix is to set Prettier as the default formatter. This is not the case here. My Visual Studio Code settings are as follows: // Settings.json { "editor.formatOnSave": true, …
Wizard-of-Koz
  • 1,217
  • 1
  • 10
  • 13
0
votes
0 answers

How does this "syntax" called in javascript

let a function f() { [a] = [1] // <<----- return a } console.log(f()) How does [a] = .... is called? it's not a normal assignment because a is defined elsewhere. Bonus: Why prettier thinks that there should be semicolon before the [?
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
0
votes
1 answer

Prettier does not format HTML

Prettier has just stopped working and is not formatting HTML in my VSCode. In the output I get: ["ERROR" - 5:00:45 PM] Error formatting document. ["ERROR" - 5:00:45 PM] Unexpected closing tag "p". It may happen when the tag has already been closed…
fridavbg
  • 3
  • 1
  • 2
0
votes
0 answers

Redux Saga (TypeScript): Prettier extension adds semicolons to the ActionType definition

I noticed that prettier replaces the commas with semicolons, which are for example in my ActionType definitions (written in TypeScript). Is this a problem? If so, how can I prevent that? I don't find any possibilities for this in the Prettier…
Codehan25
  • 2,704
  • 10
  • 47
  • 94
0
votes
1 answer

Prettier [error] No files matching the pattern were found: "src\app\app.component.html"

I have setup an Angular 10 application. Here are the steps I have used: Installed Prettier as global Added .prettierrc file I was trying to setup a file watcher with the below configuration But it is not detecting any file changes and throwing…
Ragavan Rajan
  • 4,171
  • 1
  • 25
  • 43
0
votes
1 answer

Prettier adding a trailing whitespace

I am stuck at trying to figure out how to disable prettier formatting on the following css. It always adds a trailing space on the line -webkit-tap-highlight-color: `rgba(${colorBlack}, 0.2)`; becomes -webkit-tap-highlight-color:…
Gaurav
  • 123
  • 7
0
votes
1 answer

Unable to parse content from 'http://json.schemastore.org/prettierrc': Parse error at offset 0. (768)

Hello stackoverflow community, I am trying to use prettier in one of my projects and when I created a simple .prettierrc file, I got an error message that I ended up discovering that it seems to be related with the proxy (I'm under a corporate…
Jonathan
  • 59
  • 1
  • 4
0
votes
2 answers

npm ERR! code EJSONPARSE npm install with husky and lint-staged

My package.json works without husky and lint-staged but not with them. It's saying: npm ERR! code EJSONPARSE npm ERR! file C:\Proyectos\my-app\package.json npm ERR! JSON.parse Failed to parse json npm ERR! JSON.parse Unexpected token ​ in JSON at…
Carlos
  • 5
  • 3
0
votes
2 answers

VSCode - disable comments auto-formatting for C code

I just installed an extension prettier in vscode to autoformat my code. However all the comments in my code are being moved towards the left. Which I don't want. Before formatting: enter image description here After formatting: enter image…
0
votes
0 answers

eslint and prettier break style tag on div

I've got a Nuxt project set up with eslint. VSCode autmatically formats my code. However I don't understand why it complains about the style tags on my div:
0
votes
1 answer

Prettier VSCODE reformat on save has stopped working

I can reformat the document by typing shift cmd p and type "Format document". This reformats. But when I save it does not (although it used to) the format on save settings are below "editor.formatOnSaveMode": "file" editor default formatter is…
Benny
  • 103
  • 2
  • 12
0
votes
1 answer

How to get Prettier to keep ending symbol of ending tag on the same line

For some reason, when I use an emmet abbreviation like this: div>button.round-button+button>i.fas.fa-icons and I save the file to trigger the Prettier formatter, it will format it like this:
pjMaster
  • 3
  • 2