Zahal A_Omer
Zahal A_Omer

Reputation: 163

why prettier.semi not adding any semicolons on my JavaScript files?

This one of my files that prettier didn't add any semicolons but format it well,

function usercreate(name,score){
        this.name = name 
        this.score = score
        }
        usercreate.prototype.increment=function(){
            this.score++
            console.log(this.score)
        }
        usercreate.prototype.login=function(){
            console.log("loged in")
        }
    const user1=new usercreate("zahal",100)
    user1.increment()
    user1.login()
    const user2=new usercreate("sam",01)
    user2.increment()
    user2.login()

and this is my v-code setting.json

{
    "workbench.colorTheme": "Visual Studio Light",
    "security.workspace.trust.untrustedFiles": "open",
    "prettier.semi": true
}

and I don't use Eslint

Upvotes: 11

Views: 17685

Answers (5)

AzJa
AzJa

Reputation: 121

In my case I had Prettier as default formatter. Also in preferences I had Prettier: semi enabled.

BUT for some reason in .prettierrc there was semi: false. After change to semi: true it was fixed

Upvotes: 0

cseguinlz
cseguinlz

Reputation: 71

I have just experienced the same problem and none of the solutions detailed above worked for me.

What it worked for me was adding a configuration file to my project.

A simple .prettierrc with a JSON and the semi property:

{
  "semi": true,
 ...
}

See more detail here: https://prettier.io/docs/en/configuration.html

Upvotes: 5

omar elsayed
omar elsayed

Reputation: 11

enter image description here

Write these words in the setting search bar and make sure to change the default option to the insert option I hope this helps you.

Upvotes: 1

Muhammad Bilal Bangash
Muhammad Bilal Bangash

Reputation: 1236

go to setting and type word semi it will show this if it's not checked then checked it and try again enter image description here

Upvotes: 6

Mhammed Talhaouy
Mhammed Talhaouy

Reputation: 1269

How I've sorted it after having super huge frustrations with Prettier stopping working in VSCode.

  1. Select VS Code -> View -> Command Palette, and type: Format Document With
  2. Then Configure Default Formatter... and then choose Prettier - Code formatter.

This sorted the problem for me magically.

Depending on your case this might help you...

Upvotes: 21

Related Questions