我不知道如何为函数括号之间的空格设置配置。我已经将它设置为everywhere为true,但是当我保存一个.vue
文件时,空格就被删除了--删除后,它被高亮显示为错误(Missing space between function parentheses
)。它发生在script
部分。在.js
文件空间中添加了,但也突出显示为错误,这一次.Unexpected space between function parentheses
?!有一些设置的配置(我现在无法重新创建)时,在保存空间时添加了片刻,然后在.vue
文件中再次删除。
我的settings.json
"vetur.format.defaultFormatter.js": "prettier", // tried both prettier and typescript
// "vetur.format.defaultFormatter.js": "vscode-typescript", // tried both prettier and typescript
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
"vetur.format.defaultFormatterOptions": {
"prettier": {
"singleQuote": true,
"spaceBeforeFunctionParen": true,
"eslintIntegration": true,
},
"vscode-typescript": {
"singleQuote": true,
"spaceBeforeFunctionParen": true,
"eslintIntegration": true,
}
},
.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/standard'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
"space-before-function-paren": ["error", "always"], //setting this to 'never' removes the error highlight in vue files, not js files
},
parserOptions: {
parser: 'babel-eslint',
sourceType: "module"
}
}
我阅读了无数个问题,并在我在答案中找到的每一个可能的设置中设置了函数括号之间的空格。尽管如此,衬里过程还是找到了一种忽略所有这些设置并实现不同设置的方法。更别提它突出显示了与自动格式化不一致的错误。还有其他我还没找到的场景吗?
发布于 2022-03-11 19:43:44
对于vetur和ESLint文本,我也有同样的问题。随后在settings.json修复了它。默认情况下它更漂亮。
"vetur.format.defaultFormatter.js": "prettier-eslint",
https://stackoverflow.com/questions/60992811
复制相似问题