问题描述
我正在尝试使用 prettier 格式化一个 js 文件,但似乎更漂亮的方式破坏了代码语法。我想实现这一目标
(expectated result) 但出现红线。保存时我得到以下 result。在运行代码时,我收到以下错误 TypeError: {} is not a function
(error image)。我尝试了以下操作,但在我的情况下似乎没有任何效果。
- Why do I keep getting Delete 'cr' [prettier/prettier]?
- Visual Studio Code [eslint] Delete 'CR' [prettier/prettier] on windows
我正在使用以下 .prettierrc.js
module.exports = {
tabWidth: 2,bracketSpacing: true,endOfLine: "auto",jsxBracketSameLine: true,printWidth: 100,semi: false,singleQuote: false,trailingComma: "none"
}
在我的 .eslintrc.json 文件中,我为更漂亮设置了以下规则
"prettier/prettier": [
"error",{
"bracketSpacing": true,"endOfLine": "auto","jsxBracketSameLine": true,"printWidth": 100,"semi": false,"singleQuote": false,"trailingComma": "none"
}
],
我尝试将 LF 更改为 CRLF,反之亦然,这出现在 vscode 的底部,但没有成功。我还缺少什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)