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
0 answers

prettier --write found some errors. Please fix them and try committing again.-how can I resolve these errors?

I am new to git and cypress. We also use circleCI. When I am trying to commit, I am getting these errors, and dont know how to fix them..are the errors in the files pointed out by "error"? ✖ prettier --write found some errors. Please fix them and…
RenukaA
  • 25
  • 1
  • 8
0
votes
1 answer

Your branch and origin/master have diverged

I know others have asked this question but I want to understand what it means.I am still learning git. I was on the branch sample-tests I did the following : git checkout master- I switched to master branch git pull - I did this to pull all the…
RenukaA
  • 25
  • 1
  • 8
0
votes
0 answers

Prettier working wrong with Salesforce APEX

Prettier working wrong with Salesforce APEX before formatting and after formatting. I need solution...
0
votes
1 answer

prettier in vscode is wrapping content within an html tag, which causes it to ignore spaces

I am using vscode. My current extension is prettier, and my files are JavascriptReact (JSX). When I manually choose to format the code or activate format on saving, it takes content like this:

This type of cancer is also called

mheavers
  • 29,530
  • 58
  • 194
  • 315
0
votes
0 answers

Naming conventions for numbered variables in JavaScript

I'm new to JS and I'm not sure if this is something that you actually run in to in real-world scenarios. So please forgive me if this question turns out to be trivial. We're currently learning about test-driven dev and when we create different edge…
0
votes
0 answers

Prettier didn't appear on status bar in VS Code for minified file on server

I installed the prettier extension on VS Code and it works perfectly for the javascript codes on my local machine. But when I'm debugging some minified javascript on server, prettier didn't appear on the status bar, the Ctrl+Alt+F shortcut didn't…
Richter
  • 1
  • 1
0
votes
1 answer

Why does Prettier break up my JSON object into multiple lines?

Prettier is great, but it breaks up my javascript object into multiple lines, like so: { this.state .housePayload .sitMountain .chinese …
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
0
votes
1 answer

Eslint + Prettier + React. Props indents

I want to use this format, where first prop located in the line with the tag I want to use…
Yoskutik
  • 1,859
  • 2
  • 17
  • 43
0
votes
1 answer

How to stop npm version patch from formatting my typescript code

Not sure why in my setup, every time I do npm version patch It will auto reformat all my typescript source code. This is very annoying as the style is totally not what I preferred. I have to manually revert the format. How can I avoid it from…
Jianwu Chen
  • 5,336
  • 3
  • 30
  • 35
0
votes
1 answer

How to match Node.js server's ESLint rules to my Vue.js frontend's ESLint rules?

I want to have my serverside files in Node.js to have the exact same ESLint rules as my Vue.js frontend. The .eslintrc.js file in my Vue project looks like this: module.exports = { root: true, env: { node: true }, extends:…
Raj
  • 1,555
  • 18
  • 32
0
votes
1 answer

How can I increase the line length in Atom with prettier-atom?

When my lines run a bit too long, saving the file auto-formats the code into multiple lines. I've spent more than I care to admit figuring out how to increase the line length to avoid multiple lines yet nothing seems to work. It seems like Atom…
slider
  • 2,736
  • 4
  • 33
  • 69
0
votes
1 answer

Prettier or VSCode formatting with unwanted behavior. Adding {' '}

I have a problem with prettier. The code would format in an unwanted way. How can I solve this problem? I have checked prettier docs and tried going through the settings config. After formatting is applied to Figure A there is unwanted formatting…
Sporego
  • 376
  • 4
  • 12
0
votes
1 answer

Prettier config for diferent type of files in VSCODE

Is there any way to create a prettier configuration file for different file types? For example, one for .html and one for .ts
0
votes
1 answer

How to add custom formatting in prettier (or es-lint)

I have a script in my React JS project that allows to reorder imports in three specific categories: Imports from dependencies libraries Imports from internal components Imports from styles files All works well, using the command npm run…
Aron
  • 1,142
  • 1
  • 14
  • 26
0
votes
0 answers

Is it possible to notify the user of error formatting document?

I have the VS Code with the Prettier extension installed. I'm always frustrated when I don't know why my code is not formatted properly. When I look at the output of Prettier, I see "Error formatting document.". And it pretty always means that I…
J Kluseczka
  • 1,150
  • 9
  • 14