I wanted to test out publishing to npm for a while. I also have an urge to reorder imports in a file to be prettier. Well I believe there is already an eslint rule or prettier setting for this, but thought it will be good for practice. So this is it. If you call this on a file it will order your imports like this:
- Global imports by line length
- Local imports by line length
- Global requires by line length
- Local requires by line length
To install:
npm install -g import-order
To run:
import-order <path-to-file>/file.ts
There is no real plan to keep this project up to date. But probably will need to add:
- multiple file support (with regex or something)
- tests!?
- support for multiline import, like:
import {
func1,
func2
} from 'lib';