javascript - 如何让 React .js 文件正确格式化
问题描述
我有一个App.js
在 Visual Studio Code 中命名的文件,该文件实际上在浏览器中呈现良好,但格式不正确:
我已将文件类型切换为javascriptreact
:
但它仍然不会用SHIFT-ALT-F
.
这是我的settings.json
文件:
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"explorer.confirmDelete": false,
"files.autoSave": "afterDelay",
"editor.formatOnSave": true,
"explorer.confirmDragAndDrop": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.fontSize": 12,
"window.zoomLevel": 0,
"workbench.editor.enablePreview": false,
"editor.renderWhitespace": "all",
"[javascriptreact]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[javascript]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[json]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"editor.wordWrap": "on",
"git.enableSmartCommit": true,
"git.autofetch": true,
"diffEditor.ignoreTrimWhitespace": false,
"workbench.sideBar.location": "left",
}
我还需要设置什么才能SHIFT-ALT-F
正确格式化我的 React Javascript 文件?
解决方案
推荐阅读
- xml - Jmeter Ant 任务 - 从 .jtl 文件生成 .xslt 报告
- wordpress - Wordpress W3 缓存过度缓存 - 并且不知道如何解决问题
- firebase - 如何修改代码以获得 Stream
流生成器的类型流? - javascript - 如何从一个索引文件中导出 node.js 中的所有模块、函数等?
- javascript - 如何从 Promise 获取用户名
? - javascript - 为什么我按 ESC 关闭由 window.prompt() 创建的窗口后无法键入
- php - 时间戳仅与 Laravel 中的天数而不是月/年比较
- javascript - 如何在 Discord V12 中添加嵌入
- javascript - 如何从特定索引中获取元素,其中索引是 TensorFlow.js 的标量张量?
- python - 从循环创建的对象列表中的对象获取属性