prettier - Prettier/VSCode 打破了语法
问题描述
我正在尝试用更漂亮的格式格式化 js 文件,但似乎更漂亮正在破坏代码语法。我想实现这一点(预期结果),但出现红线。在保存时,我得到以下结果。运行代码时出现以下错误TypeError: {} is not a function
(错误图像)。我尝试了以下方法,但在我的情况下似乎都没有。
- 为什么我不断收到 Delete 'cr' [prettier/prettier]?
- Visual Studio Code [eslint] 在 Windows 上删除 'CR' [prettier/prettier]
我正在使用以下 .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 的底部,但没有成功。我还缺少什么?
解决方案
推荐阅读
- javafx - 如何使组件适合它们添加到的 GridPane 的宽度?
- javascript - 将 gps 坐标转换为旋转地图上的 xy
- python - 输入形状不受限制的分割神经网络
- javascript - Node.js:如何在 C++ 中创建 ES6 模块
- python - 如何在 Django 中格式化日期和时间?
- python - 如何删除换行后的字符和单词之间的空格
- python - 我正在创建一个虚拟语音助手,一切都很好,但是执行命令所花费的时间太多了。那么我可以减少花费的时间吗
- php - PHP 如果存在数组值,则回显文本
- java - 休眠 - OneToMany ORA-02291 - 违反 - 未找到父键
- javascript - Material UI TablePagination 中的 ColSpan 属性是什么意思?