simonhaenisch/prettier-plugin-organize-imports

Blank line between imports creates "sort groups"

softdays opened this issue · 1 comments

Hi and thanks your plugin which seems to do the job very well.

It seems that when I put a blank line between two imports the plugin sorts each part separately.

Given the following input:

import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Foo } from '../foo';

import { Bar } from '../bar';
import { Component, EventEmitter, Input, Output, forwardRef} from '@angular/core';

I would expect this result:

import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Bar } from '../bar';
import { Foo } from '../foo';

But I got:

import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Foo } from '../foo';

import { Component, EventEmitter, forwardRef, Input, Output } from '@angular/core';
import { Bar } from '../bar';

From my point of view this looks like a bug but tell me if if this is just feature

It's a feature since TypeScript 4.7 or so, there was some info about it in one of the other issues.

Just remove the blank line and you'll get your expected output.