DEV Community

Discussion on: How to: Enable automatic import sorting in VS Code

Collapse
 
nikkizol profile image
Mykyta Zholkovskyi

Hi, I have source.organizeImports but it doesn't remove blank lines between import declarations, it there any rule for this one?

Collapse
 
pefington profile image
Pierre-François Salmand • Edited

Hi, with the package eslint-plugin-simple-import-sort as well as eslint-plugin-import this works:

// in settings.json

 "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.organizeImports": true
  },
Enter fullscreen mode Exit fullscreen mode
// in .eslintrc

"plugins": ["simple-import-sort", "import"],
  "rules": {
    "simple-import-sort/imports": "error",
    "simple-import-sort/exports": "error",
    "import/first": "error",
    "import/newline-after-import": "error",
    "import/no-duplicates": "error",
  }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
maxim_onishchenko_158bb1c profile image
maxim onishchenko

Wreally importante publicante !