我正在将Visual Studio Code与React Native项目一起使用。 ESLint用于检查dt["diff"]=dt["year"].mul(12).add(dt["month"])
dt['diff']=dt.groupby('patient_ID')['diff'].diff().fillna(0)
中指定的内容。
当某些问题不正确时,我会得到如下提示:
我希望自动或使用快捷方式组合来解决问题,而不是获取这些通知并右键单击它们,选择>> dt[['patient_ID', 'year', 'month', 'diff']]
patient_ID year month diff
0 4388 2004 8 0.0
1 4388 2007 9 37.0
2 9086 2007 9 0.0
3 9086 2008 6 9.0
4 9086 2011 2 32.0
。我该如何配置?我目前正在使用纯JavaScript,没有Typescript。
答案 0 :(得分:2)
编辑/创建.vscode/settings.json
,使其包含
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
修复了保存时的问题。
答案 1 :(得分:0)
感谢@jonrsharpe!只想加我几毛钱。
转到 settings.json 文件:
%APPDATA%\Code\User\settings.json
$HOME/Library/Application Support/Code/User/settings.json
$HOME/.config/Code/User/settings.json
添加到此处:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
享受编码!))
更新
在Mac上,上述解决方案适用于我,但在Windows上,要使其正常运行,我必须在 settings.json 中添加以下内容:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll": true
},
"eslint.autoFixOnSave": true