The no-duplicates rule auto-fix logic is adding an extra space in some cases.
Example case:
import { Observable, Subscription } from 'rxjs';
import { of } from 'rxjs';
Auto-fixing this rule turns into:
import { Observable, Subscription , of } from 'rxjs';
Note the extra space after "Subscription" before the comma.
Some feedback I've received is to use the @stylistic/comma-spacing rule to fix it, and that does work in a vacuum. However, this doesn't work for my project because I have other rules that affect imports. Specifically, I'm using the imports rule from the plugin eslint-plugin-simple-import-sort which sorts the imports alphabetically, turning it into this:
import { Observable, of, Subscription } from 'rxjs';
And then the comma-spacing rule doesn't clean up the double spaces before the closing curly brace.
Using comma-spacing as a fix is a workaround anyway to fix the extra space that was introduced by the no-duplicates rule. The cleanest solution then is to fix the original bug in eslint-plugin-import.
The no-duplicates rule auto-fix logic is adding an extra space in some cases.
Example case:
Auto-fixing this rule turns into:
Note the extra space after "Subscription" before the comma.
Some feedback I've received is to use the
@stylistic/comma-spacingrule to fix it, and that does work in a vacuum. However, this doesn't work for my project because I have other rules that affect imports. Specifically, I'm using theimportsrule from the plugineslint-plugin-simple-import-sortwhich sorts the imports alphabetically, turning it into this:And then the
comma-spacingrule doesn't clean up the double spaces before the closing curly brace.Using
comma-spacingas a fix is a workaround anyway to fix the extra space that was introduced by theno-duplicatesrule. The cleanest solution then is to fix the original bug in eslint-plugin-import.