vyt*_*ute 6 formatting eslint visual-studio-code
我有一个简单的项目,只有几个 html 和 js 文件。为 VS 代码安装 ESLint 扩展并将 ESLint 设置为默认格式化程序:
此外,此设置已转向所有
这是我的 settings.json 文件:
"window.zoomLevel": 1,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"],
"git.enableSmartCommit": true,
"eslint.alwaysShowStatus": true,
"files.autoSave": "off",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"git.ignoreWindowsGit27Warning": true,
"eslint.options": {
"eslint brace-style": [
"error",
"allman",
{
"allowSingleLine": true
}
]
},
"eslint.codeAction.showDocumentation": {
"enable": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true
}
Run Code Online (Sandbox Code Playgroud)
当按下保存 ESLint 对我的 js 文件不起作用(没有括号、空格等被更正)。我之前在 React 应用程序中使用过 ESLint,所以它在一年前就成功了。
vyt*_*ute 23
我找到了我自己问题的答案:)
我后来收到通知
ESLint is disabled since its execution has not been approved or denied yet. Use the light bulb menu to open the approval dialog.eslint
Run Code Online (Sandbox Code Playgroud)
所以我按这里:
在 ESLint 上并允许这个扩展完成它的工作。
| 归档时间: |
|
| 查看次数: |
7557 次 |
| 最近记录: |