Skip to content

feat: Add new config option for deduplicating import declarations#405

Open
AdrianGonz97 wants to merge 8 commits intotrivago:mainfrom
AdrianGonz97:feat/combined-specifiers
Open

feat: Add new config option for deduplicating import declarations#405
AdrianGonz97 wants to merge 8 commits intotrivago:mainfrom
AdrianGonz97:feat/combined-specifiers

Conversation

@AdrianGonz97
Copy link
Copy Markdown

@AdrianGonz97 AdrianGonz97 commented Mar 25, 2026

Closes #298

Adds a new config option, importOrderMergeImports (the name could be better), that deduplicates import declarations from the same source.

For example, provided the following code:

import * as NamespacedImport from './example';
import DefaultImport from './example';
import { NamedImport1 } from './example';
import { NamedImport2 } from './example';
import { NamedImport3 } from './example';

will be formatted into:

// namespaced imports are ignored as they cannot contain other specifier types
import * as NamespacedImport from './example'; 
import DefaultImport, { NamedImport1, NamedImport2, NamedImport3 } from './example';

As for the name, some alternatives I've considered could be importOrderDeduplicateImports or importOrderCombineImportSpecifiers. Suggestions are welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combine imports for the same dependency

1 participant