【发布时间】:2021-01-21 00:46:09
【问题描述】:
我有一个简单的项目,只有几个 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
}
当按保存时 ESLint 不适用于我的 js 文件(没有括号、间距等已更正)。我之前在 React 应用程序中使用过 ESLint,所以它在一年前就可以使用。
【问题讨论】:
标签: visual-studio-code formatting eslint