Skip to content

formatter: sort-imports #14253

@leaysgur

Description

@leaysgur

Part of #13610, tracking issue for sorting ImportDeclaration.

Phase 0: Foundation parts

  • Research prior arts
  • Decide how to integrate it to current formatter workflow
    • Reorder IR, after formatting
  • Implement very basic sorting
  • Setup tests and verify current architecture

Phase 1: Features behind default options

  • Fix options.type default alphabetical, not properly implemented localeCompare
  • options.partitionByComments(boolean only)
  • options.partitionByNewline
  • options.sortSideEffects
  • options.order
  • options.ignoreCase
  • options.newlinesBetween
  • options.groups
  • Clean up comments, credits, and past trials
  • Investigate perf improvement with this benchmark result
  • Align default groups with prettier-plugin-sort-imports default?

Phase 2: More advanced options, features

  • Perf: Skip sorting if ImportDeclaration not found
  • Handle ignore comments
  • options.customGroups
  • Consider to support or not
    • options.internalPattern
    • options.fallbackSort
    • options.environment
    • options.specialCharacters
    • options.type: natural, unsorted
    • options.locales
    • options.partitionByComments(non-boolean)
    • Support ImportEquals, require()?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions