默认情况下,ESLint和vscode格式化工具有冲突,需要添加配置文件解决冲突。
在项目根目录添加 .prettierrc 文件
{
"semi":false,
"singleQuote":true
}
打开.eslintrc.js文件,禁用对 space-before-function-paren 的检查:
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'space-before-function-paren' : 0
},
本文介绍了如何处理ESLint与Visual Studio Code(vscode)内置格式化工具之间的冲突。通过在项目中创建一个.prettierrc配置文件,并在.eslintrc.js中禁用特定规则(如space-before-function-paren),可以实现两者共存并避免警告。
962

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



