question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

conflict with vetur prettyhtml

See original GitHub issue

Tell us about your environment

  • ESLint version: 5.9.0
  • eslint-plugin-vue version: 5.0.0
  • Node version: 11.3.0

Please show your full configuration:

"eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/recommended",
      "standard",
      "prettier",
      "prettier/standard"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
}

What did you expect to happen? The problem is:

  • Prettyhtml does not put space before />: <HelloWorld msg="Welcome to Your Vue.js App"/>
  • eslint-plugin-vue wants a space before /> and actually have a autofix for it
  • They cannot agree on a format.

please see this issue: https://github.com/vuejs/vetur/issues/994#issuecomment-442745593

thank you

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
ota-meshicommented, Dec 11, 2018

I got confused with Prettyhtml and prettier.

If you want to use eslint’s autofix, I think you need to change the following settings to settings.json.

"editor.formatOnSave": false,
"eslint.autoFixOnSave": true,

If you want to use Prettyhtml you need to add the following settings to .eslintrc.

	"rules": {
		"prettier/prettier": "off",
		"vue/html-closing-bracket-spacing": [
			"error",
			{
				"selfClosingTag": "never"
			}
		]
	}
1reaction
jongiocommented, Feb 5, 2019

@francoisromain - I spent a ton of time researching why this is happening. It turns out that Prettyhtml removes all whitespace and doesn’t have a way to turn it off.

Prettier always wraps attributes and doesn’t have a way to turn that off.

I ended up going with js-beautify-html for now. I would like to use Prettyhtml, but I need that whitespace sometimes.

I blogged and created a video on my experience trying to get everything to play nice together: https://blog.jongallant.com/2019/02/vuejs-vetur-vscode-format-eslint-issues/

https://youtu.be/z3u6LYRKHWE

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettyhtml/Lobby - Gitter
I am using pretty html with Vue through Vetur. Any particular reason that when you format code it changes the classname attribute name...
Read more >
Script part of .vue files gets formatted by Vetur but without the ...
Prettier formats the project's .ts files without any issues. In my .vue files Vetur uses prettyhtml for the template part which works fine...
Read more >
ES Lint, Prettier, Vetur, VSCode: Ironing out the conflicts
I could tell that they were being prettied twice because the first round removed the trailing commas and the second round put them...
Read more >
vscode, eslint, prettier, vetur conflicts and solutions
vscode, eslint, prettier, vetur conflicts and solutions. These 3 tools must be installed. But after installation, rule conflicts are another headache.
Read more >
How to resolve eslint(vue/html-closing-bracket-newline) conflict
How to fix the below conflict? ... defaultFormatter.sass": "sass-formatter", "vetur.validation.template": true, "vetur.format.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found