[Error - 10:57:00 AM] prettier-eslint [ERROR]:
Prettier-Eslint format failed
[Error - 10:57:00 AM] No parser could be inferred for file: c:\Users\<user-name>\Documents\Repositories\project-x\pages
<script> section doesn't format at all. My eslint settings:
{
"root": true,
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"parser": "babel-eslint"
},
"extends": ["plugin:vue/recommended", "airbnb-base"],
"plugins": ["vue"],
"rules": {
"no-console": "warn",
"no-debugger": "warn"
},
"settings": {
"import/resolver": {
"nuxt": {
"extensions": [".js", ".vue"]
}
}
}
}
My prettier settings:
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
}
Vetur settings are set to default, eslint and prettier settings for VSCode:
"prettier.stylelintIntegration": true,
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
}
]
Prettier is installed locally, so #498 doesn't help.
I am having the same problem, it worked before and suddenly it stopped working. Similar settings.
I already fixed this in #933 (merged). These changes should be in the next release. @octref Is there an ETA for this?
EDIT: This is probably a duplicate of #695/#835.
thanks @Coder-256! Your hard work is really appreciated! We'll wait for the next release
@octref Is there an ETA for this?
This should be fixed by 0.14.0. If not, feel free to reopen or open new issues.
I'm running 0.14.0, and I still see this issue. Not sure how to debug it, but I did set vetur.trace.server: "verbose". Here's the output:
[Trace - 11:46:04 AM] Sending request 'textDocument/formatting - (2352)'.
Params: {
"textDocument": {
"uri": "file:///d%3A/src/mobile-footer-layout/src/components/MobileFooterTabs.vue"
},
"options": {
"tabSize": 4,
"insertSpaces": true
}
}
[Trace - 11:46:04 AM] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "Prettier format failed"
}
Prettier format failed
[Trace - 11:46:04 AM] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Cannot read property 'tabWidth' of null"
}
If I add a prettier.config.js file, the problem goes away. Oddly though, my prettier.config.js file does
not set tabWdith.
module.exports = {
printWidth: 100,
singleQuote: false
};
@octref Might this be the issue?
https://github.com/vuejs/vetur/commit/20308083d1d014475a62bace88941f2f389a4c11#diff-688041a1cacb904fa83a9c09faec7b38R64
I see the problem. When prettier cannot resolve a config, it returns null instead of an empty object. I've pushed a fix and am queuing a new release.
Try 0.14.1.
Most helpful comment
thanks @Coder-256! Your hard work is really appreciated! We'll wait for the next release