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
}
}
在Visual Studio Code中配置ESLint自动格式化时遇到警告‘Thesettingisdeprecated.Useeditor.codeActionsOnSaveinsteadwithasource.fixAll.eslintmember.’。解决方法是移除'eslint.autoFixOnSave': true,改用'editor.codeActionsOnSave',并设置'source.fixAll.eslint': true,确保保存时自动应用ESLint修复。
3万+

被折叠的 条评论
为什么被折叠?



