-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Steps to reproduce are below. I get the same results on Ubuntu 18.04 and Windows 10, so I don't think this is OS-related.
- Use vue/cli to create a Vue project: Install latest vue/cli
npm i -g @vue/cli(sudo npm i -g @vue/clion Ubuntu), thenvue create hello-worldin a folder. Select the default '[Vue 3] babel, eslint'. - Once that's completed edit the package.json file created in the hello-world subfolder. Replace the devDependencies and eslintConfig properties with what's below. This adds in prettier and eslint-plugin-prettier-vue, and configures ESLint to use them with CRLF as the end of line characters.
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"eslint-plugin-prettier-vue": "4.2.0",
"prettier": "2.7.1"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"plugins": [
"prettier-vue"
],
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {
"prettier-vue/prettier": [
"warn",
{ "endOfLine": "crlf" }
]
}
},cd hello-worldif you're not in it, and thennpm ito install the new dependencies.npm run lint --fix
Now look at HelloWorld.vue or App.vue in your favorite editor and you'll see nine blank lines have been inserted between the closing <\template> tag and the opening <script> tag, and similarly after the closing </script> tag and the opening <style> tag.
In fact ESLint inserts a load of CRs at these points every time you fix.
This doesn't happen with eslint-plugin-prettier. It DOES happen if you upgrade all the packages to their latest versions.
This also happens if endOfLine is set to auto and your line endings are already CRLF. CRLF is the default if you create a new text file on Windows, of course.
I suspect this is related to Issue #13, and may even be the same bug.