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

React props shorthand prettier

There is a react codebase, and I would like to prettify it with the following rule: Complete the prop shorthands with a value. shorthand => shorthand={true} Current: Expected:
Peter
  • 1,280
  • 8
  • 15
0
votes
1 answer

Can't select Prettier in Vscode as default formatter

I can't change the default formatter to prettier. When I select esbenp.prettier-vscode it automatically chages back to null both for user and workspace setting. I uninstalled and re-installed prettier, edited the setting.json to: { …
0
votes
1 answer

VSCode, disable hyphenation

Tell me how to turn off the wrapping of closing tags in VSCode? working with vue - set the settings: Editor: Word Wrap Column = 300 Vetur ›Format› Default Formatter: HTML - specified prettyhtml in its settings also indicated "prettyhtml": { …
0
votes
0 answers

Prettier is not respecting self closing jsx tags

In my React project, I need prettier to put each prop/attribute of a jsx component onto a separate line. If I type this: I want prettier to change it to this: But it is…
Jar
  • 1,766
  • 1
  • 21
  • 27
0
votes
1 answer

On saving, Prettier formats "use strict"; to ('use strict'); & strict mode is not initialised?

I'm pretty new to coding & using VS Code / Prettier I'm trying to turn on strict mode in my JS code, using "use strict"; when I save my file, Prettier formats the code from "use strict" to ('use strict'); which then as far as I can see means strict…
jckadms
  • 3
  • 4
0
votes
0 answers

Remove prettiers from typescript project

I have to much prettier in my project and it implicit a lot of problems. I want to stay with prettier@2.1.2 Do You know how can i delete od disable other prettier's ?
Daxter44
  • 115
  • 12
0
votes
0 answers

Prettier JS VSCode Setup Not Working As Expected

i have installed prettier and it seems to work as expected from the executable when i run: prettier --write . i am trying to set it up with the vscode addon to "format on save"... but this doesnt seem to format it correctly. and i can figure out…
X0r0N
  • 1,816
  • 6
  • 29
  • 50
0
votes
0 answers

Why prettier in VC do not put comma in the last item in list?

We all have prettier, the latest version. I have a Mac and Atom, other has Windows and VS. Why on Mac will have an ending , but VC guys will not have? I have on Atom a plugin and VS guys has a plugin as well to align code when saving.
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
0 answers

Prettier extension not wokring onsave on Linux Ubuntu

Summary when I run prettier from the command line it's working fine, but when I open vscode prettier it's not working. NOTE: I do have prettier working in Windows in the same project and formatter works fine onsave. The problem is when i run the…
Nick
  • 2,818
  • 5
  • 42
  • 60
0
votes
3 answers

Problems with Prettier config in vscode

I have a standard Angular app and am trying to disable trailing commas in Prettier. So I go into vscode settings (both user and workspace) and set trailing commas to none: I also have an .editorconfig file and tslint.json files. The tslint.json…
fumeng
  • 1,771
  • 5
  • 22
  • 61
0
votes
1 answer

Prettier formatting a Vue component when I don't want it to

I've got Prettier configured to format on save. I'm using a Vue component I got from npm to display data from an API. The prop dataset is required by the component. The issue is…
bjurtown
  • 163
  • 4
  • 13
0
votes
1 answer

VSCode jsx expression formatting

Hi I have a format in my existing code I want to change it to a different format, but cannot understand how to do it? if there is any eslint or prettier rules please suggest: The current format is: {this.state.creatingNew && ( …
suvodipMondal
  • 656
  • 10
  • 27
0
votes
1 answer

LF configuration of VSCode on Ubuntu and Windows

My projects that are programmed in Ubuntu, where VSCode is configured in LF work perfectly. When I clone on Windows even with the .editorconfig configured only for lf, it modifies the entire code of a file when saving, needing to commit the files…
itamazor
  • 1
  • 1
0
votes
1 answer

vscode inserting parentheses in the constructor when i save js file

Prettier or Eslint is formatting my constructor by adding parentheses, how do I stop this? It was my code before saving function Person(name, first, second) { this.name = name, this.first = first, this.second = second, this.sum =…
CodeHada
  • 27
  • 4
0
votes
1 answer

Prettier spacing

I'm starting to using VSC and looking for a good formatter for js, jsx, css, html.. etc Tried several auto-indent extensions for VSC and for now settled with the Prettier, so I have few questions: How to disable spacing: on arrow functions to const…
Vadim
  • 306
  • 1
  • 5
  • 13