Skip to content

Codemods for sorting module requires#934

Draft
Vighnesh-V wants to merge 2 commits intoprimaryfrom
autosort-module-requires
Draft

Codemods for sorting module requires#934
Vighnesh-V wants to merge 2 commits intoprimaryfrom
autosort-module-requires

Conversation

@Vighnesh-V
Copy link
Copy Markdown
Collaborator

@Vighnesh-V Vighnesh-V commented Apr 2, 2026

This codemod groups requires by @lute, @std, @batteries, @self, .... all the other imports. Requires within each group are sorted lexicographically by require path. Each group of imports renders with a new line.

The current transform library doesn't offer a way to replace without trivia, which ends up duplicating comments at the top of files, for pretty much every file in this repo. I've just returned no replacements, and manually writeStringToFile until we can fix that issue.

@Vighnesh-V Vighnesh-V marked this pull request as draft April 2, 2026 20:45
@Vighnesh-V Vighnesh-V force-pushed the autosort-module-requires branch from 77da403 to 2fbef0e Compare April 3, 2026 20:24
@Vighnesh-V Vighnesh-V force-pushed the autosort-module-requires branch from 2fbef0e to e6b0dae Compare April 3, 2026 20:29
@Vighnesh-V Vighnesh-V changed the title Enables Stylua to autosort module requires Codemods for sorting module requires Apr 3, 2026
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.

1 participant