R
R
Rag'n' Code Man2022-02-20 23:36:12
webstorm
Rag'n' Code Man, 2022-02-20 23:36:12

Is it possible to configure grouping of imports according to this scheme in WebStorm?

Before grouping:

import { usefulLibrary } from 'usefulLibrary '
import { myModule1 } from '../my/module/module1'
import { myModule2 } from '../my/module/module2'
import { usefulLibrary2 } from 'usefulLibrary2'
import { myModule3 } from '../my/module/module3'
import { usefulLibrary3 } from 'usefulLibrary3'

After grouping:

import { usefulLibrary } from 'usefulLibrary '
import { usefulLibrary2 } from 'usefulLibrary2'
import { usefulLibrary3 } from 'usefulLibrary3'

import { myModule1 } from '../my/module/module1'
import { myModule2 } from '../my/module/module2'
import { myModule3 } from '../my/module/module3'

That is, everything that is imported from node_moduleswe put at the top of the file, and the project files a line after them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2022-02-20
@iDmitriyWinX

Found a suitable ESLintplugin: https://github.com/lydell/eslint-plugin-simple-imp...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question