Vetur: prettier config not work

Created on 28 Nov 2018  路  13Comments  路  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.14.2
  • VS Code version: 1.29.1

Problem

the formatter always add the semi and doubleQuote in the .vue file
and the formatter will not read the config such as

  "prettier.semi": false,
  "prettier.singleQuote": true

or the

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

it just work with the .prettierrc file in the root path of the project

question

Most helpful comment

@octref

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

i did this, but it just not work . and even the formatter will not work

this is my config

{
  "workbench.startupEditor": "newUntitledFile",
  "editor.fontSize": 14,
  "workbench.editor.showTabs": true,
  "workbench.colorTheme": "New Moon",
  "editor.tabSize": 2,
  "workbench.iconTheme": "vscode-icons",
  "explorer.confirmDragAndDrop": false,
  "explorer.confirmDelete": false,
  "editor.minimap.enabled": false,
  "window.zoomLevel": 0,
  "editor.formatOnSave": true,
  "prettier.semi": false,
  "prettier.singleQuote": true,
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      // Prettier option here
      "semi": false
    }
  }
}

All 13 comments

If your project has prettierrc at root level, Vetur should follow it. You can either:

  • Switch to another formatter
  • Include dir/.prettierrc so everything under dir is formatted using that setting
"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

This is only used when Vetur cannot find a prettierrc.

@octref

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

i did this, but it just not work . and even the formatter will not work

this is my config

{
  "workbench.startupEditor": "newUntitledFile",
  "editor.fontSize": 14,
  "workbench.editor.showTabs": true,
  "workbench.colorTheme": "New Moon",
  "editor.tabSize": 2,
  "workbench.iconTheme": "vscode-icons",
  "explorer.confirmDragAndDrop": false,
  "explorer.confirmDelete": false,
  "editor.minimap.enabled": false,
  "window.zoomLevel": 0,
  "editor.formatOnSave": true,
  "prettier.semi": false,
  "prettier.singleQuote": true,
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      // Prettier option here
      "semi": false
    }
  }
}

Same thing over here unfortunately.

Same OS/Code version/Vetur version.

If there's any more information I can provide, please let me know.

i did this, but it just not work . and even the formatter will not work

https://vuejs.github.io/vetur/formatting.html

As I repeated, that setting is only used when Vetur cannot find any prettierrc in your project.

Just to note, I've also tried this without a prettierrc in the project and still nothing.

I do have prettier configured in my Code user settings, though removing those doesn't seem to remedy the issue.

@parttimenobody Can you then:

prettier

@octref
it's strange...... it's ok in https://github.com/octref/veturpack
however. i can't find any different configure between my project and this....

and i delete every file untill i uninstall the node_modules .....it just work....
what the hell..

anyway, it just get done.

I have the same problem
Today, my prettier settings don't work
There is no ".prettierrc" under the project

@yuicer Does your project use a different version of prettier / prettier-eslint as dev dependencies?

@octref
no, i didn't have either of them

OK, let me know if you can reproduce the issue.

@octref
馃憣锛宼hanks

Was this page helpful?
0 / 5 - 0 ratings