我的React JS项目中有一个脚本,该脚本可以对三个特定类别的导入进行重新排序:
使用命令npm run order-imports
现在,我有兴趣直接在VS Code中运行此脚本,例如,在编写代码时,我想执行Crt + S并运行此脚本来重新排序导入。
预先感谢您的建议。
答案 0 :(得分:0)
在您的settings.json中(用于您的工作区或全局vscode)
添加此
"editor.codeActionsOnSave": {
"source.organizeImports": true, // This will organize all your imports
"source.fixAll.eslint": true // if you want to fix other fixable inting errors
},