vscode配置eslint自动格式化报错"The setting is deprecated. Use editor.codeActionsOnSave instead with a source.fixAll.eslint member."
背景
在我们配置vscode自动依据eslint格式化代码的时候,报错The setting is deprecated. Use editor.codeActionsOnSave instead with a source.fixAll.eslint member.
,意思是:该设置已弃用。 将 editor.codeActionsOnSave 与 source.fixAll.eslint 成员一起使用。
解决办法
解决方案如提示所示,删除"eslint.autoFixOnSave": true,
,用editor.codeActionsOnSave
替代即可
{
"search.followSymlinks": false,
"editor.tabSize": 2,
//配置eslint
"eslint.validate": [
"javascript", // 用eslint的规则检测js文件
"javascriptreact",
"vue",
"html",
],
// 启用保存时自动修复eslint,默认只支持.js文件
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}