0

I have a script in my React JS project that allows to reorder imports in three specific categories:

  1. Imports from dependencies libraries
  2. Imports from internal components
  3. Imports from styles files

All works well, using the command npm run order-imports

Now, I'm interested to run this script directly in VS Code, for example when I'm writing code, I want to do Crt+S and run this script to reorder my imports.

Thanks in advance for your advice.

Aron
  • 1,142
  • 1
  • 14
  • 26

1 Answers1

0

In your settings.json, either for your workspace or vscode global,

add this


    "editor.codeActionsOnSave": {
        "source.organizeImports": true, // This will organize all your imports 
        "source.fixAll.eslint": true // if  you want to fix other fixable inting errors
     },

tHeSiD
  • 4,587
  • 4
  • 29
  • 49