import-js
import-js copied to clipboard
append to import list?
When you have groupImports: false
and sortImport: false
, any new import is prepended
to the top of the file. If this was being done manually you'd normally always append it to your imports like:
import old from 'old'
import new from 'new'
and not this, which is the current functionality:
import new from 'new'
import old from 'old'
Maybe a new option called newImportsDirection
, so you can choose? i.e. newImportsDirection: 'append'
would be a good way to solve this issue?
Maybe new imports should always be added to the bottom when sorting and grouping are turned off? I can't really see a use case for adding them to the top. I probably should've done this when I added the 'sortImports' option :P
In lib/ImportStatements.js reverse the result in the _toGroups() with .reverse()
let result = partition( importsArray, (importStatement: ImportStatement): boolean => !importStatement.isParsedAndUntouched(), ).reverse();
@ivangeorgiew do you want to push that as a PR? I'm happy to review and merge.